$npx -y skills add managedcode/dotnet-skills --skill netarchtestUse the open-source free NetArchTest.Rules library for architecture rules in .NET unit tests. Use when a repo wants lightweight, fluent architecture assertions for namespaces, dependencies, or layering. USE FOR: the repo uses or wants NetArchTest.Rules; architecture rules shoul
| 1 | # NetArchTest |
| 2 | |
| 3 | ## Trigger On |
| 4 | |
| 5 | - the repo uses or wants `NetArchTest.Rules` |
| 6 | - architecture rules should be enforced in automated tests |
| 7 | |
| 8 | ## Value |
| 9 | |
| 10 | - produce a concrete project delta: code, docs, config, tests, CI, or review artifact |
| 11 | - reduce ambiguity through explicit planning, verification, and final validation skills |
| 12 | - leave reusable project context so future tasks are faster and safer |
| 13 | |
| 14 | ## Do Not Use For |
| 15 | |
| 16 | - very rich architecture modeling that needs a heavier DSL |
| 17 | |
| 18 | ## Inputs |
| 19 | |
| 20 | - the nearest `AGENTS.md` |
| 21 | - architecture boundaries to enforce |
| 22 | - target assemblies |
| 23 | |
| 24 | ## Quick Start |
| 25 | |
| 26 | 1. Read the nearest `AGENTS.md` and confirm scope and constraints. |
| 27 | 2. Run this skill's `Workflow` through the `Ralph Loop` until outcomes are acceptable. |
| 28 | 3. Return the `Required Result Format` with concrete artifacts and verification evidence. |
| 29 | |
| 30 | ## Workflow |
| 31 | |
| 32 | 1. Encode only durable architecture rules: |
| 33 | - forbidden dependencies |
| 34 | - namespace layering |
| 35 | - type shape conventions |
| 36 | 2. Keep rules readable and close to the boundary they protect. |
| 37 | 3. Fail tests on architecture drift, not on temporary style noise. |
| 38 | |
| 39 | ## Bootstrap When Missing |
| 40 | |
| 41 | If `NetArchTest.Rules` is not configured yet: |
| 42 | |
| 43 | 1. Detect existing setup: |
| 44 | - `rg -n "NetArchTest\\.Rules" -g '*.csproj' .` |
| 45 | 2. Add the package to the architecture test project: |
| 46 | - `dotnet add TEST_PROJECT.csproj package NetArchTest.Rules` |
| 47 | 3. Add at least one executable boundary rule test. |
| 48 | 4. Wire architecture tests into the standard `test` command in `AGENTS.md` and CI. |
| 49 | 5. Run `dotnet test TEST_PROJECT.csproj` and return `status: configured` or `status: improved`. |
| 50 | 6. If richer modeling is required and `ArchUnitNET` is chosen as the standard, return `status: not_applicable`. |
| 51 | |
| 52 | |
| 53 | ## Deliver |
| 54 | |
| 55 | - architecture tests that are understandable and stable |
| 56 | - boundary checks wired into the normal test path used by agents and CI |
| 57 | |
| 58 | ## Validate |
| 59 | |
| 60 | - the rules map to real boundaries the team cares about |
| 61 | - failures point to actionable dependency drift |
| 62 | |
| 63 | ## Ralph Loop |
| 64 | |
| 65 | Use the Ralph Loop for every task, including docs, architecture, testing, and tooling work. |
| 66 | |
| 67 | 1. Plan first (mandatory): |
| 68 | - analyze current state |
| 69 | - define target outcome, constraints, and risks |
| 70 | - write a detailed execution plan |
| 71 | - list final validation skills to run at the end, with order and reason |
| 72 | 2. Execute one planned step and produce a concrete delta. |
| 73 | 3. Review the result and capture findings with actionable next fixes. |
| 74 | 4. Apply fixes in small batches and rerun the relevant checks or review steps. |
| 75 | 5. Update the plan after each iteration. |
| 76 | 6. Repeat until outcomes are acceptable or only explicit exceptions remain. |
| 77 | 7. If a dependency is missing, bootstrap it or return `status: not_applicable` with explicit reason and fallback path. |
| 78 | |
| 79 | ### Required Result Format |
| 80 | |
| 81 | - `status`: `complete` | `clean` | `improved` | `configured` | `not_applicable` | `blocked` |
| 82 | - `plan`: concise plan and current iteration step |
| 83 | - `actions_taken`: concrete changes made |
| 84 | - `validation_skills`: final skills run, or skipped with reasons |
| 85 | - `verification`: commands, checks, or review evidence summary |
| 86 | - `remaining`: top unresolved items or `none` |
| 87 | |
| 88 | For setup-only requests with no execution, return `status: configured` and exact next commands. |
| 89 | |
| 90 | ## Load References |
| 91 | |
| 92 | - [references/patterns.md](references/patterns.md) |
| 93 | - [references/examples.md](references/examples.md) |
| 94 | - [references/netarchtest.md](references/netarchtest.md) |
| 95 | |
| 96 | ## Example Requests |
| 97 | |
| 98 | - "Add architecture tests with NetArchTest." |
| 99 | - "Block UI from referencing data directly." |