Skip to content

Commit 45043b9

Browse files
committed
Add .NET orchestration and modern feature skills
1 parent c0bbc6e commit 45043b9

File tree

15 files changed

+520
-13
lines changed

15 files changed

+520
-13
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ The public skill catalog lives on the Skills page:
108108
- [https://mcaf.managed-code.com/skills.html](https://mcaf.managed-code.com/skills.html)
109109

110110
Platform-specific bundles can stay small and still be explicit.
111-
For example, a typical .NET repo baseline can install `mcaf-solution-governance`, `mcaf-testing`, exactly one of `mcaf-dotnet-xunit`, `mcaf-dotnet-tunit`, or `mcaf-dotnet-mstest`, plus `mcaf-dotnet-quality-ci`, `mcaf-dotnet-complexity`, `mcaf-solid-maintainability`, and `mcaf-ci-cd`.
112-
In that setup, the repo-root lowercase `.editorconfig` is the default source of truth for formatting and analyzer severity, while `AGENTS.md` records the exact `dotnet build`, `dotnet test`, `dotnet format`, `analyze`, and coverage commands. Nested `.editorconfig` files are allowed when they serve a clear subtree-specific purpose, such as stricter domain rules, generated-code handling, test-specific conventions, or legacy-code containment.
111+
For example, a typical .NET repo baseline can install `mcaf-dotnet` as the entry skill, `mcaf-dotnet-features`, `mcaf-solution-governance`, `mcaf-testing`, exactly one of `mcaf-dotnet-xunit`, `mcaf-dotnet-tunit`, or `mcaf-dotnet-mstest`, plus `mcaf-dotnet-quality-ci`, `mcaf-dotnet-complexity`, `mcaf-solid-maintainability`, `mcaf-architecture-overview`, and `mcaf-ci-cd`.
112+
In that setup, `mcaf-dotnet` knows when to open the more specific .NET skills, the repo-root lowercase `.editorconfig` is the default source of truth for formatting and analyzer severity, and `AGENTS.md` records the exact `dotnet build`, `dotnet test`, `dotnet format`, `analyze`, and coverage commands. Nested `.editorconfig` files are allowed when they serve a clear subtree-specific purpose, such as stricter domain rules, generated-code handling, test-specific conventions, or legacy-code containment.
113+
For .NET code changes, the task is not done when tests are green if the repo also configured formatters, analyzers, coverage, architecture tests, or security gates. Agents should run the repo-defined post-change quality pass before completion.
113114
If the repo standardizes on concrete tools, install the matching tool skills as well. Typical open or free .NET additions include `mcaf-dotnet-format`, `mcaf-dotnet-code-analysis`, `mcaf-dotnet-analyzer-config`, `mcaf-dotnet-stylecop-analyzers`, `mcaf-dotnet-roslynator`, `mcaf-dotnet-meziantou-analyzer`, `mcaf-dotnet-coverlet`, `mcaf-dotnet-reportgenerator`, `mcaf-dotnet-stryker`, `mcaf-dotnet-netarchtest`, `mcaf-dotnet-archunitnet`, `mcaf-dotnet-semgrep`, and `mcaf-dotnet-csharpier`. `mcaf-dotnet-codeql` stays available, but should be chosen only when its hosting and licensing model fits the repository.
114115

115116
### 2.5 Context Rules

TUTORIAL.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,35 @@ This keeps install deterministic without requiring manifests or archives.
8181

8282
For a .NET repository, the usual baseline is:
8383

84+
- `mcaf-dotnet`
85+
- `mcaf-dotnet-features`
8486
- `mcaf-solution-governance`
8587
- `mcaf-testing`
8688
- exactly one of:
8789
- `mcaf-dotnet-xunit`
8890
- `mcaf-dotnet-tunit`
8991
- `mcaf-dotnet-mstest`
9092
- `mcaf-dotnet-quality-ci`
93+
- `mcaf-dotnet-complexity`
9194
- `mcaf-solid-maintainability`
95+
- `mcaf-architecture-overview`
9296
- `mcaf-ci-cd`
9397

9498
For .NET repositories, also make these repo-native artifacts explicit:
9599

96100
- a repo-root `.editorconfig` as the analyzer and formatting source of truth
97101
- project-specific nested `.editorconfig` files when a subtree has a clear different purpose or policy
98102
- `Directory.Build.props` or project files for bulk analyzer and runner settings
103+
- target `TFM` and explicit `LangVersion` only when the repo intentionally differs from the SDK default
99104
- whether the solution uses `VSTest` or `Microsoft.Testing.Platform`
100105

106+
The intended flow is:
107+
108+
- `mcaf-dotnet` is the entry skill for normal C# or .NET work
109+
- `mcaf-dotnet-features` decides which modern language features are safe to use, especially for C# 13 on `.NET 9` and C# 14 on `.NET 10`
110+
- the framework-specific test skill handles xUnit, TUnit, or MSTest mechanics
111+
- after code changes, agents run the repo-defined quality pass: format, build, analyze, tests, coverage, and any configured extra gates
112+
101113
Add tool-specific .NET skills only when the repo standardizes on them:
102114

103115
- `mcaf-dotnet-format`

docs/templates/AGENTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,15 @@ Do not paste the whole framework catalog here.
9494

9595
If the stack is `.NET`, this usually includes:
9696

97+
- `mcaf-dotnet`
98+
- `mcaf-dotnet-features`
9799
- `mcaf-testing`
98100
- exactly one of `mcaf-dotnet-xunit`, `mcaf-dotnet-tunit`, or `mcaf-dotnet-mstest`
99101
- `mcaf-dotnet-quality-ci`
102+
- `mcaf-dotnet-complexity`
103+
- `mcaf-solid-maintainability`
104+
- `mcaf-architecture-overview` if the repo keeps a maintained architecture map
105+
- `mcaf-ci-cd`
100106

101107
## Rules to Follow (Mandatory)
102108

@@ -113,6 +119,7 @@ If the stack is `.NET`, also document:
113119
- whether tests run on `VSTest` or `Microsoft.Testing.Platform`
114120
- whether `format` is `dotnet format --verify-no-changes` or a checked-in wrapper over it
115121
- whether coverage uses a VSTest collector, `coverlet.MTP`, or an MSTest SDK extension
122+
- explicit `LangVersion` only when the repo intentionally differs from the SDK default
116123

117124
### Project AGENTS Policy
118125

@@ -194,6 +201,7 @@ Local `AGENTS.md` files may tighten these values, but they must not loosen them
194201
- Repository or module coverage must not decrease without an explicit written exception.
195202
- Coverage is for finding gaps, not gaming a number. Coverage numbers do not replace scenario coverage or user-flow verification.
196203
- If the stack is `.NET`, document the active framework and runner model explicitly so agents do not mix VSTest and Microsoft.Testing.Platform assumptions.
204+
- If the stack is `.NET`, after changing production code run the repo-defined quality pass: format, build, analyze, focused tests, broader tests, coverage, and any configured extra gates such as architecture, security, or mutation checks.
197205

198206
### Code and Design
199207

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: mcaf-dotnet-features
3+
description: "Write modern, version-aware C# for .NET repositories. Use when choosing language features across C# versions, especially C# 13 and C# 14, while staying compatible with the repo's target framework and `LangVersion`."
4+
compatibility: "Requires a C# or .NET repository; respects explicit `LangVersion` and target framework settings."
5+
---
6+
7+
# MCAF: .NET Features
8+
9+
## Trigger On
10+
11+
- the repo wants more modern idiomatic C# code
12+
- a change depends on language-version compatibility
13+
- the team is upgrading or reviewing C# feature usage across versions
14+
- you need to know whether a C# 13 or C# 14 feature is safe to use
15+
16+
## Do Not Use For
17+
18+
- non-C# .NET languages such as F# or VB
19+
- analyzer-only or formatter-only setup with no language feature choice
20+
21+
## Inputs
22+
23+
- target `TFM` or `TFMs`
24+
- explicit `LangVersion`, if any
25+
- current SDK version
26+
- team style rules in `.editorconfig` and `AGENTS.md`
27+
28+
## Workflow
29+
30+
1. Detect the real language ceiling from the repo's target framework and explicit `LangVersion`.
31+
2. Prefer stable features that the current repo actually supports.
32+
3. Use modern syntax when it reduces ceremony, improves correctness, or makes invariants clearer.
33+
4. Do not mass-rewrite a codebase into newer syntax unless the repo wants that churn.
34+
5. Treat preview features as opt-in only. Never assume preview because the current machine has a newer SDK.
35+
6. Pay special attention to C# 13 and C# 14:
36+
- C# 13 is the stable language for `.NET 9`
37+
- C# 14 is the stable language for `.NET 10`
38+
7. When feature selection changes architecture, style rules, or generated-code patterns, coordinate with:
39+
- `mcaf-dotnet`
40+
- `mcaf-dotnet-analyzer-config`
41+
- `mcaf-solid-maintainability`
42+
8. After feature-driven refactors, run the repo's .NET quality pass through `mcaf-dotnet`.
43+
44+
## Deliver
45+
46+
- modern C# code that fits the repo's real language version
47+
- fewer obsolete patterns when a newer stable feature is clearer
48+
- no accidental preview or unsupported-language drift
49+
50+
## Validate
51+
52+
- the chosen syntax is supported by the repo's `TFM` and `LangVersion`
53+
- the feature improves clarity, correctness, or maintainability
54+
- preview-only features are used only when the repo explicitly opted in
55+
- style and analyzer rules still agree with the new syntax
56+
57+
## Load References
58+
59+
- read `references/csharp-modern-features.md` first
60+
61+
## Example Requests
62+
63+
- "Make this C# code more modern."
64+
- "Which features can we use on .NET 9?"
65+
- "Review this repo for C# 13 or C# 14 opportunities."
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# Modern C# Features For .NET Repositories
2+
3+
Use this reference when modernizing C# code without breaking the repo's target framework, SDK, or language-version expectations.
4+
5+
## First Rule: Detect The Real Language Ceiling
6+
7+
- the default C# version follows the target framework in modern SDK-style projects
8+
- `.NET 9` maps to `C# 13`
9+
- `.NET 10` maps to `C# 14`
10+
- newer language versions than the target framework supports are not supported
11+
- do not set `<LangVersion>latest</LangVersion>` because it makes builds machine-dependent
12+
- use `<LangVersion>preview</LangVersion>` only when the repo intentionally opts into preview
13+
14+
Useful checks:
15+
16+
```bash
17+
rg -n "<TargetFramework|<TargetFrameworks|<LangVersion" -g '*.csproj' -g 'Directory.Build.*' .
18+
```
19+
20+
If the repo's current language version is unclear, the compiler can reveal it:
21+
22+
```csharp
23+
#error version
24+
```
25+
26+
As of March 8, 2026:
27+
28+
- `C# 14` is the latest stable version
29+
- `C# 15` exists in preview, but should not be a default choice for production repo guidance
30+
31+
## Practical Adoption Rules
32+
33+
- prefer stable features that remove ceremony, improve correctness, or improve performance without obscuring intent
34+
- do not rewrite entire codebases just to use new syntax
35+
- modernize opportunistically when touching the code anyway
36+
- coordinate feature adoption with `.editorconfig`, analyzers, and architecture rules
37+
38+
## Version Guide
39+
40+
### C# 8
41+
42+
Typical pairing: `.NET Core 3.x`
43+
44+
Key features:
45+
46+
- readonly members
47+
- default interface members
48+
- switch expressions
49+
- property patterns
50+
- tuple patterns
51+
- positional patterns
52+
- using declarations
53+
- static local functions
54+
- disposable `ref struct`
55+
- nullable reference types
56+
- asynchronous streams
57+
- indices and ranges
58+
- null-coalescing assignment
59+
- unmanaged constructed types
60+
- stackalloc in nested expressions
61+
- improved interpolated verbatim strings
62+
63+
### C# 9
64+
65+
Typical pairing: `.NET 5`
66+
67+
Key features:
68+
69+
- records
70+
- init-only setters
71+
- top-level statements
72+
- relational patterns
73+
- logical patterns
74+
- native-sized integers
75+
- function pointers
76+
- module initializers
77+
- target-typed `new`
78+
- static anonymous functions
79+
- target-typed conditional expressions
80+
- covariant return types
81+
- extension `GetEnumerator` support in `foreach`
82+
- lambda discard parameters
83+
- attributes on local functions
84+
85+
### C# 10
86+
87+
Typical pairing: `.NET 6`
88+
89+
Key features:
90+
91+
- record structs
92+
- struct initialization improvements
93+
- interpolated string handlers
94+
- `global using`
95+
- file-scoped namespaces
96+
- extended property patterns
97+
- lambda natural type
98+
- explicit lambda return types
99+
- attributes on lambda expressions
100+
- `const` interpolated strings
101+
- `sealed` `ToString` in records
102+
- more accurate definite assignment and null-state analysis
103+
- mixed assignment and declaration in deconstruction
104+
- `AsyncMethodBuilder` on methods
105+
- `CallerArgumentExpression`
106+
- new `#line` format
107+
108+
### C# 11
109+
110+
Typical pairing: `.NET 7`
111+
112+
Key features:
113+
114+
- raw string literals
115+
- generic math support
116+
- generic attributes
117+
- UTF-8 string literals
118+
- newlines inside interpolation expressions
119+
- list patterns
120+
- file-local types
121+
- required members
122+
- auto-default structs
123+
- matching `Span<char>` against a constant string
124+
- extended `nameof` scope
125+
- `nint` and `nuint` aliases
126+
- `ref` fields and `scoped ref`
127+
- improved method-group conversion to delegate
128+
- warning wave 7
129+
130+
### C# 12
131+
132+
Typical pairing: `.NET 8`
133+
134+
Key features:
135+
136+
- primary constructors
137+
- collection expressions
138+
- inline arrays
139+
- optional parameters in lambda expressions
140+
- `ref readonly` parameters
141+
- alias any type
142+
- `Experimental` attribute
143+
- interceptors as a preview feature
144+
145+
### C# 13
146+
147+
Released November 2024. Stable on `.NET 9`.
148+
149+
Key features:
150+
151+
- `params` collections
152+
- new `lock` type and semantics with `System.Threading.Lock`
153+
- `\e` escape sequence
154+
- method-group natural type improvements
155+
- implicit indexer access in object initializers
156+
- `ref` locals and `unsafe` contexts in iterators and async methods
157+
- `ref struct` can implement interfaces
158+
- `allows ref struct` anti-constraint for generics
159+
- partial properties and partial indexers
160+
- overload resolution priority
161+
- `field` contextual keyword as a preview feature in C# 13-era tooling
162+
163+
Practical use:
164+
165+
- use `System.Threading.Lock` when the repo is on `.NET 9` and wants the newer synchronization model
166+
- use `params ReadOnlySpan<T>` or related collection forms in performance-sensitive APIs
167+
- use partial properties or indexers only where partial-type generation patterns already exist
168+
- do not assume `field` is safe unless the repo explicitly opted into preview behavior
169+
170+
### C# 14
171+
172+
Released November 2025. Stable on `.NET 10`.
173+
174+
Key features:
175+
176+
- extension members
177+
- null-conditional assignment
178+
- `nameof` with unbound generic types such as `nameof(List<>)`
179+
- more implicit conversions for `Span<T>` and `ReadOnlySpan<T>`
180+
- modifiers on simple lambda parameters
181+
- field-backed properties via `field`
182+
- partial events and partial constructors
183+
- user-defined compound assignment operators
184+
- file-based app preprocessor directives
185+
186+
Practical use:
187+
188+
- use null-conditional assignment to remove boilerplate null guards when side effects are clear
189+
- use field-backed properties when you need simple validation in an otherwise auto-property style
190+
- use extension members when the repo wants richer extension APIs, not for cosmetic rewrites
191+
- use span-related improvements in performance-sensitive code paths, not as blanket style churn
192+
193+
## Sources
194+
195+
- [Configure C# language version](https://learn.microsoft.com/dotnet/csharp/language-reference/configure-language-version)
196+
- [The history of C#](https://learn.microsoft.com/dotnet/csharp/whats-new/csharp-version-history)
197+
- [What's new in C# 13](https://learn.microsoft.com/dotnet/csharp/whats-new/csharp-13)
198+
- [What's new in C# 14](https://learn.microsoft.com/dotnet/csharp/whats-new/csharp-14)

skills/mcaf-dotnet-quality-ci/SKILL.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,29 @@ compatibility: "Requires a .NET solution or project; may update `AGENTS.md`, CI
5353
- which command analyzes
5454
- which command measures coverage
5555
- which runner model the tests use
56-
6. Route tool-specific setup through dedicated skills where possible:
56+
6. After any .NET code change, the repo's quality pass must be runnable by agents:
57+
- format
58+
- build
59+
- analyze
60+
- focused tests
61+
- broader tests
62+
- coverage and report generation when configured
63+
- extra configured gates only when the repo actually enabled them
64+
7. Route tool-specific setup through dedicated skills where possible:
5765
- `mcaf-dotnet-format`
5866
- `mcaf-dotnet-code-analysis`
5967
- `mcaf-dotnet-analyzer-config`
6068
- analyzer-pack skills such as `mcaf-dotnet-stylecop-analyzers`, `mcaf-dotnet-roslynator`, and `mcaf-dotnet-meziantou-analyzer`
6169
- coverage/reporting skills such as `mcaf-dotnet-coverlet` and `mcaf-dotnet-reportgenerator`
6270
- architecture/security skills such as `mcaf-dotnet-netarchtest`, `mcaf-dotnet-archunitnet`, `mcaf-dotnet-codeql`, and `mcaf-dotnet-semgrep`
63-
7. Avoid overlapping tools with conflicting ownership. If you add an opinionated formatter, define whether it replaces or complements `dotnet format`.
71+
8. Avoid overlapping tools with conflicting ownership. If you add an opinionated formatter, define whether it replaces or complements `dotnet format`.
6472

6573
## Deliver
6674

6775
- a documented .NET quality baseline
6876
- CI commands that are explicit and reproducible
6977
- analyzer and coverage choices that match the repo's runner model
78+
- a documented post-change quality pass for agents and CI
7079
- tool selection that stays open-source and free by default, with caveats called out explicitly
7180

7281
## Validate
@@ -75,6 +84,7 @@ compatibility: "Requires a .NET solution or project; may update `AGENTS.md`, CI
7584
- formatting, analyzer, and coverage commands are runner-compatible
7685
- added tools cover distinct gaps instead of duplicating each other
7786
- complexity and architecture policy are explicit, not implied
87+
- .NET code changes are expected to pass more than tests alone when quality gates are configured
7888
- any licensing or hosting caveat is documented before the tool becomes a default gate
7989

8090
## Load References

0 commit comments

Comments
 (0)