convention-learner
Skill5 starsChanged 6 days agoMITView on GitHub
Protocol for detecting and replicating existing project conventions before generating new code — naming, folder structure, DI registration, test framework, DTOs, and error handling.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- codewithmukesh/dotnet-claude-kittheir own version, first seen Nov 8, 2026
- Resgrid/Coretheir own version, first seen Oct 8, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- codewithmukesh/dotnet-claude-kit★ 808same name
- Resgrid/Core★ 238same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository15 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- aspnet-api-patternsSkill
- authenticationSkill
- cachingSkill
- clean-architectureSkill
- dddSkill
- dotnet-project-initSkill
- ef-core-patternsSkill
- error-handlingSkill
- loggingSkill
- modern-csharpSkill
- opentelemetrySkill
- resilienceSkill
- testing-dotnetSkill
- vertical-sliceSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Run this the first time you create a file in a codebase you haven't touched this session, and whenever the request leaves naming or …
- Very specific: line 32
If mixed: use the suffix most common in the feature area you're working in (e.g., if Orders/ uses Handler, use Handler for new order code …
- Distinctive: line 113
After completing all 6 steps, state the detected conventions explicitly before generating any code:
- Distinctive: line 123
If the user specifies a convention explicitly in their request, it takes precedence over detected conventions.
- Very specific: line 129
All Roslyn-aware tools are preferred over Grep for .cs files when available.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Convention Learner
Purpose: prevent naming drift. Generated code that doesn't match the project's conventions creates review friction and merge noise long after it ships.
Run this the first time you create a file in a codebase you haven't touched this session, and whenever the request leaves naming or structure open. Skip it when the request specifies the conventions, or when you already established them earlier in this conversation.
Detection
Six questions. Answer the ones your change actually depends on — a new validator needs the naming and folder answers, not the EF configuration one.
Step 1 — Naming Suffix Convention
What suffix does this project use for its handlers/services?
Grep pattern: "class \w+(Handler|Service|Manager|Controller|UseCase|Interactor)"
Files: src/**/*.csDetermine: Handler, Service, Manager, Controller, or a mix?
If mixed: use the suffix most common in the feature area you're working in (e.g., if Orders/ uses Handler, use Handler for new order code even if Customers/ uses Service).
Step 2 — Folder / Architecture Style
What is the top-level organization under src/?
Glob: src/**/*.cs → inspect top-level directory names under src/<AppName>/| Pattern found | Architecture style |
Features/<Feature>/<Action>/ | Vertical Slice (VSA) |
Controllers/ + Services/ + Models/ | Layered / MVC |
Domain/ + Application/ + Infrastructure/ | Clean Architecture |
Domain/ + aggregates with AggregateRoot | DDD |
Step 3 — DI Registration Pattern
How are services registered?
Grep pattern: "AddScoped|AddTransient|AddSingleton"
Files: src/**/*.cs| Pattern found | Convention |
services.Add*(...) in Program.cs only | Inline registration |
services.AddOrders() in extension methods | Extension method per module/feature |
services.AddApplication() + services.AddInfrastructure() | Layer-scoped extension methods |
Step 4 — Test Organization
What test framework and assertion library does this project use?
Glob: tests/**/*Tests.cs → read 2 representative test files
Grep pattern: "using Xunit|using NUnit|using Microsoft.VisualStudio.TestTools"
Grep pattern: "NSubstitute|Moq|FakeItEasy"
Grep pattern: "FluentAssertions|Shouldly"Determine: xUnit / NUnit / MSTest? NSubstitute / Moq / FakeItEasy? FluentAssertions / Shouldly / raw asserts?
Also check: are test classes named <Subject>Tests or <Subject>Test (no plural)?
Step 5 — DTO Style
How are request/response types defined?
Grep pattern: "public record|public class.*Request|public class.*Response|public class.*Dto"
Files: src/**/*.cs| Pattern found | Convention |
public record CreateOrderRequest(...) | Positional record |
public record CreateOrderRequest { ... } | Property-init record |
public class CreateOrderRequest { public ... get; set; } | Mutable class |
Suffix used: Request/Response, Dto, Model, or ViewModel?
Step 6 — Error Handling Style
How does this project signal failures?
Grep pattern: "Result<|OneOf<|throw new \w+Exception|ProblemDetails|IActionResult.*Problem"
Files: src/**/*.cs| Pattern found | Convention |
Result<TValue, TError> / OneOf<> | Result/discriminated union pattern |
throw new DomainException / throw new ValidationException | Exception-based |
TypedResults.Problem(...) / ValidationProblem(...) | ProblemDetails (RFC 9457) |
Applying Conventions
After completing all 6 steps, state the detected conventions explicitly before generating any code:
Detected conventions: naming=
Handler, folders=VSA (Features/<Feature>/<Action>/), DI=extension methods per feature, tests=xUnit + NSubstitute + FluentAssertions, DTOs=positional records with Request/Response suffix, errors=Result pattern
Then generate code matching all detected conventions. If a convention is ambiguous (genuinely mixed), use the most common pattern in the nearest code area and note the ambiguity:
Note: DI registration is mixed — 3 extension methods, 2 inline. Using extension method pattern (majority).
Convention Override
If the user specifies a convention explicitly in their request, it takes precedence over detected conventions. Acknowledge it:
User-specified override: using
Controllersuffix per request (detected:Handler).
Quick Reference — Convention Extraction Commands
All Roslyn-aware tools are preferred over Grep for .cs files when available.
| What to find | Tool / Pattern | ||
| Solution structure | mcp__roslyn__get_solution_structure | ||
| Class naming suffixes | `Grep "class \w+(Handler | Service | Manager)" src/` |
| Folder layout | Glob "src/**/*.cs" + inspect directories | ||
| DI registrations | Grep "AddScoped|AddTransient|AddSingleton" src/ | ||
| Test files sample | Glob "tests/**/*Tests.cs" → Read 2 files | ||
| DTO types | Grep "public record|class.*Request|class.*Response" src/ | ||
| Error handling | Grep "Result<|throw new|ProblemDetails" src/ |
Common Pitfalls
- Don't assume VSA because there's a
Features/folder — check if handlers are inside feature subfolders or at the root ofFeatures/. - Don't assume NSubstitute — Moq is still common; mixing substitute APIs breaks build.
- Don't infer from one file — read at least 2–3 representative files per convention.
Dtosuffix ≠Request/Responsesuffix — they signal different intent; don't mix them in the same codebase.
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.

