#.NET Coding Practices
Cross-cutting application skill for Framework Design Guidelines + secure coding (from the archived awesome-guidelines style capsules). For language syntax, load csharp-coding-practices, vb-coding-practices, or fsharp-coding-practices.
Core Principle
.NET library quality is scenario-first public API with FDG naming and modern security boundaries, no CAS/binary formatters, specific exceptions, aggregate entry types.
When to Use / NOT
- Shared.NET libraries, NuGet packages, multi-language solutions, public API reviews.
- Naming namespaces/types, designing aggregate components, security baseline audits.
NOT when:
- C#/VB/F# formatting-only changes, use language practice skills.
- Non-.NET stacks.
- Generated designer/proxy code, validate generators.
Workflow
- Naming, Pascal/camel, affixes, namespaces (
dotnet-style-naming-framework.md).
- API design, scenarios, aggregates, collections (
dotnet-style-api-design.md).
- Exceptions/events, throw/catch, dispose (
dotnet-style-exceptions-events.md).
- Security/verify, CAS ban, input hardening, analyzers (
dotnet-style-security-verify.md).
- Language pass, route to C#/VB/F# skill for syntax/layout.
- Verify, analyzers, CLS, build/tests on changed assemblies.
Red Flags
- Org-chart namespace hierarchy
- Abstract base gets the best feature-area name
- Simple scenario needs many instantiated types
- Hungarian notation or underscores in public API
- Public fields
- Arrays/
List<T>/Dictionary<,> in public API instead of collection types
- Throwing
Exception/SystemException
- Catching
Exception without strategy
- Error codes instead of exceptions
Before*/After* event naming
StatusEnum or prefixed enum members
- Interface without concrete implementation and consumer
- Sealed/virtual without documented reason
- Mutable public value types
- BinaryFormatter, Remoting, DCOM, APTCA, partial trust
- Unvalidated external/path input
- Native wrapper granting unmanaged rights broadly
- Library missing CLS/analyzer gate
- Duplicating FDG rules only in language skill without this cross-cut
Verification
- Roslyn analyzers / FxCop-style rules on changed libraries
[CLSCompliant(true)] where applicable
- Scenario sample code uses intended aggregate type
- Banned API grep clean on new code
dotnet build + tests on touched projects
- Capsule checklist on public API additions
References
awesome-guidelines/references/dotnet-style-learning-note.md
awesome-guidelines/references/dotnet-style-naming-framework.md
awesome-guidelines/references/dotnet-style-api-design.md
awesome-guidelines/references/dotnet-style-exceptions-events.md
awesome-guidelines/references/dotnet-style-security-verify.md
Language routing
- C# layout/idioms →
csharp-coding-practices
- Visual Basic.NET →
vb-coding-practices
- F# →
fsharp-coding-practices
1---2name: dotnet-coding-practices3description: Use when designing or reviewing cross-language.NET public APIs, Framework Design naming, scenario-driven library design, exception/event/dispose patterns, secure coding baseline, and analyzer/CLS gates in CI.4---56#.NET Coding Practices78Cross-cutting application skill for Framework Design Guidelines + secure coding (from the archived `awesome-guidelines` style capsules). For language syntax, load `csharp-coding-practices`, `vb-coding-practices`, or `fsharp-coding-practices`.910## Core Principle1112.NET library quality is **scenario-first public API with FDG naming and modern security boundaries**, no CAS/binary formatters, specific exceptions, aggregate entry types.1314## When to Use / NOT1516- Shared.NET libraries, NuGet packages, multi-language solutions, public API reviews.17- Naming namespaces/types, designing aggregate components, security baseline audits.1819**NOT when:**2021- C#/VB/F# formatting-only changes, use language practice skills.22- Non-.NET stacks.23- Generated designer/proxy code, validate generators.2425## Workflow26271. **Naming**, Pascal/camel, affixes, namespaces (`dotnet-style-naming-framework.md`).282. **API design**, scenarios, aggregates, collections (`dotnet-style-api-design.md`).293. **Exceptions/events**, throw/catch, dispose (`dotnet-style-exceptions-events.md`).304. **Security/verify**, CAS ban, input hardening, analyzers (`dotnet-style-security-verify.md`).315. **Language pass**, route to C#/VB/F# skill for syntax/layout.326. **Verify**, analyzers, CLS, build/tests on changed assemblies.3334## Red Flags3536- Org-chart namespace hierarchy37- Abstract base gets the best feature-area name38- Simple scenario needs many instantiated types39- Hungarian notation or underscores in public API40- Public fields41- Arrays/`List<T>`/`Dictionary<,>` in public API instead of collection types42- Throwing `Exception`/`SystemException`43- Catching `Exception` without strategy44- Error codes instead of exceptions45- `Before*`/`After*` event naming46- `StatusEnum` or prefixed enum members47- Interface without concrete implementation and consumer48- Sealed/virtual without documented reason49- Mutable public value types50- BinaryFormatter, Remoting, DCOM, APTCA, partial trust51- Unvalidated external/path input52- Native wrapper granting unmanaged rights broadly53- Library missing CLS/analyzer gate54- Duplicating FDG rules only in language skill without this cross-cut5556## Verification5758- Roslyn analyzers / FxCop-style rules on changed libraries59- `[CLSCompliant(true)]` where applicable60- Scenario sample code uses intended aggregate type61- Banned API grep clean on new code62- `dotnet build` + tests on touched projects63- Capsule checklist on public API additions646566## References6768- `awesome-guidelines/references/dotnet-style-learning-note.md`69- `awesome-guidelines/references/dotnet-style-naming-framework.md`70- `awesome-guidelines/references/dotnet-style-api-design.md`71- `awesome-guidelines/references/dotnet-style-exceptions-events.md`72- `awesome-guidelines/references/dotnet-style-security-verify.md`7374## Language routing7576- C# layout/idioms → `csharp-coding-practices`77- Visual Basic.NET → `vb-coding-practices`78- F# → `fsharp-coding-practices`