engineering-craft
/engineering-craft
Use when writing or changing any production code or tests — new features, bug fixes, refactors, or test authoring, in any language, by any model on any CLI.
- Author
- mickeyyaya ↗
- Repository
- evolve-loop ↗
- Licence
- Apache-2.0
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 4
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
What it does and when to use it
Use when writing or changing any production code or tests — new features, bug fixes, refactors, or test authoring, in any language, by any model on any CLI.
Original author description
Use when writing or changing any production code or tests — new features, bug fixes, refactors, or test authoring, in any language, by any model on any CLI.
How it works
- Iron Laws (RIGID — no exceptions, no negotiation)
- Rationalization table (RIGID — if you think it, stop)
- The write-code loop (RIGID)
- Red flags in code you just wrote (RIGID)
- References (progressive disclosure — load what the task needs)
- Works with (don't duplicate these)
- Precedence
SKILL.md preview
---
name: engineering-craft
description: Use when writing or changing any production code or tests — new features, bug fixes, refactors, or test authoring, in any language, by any model on any CLI.
---
# Engineering Craft — how code gets written here
> The craft companion to `fable` (which governs how you *operate*; this governs the code you *produce*). Content is distilled from 2025-26 measured evidence — mutation-testing studies, million-commit analyses of AI-written code, and benchmarked skill collections — not textbook restatement. Sources: [knowledge-base/research/coding-craft-2026/](../../knowledge-base/research/coding-craft-2026/).
## Iron Laws (RIGID — no exceptions, no negotiation)
1. **No production code without a failing test first.** Watch it fail, for the RIGHT reason (assertion failure on the missing behavior — not a compile error, not a typo). If code came first anyway: delete it, write the test, start over. Yes, really.
2. **Completion = machine evidence.** Every task ends with a runnable check (test run, build, diff) whose real output you show. "Should work" is not a state of code.
3. **Search before you write.** Before adding any function/type/helper: search for the existing one. Duplication is the measured #1 AI-code pathology (+81% duplicated blocks since 2023). Extending beats re-creating; consolidating beats both.
4. **Never weaken a test to make it pass.** Tests encode intent. If a test is wrong, fix it in a commit that says so; if it's right, fix the code. Deleting/skipping/loosening assertions to go green is falsifying evidence.
5. **The diff you ship is the smallest correct one.** No drive-by refactors, no unrequested "improvements", no formatting churn outside touched lines. File separate work separately.
6. **Mock only network/clock/subprocess — never your own logic.**
## Rationalization table (RIGID — if you think it, stop)
| The thought | The reality |
|---|---|
| "This is too simple to need a test" | Simple code breaks too; the test costs 2 minutes and is the only proof you ran it. |
| "I'll add tests after it works" | After-tests pass by construction and verify nothing. Red-first or start over. |
| "A mock is easier here" | Agents over-mock measurably (mocks in 36% of agent commits touching tests vs 26% of non-agent commits). Mock only process boundaries (network, clock, subprocess) — never your own logic. |
| "I'll extract an interface for testability" | Interfaces-for-mocking is inverted design. Consumer-side interfaces, only when ≥2 real implementations exist. (Different threshold from rule-of-three, which governs code duplication.) |
| "While I'm here, I'll clean this up" | Scope creep buries the actual change in review noise. Note it, file it, move on. |
| "Coverage is high, tests are good" | 85% coverage can hide a 57% mutation kill rate. Ask: would this test FAIL if the logic inverted? |
| "This helper probably doesn't exist yet" | Search first (Iron Law 3). The codebase is bigger than your context. |
| "The linter/reviewer is wrong, I'll ignore it" | Decline visibly with a reason, or comply. Silent disagreement re-litigates forever. |
## The write-code loop (RIGID)
1. **Scope contract**: one sentence of goal + explicit non-goals; identify the blast radius (what must NOT change behavior).
2. **RED**: failing test(s) — the new behavior's test + for bug fixes a *regression test* (fails pre-fix) AND *preservation tests* (pass pre-fix, must stay green).
3. **GREEN**: minimal implementation. Match surrounding conventions (naming, error style, layout) even where you'd choose differently.
4. **REFACTOR**: only with green tests, only within scope; consolidate any duplication you introduced.
5. **EVIDENCE**: run the check, show output as `N/N PASS, no regression`; verify the diff against the scope contract (nothing outside it).
## Red flags in code you just wrote (RIGID)
- A test with no assertion, or asserting only that a mock was called.
- A new `if err != nil { return nil }` (swallowed error) or empty catch.
- A guard clause for a condition nothing can produce (agents add ~2× unnecessary guards — every guard needs a caller that triggers it or a test that proves the boundary).
- Any comment in new code that is not machine-read (directive, marker, generated header): a name, a type, an extraction or a test says it instead ([code-comments](../../docs/conventions/code-comments.md)).
- Two blocks that differ by a variable name (extract, or if <3 occurrences, deliberately leave and note — rule-of-three).
- An exported symbol nothing outside the package calls.
## References (progressive disclosure — load what the task needs)
| Reference | Load when |
|---|---|
| [references/tdd-craft.md](references/tdd-craft.md) | writing any test — red-first mechanics, test-quality-over-coverage, anti-mock discipline, regression twins, property-based and table-driven patterns |
| [references/clean-code.md](references/clean-code.md) | writing/reviewing production code — the empirically-surviving rules, duplication discipline, reviewability budgets, comment policy, error handling |
| [references/design-patterns.md](references/design-patterns.md) | structuring components — DI/Strategy/Specification/ports-adapters selection, misuse table, Go interface discipline, when NOT to abstract |
(Flat-namespace installs — e.g. the codex target — project only SKILL.md; the reference files are absent.)
## Works with (don't duplicate these)
- `minimalism` — the laziest-correct-solution ladder; invoke alongside this skill for green-field code.
- `refactor` / `code-review-simplify` — orchestrate refactoring and review sessions; this skill sets the standards they check against.
- `golang-test-review` — Go-specific test review depth.
- `fable` (references/verification.md) — the operating-level completion/verification protocol this skill's Iron Law 2 instantiates for code.
## Precedence
User/project instructions (CLAUDE.md, AGENTS.md) outrank this skill where they conflict; this skill outranks default model behavior. RIGID sections are non-negotiable; everything else adapts to the codebase's existing conventions — convention-matching itself being one of the RIGID expectations.
Files in this package (4)
- SKILL.md 6 KB
- references/clean-code.md 5 KB
- references/design-patterns.md 6 KB
- references/tdd-craft.md 7 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · mickeyyaya/evolve-loop | 90 | Apache-2.0 |
| tmj-90/gaffer | 90 | Apache-2.0 |
Database snapshot: 13.11.2026 · package version 3e00e8000926 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 1 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100tdd
Use before writing or changing any production code — features, bug fixes, refactors — and whenever the router announces the tdd-fast-path. Invoke via route or explicit command. - 100tdd
Use when writing production code that needs tests -- new features, bug fixes, refactoring. Enforces RED-GREEN-REFACTOR before implementation. - 90repository-engineering
Audit, understand, modify, test, and document an existing software repository. Use for bug fixes, refactoring, feature implementation, build failures, CI issues, dependency changes, and engineering handoffs. Preserve project conventions and avoid unsupported claims. - 100python-style-guide
Guides production Python authoring and refactoring across API design, typing, docstrings, errors, boundaries, security, observability, resources, and proportional SRE controls. Use when writing or changing Python. Requires python-standards. Use technical-writing for project prose. - 100clean-code
Use when writing, editing, reviewing, testing, planning, or refactoring code in any language or framework; creating files or deciding where code and folders belong; designing or changing module boundaries, layers, and dependencies; starting a new project; auditing or cleaning up… - 90writing-tests
Generic test writing discipline: test quality, real assertions, anti-patterns, and rationalization resistance. Use when writing tests, adding test coverage, or fixing failing tests for any language or framework. Complements language-specific skills.