add-use-case
Skill2 starsChanged 32 days agoMITView on GitHub
Adds one Govern use case end to end: Application contract (Request/Response/Validator/Handler), feature errors, Api endpoint, integration tests and docs. Use when the user asks for a new command, query or endpoint ("add an endpoint to…", "users should be able to…", "create/update/delete/list X").
In this repository7 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- add-entitySkill
- add-infra-concernSkill
- add-migrationSkill
- develop-featureSkill
- outdated-packagesSkill
- verifySkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Run inside /develop-feature, which covers the plan, verification and review.
- Very specific: line 13
Read first: architecture.md, api-endpoints.md, error-handling.md, mapping.md, and persistence.md if data changes.
- Very specific: line 46
Helpers: add request helpers to tests/Govern.IntegrationTests/Support/[Feature]Api.cs (pattern: UsersApi).
- Very specific: line 49
Update docs/features/[feature].md: the use case, endpoint row (method, route, auth, statuses), error codes and business rules.
- Very specific: line 50
Add the file to docs/README.md if it is new.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add a use case
Run inside /develop-feature, which covers the plan, verification and review. This skill is the recipe for the code. Reference implementation: src/Govern.Application/Users/Contracts/SignUpContract.cs + src/Govern.Api/Features/Users/SignUpEndpoint.cs + tests/Govern.IntegrationTests/Features/Users/SignUpEndpointTests.cs.
Read first: architecture.md, api-endpoints.md, error-handling.md, mapping.md, and persistence.md if data changes.
1. Contract: src/Govern.Application/[Feature]/Contracts/[UseCase]Contract.cs
[UseCase]Request:sealed recordimplementingIRequest<[UseCase]Request, [UseCase]Response>. Document every positional parameter.[UseCase]Response:sealed recordimplementingIResponse. If the projection is reused, addstatic Expression<Func<TEntity, [UseCase]Response>> Projection(mapping.md).[UseCase]Validator:sealed classderivingAbstractValidator<[UseCase]Request>, with bounds on every string and collection.[UseCase]Handler:internal sealed classimplementingIRequestHandler<,>:- Primary constructor, at most 6 dependencies.
await using var db = await dbContextFactory.CreateDbContextAsync(ct);- Reads use
AsNoTracking().Select(...). - Writes go through domain methods, then
SaveChangesAsync. - Expected failures are
return XxxErrors.Y;. - Ownership is enforced with
ICurrentUserService.UserId.
- Anything else in the file is a
file-scoped type.
2. Errors: src/Govern.Application/[Feature]/Models/[Feature]Errors.cs
- Add
public static readonly Error X = Error.Conflict("feature.snake_code", "Client-safe message.");. - Reuse existing errors; never change existing codes.
3. Endpoint: src/Govern.Api/Features/[Feature]/[UseCase]Endpoint.cs
Copy the shape of SignUpEndpoint: static class, Map(IEndpointRouteBuilder), a named HandleAsync.
- Access: explicit
.RequireAuthorization()or.AllowAnonymous(). A new anonymous route must be added to the allow-list intests/Govern.IntegrationTests/Security/EndpointAuthorizationTests.cs. - Metadata:
.WithName(nameof(...)),.WithTags("[Feature]"),.Produces<...>(status),.ProducesValidationProblem(),.ProducesProblem(...)for each error status. - Docs: XML docs with
<response code>for every status.
4. Integration tests: tests/Govern.IntegrationTests/Features/[Feature]/[UseCase]EndpointTests.cs
- Base class: derive from
ApiTestBase(fixture). The database is reset per test. - Required cases:
- Happy path: status, body and persisted state via
Fixture.OpenDbAsync(). - 400 with the exact invalid fields (
ShouldBeValidationProblemAsync). - 401 without a token when protected.
- Each domain error with its code (
ShouldBeProblemAsync(status, "feature.code")). - Ownership: another user's resource returns 404.
- Happy path: status, body and persisted state via
- Helpers: add request helpers to
tests/Govern.IntegrationTests/Support/[Feature]Api.cs(pattern:UsersApi).
5. Docs
- Update
docs/features/[feature].md: the use case, endpoint row (method, route, auth, statuses), error codes and business rules. - Add the file to
docs/README.mdif it is new.
6. Check
dotnet build Govern.slnx.dotnet test --project tests/Govern.ArchitectureTests: contract shape, endpoint shape, folders, size limits.dotnet test Govern.slnx.
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
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.

