agentleFS
codewithmukeshcodewithmukesh/dotnet-agent-kit/skills/scaffold/SKILL.md

scaffold

Skill853 starsChanged yesterdayMITView on GitHub

Architecture-aware scaffolding (/scaffold) for .NET 10: generates a Features/<VerbPhrase>/ slice (IEndpoint, IHandler, validator, integration tests) or a new module (implementation + Contracts, ModuleDbContext), matching existing conventions. Use for "scaffold", "add feature", "new endpoint", "add entity", "new module". Do NOT use for deciding architecture (use modular-slices or architecture-advisor) or project setup (use dotnet-init).

53 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ascii-diagram, docs-ci and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SethGammonSkill

    ascii-diagram

    Generate perfectly aligned ASCII diagrams — architecture, flow, sequence, box-and-arrow. Uses a programmatic character-grid approach so alignment is guaranteed by math, not token prediction. Includes post-render verification.

    Also in 4 projects that use this

  • jh941213Skill

    docs-ci

    문서 CI(링크·OpenAPI lint·breaking 게이트·mermaid 검증)나 문서 드리프트 감지(docs.yaml 신선도 검사)를 설치하거나 돌릴 때 사용. 문서 내용 작성은 docs-architecture·docs-interfaces·docs-manuals.

    Also in 3 projects that use this

  • jh941213Skill

    docs-interfaces

    API·이벤트 인터페이스 문서(OpenAPI·swagger·AsyncAPI 명세, 엔드포인트 레퍼런스, API 구성도·시퀀스, API CHANGELOG)를 만들거나 코드와 맞출 때 사용. 시스템 구성도는 docs-architecture, API 설계 원칙은 api-design-principles.

    Also in 3 projects that use this

  • SethGammonSkill

    research-fleet

    Parallel research using Fleet wave mechanics. Spawns multiple scout agents, each investigating a different angle of the same question. Findings are compressed between waves. Produces a unified research brief from multiple independent perspectives.

    Also in 3 projects that use this

  • RachaelQuiselSkill

    client-docs

    Client documentation. Use when a build needs documentation updates or missing project documents need to be identified.

    Also in 3 projects that use this

  • vicoa-aiSkill

    live-preview

    Start a local app in the current user project, expose it through a tunnel, and return preview details in structured Markdown. Use when the user asks for a preview URL, public URL, shareable localhost, mobile/web preview, or tunnel setup.

    Also in 4 projects that use this

  • +4 more from jh941213

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 45 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If it is ambiguous, ask rather than guess.

    line 41
  2. Very specific:

    Use the instinct-system skill and Roslyn MCP tools (find_symbol, get_file_outline) on one existing feature folder:

    line 55
  3. Very specific:

    A new module: create <Module> and <Module>.Contracts projects, <Module>Module : IModule, <Module>Permissions, <Module>DbContext : …

    line 73
  4. Very specific:

    If the Modularity building blocks are missing, scaffold them first from skills/modular-slices/references/building-blocks.md.

    line 75
  5. Distinctive:

    Every scaffolded feature must satisfy all of these:

    line 79
  6. Distinctive:

    If the build or tests fail, fix and re-run before presenting results.

    line 102

“Common” is measured: kept by at least 6 in 10 of the 45 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/scaffold: Architecture-Aware Feature Scaffolding

What

Generates a complete feature, or a new module, with every file it needs. It never generates half a feature: the endpoint, handler, request, validator, response, EF configuration and integration tests come as one unit, in modern C# 14 (primary constructors, collection expressions, records, sealed internal classes, TypedResults).

The default shape is modular slices (ADR-008, modular-slices skill). Other architectures are supported when the codebase already uses them. File placement maps and code templates live in references/architecture-patterns.md:

  • Modular slices (default): src/Modules/<Module>/<Module>/Features/<VerbPhrase>/, one class per file
  • Single-project VSA: the same slice files in Features/, without modules
  • Clean Architecture: files across Domain, Application, Infrastructure, Api
  • DDD: aggregate methods and domain events, with a thin handler

When

  • "Scaffold a [feature]", "create an endpoint for", "add a feature"
  • "Generate CRUD for", "add entity", "new module", "scaffold a module"
  • Starting a new feature after /spec has produced an approved plan
  • Customizing generation templates or defining what a complete slice includes

How

Step 1: Detect the architecture

  • src/Modules/<Name>/<Name> and <Name>.Contracts projects, IModule classes: modular slices
  • A single API project with Features/ folders and no modules: single-project VSA
  • Domain / Application / Infrastructure / Api projects: Clean Architecture (plus DDD if aggregates raise domain events)
  • An empty or new solution: modular slices, unless the architecture-advisor recommended something else

If it is ambiguous, ask rather than guess. Load the matching skill (modular-slices, or architecture-advisor for single-project VSA, Clean Architecture, DDD).

Step 2: Clarify scope

Confirm before generating (skip what the plan already answers):

  1. Operations needed, named as verb phrases (PlaceOrder, CancelOrder, ListOrders)
  2. Key fields and invariants for any new entity
  3. Which module owns it, or whether it needs a new module (decide by who owns the data)
  4. The permission each endpoint needs, and whether the data is tenant-owned
  5. Events other modules need from this change, if any

Step 3: Learn conventions

Use the instinct-system skill and Roslyn MCP tools (find_symbol, get_file_outline) on one existing feature folder:

  • Naming (*Endpoint, *Handler, *Request, *RequestValidator, *Response)
  • How handlers report errors (Problems.* codes, or an existing Result<T>)
  • Permission constants and test helper style ({Module}Api.cs)

Match what exists. Do not bring the default conventions into a codebase that uses different ones.

Step 4: Generate

A feature (default): in Features/<VerbPhrase>/ create

  • <VerbPhrase>Endpoint.cs: internal sealed, implements IEndpoint, relative route, .RequirePermission(...), .WithName(), .WithSummary(), injects the handler
  • <VerbPhrase>Handler.cs: internal sealed, implements IHandler, primary constructor with the module DbContext and TimeProvider, HandleAsync returning a Results<...> union
  • <VerbPhrase>Request.cs and <Noun>Response.cs: public sealed record (shared responses go in Features/Common/)
  • <VerbPhrase>RequestValidator.cs: internal sealed, rules with meaning
  • tests/<Module>.Tests/Features/<VerbPhrase>/<VerbPhrase>Tests.cs

A new module: create <Module> and <Module>.Contracts projects, <Module>Module : IModule, <Module>Permissions, <Module>DbContext : ModuleDbContext, add builder.AddModule<<Module>Module>() to the Api, Worker and Migrator hosts, add the projects to the .slnx, add a test project, and create the first migration.

If the Modularity building blocks are missing, scaffold them first from skills/modular-slices/references/building-blocks.md.

Step 5: Completeness checklist (mandatory)

Every scaffolded feature must satisfy all of these:

  • Endpoint: one IEndpoint per feature, discovered automatically; nothing added to Program.cs or the module class
  • Permission: .RequirePermission(...) or an explicit .AllowAnonymous() on every endpoint
  • Handler: internal sealed, implements IHandler, returns a TypedResults union; no mediator, no repository
  • Errors: Problems.NotFound() / Conflict(code, ...) / RuleBroken(code, ...) with <module>.<reason> codes; never bare strings
  • Validator: FluentValidation with real rules, run by the shared endpoint filter
  • Contracts: request/response records public; everything else internal; anything other modules need goes in <Module>.Contracts
  • Data: entities paired with IEntityTypeConfiguration<T>; reads use AsNoTracking() and projections; lists are paged (page size capped at 50)
  • Events: cross-module side effects published with db.Publish(evt, clock) before SaveChangesAsync
  • CancellationToken: on every async method and passed to every async call
  • Tests: success, permission refusal (403), validation refusal (400 validation-failed), each business rule code, and cross-tenant 404 for tenant-owned data

For single-project VSA the same list applies minus the Contracts and module items. For Clean Architecture or DDD codebases, follow their error and dispatch conventions (for example Result<T> with Mediator) but keep the endpoint, validation, data, cancellation and test items.

Step 6: Verify

dotnet build --no-restore
dotnet test --no-build --filter "FullyQualifiedName~{FeatureName}"
dotnet test --no-build --filter "FullyQualifiedName~Architecture"

If the build or tests fail, fix and re-run before presenting results. The architecture tests catch a public handler or a reference to another module's implementation.

Example

User: /scaffold cancelling an order

Claude: Detected architecture: modular slices (src/Modules/Orders). Feature goes in Orders.

Created files:
  src/Modules/Orders/Orders/Features/CancelOrder/CancelOrderEndpoint.cs
  src/Modules/Orders/Orders/Features/CancelOrder/CancelOrderHandler.cs
  src/Modules/Orders/Orders/Features/CancelOrder/CancelOrderRequest.cs
  src/Modules/Orders/Orders/Features/CancelOrder/CancelOrderRequestValidator.cs
  src/Modules/Orders/Orders.Contracts/OrderCancelled.cs        -- event for Billing
  tests/Orders.Tests/Features/CancelOrder/CancelOrderTests.cs

Handler returns Results<Ok<OrderResponse>, ProblemHttpResult>
Error codes: orders.cannot-cancel (409)
Tests: success, 403 without orders.manage, 400 empty reason, 409 shipped order, 404 other tenant

Checklist: 10/10 | Build: PASS | Tests: 5/5 PASS | Architecture tests: PASS

Related

  • modular-slices: the default architecture and its building blocks
  • architecture-advisor: single-project slices, Clean Architecture and DDD references
  • dotnet-init: set up the project and CLAUDE.md before scaffolding
  • tdd: write the feature's tests first, then scaffold to make them pass

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.