dotnet-netarchtest

Enforce .NET architectural rules with NetArchTest.Rules in unit tests.

466|35|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/managedcode/dotnet-skills --skill dotnet-netarchtest
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-netarchtest
Source: https://github.com/managedcode/dotnet-skills/tree/main/skills/dotnet-netarchtest
Command: npx skills add https://github.com/managedcode/dotnet-skills --skill dotnet-netarchtest

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps enforce architectural integrity in .NET projects by defining and automatically testing rules for dependencies, namespaces, and layering.

Core Features & Use Cases

  • Architecture Rule Definition: Define rules using a fluent API to specify allowed and forbidden dependencies between project layers or namespaces.
  • Automated Testing: Integrate these rules into your unit test suite to catch architectural drift early.
  • Use Case: Ensure your UI layer never directly references your data access layer, maintaining a clean separation of concerns.

Quick Start

Use the dotnet-netarchtest skill to add architecture tests to the project.

Frequently Asked Questions about dotnet-netarchtest

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce .NET architecture rules within my unit tests?

You can enforce .NET architecture rules by integrating the NetArchTest.Rules library into your unit tests, applying fluent assertions to verify namespace boundaries and inter-layer dependencies. This automatically catches architectural drift during the test phase.

Can I prevent my UI layer from directly referencing my data access layer in .NET?

Yes, you can prevent unwanted references by defining architecture rules with a fluent API to specify forbidden dependencies between project layers. Automated testing then validates these boundaries to maintain a clean separation of concerns across namespaces.

What do I need to set up architecture tests for namespace boundaries in .NET?

Setting up architecture tests requires a .NET test project and any compatible unit-test framework. You use these to run the NetArchTest.Rules library, applying lightweight fluent assertions to validate your project's architectural layering and inter-layer dependencies.

What is the best way to automate dependency analysis for .NET architectural layering?

The best way to automate dependency analysis for .NET architectural layering is defining rules with a fluent API and running them as unit tests. This approach automatically detects architectural violations and ensures structural integrity across your project namespaces.

Does this architecture testing approach work with any .NET unit-test framework?

Yes, this architecture testing approach works with any compatible .NET unit-test framework. It relies on the NetArchTest.Rules library to apply fluent assertions for dependency analysis within your existing test suite to verify architectural layering.

Why should I use architecture tests to check inter-layer dependencies in .NET?

You should use architecture tests to check inter-layer dependencies because they automatically enforce architectural integrity and catch drift early. By integrating these rules into your unit tests, you continuously validate namespace boundaries and maintain a clean separation of concerns.