Analyze architecture fitness and optionally generate architecture tests.
Analyzes codebase architecture for compliance with clean architecture principles and generates tests.
/plugin marketplace add melodic-software/claude-code-plugins/plugin install soft-skills@melodic-softwareAnalyze architecture fitness and optionally generate architecture tests.
[scope]: Path to analyze (default: current directory)--generate: Generate test files (without this flag, only analysis is performed)--framework: Test framework to use when generating (default: netarchtest)
netarchtest: Generate NetArchTest testsarchunitnet: Generate ArchUnitNET testsExtract scope, generate flag, and framework preference.
Default scope is current directory.
Default framework is netarchtest if --generate is specified.
Invoke the fitness-functions skill to access test patterns, templates, and rule definitions.
Discover the codebase architecture:
Find solution/project files
.sln and .csproj filesIdentify namespace patterns
Detect architecture style
Catalog types and conventions
Check for common architectural rules:
# Architecture Fitness Report
**Project:** [Name]
**Date:** [ISO Date]
**Architecture Style:** [Detected Style]
## Summary
| Category | Checks | Passed | Failed |
|----------|--------|--------|--------|
| Dependencies | 5 | 4 | 1 |
| Layer Constraints | 4 | 4 | 0 |
| Naming Conventions | 6 | 5 | 1 |
| **Total** | **15** | **13** | **2** |
## Passed Checks ✓
- [x] Domain has no dependency on Infrastructure
- [x] Application has no dependency on Presentation
- [x] All handlers end with "Handler"
- [x] All repositories end with "Repository"
## Failed Checks ✗
### 1. Module Cross-Reference
**Rule:** Orders module should not depend on Payments module directly
**Violation:** `Orders.Application.Services.OrderService` references `Payments.Domain.PaymentStatus`
**Recommendation:** Use integration events instead of direct reference
### 2. Naming Convention
**Rule:** All controllers should end with "Controller"
**Violation:** `Api/Endpoints/OrderEndpoints.cs`
**Recommendation:** Rename to `OrderEndpointsController` or mark as intentional (Minimal API)
## Recommendations
1. **High Priority:** Decouple Orders from Payments using domain events
2. **Medium Priority:** Standardize endpoint naming conventions
3. **Low Priority:** Consider adding architecture tests to CI/CD pipeline
If --generate flag is provided:
Spawn fitness-function-generator agent
Agent creates test project (if not exists):
tests/ArchitectureTests/
├── ArchitectureTests.csproj
├── DependencyTests.cs
├── NamingConventionTests.cs
└── StructureTests.cs
Generate test classes based on analysis:
Output generated files:
## Generated Tests
Created 3 test files in `tests/ArchitectureTests/`:
- `DependencyTests.cs` (5 tests)
- `NamingConventionTests.cs` (4 tests)
- `StructureTests.cs` (3 tests)
Run with: `dotnet test tests/ArchitectureTests`
After analysis, suggest adding to CI/CD:
# Add to your GitHub Actions workflow:
- name: Run Architecture Tests
run: dotnet test tests/ArchitectureTests --logger "trx;LogFileName=arch-tests.trx"