agentleFS
zdanovichnickzdanovichnick/dotnet-pilot/skills/convention-learner/SKILL.md

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

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
  1. Distinctive:

    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 …

    line 12
  2. Very specific:

    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 …

    line 32
  3. Distinctive:

    After completing all 6 steps, state the detected conventions explicitly before generating any code:

    line 113
  4. Distinctive:

    If the user specifies a convention explicitly in their request, it takes precedence over detected conventions.

    line 123
  5. Very specific:

    All Roslyn-aware tools are preferred over Grep for .cs files when available.

    line 129

≈ “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.

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

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/**/*.cs

Determine: 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 foundArchitecture style
Features/<Feature>/<Action>/Vertical Slice (VSA)
Controllers/ + Services/ + Models/Layered / MVC
Domain/ + Application/ + Infrastructure/Clean Architecture
Domain/ + aggregates with AggregateRootDDD

Step 3 — DI Registration Pattern

How are services registered?

Grep pattern: "AddScoped|AddTransient|AddSingleton"
Files: src/**/*.cs
Pattern foundConvention
services.Add*(...) in Program.cs onlyInline registration
services.AddOrders() in extension methodsExtension 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 foundConvention
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 foundConvention
Result<TValue, TError> / OneOf<>Result/discriminated union pattern
throw new DomainException / throw new ValidationExceptionException-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 Controller suffix per request (detected: Handler).

Quick Reference — Convention Extraction Commands

All Roslyn-aware tools are preferred over Grep for .cs files when available.

What to findTool / Pattern
Solution structuremcp__roslyn__get_solution_structure
Class naming suffixes`Grep "class \w+(HandlerServiceManager)" src/`
Folder layoutGlob "src/**/*.cs" + inspect directories
DI registrationsGrep "AddScoped|AddTransient|AddSingleton" src/
Test files sampleGlob "tests/**/*Tests.cs" → Read 2 files
DTO typesGrep "public record|class.*Request|class.*Response" src/
Error handlingGrep "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 of Features/.
  • 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.
  • Dto suffix ≠ Request/Response suffix — they signal different intent; don't mix them in the same codebase.

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.