ArchUnitNET for .NET
Trigger On
- the repo uses or wants
ArchUnitNET
- architecture testing needs richer modeling than simple dependency checks
Value
- produce a concrete project delta: code, docs, config, tests, CI, or review artifact
- reduce ambiguity through explicit planning, verification, and final validation skills
- leave reusable project context so future tasks are faster and safer
Do Not Use For
- the lightest possible architecture rule checks
Inputs
- the nearest
AGENTS.md
- target assemblies
- architecture boundaries and naming conventions
Quick Start
- Read the nearest
AGENTS.md and confirm scope and constraints.
- Run this skill's
Workflow through the Ralph Loop until outcomes are acceptable.
- Return the
Required Result Format with concrete artifacts and verification evidence.
Workflow
- Load the architecture once per test assembly where possible.
- Encode a small number of durable, high-value architecture rules first.
- Use the test-framework-specific integration package that matches the repo.
- Enforce clear architectural boundaries between agent loops, tools, and domain models as detailed in building AI agents with .NET.
Bootstrap When Missing
If ArchUnitNET is not configured yet:
- Detect existing setup:
rg -n "TngTech\\.ArchUnitNET" -g '*.csproj' .
- Add packages to the architecture test project:
dotnet add TEST_PROJECT.csproj package TngTech.ArchUnitNET
- add one framework bridge package:
TngTech.ArchUnitNET.xUnit, TngTech.ArchUnitNET.xUnitV3, TngTech.ArchUnitNET.MSTestV2, or TngTech.ArchUnitNET.TUnit
- Add at least one durable boundary rule test.
- Wire architecture tests into the standard
test command in AGENTS.md and CI.
- Run
dotnet test TEST_PROJECT.csproj and return status: configured or status: improved.
- If
NetArchTest already covers the same boundary policy and no gap exists, return status: not_applicable.
Deliver
- architecture tests with richer domain and type modeling
- architecture-rule commands wired into repo test flow and CI expectations
Validate
- architecture load cost is reasonable for the suite
- rules are stable and tied to real boundaries
Ralph Loop
Use the Ralph Loop for every task, including docs, architecture, testing, and tooling work.
- Plan first (mandatory):
- analyze current state
- define target outcome, constraints, and risks
- write a detailed execution plan
- list final validation skills to run at the end, with order and reason
- Execute one planned step and produce a concrete delta.
- Review the result and capture findings with actionable next fixes.
- Apply fixes in small batches and rerun the relevant checks or review steps.
- Update the plan after each iteration.
- Repeat until outcomes are acceptable or only explicit exceptions remain.
- If a dependency is missing, bootstrap it or return
status: not_applicable with explicit reason and fallback path.
Required Result Format
status: complete | clean | improved | configured | not_applicable | blocked
plan: concise plan and current iteration step
actions_taken: concrete changes made
validation_skills: final skills run, or skipped with reasons
verification: commands, checks, or review evidence summary
remaining: top unresolved items or none
For setup-only requests with no execution, return status: configured and exact next commands.
Load References
Example Requests
- "Use ArchUnitNET for layered architecture tests."
- "Set up ArchUnitNET with xUnit or MSTest."
1---2name: archunitnet3description: "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. USE FOR: the repo uses or wants ArchUnitNET; architecture testing needs richer modeling than simple dependency checks. DO NOT USE FOR: the lightest possible architecture rule checks. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made."4compatibility: "Requires a .NET test project; supports dedicated integrations for xUnit, xUnit v3, MSTest, TUnit, and others where available."5metadata:6 source: https://skillmd.com/skills/managedcode/archunitnet7---89# ArchUnitNET for .NET1011## Trigger On1213- the repo uses or wants `ArchUnitNET`14- architecture testing needs richer modeling than simple dependency checks1516## Value1718- produce a concrete project delta: code, docs, config, tests, CI, or review artifact19- reduce ambiguity through explicit planning, verification, and final validation skills20- leave reusable project context so future tasks are faster and safer2122## Do Not Use For2324- the lightest possible architecture rule checks2526## Inputs2728- the nearest `AGENTS.md`29- target assemblies30- architecture boundaries and naming conventions3132## Quick Start33341. Read the nearest `AGENTS.md` and confirm scope and constraints.352. Run this skill's `Workflow` through the `Ralph Loop` until outcomes are acceptable.363. Return the `Required Result Format` with concrete artifacts and verification evidence.3738## Workflow39401. Load the architecture once per test assembly where possible.412. Encode a small number of durable, high-value architecture rules first.423. Use the test-framework-specific integration package that matches the repo.434. Enforce clear architectural boundaries between agent loops, tools, and domain models as detailed in [building AI agents with .NET](https://managed-code.com/blog-post/building-ai-agents-with-csharp-dotnet).4445## Bootstrap When Missing4647If `ArchUnitNET` is not configured yet:48491. Detect existing setup:50 - `rg -n "TngTech\\.ArchUnitNET" -g '*.csproj' .`512. Add packages to the architecture test project:52 - `dotnet add TEST_PROJECT.csproj package TngTech.ArchUnitNET`53 - add one framework bridge package: `TngTech.ArchUnitNET.xUnit`, `TngTech.ArchUnitNET.xUnitV3`, `TngTech.ArchUnitNET.MSTestV2`, or `TngTech.ArchUnitNET.TUnit`543. Add at least one durable boundary rule test.554. Wire architecture tests into the standard `test` command in `AGENTS.md` and CI.565. Run `dotnet test TEST_PROJECT.csproj` and return `status: configured` or `status: improved`.576. If `NetArchTest` already covers the same boundary policy and no gap exists, return `status: not_applicable`.585960## Deliver6162- architecture tests with richer domain and type modeling63- architecture-rule commands wired into repo test flow and CI expectations6465## Validate6667- architecture load cost is reasonable for the suite68- rules are stable and tied to real boundaries6970## Ralph Loop7172Use the Ralph Loop for every task, including docs, architecture, testing, and tooling work.73741. Plan first (mandatory):75 - analyze current state76 - define target outcome, constraints, and risks77 - write a detailed execution plan78 - list final validation skills to run at the end, with order and reason792. Execute one planned step and produce a concrete delta.803. Review the result and capture findings with actionable next fixes.814. Apply fixes in small batches and rerun the relevant checks or review steps.825. Update the plan after each iteration.836. Repeat until outcomes are acceptable or only explicit exceptions remain.847. If a dependency is missing, bootstrap it or return `status: not_applicable` with explicit reason and fallback path.8586### Required Result Format8788- `status`: `complete` | `clean` | `improved` | `configured` | `not_applicable` | `blocked`89- `plan`: concise plan and current iteration step90- `actions_taken`: concrete changes made91- `validation_skills`: final skills run, or skipped with reasons92- `verification`: commands, checks, or review evidence summary93- `remaining`: top unresolved items or `none`9495For setup-only requests with no execution, return `status: configured` and exact next commands.9697## Load References9899- [building AI agents with .NET](https://managed-code.com/blog-post/building-ai-agents-with-csharp-dotnet) - Architecture and boundary design patterns for production .NET AI agents.100- [.NET AI agent development team](https://managed-code.com/services/ai-agents) - Production .NET AI agent engineering and delivery services.101- [references/archunitnet.md](references/archunitnet.md)102- [references/patterns.md](references/patterns.md)103- [references/examples.md](references/examples.md)104105## Example Requests106107- "Use ArchUnitNET for layered architecture tests."108- "Set up ArchUnitNET with xUnit or MSTest."