Skip to content

Commit f6d2adc

Browse files
committed
Add .NET skills and quality tooling guidance
1 parent 4c126e7 commit f6d2adc

47 files changed

Lines changed: 3409 additions & 1112 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 241 additions & 506 deletions
Large diffs are not rendered by default.

TUTORIAL.md

Lines changed: 124 additions & 383 deletions
Large diffs are not rendered by default.

docs/templates/AGENTS.md

Lines changed: 198 additions & 166 deletions
Large diffs are not rendered by default.

skills/mcaf-ci-cd/SKILL.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
name: mcaf-ci-cd
3+
description: "Design or refine CI/CD workflows, quality gates, release flow, and safe AI-assisted pipeline authoring. Use when adding or changing build pipelines, release stages, IaC-driven environments, or deployment rollback policy."
4+
compatibility: "Requires repository access; may update CI workflows, pipeline docs, and release guidance."
5+
---
6+
7+
# MCAF: CI/CD
8+
9+
## Trigger On
10+
11+
- adding or changing CI workflows
12+
- defining release flow or rollback policy
13+
- tightening pipeline quality gates
14+
- writing or reviewing AI-assisted pipeline YAML
15+
16+
## Do Not Use For
17+
18+
- feature-level testing with no pipeline or release impact
19+
- general source-control policy without CI/CD changes
20+
21+
## Inputs
22+
23+
- the current pipeline and release flow
24+
- real build, test, analyze, and deploy steps
25+
- environment and rollback constraints
26+
27+
## Workflow
28+
29+
1. Define the target flow first:
30+
- PR validation
31+
- integration-branch gates
32+
- non-production deployment
33+
- production promotion or release
34+
2. Keep pipelines reviewable:
35+
- explicit build, test, and analyze steps
36+
- least-privilege secrets and permissions
37+
- rollback or fail-safe strategy
38+
3. Treat AI-generated YAML as draft content until it is reviewed and validated.
39+
4. For .NET repositories, make the quality gate explicit:
40+
- formatting ownership
41+
- analyzer ownership
42+
- coverage and report generation
43+
- runner model (`VSTest` or `Microsoft.Testing.Platform`)
44+
5. Pull only the references that match the current delivery problem.
45+
46+
## Deliver
47+
48+
- CI/CD changes that are explicit, reproducible, and reviewable
49+
- release documentation with rollback thinking
50+
- pipeline rules aligned with MCAF verification
51+
52+
## Validate
53+
54+
- every stage has a clear purpose and failure signal
55+
- rollback or safe failure is explicit
56+
- secrets and permissions are minimized
57+
- the pipeline matches the repo’s actual verification model
58+
59+
## Load References
60+
61+
- read `references/ci-cd.md` first
62+
- for .NET quality gates, use `mcaf-dotnet-quality-ci`
63+
64+
## Example Requests
65+
66+
- "Design CI for this repo."
67+
- "Tighten our deployment gates and rollback story."
68+
- "Review this GitHub Actions YAML before we trust it."
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
name: mcaf-dotnet-analyzer-config
3+
description: "Use a repo-root `.editorconfig` to configure free .NET analyzer and style rules. Use when a .NET repo needs rule severity, code-style options, section layout, or analyzer ownership made explicit. Nested `.editorconfig` files are allowed when they serve a clear subtree-specific purpose."
4+
compatibility: "Requires a .NET SDK-based repository; respects the repo's `AGENTS.md` commands first."
5+
---
6+
7+
# MCAF: .NET Analyzer Config
8+
9+
## Trigger On
10+
11+
- the repo needs a root `.editorconfig`
12+
- analyzer severity and style ownership are unclear
13+
- the team wants one source of truth for rule configuration
14+
15+
## Do Not Use For
16+
17+
- choosing analyzers with no config change
18+
- formatting-only execution with no config ownership question
19+
20+
## Inputs
21+
22+
- the nearest `AGENTS.md`
23+
- current `.editorconfig`
24+
- any `Directory.Build.props` overrides
25+
26+
## Workflow
27+
28+
1. Prefer one repo-root `.editorconfig` with `root = true`.
29+
2. Add nested `.editorconfig` files when a subtree has a clear scoped purpose, such as stricter rules, different generated-code handling, or a different policy for tests or legacy code.
30+
3. Keep severity in `.editorconfig`, not scattered through IDE settings.
31+
4. Write the file as real EditorConfig, not as a made-up `.NET` variant:
32+
- lowercase filename `.editorconfig`
33+
- `root = true` in the preamble
34+
- no inline comments
35+
- forward slashes in globs
36+
5. Keep bulk switches such as `EnableNETAnalyzers` in MSBuild files, not in `.editorconfig`.
37+
6. Treat `.globalconfig` as an exceptional case, not the normal repo setup.
38+
39+
## Deliver
40+
41+
- one explicit analyzer configuration ownership model
42+
- a root `.editorconfig` layout that agents can extend safely
43+
44+
## Validate
45+
46+
- rule severity is reproducible in local and CI builds
47+
- IDE-only settings do not silently override repo policy
48+
- the default path is a root `.editorconfig`, not a surprise alternative
49+
50+
## Load References
51+
52+
- read `references/analyzer-config.md` first
53+
54+
## Example Requests
55+
56+
- "Make `.editorconfig` the source of truth."
57+
- "Write a proper root `.editorconfig` for this repo."
58+
- "Fix conflicting analyzer severities in this .NET repo."
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# .NET Root .editorconfig
2+
3+
## Open/Free Status
4+
5+
- built-in .NET configuration system
6+
- free to use
7+
8+
## Default Placement
9+
10+
The default MCAF path is:
11+
12+
- one repo-root lowercase `.editorconfig`
13+
- `root = true` at the top
14+
- optional nested `.editorconfig` files when a subtree has a clear scoped purpose
15+
16+
## Verify First
17+
18+
Before adding a new config file, check whether the repo already has one:
19+
20+
```bash
21+
rg --files -g '.editorconfig' -g '.globalconfig'
22+
```
23+
24+
## File Format
25+
26+
`EditorConfig` is an INI-style format:
27+
28+
- section names are path globs like `[*.cs]` or `[src/**/*.cs]`
29+
- files are read from the current file directory upward
30+
- `root = true` stops the search
31+
- closer matching `.editorconfig` files override earlier parent rules
32+
- later matching sections in the same file win
33+
- comments must be on their own line and start with `#` or `;`
34+
- inline comments are not part of the format
35+
- the file should be UTF-8 with `LF` or `CRLF` line separators
36+
- forward slashes are the path separator in section globs
37+
- keys and values are case-insensitive
38+
- `unset` removes the effect of a previously set property
39+
40+
## Core Rules That Matter for .NET
41+
42+
- only `root` belongs in the preamble for effect outside sections
43+
- all other effective pairs belong under a matching section such as `[*.cs]`
44+
- unknown keys are allowed by the EditorConfig format, which is why `.NET`-specific keys like `dotnet_diagnostic.*`, `dotnet_style_*`, and `csharp_*` can live in `.editorconfig`
45+
- unsupported keys or values may be ignored by a given plugin or tool, so keep repo expectations tied to tools that actually honor them
46+
47+
## Glob Rules That People Commonly Get Wrong
48+
49+
- `*.cs` can match at any level below the directory that contains the `.editorconfig`
50+
- `src/*.cs` is relative to the directory that contains that `.editorconfig`
51+
- if a glob contains `/`, use `/`, never `\\`
52+
- a section ending with `/` does not match a file
53+
- a leading `/` does not add extra meaning if the glob already contains a `/`
54+
55+
## Comments
56+
57+
Good:
58+
59+
```ini
60+
# C# rules
61+
[*.cs]
62+
dotnet_diagnostic.CA1502.severity = warning
63+
```
64+
65+
Bad:
66+
67+
```ini
68+
[*.cs]
69+
dotnet_diagnostic.CA1502.severity = warning # inline comment
70+
```
71+
72+
In the bad example, the trailing `# inline comment` is not a comment under the current specification.
73+
74+
## Recommended Root Layout
75+
76+
Start with one root file like this:
77+
78+
```ini
79+
root = true
80+
81+
[*]
82+
charset = utf-8
83+
end_of_line = lf
84+
insert_final_newline = true
85+
trim_trailing_whitespace = true
86+
87+
[*.cs]
88+
indent_style = space
89+
indent_size = 4
90+
dotnet_analyzer_diagnostic.severity = warning
91+
dotnet_style_qualification_for_method = false:suggestion
92+
dotnet_style_qualification_for_property = false:suggestion
93+
dotnet_style_qualification_for_field = false:suggestion
94+
dotnet_style_qualification_for_event = false:suggestion
95+
96+
[*.{csproj,props,targets}]
97+
indent_style = space
98+
indent_size = 2
99+
```
100+
101+
Then add rule-specific severity in the same root file:
102+
103+
```ini
104+
root = true
105+
106+
[*.cs]
107+
dotnet_diagnostic.CA1000.severity = warning
108+
dotnet_diagnostic.CA1502.severity = warning
109+
dotnet_diagnostic.SA1200.severity = warning
110+
dotnet_diagnostic.RCS1036.severity = error
111+
```
112+
113+
## Scoped Nested .editorconfig
114+
115+
Add a nested `.editorconfig` when a subtree has a real local purpose, for example:
116+
117+
- tighter rules in a core domain
118+
- relaxed rules for generated code
119+
- different test-project conventions
120+
- legacy-code containment during gradual cleanup
121+
122+
Example:
123+
124+
```ini
125+
# src/LegacyModule/.editorconfig
126+
[*.cs]
127+
dotnet_diagnostic.CA1502.severity = error
128+
```
129+
130+
## CI Fit
131+
132+
- `dotnet format` and .NET analyzers both read `.editorconfig`
133+
- repo-root `.editorconfig` should be versioned and treated as the default source of truth
134+
- keep MSBuild switches such as `EnableNETAnalyzers` and `AnalysisLevel` in project files or `Directory.Build.props`
135+
- keep the file lowercase as `.editorconfig`
136+
137+
## Exceptional Use of .globalconfig
138+
139+
Use `.globalconfig` only when you have a real reason, for example:
140+
141+
- analyzer config distributed by package or SDK conventions
142+
- special project layouts where file-tree inheritance is not the right model
143+
144+
That is not the default MCAF recommendation for normal .NET repos.
145+
146+
## When Not To Use
147+
148+
- when the repo is trying to store analyzer policy only in IDE profiles or ephemeral local settings
149+
150+
## Sources
151+
152+
- [EditorConfig home and file location rules](https://editorconfig.org/)
153+
- [EditorConfig formal specification](https://spec.editorconfig.org/)
154+
- [Configuration files for code analysis rules](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-files)
155+
- [Code style rule options](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
name: mcaf-dotnet-archunitnet
3+
description: "Use the open-source free `ArchUnitNET` library for architecture rules in .NET tests. Use when a repo needs richer architecture assertions than lightweight fluent rule libraries usually provide."
4+
compatibility: "Requires a .NET test project; supports dedicated integrations for xUnit, xUnit v3, MSTest, TUnit, and others where available."
5+
---
6+
7+
# MCAF: .NET ArchUnitNET
8+
9+
## Trigger On
10+
11+
- the repo uses or wants `ArchUnitNET`
12+
- architecture testing needs richer modeling than simple dependency checks
13+
14+
## Do Not Use For
15+
16+
- the lightest possible architecture rule checks
17+
18+
## Inputs
19+
20+
- the nearest `AGENTS.md`
21+
- target assemblies
22+
- architecture boundaries and naming conventions
23+
24+
## Workflow
25+
26+
1. Load the architecture once per test assembly where possible.
27+
2. Encode a small number of durable, high-value architecture rules first.
28+
3. Use the test-framework-specific integration package that matches the repo.
29+
30+
## Deliver
31+
32+
- architecture tests with richer domain and type modeling
33+
34+
## Validate
35+
36+
- architecture load cost is reasonable for the suite
37+
- rules are stable and tied to real boundaries
38+
39+
## Load References
40+
41+
- read `references/archunitnet.md` first
42+
43+
## Example Requests
44+
45+
- "Use ArchUnitNET for layered architecture tests."
46+
- "Set up ArchUnitNET with xUnit or MSTest."
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# ArchUnitNET
2+
3+
## Open/Free Status
4+
5+
- open source
6+
- free to use
7+
8+
## Install
9+
10+
Core package:
11+
12+
```bash
13+
dotnet add package TngTech.ArchUnitNET
14+
```
15+
16+
Framework integration packages vary by test framework, for example:
17+
18+
```bash
19+
dotnet add package TngTech.ArchUnitNET.xUnit
20+
dotnet add package TngTech.ArchUnitNET.xUnitV3
21+
dotnet add package TngTech.ArchUnitNET.MSTestV2
22+
dotnet add package TngTech.ArchUnitNET.TUnit
23+
```
24+
25+
## Verify First
26+
27+
Before adding packages, check whether the repo already references ArchUnitNET and which framework integration it uses:
28+
29+
```bash
30+
rg -n "TngTech\\.ArchUnitNET" -g '*.csproj' .
31+
```
32+
33+
## Common Usage
34+
35+
Load the target assemblies once, then assert rules in tests.
36+
37+
Good fit for:
38+
39+
- layered architecture
40+
- namespace rules
41+
- dependency restrictions
42+
- domain boundary checks
43+
44+
## CI Fit
45+
46+
- runs as part of the normal test suite
47+
- richer than lightweight architecture-rule libraries, but also heavier
48+
49+
## When Not To Use
50+
51+
- when simple `NetArchTest` rules already cover the needed constraints
52+
53+
## Sources
54+
55+
- [ArchUnitNET](https://github.com/TNG/ArchUnitNET)

0 commit comments

Comments
 (0)