Always-on quality enforcement for Claude Code. Forces real engineering discipline. Blocks LLM laziness, over-engineering, vibe coding, redundancy. Enforces TDD, Clean Code, flat-first architecture, EARS requirements, mutation testing.
LLMs (Claude, GPT, Opus) have deep knowledge of software engineering. But they're trained to iterate โ generate simple answer first, wait for you to correct, burn more tokens. More iteration = more revenue for AI companies.
Result: you pay for code worse than what the model can produce.
This skill forces LLM to use real knowledge from the 1st response:
- โ Blocks lazy patterns (
Manager,Util,IRepositorywithout 2nd impl,UseCasefor CRUD) - โ Blocks over-engineering (ritualistic Clean Arch, 18 files for 1 feature)
- โ Blocks code without tests (TDD non-negotiable)
- โ Blocks quality regression (Quality Gate ratchet)
- โ Forces flat-first, YAGNI, abstract by real pain
- โ Compresses output (no fluff/pleasantries)
- โ Auto-trigger snapshot/contract/mutation tests
- โ E2E opt-in with recorded ADR
Real test comparing delivery app plan (same prompt, same stack):
| Metric | Without skill | With skill |
|---|---|---|
| Plan lines | 783 | 463 (-29%) |
| EARS requirements | 0 | 7 |
| Mutation testing | โ | โ |
| Snapshot/contract auto-trigger | โ | โ |
| TDD explicit mandate | partial | complete |
| E2E opt-in protocol | โ | โ |
Effectiveness: 92% โ forces real discipline without becoming formatting tyranny.
git clone https://github.com/giovani-junior-dev/code-craftsman.git ~/.claude/skills/code-craftsmanRestart Claude Code. Skill appears in any session.
# When published to marketplace
claude plugin install code-craftsmanSkill follows universal SKILL.md spec. Works in any agent that supports it:
# Cursor
mkdir -p ~/.cursor/skills/
git clone https://github.com/giovani-junior-dev/code-craftsman.git ~/.cursor/skills/code-craftsman
# Windsurf
git clone https://github.com/giovani-junior-dev/code-craftsman.git ~/.codeium/windsurf/skills/code-craftsman
# Cline
git clone https://github.com/giovani-junior-dev/code-craftsman.git ~/.cline/skills/code-craftsmangemini extensions install https://github.com/giovani-junior-dev/code-craftsmancodex skill add https://github.com/giovani-junior-dev/code-craftsmannpx skills add giovani-junior-dev/code-craftsman -a <agent>After global skill install, activate quality gate in a Node.js/TypeScript project:
cd /path/to/your-project
bash ~/.claude/skills/code-craftsman/install.shWhat it does:
- Installs dev deps: biome, knip, stryker, dependency-cruiser, jscpd, madge, msw, zod
- Configures hooks in
.claude/settings.json - Adds visual statusline
- Creates
.code-craftsman/baseline.jsonwith initial metrics - Adds npm scripts:
craftsman:check,craftsman:full, etc
After install:
npm run craftsman:check # Quality gate
npm run craftsman:full # Macro validation (mutation + security + ratchet)
npm run craftsman:baseline # Reset baseline after intentional improvement| Command | Function |
|---|---|
/code-craftsman:on |
Activate skill |
/code-craftsman:off |
Disable in this session |
/code-craftsman:pause 30m |
Temporary pause |
/code-craftsman:status |
State + metrics |
/code-craftsman:bypass <rule> <reason> |
Specific bypass (creates ADR) |
| Command | Function |
|---|---|
/code-craftsman:install |
Install in current project |
/code-craftsman:report |
Full report |
/code-craftsman:baseline-update |
Freeze new baseline |
/code-craftsman:e2e-decide <feature> |
Ask about E2E + create ADR |
- โค20 lines
- โค2 indentation levels
- โค2 parameters (3+ โ encapsulate in object)
- No boolean flag parameter
- โค500 lines total (avg ~200)
- โค120 chars per line
- โค15 imports
- โ
Manager,Processor,Handler,Util,Helper(generic) - โ
Iprefix on interfaces (IRepository) - โ
m_,_private, Hungarian Notation - โ Suffixes:
NameString,UserData,OrderInfo
- โ Interface without 2nd real implementation
- โ UseCase for simple CRUD
- โ DTO/Mapper in 3+ layers without real pain
- โ Preventive dependency inversion (YAGNI)
- โ Cross-domain imports (
billing/importsorders/)
- TDD mandatory (RED โ GREEN โ REFACTOR)
- โฅ80% coverage on modified files
- โฅ70% mutation score (Stryker)
- 1 assert/test, โค100ms unit
- F.I.R.S.T compliance
- Auto-trigger:
- UI render โ snapshot test
- External HTTP โ contract test (Pact/MSW + Zod)
- Financial logic โ mutation test
- E2E โ opt-in (asks after feature complete)
- Lint violations: cannot rise
- Code duplication: cannot rise
- Cyclomatic complexity: cannot rise
- File size violations: cannot rise
- Test coverage: only holds or rises
1. EARS requirement (When/shall format)
2. ATDD acceptance test (failing)
3. TDD unit loop (red-green-refactor)
4. Auto-trigger:
โโ UI render? โ snapshot test
โโ External call? โ contract test
โโ Continue with unit only
5. Mutation testing (Stryker โฅ70%)
6. Coverage ratchet (changed files โฅ80%)
7. F.I.R.S.T compliance check
8. E2E question (opt-in with ADR)
9. Final quality gate ratchet
10. PR
For temporary exploration:
// SPIKE: validating Stripe Connect for split payment merchants โ expires 2026-05-12
// SPIKE-ISSUE: #234
// exploratory code without testsStrict rules (enforced):
- Reason โฅ15 chars, non-generic (forbidden:
testing,wip,tmp) - Expiration โค7 days
- Issue # required
- After expires โ blocks editing (force conversion to real or delete)
- Branch
spike/*forbidden to merge into main
Real-time visual indicator:
๐จ craftsman ON โ ratchet โ โ cov 82% โ mut 74% โ lint 0 โ โก -47% tok
| State | Appearance |
|---|---|
| Active + green | ๐จ craftsman ON โ ratchet โ โ cov 82% |
| Active + regression | ๐จ craftsman ON โ โ ๏ธ ratchet FAIL |
| Paused | ๐จ craftsman โธ paused 24m |
| Disabled | ๐จ craftsman OFF |
| Bypass active | ๐จ craftsman ON โ โ 2 bypass |
code-craftsman/
โโโ SKILL.md # Always-active manifesto
โโโ README.md # This file
โโโ install.sh # Per-project installer
โโโ LICENSE # MIT
โ
โโโ scripts/ # 12 Node.js scripts
โ โโโ toggle.sh, pause.sh, bypass.sh
โ โโโ statusline.sh
โ โโโ quality-gate.js, baseline-init.js, metrics-collector.js
โ โโโ self-validate.js, coverage-ratchet.js
โ โโโ tdd-enforcer.js, first-checker.js
โ โโโ snapshot-validator.js, contract-detector.js
โ โโโ e2e-prompt.js
โ
โโโ hooks/ # 4 Claude Code hooks
โ โโโ pre-edit.js # PreToolUse Write|Edit
โ โโโ post-edit.js # PostToolUse Write|Edit
โ โโโ user-prompt.js # UserPromptSubmit
โ โโโ stop.js # Stop hook
โ
โโโ config/ # 6 configs
โ โโโ thresholds.json
โ โโโ biome.json
โ โโโ dependency-cruiser.cjs
โ โโโ stryker.config.json
โ โโโ knip.json
โ โโโ baseline.template.json
โ
โโโ templates/ # 11 templates
โ โโโ ears-requirement.md
โ โโโ adr.md
โ โโโ tdd-cycle.md
โ โโโ unit-test.template
โ โโโ snapshot-test.template
โ โโโ contract-test.template
โ โโโ e2e-playwright.template
โ โโโ e2e-decision-adr.md # Structured ADR
โ โโโ spike-marker.md # SPIKE protocol
โ โโโ acceptance-test.template
โ โโโ module-flat.template
โ
โโโ references/ # 6 knowledge base files
โ โโโ clean-code-rules.md
โ โโโ anti-patterns.md
โ โโโ architecture-rules.md
โ โโโ tdd-protocol.md
โ โโโ test-strategy.md
โ โโโ llm-laziness-guard.md
โ
โโโ commands/ # 9 slash commands
โ โโโ on.md, off.md, pause.md
โ โโโ status.md, bypass.md
โ โโโ report.md, baseline-update.md
โ โโโ install.md, e2e-decide.md
โ
โโโ state/ # Runtime state
โโโ enabled.flag
โโโ session.json
โโโ stats.json
Total: ~57 files, ~240KB
The skill orchestrates these free tools:
| Tool | Function |
|---|---|
| Biome | Lint+format (Rust-based, 10x faster than ESLint+Prettier) |
| Knip | Dead code, circular deps, duplication |
| Stryker | Mutation testing (tests the quality of your tests) |
| Vitest/Jest | Test runner |
| dependency-cruiser | Arch boundaries (forbids cross-imports) |
| Madge | Circular deps visualization |
| Pact | Consumer-driven contracts |
| MSW | Mock Service Worker (HTTP in tests) |
| Zod / TypeBox | Runtime schema validation |
| Playwright | E2E (opt-in) |
| Semgrep | Security scanning (optional) |
| Gitleaks | Secrets detection (optional) |
Skill built from research on:
- Lucas video โ Why I no longer Review AI โ ratchet, baseline, AI babysitting its own PR
- Fabio Akita Flow #588 โ harness > LLM, junior dev mindset, "AI reflects who you are"
- Clean Architecture in the AI era โ flat-first, strategic DDD, abstract by pain
- Clean Code (Robert C. Martin) โ measurable rules: names, functions, classes, tests, smells
- mattpocock/skills โ 16 skills (TDD, diagnose, grill-with-docs, etc)
- JuliusBrussee/caveman โ 65% output token reduction
Full research documented via NotebookLM.
PRs welcome. Areas of interest:
- Multi-language support (Python/Go/Rust)
- Adapters for other IDEs (JetBrains, VS Code extension)
- CI/CD integration (GitHub Actions workflow template)
- Mutation testing for other languages
- SKILL.md internationalization
- Additional tests validating enforcement
git clone https://github.com/giovani-junior-dev/code-craftsman.git
cd code-craftsman
# Test scripts in isolation
node scripts/tdd-enforcer.js test-file.ts
bash scripts/statusline.shThis skill applies its own rules to itself. PRs must:
- Follow caveman style in commits and PRs
- Not introduce abstraction without real pain (YAGNI)
- Add tests where applicable
- Keep scripts โค500 lines
- v1 โ Core: hooks, configs, Clean Code rules
- v2 โ Planning enforcement (EARS, mutation, snapshot/contract triggers)
- v2.1 โ Strict SPIKE protocol, structured E2E ADR
- v3 โ Multi-language (Python pytest, Go test)
- v3.1 โ Cloud integrations (GitHub Actions, GitLab CI)
- v4 โ Plugin marketplace publication
Simple code = easy to refactor This skill prefers simple-working over elegant-broken
YAGNI > ritualistic Clean Architecture Measure > opine Force quality from 1st response > iterate
MIT โ see LICENSE
"The only way to go fast is to go well." โ Robert C. Martin
"AI reflects who you are." โ Fabio Akita
"Why use many token when few do trick." โ caveman philosophy