Generates architecture tests / fitness functions that fail the build when architectural rules are violated — layer dependencies, module boundaries, cycles, naming, and visibility conventions — across .NET, Java/Kotlin, TypeScript/JavaScript, Python, and Go stacks.
Ships in AI for Developers Toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Turn architectural rules into automated checks so violations fail the build instead of slowly rotting the codebase - layering, dependencies, module boundaries, cycles, and naming rules tailored to the project.
Works on a target: a solution/project/repo or GitHub URL (git clone --depth 1 <url> /tmp/repo). First map the real structure: projects/packages, folder names, and who imports whom. Identify the style (Clean/Onion layers? Hexagonal? Vertical Slice? modular monolith?) before writing a single rule.
| Manifest | Stack | Tool (prefer what's already installed) | Runs as |
|---|---|---|---|
*.csproj / *.sln | C# / .NET | NetArchTest.Rules or ArchUnitNET | xUnit/NUnit/MSTest test |
pom.xml / build.gradle(.kts) | Java / Kotlin | ArchUnit (Kotlin: also Konsist) | JUnit 5 test |
package.json | TypeScript / JavaScript | dependency-cruiser, or eslint-plugin-boundaries (Nx: @nx/enforce-module-boundaries) | CLI / lint step in CI |
pyproject.toml / requirements*.txt | Python | import-linter | lint-imports in CI |
go.mod | Go | depguard (via golangci-lint) or go-arch-lint; plus Go's internal/ package rule | lint step in CI |
Then map the rules to real names: assemblies/namespaces, Java packages, TS path globs, Python dotted modules, Go import paths.
Handler, repositories live in infrastructure, etc. Only where the team actually relies on it.internal types, Go internal/).Each rule must map to a real architectural decision. A handful of high-value rules beats dozens of pedantic ones.
dotnet add package NetArchTest.Rules
Clean Architecture dependency rule:
[Fact]
public void Domain_has_no_outward_dependencies()
{
var r = Types.InAssembly(typeof(Order).Assembly)
.Should().NotHaveDependencyOnAny("MyApp.Application", "MyApp.Infrastructure", "MyApp.Api")
.GetResult();
Assert.True(r.IsSuccessful, string.Join("\n", r.FailingTypeNames ?? new()));
}
Other common fitness functions:
// Handlers must be sealed
Types.InAssembly(asm).That().HaveNameEndingWith("Handler").Should().BeSealed();
// Controllers/endpoints don't reference the DbContext directly
Types.InAssembly(asm).That().HaveNameEndingWith("Controller").ShouldNot().HaveDependencyOn("MyApp.Infrastructure.Data");
// Modules don't reference each other's internals (modular monolith)
Types.InAssembly(ordersAsm).ShouldNot().HaveDependencyOn("MyApp.Modules.Billing");
Always print FailingTypeNames in the assertion message so the failure is actionable. Use ArchUnitNET instead if it's already in the solution or you need its richer layer/slice API.
@AnalyzeClasses(packages = "com.acme.shop")
class ArchitectureTest {
@ArchTest
static final ArchRule layers = layeredArchitecture().consideringAllDependencies()
.layer("Web").definedBy("..web..")
.layer("Application").definedBy("..application..")
.layer("Domain").definedBy("..domain..")
.layer("Infrastructure").definedBy("..infrastructure..")
.whereLayer("Web").mayNotBeAccessedByAnyLayer()
.whereLayer("Application").mayOnlyBeAccessedByLayers("Web", "Infrastructure")
.whereLayer("Domain").mayOnlyBeAccessedByLayers("Application", "Infrastructure");
@ArchTest
static final ArchRule domainIsFrameworkFree = noClasses().that().resideInAPackage("..domain..")
.should().dependOnClassesThat().resideInAnyPackage("org.springframework..", "jakarta.persistence..");
@ArchTest
static final ArchRule modulesIndependent = slices().matching("com.acme.shop.modules.(*)..")
.should().notDependOnEachOther();
}
On Spring Modulith projects, ApplicationModules.of(App.class).verify() already enforces module boundaries - use it instead of hand-written slice rules. For Kotlin-specific conventions (naming, file structure) Konsist is an option.
// .dependency-cruiser.js
module.exports = {
forbidden: [
{ name: "no-circular", severity: "error", from: {}, to: { circular: true } },
{ name: "domain-is-pure", severity: "error",
from: { path: "^src/domain" }, to: { path: "^src/(infrastructure|api)" } },
{ name: "domain-no-orm", severity: "error",
from: { path: "^src/domain" }, to: { path: "node_modules/(@prisma|typeorm|drizzle-orm)" } },
{ name: "modules-via-public-api", severity: "error",
from: { path: "^src/modules/([^/]+)/" },
to: { path: "^src/modules/([^/]+)/(?!index\\.ts$)", pathNot: "^src/modules/$1/" } },
],
};
Run npx depcruise src in CI (generate a starter config with npx depcruise --init). If the project lints rather than tests, eslint-plugin-boundaries expresses the same rules as element types with allowed dependencies; in Nx workspaces use @nx/enforce-module-boundaries with project tags. Check the rule names against the installed plugin version.
# pyproject.toml
[tool.importlinter]
root_package = "shop"
[[tool.importlinter.contracts]]
name = "Layered architecture"
type = "layers"
layers = ["shop.api", "shop.application", "shop.domain"]
[[tool.importlinter.contracts]]
name = "Domain is framework-free"
type = "forbidden"
source_modules = ["shop.domain"]
forbidden_modules = ["sqlalchemy", "fastapi", "django"]
[[tool.importlinter.contracts]]
name = "Modules are independent"
type = "independence"
modules = ["shop.modules.orders", "shop.modules.billing"]
Run lint-imports in CI. Forbidding third-party modules requires include_external_packages = true in the [tool.importlinter] section.
Go already enforces one boundary for free: a package under x/internal/ can only be imported by code rooted at x/. Use it for module internals first. For layer rules, depguard via golangci-lint:
# .golangci.yml (depguard v2 rules; golangci-lint v2 nests this under linters.settings)
linters-settings:
depguard:
rules:
domain:
files: ["**/internal/domain/**"]
deny:
- pkg: "github.com/acme/shop/internal/infrastructure"
desc: "domain must not depend on infrastructure"
- pkg: "gorm.io/gorm"
desc: "domain must stay persistence-agnostic"
For a whole-graph component model (components + mayDependOn), go-arch-lint with a .go-arch-lint.yml is the closer equivalent of ArchUnit; verify the config schema against its docs for the installed version.
## Detected structure
<stack, tool chosen, architecture style, layers/modules found>
## Rules
| Rule | Why it matters | Currently passing? |
## Files
<test class / config file(s), ready to paste>
## CI
<the command or test run that enforces it>
Run the rules against the current code when possible. If a rule fails today, report the existing violations instead of silently weakening the rule.
"Add architecture tests to enforce my layers", "stop controllers from using the DbContext", "enforce that handlers are sealed", "ArchUnit rules for my Spring modules", "dependency-cruiser rules so domain can't import infrastructure", "import-linter contracts for my Django apps", "depguard rules for my Go service". Pairs with clean-architecture-scaffolder, modular-monolith-generator, and the architecture-reviewer agent.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
TypeScript, JavaScript, Python, Java, Kotlin, Go, .NET, C#
/ai-dev-toolkit:architecture-test-generatorfrom AI for Developers Toolkit
npx claudepluginhub stefanthecode/ai-for-developers --plugin ai-dev-toolkit45 skills in this plugin
/api-endpoint-scaffolderScaffold HTTP API endpoints in any stack - ASP.NET Core Minimal APIs or controllers, Express, Fastify, NestJS, FastAPI, Django REST Framework, Spring Boot controllers, Go net/http, chi, Gin - one feature per endpoint (REPR style) with request validation, typed responses, route grouping, auth, and OpenAPI metadata. Use this skill whenever the user wants to add an endpoint or route, convert controllers to minimal APIs, structure routes or routers, set up endpoint groups, TypedResults, route handlers, request DTOs/schemas (zod, Pydantic, Bean Validation, binding tags), or asks "how do I add an endpoint / structure my API routes". Always use this skill for endpoint scaffolding; it generates a complete, validated endpoint that matches the project's conventions./async-await-auditorAudit async and concurrent code in any language for correctness and performance bugs - C#/.NET (async/await, Task), JavaScript/TypeScript (Promises, async/await), Python (asyncio), Java/Kotlin (CompletableFuture, virtual threads, coroutines), Go (goroutines, channels, context), Rust (tokio/async). Use this skill whenever the user shares async or concurrent code, or asks about deadlocks, hangs, blocking calls, .Result/.Wait(), async void, ConfigureAwait, floating or unhandled promises, await in a loop vs Promise.all, blocking the event loop, forgotten await, asyncio.gather/TaskGroup, CompletableFuture.join, virtual thread pinning, goroutine leaks, context cancellation, WaitGroup/errgroup, holding a lock across .await, fire-and-forget tasks, cancellation tokens, or "why does my async code hang". Always use this skill for async/concurrency reviews instead of answering from memory; it applies a fixed checklist and rewrites the code.Other plugins' skills for the same job