Tdd green gate
Enforce the red-green-refactor law and the exact ordered definition of green (typecheck, module-boundary, unit, BDD, build, artifact-drift) at every commit; use before writing code, before any feat/fix commit, and whenever a commit is blocked as red or for a missing test.From its SKILL.md
npx -y skills add MrEyratnz/software-factory --skill tdd-green-gateAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.9 KB, as published. Nobody here has run it
TDD Green Gate
The one law: never commit red, and never write implementation before a failing test.
"Green" is not a feeling — it is a fixed, ordered pipeline that must pass in full at
every commit. record-green mints a receipt bound to the exact working tree; guard-commit
refuses any commit whose tree does not match a green receipt.
Invariants (non-negotiable)
- Tests first. The failing test is written and committed-intent before the code that
makes it pass. A
feat/fixthat stages source files with no accompanying test is blocked byguard-commit+commit_lint. - Green is ordered. The stages run in this order and short-circuit on first failure:
typecheck -> module-boundary -> unit -> BDD -> build -> generated-artifact drift. A later stage never runs, and never masks, an earlier failure. - Green is tree-bound. A receipt is valid only for the precise
git write-treehash it was minted from. Any edit — even whitespace — changes the tree and invalidates the receipt. Re-run the gate. - Local == CI. Hooks fail you early; CI re-runs the identical gates as the authority. Do not tune tests to pass locally-only.
- Refactor is green-to-green. Refactor only from a green receipt to a new green receipt; behavior-preserving changes keep every stage passing.
The stages (what each proves)
| # | Stage | Proves | Fail means |
|---|---|---|---|
| 1 | typecheck | types sound, no any-holes | fix types before anything else |
| 2 | module-boundary | kernel<modules<app, ports/adapters honored (dependency-cruiser) | illegal import; move code or add a port |
| 3 | unit | logic correct in isolation | the failing test you wrote, or a regression |
| 4 | BDD | behavior/contract-per-port holds end-to-behavior | scenario broke; fix impl, not the scenario |
| 5 | build | app + modules compile/bundle | build-only breakage (config, exports) |
| 6 | artifact-drift | generated artifacts (e.g. tokens->CSS) match checked-in | regenerate and commit the generated file |
Procedure
- Resolve the repo's real commands. Read
.factory/config.json— it declares the package manager and the exact script per stage (do not guessnpm/pnpmor script names).
(Artifact-drift — stage 6 — is the.factory/config.json { "stack": "node", "gates": { "typecheck": "...", "boundaries": "...", "unit": "...", "bdd": "...", "build": "..." }, "generators": [ { "sourceRegex": "...", "command": "...", "output": "..." } ] }generators[]entries, diffed after regeneration; see thefactory-configskill for the full schema.) - Red first. Write the smallest failing test that pins the new behavior/bug. Run stage 3/4 and watch it fail for the right reason. A test that passes before you write code proves nothing — strengthen it.
- Green. Implement the minimum to pass. Run the full ordered gate via the connector:
gate_evaluateruns stages 1->6 and returns a deterministic per-stage verdict. Fix at the earliest red stage and re-run; never skip ahead. - Mint the receipt. With every stage green,
record-greenwrites.factory/state/gate-receipt.jsonbound to the currentgit write-tree. This survives compaction/resume — the proof lives on disk, not in conversation. - Lint the commit.
commit_lintchecks Conventional Commit type and that afeat/fixcarries a test. Fix message/scope before committing. - Commit.
guard-commitrecomputes the tree hash and compares it to the receipt. Match -> allowed. Mismatch (you edited after minting) -> re-run the gate and re-mint; do not--no-verify.
Connector cheat-sheet
gate_evaluate— run the full ordered pipeline; authoritative green/red per stage. Use this instead of eyeballing individual script output.commit_lint— Conventional Commit + tests-present verdict for the staged change.- Receipt:
.factory/state/gate-receipt.json(tree-bound). Never hand-edit it.
Anti-patterns (will be blocked or bite you)
- Staging
src/in afeatwith no test -> blocked (invariant 1). - Running
unitbeforetypecheck"to save time" -> forbidden ordering; earlier red hides. git commit --no-verify/ editing the receipt JSON -> defeats the tree binding; CI re-runs the gate and fails the PR anyway.- Committing a regenerated build but not the generated artifact -> stage 6 drift red.
- "It passes on my machine": if
.factory/config.jsonscripts pass but CI differs, the config is wrong — fix the config, not the gate.