arch-check
codewithmukesh/dotnet-claude-kit
Verify your codebase matches its declared architecture—catch dependency violations, layer leaks, and cycles.
What is arch-check?
Analyzes a .NET codebase against its claimed architecture (Clean, DDD, Vertical Slice, or Modular Monolith) using project-graph and dependency analysis. Detects wrong-direction references, namespace leaks, cycles, and boundary violations with concrete fix guidance. Use this after establishing your baseline architecture.
- Validates project-level dependency direction against declared architecture rules
- Detects circular dependencies and module-boundary violations
- Probes namespace-level leaks (e.g., Domain using Infrastructure types)
- Checks presentation-layer boundaries and endpoint placement
- Reports violations by severity with file:line evidence and concrete fixes
How to install arch-check
npx skills add https://github.com/codewithmukesh/dotnet-claude-kit --skill arch-check- A .NET codebase with an established or declared architecture
- CLAUDE.md, ADR, or clear statement of which architecture baseline applies (Clean, DDD, Vertical Slice, Modular Monolith)
How to use arch-check
- 1.Establish the declared architecture (from CLAUDE.md, ADR, or ask the user)
- 2.Run the skill to analyze project-level dependency direction
- 3.Review the violation report, sorted by severity (CRITICAL, HIGH, MEDIUM, INFO)
- 4.Address CRITICAL violations first (wrong-direction references, cycles)
- 5.Apply the suggested fixes or request immediate remediation for critical items
Use cases
- Before a release to catch architecture rot from accumulated changes
- After onboarding to verify an unfamiliar codebase's actual structure
- Recurring on teams with multiple contributors to shared modules
- Validating Clean Architecture, DDD, Vertical Slice, or Modular Monolith conformance
- Identifying why a codebase feels hard to test or extend
- Backend/full-stack engineers maintaining .NET codebases
- Tech leads enforcing architectural standards on teams
- Architects validating that code matches design decisions
- Teams adopting or migrating to a structured architecture
arch-check FAQ
Four baselines: Vertical Slice (features isolated, shared code explicit), Clean Architecture (Domain → nothing; Application → Domain; Infrastructure → Application), DDD + Clean (Clean rules + aggregate boundaries), and Modular Monolith (no cross-module references except Contracts; integration events for cross-module calls).
arch-check validates an existing codebase against a declared architecture. architecture-advisor helps you choose which architecture to adopt in the first place.
You must establish one first (via CLAUDE.md, ADR, or discussion). arch-check requires a baseline to check against; it will not infer one silently.
Yes—for CRITICAL violations (wrong-direction references), it offers to apply fixes immediately. Other violations require review and context-specific remediation.
No—it uses token-cheap project-graph analysis as the backbone, then spot-checks risky edges (Domain entities, module internals, endpoints) to catch namespace leaks. This keeps analysis fast and focused on high-impact violations.
Full instructions (SKILL.md)
Source of truth, from codewithmukesh/dotnet-claude-kit.
name: arch-check description: > Architecture conformance check: verifies an existing codebase against its declared architecture (VSA, Clean Architecture, DDD, Modular Monolith) — dependency direction, layer violations, module boundary leaks, and cycles — using token-cheap Roslyn MCP analysis. Invoke when: "check architecture", "architecture violations", "layer violations", "dependency direction", "module boundaries", "arch check", "is my architecture clean", "enforce architecture", "conformance check". For CHOOSING an architecture, use architecture-advisor instead.
/arch-check
What
Verifies that the code still matches the architecture it claims to have. Architectures rot through small, individually-reasonable changes — a Domain project that gains an EF Core reference, a module that reaches into a sibling's internals, an endpoint defined outside the host. This workflow catches the rot using project-graph and dependency analysis, not file-by-file reading.
Output: a violation report with severity, file:line evidence, and the concrete fix — or a clean conformance pass.
When
- "check my architecture", "are there layer violations", "dependency direction"
- Before a release or after a large feature lands
- After onboarding to an unfamiliar codebase that claims an architecture
- Recurring on teams where multiple people merge to shared modules
- NOT for choosing an architecture — that is
architecture-advisor
How
Step 1: Establish the declared architecture
In order of authority: the project's CLAUDE.md, an ADR in docs/decisions/,
or ask the user. Never infer silently — a wrong baseline produces a wrong
report. The four supported baselines and their rules:
| Architecture | Rules checked |
|---|---|
| Vertical Slice | Features don't reference sibling features; shared code only via explicitly shared folders/projects |
| Clean Architecture | Domain → nothing; Application → Domain only; Infrastructure → Application; Api → Application (never Api → Infrastructure types, wiring only) |
| DDD + Clean | Clean rules + aggregates referenced only via roots; domain events for cross-aggregate effects |
| Modular Monolith | No project references between modules except *.Contracts; cross-module calls via integration events or contracts |
Step 2: Project-level dependency direction (cheapest, catches most)
get_project_graph()
Map every project reference against the baseline's allowed arrows. A single wrong reference here (Domain → Infrastructure) is a CRITICAL finding — it makes every downstream violation possible.
Step 3: Cycles
detect_circular_dependencies()
Cycles are violations in every baseline. Report the full chain.
Step 4: Namespace-level leaks (spot checks)
Project references can be clean while code still leaks. Probe the risky edges:
get_dependency_graph(symbolName: <a Domain entity>, depth: 2)
-- Domain types pulling in EF Core, HttpClient, or Infrastructure namespaces?
find_references(symbolName: <a module-internal type>)
-- referenced from outside its module?
detect_antipatterns()
-- known structural smells as supporting evidence
Pick probes by baseline: Clean → sample 3-5 Domain entities and Application handlers; Modular Monolith → sample each module's internal types; VSA → sample types inside two or three feature folders.
Step 5: Presentation boundary
get_endpoint_map()
Endpoints must live only in the host/Api layer (Clean) or inside their owning
module (Modular Monolith, VSA feature folders). An endpoint defined in an
Application or shared project is a boundary violation. Unmarked auth on any
endpoint is reported as a side-finding (route to /security-scan for depth).
Step 6: Report
| Severity | Meaning |
|---|---|
| CRITICAL | Wrong-direction project reference, module-to-module reference, cycle |
| HIGH | Namespace leak (Domain using Infrastructure/EF types), endpoint outside its layer |
| MEDIUM | Shared-kernel logic creep, aggregate bypassed via direct member access |
| INFO | Unmarked endpoint auth, antipattern hits worth a look |
Each finding: evidence (file:line), why it violates the baseline, and the fix (move the code, invert with an interface, introduce a contracts project, raise an integration event). Offer to fix CRITICAL items immediately.
MCP Tools Used
get_project_graph— reference-direction audit (the backbone)detect_circular_dependencies— cycle detectionget_dependency_graph/find_references— namespace-level leak probesget_endpoint_map— presentation boundary + auth posturedetect_antipatterns— supporting structural evidence
Example
User: /arch-check
Claude: Baseline from CLAUDE.md: Clean Architecture (4 projects).
Project graph (get_project_graph)...
CRITICAL Domain → Infrastructure reference (Domain.csproj:14)
Breaks the dependency rule; makes Domain untestable in isolation.
Fix: invert — define IEmailSender in Application, implement in
Infrastructure.
Cycles (detect_circular_dependencies)... none.
Leak probes on 4 Domain entities...
HIGH Order.cs:8 uses Microsoft.EntityFrameworkCore (Domain must stay
persistence-ignorant). Fix: move the [Index] config to
OrderConfiguration in Infrastructure.
Endpoint map... 23 endpoints, all in Api. 2 unmarked auth (side-finding —
run /security-scan).
Verdict: NOT conformant — 1 critical, 1 high. Fix the reference first;
want me to do it now?
Related
architecture-advisor— choosing a baseline (before this skill is useful)clean-architecture,vertical-slice,ddd,modular-monolithtemplate — the rules being enforced/security-scan— depth on the auth side-findings/health-check— broader report card; arch-check is its architecture dimension in depth
Related skills
More from codewithmukesh/dotnet-claude-kit and the wider catalog.

architecture-advisor
Guided architecture selection for .NET apps—asks structured questions, recommends Vertical Slice, Clean, DDD+Clean, or Modular Monolith.

aspire
Orchestrate cloud-native .NET services locally with AppHost, service discovery, and integrated observability.

authentication
JWT, OpenID Connect, and policy-based authorization for ASP.NET Core APIs and web apps.

build-fix
Autonomous iteration loops that drive broken .NET builds and failing tests to green with bounded retries and fail-safe guards.

caching
HybridCache and output caching strategies for .NET 10 applications with stampede protection.

checkpoint
Mid-session save point: commit progress and write a handoff note before risky changes or task switches.