skills/coding-rules-enforcement/SKILL.md
Generate hard enforcement tooling (ESLint, Ruff, golangci-lint, dependency-cruiser, pre-commit, arch tests, CI) from SDL
npx skillsauth add navraj007in/architecture-cowork-plugin coding-rules-enforcementInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Turns advisory coding rules into hard gates — linters, module boundary checks, architecture tests, pre-commit hooks, and CI workflows. All configs are derived deterministically from the SDL document.
Input: SDL document (via artifacts.generate including coding-rules-enforcement)
Output: Language-specific linter configs, dependency-cruiser rules, pre-commit hooks, architecture tests, CI workflow
API: POST /api/sdl/generate with artifactType: "coding-rules-enforcement" (no dedicated route)
The generator inspects architecture.projects.backend[] and frontend[] frameworks to determine which configs to produce:
| Framework | Language | Configs Generated |
|-----------|----------|-------------------|
| nodejs | TypeScript | ESLint, dependency-cruiser, arch tests |
| nextjs, react, vue, angular, svelte | TypeScript | ESLint (with React hooks/a11y if applicable) |
| python-fastapi | Python | Ruff + Mypy config |
| go | Go | golangci-lint config |
| java-spring | Java | ArchUnit tests |
| dotnet-8 | C# | NetArchTest tests |
| File | Language | Purpose |
|------|----------|---------|
| .eslintrc.sdl.js | TypeScript/JS | Custom ESLint rules from SDL architecture |
| pyproject.sdl.toml | Python | Ruff lint + Mypy strict + pytest coverage config |
| .golangci.sdl.yml | Go | 16+ linters with complexity limits |
| .dependency-cruiser.sdl.cjs | TypeScript/JS | Module boundary enforcement (modular-monolith/microservices) |
| .lintstagedrc.sdl.json | All | Pre-commit hook command mapping |
| .husky/pre-commit | All | Git pre-commit hook script |
| __tests__/architecture.sdl.test.ts | TypeScript | Architecture conformance tests |
| src/test/java/architecture/ArchitectureTest.java | Java | ArchUnit architecture tests |
| tests/Architecture.Tests/ArchitectureTests.cs | .NET | NetArchTest architecture tests |
| .github/workflows/enforce-architecture.yml | All | CI gate workflow |
20+ rules enforced:
@typescript-eslint/no-explicit-any: error — no any typemax-params: 3 — max function parametersno-console: error (allow warn) — no console.log in productionno-var, prefer-const — modern variable declarationsno-magic-numbers: warn — avoid unlabeled constantsmax-depth: 3 — max nesting depthmax-lines: 500 — max file sizemax-lines-per-function: 50 — max function length@typescript-eslint/consistent-type-imports — type-only importsimport/no-cycle — no circular importsimport/order — enforced import ordering@typescript-eslint/naming-convention — camelCase functions, PascalCase types, UPPER_CASE enums@typescript-eslint/no-floating-promises — no unhandled promisesno-await-in-loop: warn — avoid sequential async in loops@typescript-eslint/no-unused-vars — no dead codeReact-specific (when frontend uses React/Next.js):
react-hooks/rules-of-hooks — hook call rulesreact-hooks/exhaustive-deps — dependency arraysjsx-a11y/* — accessibility rules (alt-text, valid anchors, key events, labels)Generated when architecture.style is modular-monolith or microservices:
| Rule | Severity | What It Prevents |
|------|----------|-----------------|
| no-circular | error | Circular dependencies |
| no-cross-module-internals | error | Importing another module's internal files (only .interface.ts and .types.ts allowed) |
| no-db-in-routes | error | Routes importing database directly |
| no-repository-in-routes | error | Routes bypassing services to access repositories |
| shared-no-module-imports | error | Shared utilities depending on business modules |
| orm-only-in-repositories-{name} | error | ORM package imported outside repository files |
__tests__/architecture.sdl.test.ts)testing.coverage.targetArchitectureTest.java with ArchUnit)ArchitectureTests.cs with NetArchTest).github/workflows/enforce-architecture.yml)Runs on PR to main/develop and push to main. Jobs by language:
| Job | Steps |
|-----|-------|
| lint-typescript | npm ci → ESLint → dependency-cruiser → architecture tests |
| lint-python | pip install → ruff check → ruff format → mypy → pytest with coverage |
| lint-go | golangci-lint → go test with coverage threshold |
| lint-java | mvnw verify (includes ArchUnit) |
| lint-dotnet | dotnet restore → dotnet test Architecture.Tests |
| commit-lint | commitlint (conventional commits) |
| SDL Section | What It Controls |
|-------------|-----------------|
| architecture.projects.backend[].framework | Which language configs to generate |
| architecture.projects.frontend[].framework | React hooks/a11y rules, TypeScript linting |
| architecture.style | Enables dependency-cruiser module boundary rules |
| architecture.services[] | Module names for cross-module import restrictions |
| architecture.projects.backend[].orm | ORM-specific import restrictions |
| testing.coverage.target | Coverage enforcement threshold in CI |
| Aspect | coding-rules | coding-rules-enforcement |
|--------|----------------|---------------------------|
| Output | CLAUDE.md, .cursorrules, copilot-instructions.md | ESLint, Ruff, golangci-lint, tests, CI |
| Enforcement | Advisory (AI tool reads them) | Hard gates (CI blocks violations) |
| Scope | 27+ categories of architecture rules | Linting, boundaries, secrets, coverage |
| When | Always useful | When team needs CI-level enforcement |
Both are triggered via artifacts.generate in SDL. Use coding-rules alone for AI-guided development, add coding-rules-enforcement for automated CI gates.
development
# Trade-Off Analysis Skill Quantifies exact trade-offs when switching between architecture options. Shows users precisely what they gain and lose when choosing Option A over Option B. ## When to Use Use this skill to help users decide between options by showing: 1. **Cost difference** — how much more/less per month? 2. **Performance difference** — how much faster/slower? 3. **Complexity difference** — how much harder to build/maintain? 4. **Scalability difference** — when does this option hit
testing
# Stage Detection Skill Detects the current project stage (concept → mvp → growth → enterprise) based on `_state.json` field presence and completeness. Used by `/architect:next-steps`, `/architect:check-state`, and roadmap commands. ## When to Use Invoke this skill when you need to determine what stage a project is at based on its state file. Stage detection drives: - Command recommendations (what to run next) - Required fields validation (what should exist at this stage) - Risk assessment (w
development
# Stack Swap Simulator Skill Estimates cost and effort to switch from one tech stack to another. Helps answer: "Can we migrate later if needed?" ## When to Use Use this skill to understand: 1. **Cost of switching stacks** — engineer weeks + downtime risk 2. **Timeline to switch** — how long is the project? 3. **Risk of switching** — what can go wrong? 4. **ROI of switching** — does it save money long-term? 5. **Backwards compatibility** — can we do a gradual migration? ## Input Provide sour
tools
# Stack Compatibility Skill Verifies that chosen technologies integrate well together. Prevents "I picked these tools and they don't work well together" regrets. ## When to Use Use this skill to verify: 1. **Chosen tools work together** — React + Node + MongoDB = good? 2. **No hidden incompatibilities** — will I hit issues in production? 3. **Team can support it** — do we have expertise for this combo? 4. **Licenses compatible** — can we use these together commercially? 5. **Performance assum