personal-finance / rules
Cursor rule1 starsChanged todayMITView on GitHub
C# coding style: nullable, explicit types, file-scoped namespaces, records, async, formatting
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 4,243 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository84 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/angular-coding-style.mdcCursor rule
- .cursor/rules/angular-patterns.mdcCursor rule
- .cursor/rules/angular-security.mdcCursor rule
- .cursor/rules/angular-testing.mdcCursor rule
- .cursor/rules/common-code-review.mdcCursor rule
- .cursor/rules/common-coding-style.mdcCursor rule
- .cursor/rules/common-development-workflow.mdcCursor rule
- .cursor/rules/common-security.mdcCursor rule
- .cursor/rules/common-testing.mdcCursor rule
- .cursor/rules/csharp-data-access.mdcCursor rule
- .cursor/rules/csharp-patterns.mdcCursor rule
- .cursor/rules/csharp-security.mdcCursor rule
- .cursor/rules/csharp-testing.mdcCursor rule
- .cursor/rules/design-design-system.mdcCursor rule
- .cursor/rules/project-backend.mdcCursor rule
- .cursor/rules/project-security.mdcCursor rule
- .cursor/rules/project-testing.mdcCursor rule
- .cursor/rules/project-web.mdcCursor rule
- .cursor/rules/typescript-coding-style.mdcCursor rule
- .cursor/rules/typescript-patterns.mdcCursor rule
- .cursor/rules/typescript-security.mdcCursor rule
- .cursor/rules/typescript-testing.mdcCursor rule
- angular-guideSkill
- break-uiSkill
- dotnet-create-command-querySkill
- dotnet-create-entitySkill
- dotnet-create-moduleSkill
- dotnet-ef-migrationSkill
- emil-design-engSkill
- frontend-designSkill
- impeccableSkill
- review-animationsSkill
- speckit-analyzeSkill
- speckit-checklistSkill
- speckit-clarifySkill
- speckit-constitutionSkill
- speckit-convergeSkill
- speckit-implementSkill
- speckit-planSkill
- speckit-specifySkill
- speckit-tasksSkill
- ui-ux-pro-maxSkill
- angular-guideSkill
- break-uiSkill
- dotnet-create-command-querySkill
- dotnet-create-entitySkill
- dotnet-create-moduleSkill
- dotnet-ef-migrationSkill
- emil-design-engSkill
- frontend-designSkill
- impeccableSkill
- review-animationsSkill
- speckit-analyzeSkill
- speckit-checklistSkill
- speckit-clarifySkill
- speckit-constitutionSkill
- speckit-convergeSkill
- speckit-implementSkill
- The first 60 shown.
The file
We split this csharp-coding-style.mdc into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Prefer init and constructor parameters.
- Very specific: line 38
Every public async method takes a CancellationToken and passes it on.
≈ “Common” is an estimate: at least 1 in 5 of the 6,809 Cursor rule 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
---
description: "C# coding style: nullable, explicit types, file-scoped namespaces, records, async, formatting"
globs: **/*.cs,**/*.csx
alwaysApply: false
---
<!-- Generated by armature from stack-dotnet/rules/csharp/coding-style.md. Edit the source rule, not this file. -->
# C# coding style
Extends [common/coding-style.md](common-coding-style.mdc). `.editorconfig` enforces most of this; run
`dotnet format` before committing.
## Language
- Nullable reference types on (`<Nullable>enable</Nullable>`); treat nullable warnings as errors in new projects.
- File-scoped namespaces (`namespace X.Y;`). `using` directives outside the namespace, `System` first, unused removed.
- Braces on every control statement, even one-liners.
- Explicit access modifiers on every non-interface member. `sealed` by default for classes not designed for
inheritance. `readonly` fields where possible.
- No `dynamic` in application code.
## `var`
The repo's `.editorconfig` (`csharp_style_var_*`) decides (some repos use `var` throughout). When the
repo sets nothing, the default is:
- No `var` for built-in types: `int count = 10;`, `string name = "x";`, `Guid id = Guid.NewGuid();`.
- No `var` when the right side does not make the type obvious (repository calls, LINQ pipelines ending in
`ToListAsync`, method results): `List<Order> orders = await ...;`, `Order? order = await repo.GetAsync(id, ct);`.
- `var` is fine when the type is apparent: `new Order(...)`, `TimeSpan.FromMinutes(5)`, `Result.Success(x)`.
## Types
- `record` / `record struct` for immutable value-like data (DTOs, requests, responses, value objects); `sealed record`
for responses. `class` for entities with identity and lifecycle. Interfaces at service boundaries.
- Prefer `init` and constructor parameters; produce changed copies with `with`. Never mutate an input model.
- Primary constructors are fine for dependency injection in services and handlers; keep domain entities with private
constructors and static factories.
- Money and exact quantities are `decimal`, never `double`/`float`.
## Async
- `async`/`await` all the way; never `.Result`, `.Wait()` or `.GetAwaiter().GetResult()` in request paths.
- Every public async method takes a `CancellationToken` and passes it on. Name async methods `...Async`.
- No `async void` outside event handlers.
## Errors and logging
- Expected failures (not found, validation, conflict, forbidden) are `Result`/`Error` values, not exceptions (see
[patterns.md](csharp-patterns.mdc)). Exceptions are for the unexpected.
- Structured logging with message templates (`logger.LogError(ex, "Failed to load order {OrderId}", id)`), never
string interpolation in the template; never log tokens, secrets or personal data.
## Formatting
- Expression-bodied members for properties, accessors, operators and lambdas; block bodies for methods and
constructors unless a one-line body stays clearly readable.
- LF line endings, 4-space indent, UTF-8, final newline.
<!-- Adapted from affaan-m/ECC rules/csharp/coding-style.md (MIT) at d2ef268 (identical to the Ordo frozen copy); merged with the generic ordo-api CLAUDE.md/.editorconfig conventions (var, braces, file-scoped namespaces, modifiers), personal-finance-sdd (decimal money, primary constructors) and NEXUS knowledge/dotnet. -->
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.

