Discover repository conventions and patterns. Use when conventions file is missing, before starting work on a new repository, or when asked to "discover conventions", "analyse repo", or "what patterns does this repo use". Generates .planning/CONVENTIONS.md.
Discovers how a repository works — its architecture, patterns, conventions, and dependencies. The goal is to understand "how things are done here" so agents can follow existing practices.
Note: This skill is primarily used via the Repo Analyser agent as a subagent. The content here serves as reference documentation.
Discover, don't assume. Every repository has its own conventions. Rather than looking for specific frameworks, observe what patterns actually exist and document them. If something is unclear, note it as "unclear" rather than guessing.
.planning/CONVENTIONS.md doesn't existUse your and tools for all codebase exploration. Only use the terminal for and commands — these work identically across all shells.
searchreaddotnetgitThe Repo Analyser agent contains detailed discovery instructions. In summary, explore these areas:
*.sln and *.csproj files, note .NET version(s) and project typesPackageReference entries and config files for databases, message brokers, cloud servicesCreate .planning/CONVENTIONS.md using this template:
# Repository Conventions
> Generated by repo-analyser on {date}
> Review and adjust if needed. Re-run if conventions change significantly.
## Overview
| Aspect | Value |
|--------|-------|
| Solution | {name} |
| .NET Version | {version} |
| Architecture | {pattern or "unclear"} |
| Test Framework | {framework} |
| Key Packages | {e.g., FluentValidation 11.x, MediatR 12.x} |
## Architecture
{Description of the architectural pattern observed, with folder structure examples}
## Project Structure
{Folder tree with purpose annotations}
## External Dependencies
| Type | Technology | Notes |
|------|------------|-------|
| Database | {e.g., SQL Server via EF Core} | {any notes} |
| Messaging | {e.g., Azure Service Bus} | {any notes} |
## Testing Conventions
| Aspect | Convention |
|--------|------------|
| Framework | {xUnit/NUnit/MSTest} |
| Assertions | {FluentAssertions/Shouldly/built-in} |
| Mocking | {Moq/NSubstitute/none} |
| Test naming | {pattern} |
| Organisation | {description} |
### Example Test
{Actual test method from codebase showing naming and structure}
## Code Patterns
| Aspect | Pattern |
|--------|---------|
| Request handling | {MediatR/custom handlers/direct/etc.} |
| Validation | {FluentValidation/DataAnnotations/manual} |
| Error handling | {Result type/exceptions/etc.} |
| Mapping | {AutoMapper/Mapster/manual/extensions} |
| API style | {Controllers / Minimal APIs / mixed} |
| Data access | {Dapper raw / Dapper.Contrib / EF Core / mixed} |
### Example Handler/Service
{Simplified example from codebase showing typical structure}
### Example Error Handling
{Actual example showing Result<T> vs exception usage}
## Code Style
| Aspect | Convention |
|--------|------------|
| Nullable refs | {enabled/disabled} |
| Namespaces | {file-scoped/block-scoped} |
| Records | {used for X/not used} |
| Field naming | {_camelCase/other} |
## Notes
{Anything unusual, unclear, or worth highlighting}
---
## For Agents
**Critical rules when writing code in this repository:**
1. **Architecture:** Place new features in `{path pattern}` following {pattern}
2. **Error handling:** Use `{Result<T> | exceptions}` — see Example Error Handling above
3. **Test naming:** `{pattern}` — see Example Test above
4. **Assertions:** Use `{assertion library}` syntax
5. **New files:** Follow the folder structure in Project Structure above
6. **API style:** Use `{Controllers | Minimal APIs}` — see existing endpoints for reference
7. **Data access:** Use `{Dapper pattern}` — see existing repositories/queries for reference