agentsclimarketplace

Neo dotnet tag helper

Skill Benknightdark/neo-skills/skills/neo-dotnet-tag-helper

Neo Skills 是專為現代 AI Agent 設計的全方位能力擴充套件。本專案透過標準化的通訊架構,為 AI 代理安裝可插拔的「技能模組 (Skills)」,使其不僅僅是一個聊天機器人,而是能轉化為具備「感知-推理-行動」能力的多領域專家。

Install
npx -y skills add Benknightdark/neo-skills --skill neo-dotnet-tag-helper

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 7 stars7 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use this skill when the user asks to design, implement, refactor, or review custom ASP.NET Core Tag Helpers in C#, including TagBuilder usage, strongly typed attributes, dependency injection, ProcessAsync, and reusable Razor UI behavior.

SKILL.md

3.4 KB, as published. Nobody here has run it

.NET Tag Helper Expert Skill

Trigger On

  • The user requests to create, generate, or design a custom Razor Tag Helper in C#.
  • The user wants to encapsulate complex HTML/UI logic into reusable custom tags without using Partial Views or CSHTML.
  • The target framework is .NET 6.0 (LTS) and above.

Workflow (Generator Pattern)

Follow these steps exactly to create robust, high-performance C# Tag Helpers.

Step 1: Perceive & Gather Requirements (Inversion)

Before writing any code, ask the user to clarify the following if not already provided:

  1. Target HTML Tag: What is the name of the custom tag in HTML? (e.g., <my-button>, <user-card>)
  2. Properties: What parameters/attributes should this tag accept? (e.g., theme, is-active, user-id)
  3. Dependencies (DI): Does this tag need to query a database or call a service? (Needs Dependency Injection)
  4. Context: Does it need to access ViewContext (e.g., to generate URLs or check model state)?

Step 2: Reason & Design (Planning)

Based on the answers:

  • Class Naming: Ensure the class name ends with TagHelper (e.g., MyButtonTagHelper).
  • Target Element: Apply [HtmlTargetElement("my-button")].
  • Properties: Map HTML kebab-case attributes to C# PascalCase properties. Apply [HtmlAttributeName("is-active")] if necessary.
  • Method Selection:
    • If no IO/Async operations, override Process.
    • If using DI for database/API calls, override ProcessAsync.

Step 3: Act (Code Generation)

Generate the complete C# class. Strictly adhere to the following rules:

  1. Inherit from Microsoft.AspNetCore.Razor.TagHelpers.TagHelper.
  2. Do NOT generate .cshtml files. All HTML must be constructed using TagBuilder inside the C# class.
  3. If ViewContext is needed, use [ViewContext] and [HtmlAttributeNotBound].
  4. Manage content properly using output.TagName, output.Attributes.SetAttribute, and output.Content.SetHtmlContent.
  5. Ensure Thread-Safety (do not store request-specific state in instance fields unless injected as scoped/transient).

Step 4: Validate (Quality Check)

Review the generated code against these criteria before presenting it:

  • Are all properties strongly typed?
  • Is TagBuilder used instead of string concatenation for HTML elements?
  • Is ProcessAsync used correctly if awaiting tasks?

Deliverable

Present the C# code wrapped in a markdown code block. Briefly explain how to register it in _ViewImports.cshtml (e.g., @addTagHelper *, YourAssemblyName).

Documentation

Official References

Internal References

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.