一键导入
coding-rules-enforcement
Generate hard enforcement tooling (ESLint, Ruff, golangci-lint, dependency-cruiser, pre-commit, arch tests, CI) from SDL
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate hard enforcement tooling (ESLint, Ruff, golangci-lint, dependency-cruiser, pre-commit, arch tests, CI) from SDL
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Structured web research methodology for market analysis, competitor research, and technology evaluation. Ensures research uses live web data with source citations and confidence tags.
Mermaid diagram templates for solution architecture, service communication, C4 Context/Container, data flow, agent flow, deployment, and sequence diagrams. Use when generating architecture diagrams.
Solution Design Language (SDL) specification — schema, validation, normalization, and generation rules
Core methodology for analysing requirements, building system manifests, and generating architecture deliverables. Use when planning or designing any software architecture.
Extract and render all Mermaid diagrams from architecture blueprints to PNG images. Creates a diagrams/ folder with high-quality images ready for presentations and documentation.
Convert architecture documents (blueprints, stakeholder presentations) from Markdown to professionally formatted Word (.docx) files. Applies corporate styling, embeds PNG diagrams, and creates presentation-ready documents.
| name | coding-rules-enforcement |
| description | Generate hard enforcement tooling (ESLint, Ruff, golangci-lint, dependency-cruiser, pre-commit, arch tests, CI) from SDL |
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.