cc-spec-mutation
Skill0 starsChanged 26 days agoMITView on GitHub
Spec-locked TDD with a mutation-testing gate — refine the intent into an immutable Gherkin contract (SHA-256 frozen), implement under the three laws of TDD, pass a judge audit, and merge only if every mutant dies.
- Reads credentials
In this repository219 other files it gives its agents.
- .agents/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/behavioral-discipline.mdcCursor rule
- .cursor/rules/context-budget.mdcCursor rule
- .cursor/rules/orchestration.mdcCursor rule
- .cursor/rules/yagni-stdlib.mdcCursor rule
- androidSkill
- android-ui-designSkill
- api-versioningSkill
- astroSkill
- auth-token-inspectorSkill
- backlogSkill
- cc-api-contractSkill
- cc-db-migrationSkill
- cc-featureSkill
- cc-fixSkill
- cc-pagespeedSkill
- cc-refactorSkill
- cc-reviewSkill
- cc-tdd-cycleSkill
- cc-test-planSkill
- code-reviewSkill
- commitSkill
- conductor-setupSkill
- councilSkill
- database-migrationsSkill
- django-ormSkill
- django-testingSkill
- django-uvSkill
- drizzle-schema-architectSkill
- evaluationSkill
- fastapi-pydantic-strictSkill
- find-skillsSkill
- jpa-nplusone-detectorSkill
- jpa-postgresSkill
- laravel-specialistSkill
- livewire-alpine-bridgeSkill
- multi-agent-orchestrationSkill
- nextjs-typescriptSkill
- openspecSkill
- pagespeed-insightsSkill
- pagespeed-perfSkill
- php-proSkill
- python-django-stackSkill
- python-fastapi-stackSkill
- pythonSkill
- rust-asyncSkill
- rust-engineeringSkill
- rust-sqlxSkill
- security-ai-llmSkill
- security-blue-teamSkill
- security-cloudSkill
- security-cryptoSkill
- security-exploit-devSkill
- security-grcSkill
- security-incident-responseSkill
- security-log-analysisSkill
- security-malware-analysisSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 8 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 52
Do not jump to implementation.
- Distinctive: line 58
Stop gate: human confirms the draft before formalization.
- Distinctive: line 64
No vague language ("must respond fast" is forbidden — use measurable Then steps).
- Very specific: line 65
Every scenario declares preconditions (Given), actions (When), and observable states (Then).
- Distinctive: line 83
Law 1 (RED): no production code except to make a failing test pass.
- Distinctive: line 85
Law 2: write exactly one failing assertion or scenario at a time.
- Distinctive: line 86
Law 3 (GREEN): write only the minimal production code to pass.
- Distinctive: line 107
Run the deterministic AST mutator shipped with this preset:
- Distinctive: line 130
Do NOT modify production code to "fix" a surviving mutant.
- Very specific: line 156
Worktree isolation: run the whole flow in a dedicated git worktree.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Spec-Mutation — Hard Spec → TDD → Judge → Mutation Gate
Scope: $ARGUMENTS
Describe what behavior you want to implement. Include:
- The function, method, or feature to implement
- The expected behavior (inputs, outputs, invariants, edge cases)
- The allowed file scope (production files that may change)
- The test command for the affected suite (e.g.
pytest tests/test_billing.py)
Contract
The Gherkin specification is the immutable contract of the system. No code merges unless it survives intentional source mutations. The loop is closed:
[Human + spec_partner] ──> [gherkin_author] ──> [Test Freeze: SHA-256]
│
┌──────────────────────────────────────────────────────┘
▼
[tdd_craftsman] <───────────────┐ (surviving mutant)
(Red-Green-Refactor) │
│ │
▼ │
[judge] ───────────> [mutation_testing] ───> [Safe Merge]Role mapping onto Conductor Agents (AGENTS.md):
| Workflow role | Conductor Agent | Deliverable |
craftsman_lead | orchestrator | Routed Task Cards, per-stage scorecards |
spec_partner | task-coach | Spec draft with invariants and boundaries |
gherkin_author | contract-builder | Strict .feature file (Given/When/Then) |
tdd_craftsman | tester → implementer | Failing test, then minimal production code |
judge | reviewer | Binary verdict (PASS/REJECT) with scoring |
mutation_testing | tester (runner) | Killed/survived mutant report |
Stage 1 — Interactive refinement (spec_partner / task-coach)
Do not jump to implementation. Apply Socratic questioning to the initial intent:
- Preconditions, postconditions, and edge cases.
- Invariant matrix: what must always be true.
- Scope boundaries: explicit
Scope / FilesandScope / Outfor the Task Card.
Stop gate: human confirms the draft before formalization.
Stage 2 — Hard Spec formalization (gherkin_author / contract-builder)
Formalize the agreed draft into specs/<task>.feature using strict Gherkin:
- No vague language ("must respond fast" is forbidden — use measurable Then steps).
- Every scenario declares preconditions (
Given), actions (When), and observable states (Then). - Once the human approves the
.feature, freeze it:
shasum -a 256 specs/<task>.feature tests/ > .codeconductor/tasks/<task_id>.lockFrom this point specs/ and tests/ are read-only for implementation
agents. Before every later gate, recompute the hash; any single-byte difference
aborts the pipeline with scorecard 0 (Specification Gaming).
Stage 3 — TDD under the three laws (tdd_craftsman)
Delegates to the /cc-tdd-cycle state machine (tddCycleStateMachine in
domain/loop). Evidence must be captured with npx cc-codeconductor tdd capture — do
not hand-edit JSON under .codeconductor/evidence/.
- Law 1 (RED): no production code except to make a failing test pass. A compile error from a missing interface counts as a failure.
- Law 2: write exactly one failing assertion or scenario at a time.
- Law 3 (GREEN): write only the minimal production code to pass. No speculative code, no preventive heuristics, stdlib-first.
Hard rule: any write attempt against specs/ or tests/ during GREEN/REFACTOR
is a harness violation — stop execution and report.
Stage 4 — Judge audit (judge / reviewer)
Deterministic gates before spending compute on mutation:
- Clean compile / diagnostics exit code 0.
- Traceability: every Gherkin step maps to an implemented test step.
- Scope Gaming audit:
git diff --name-onlymust match the Task CardScope / Filesexactly. Relaxed types, weakened assertions, or out-of-scope edits → REJECT with findings.
Verdict is binary: PASS continues to the mutation gate; REJECT returns to the
implement phase with the findings attached.
Stage 5 — Mutation gate (mutation_testing)
Run the deterministic AST mutator shipped with this preset:
python3 presets/shared/mutation_runner.py \
--target <production_file.py> \
--test-command "<test command>" \
--spec-folder specsThe runner applies deterministic operator mutations (> → <=, == → !=,
is → is not, …) one at a time, re-runs the suite per mutant, and restores
the original source unconditionally (finally rollback).
- Mutant killed (tests fail): the suite detects the corruption. Continue.
- Mutant survived (tests pass): the tests are blind to this branch. The
runner writes
specs/handover.md+ appends tospecs/implementation-summary.mdand exits with code 2.
Non-Python stacks: substitute Stryker (JS/TS), PITest (JVM), or Mutmut (Python full-suite) with the same contract — 100% kill rate or hands-off.
Hands-off protocol (exit code 2)
- Do NOT modify production code to "fix" a surviving mutant.
- Route back to
tdd_craftsmanwithspecs/handover.mdas input: write the missing failing test (Law 1 & 2) that asserts the mutated branch. - Re-run stages 3–5.
Circuit breaker (max 3 loops)
The orchestrator keeps a persistent counter per Task Card. If the
tdd_craftsman ↔ mutation_testing loop does not reach a 100% kill rate after
3 iterations:
- Cancel active subagents (stop token/context spend).
git checkout -- <scope>rollback to the last clean state.- Scorecard:
STATUS = BLOCKED; escalate to a human operator. The branch stays frozen until human arbitration.
Guardrails (harness-enforced, not prompt-enforced)
- Test Freezing: SHA-256 of
specs/+tests/stored in.codeconductor/tasks/<task_id>.lock; hash mismatch aborts the pipeline. - Scope Guardian:
fs_write/fs_patchpaths are validated against the Task CardScope / Files; path escapes (../) and critical files (**/.env*,**/credentials*, infrastructure roots) are denied perpolicy.yml. - RBAC per role:
gherkin_authorwrites onlyspecs/;tdd_craftsmanreads specs/tests and writes only scopedsrc/;judgeandmutation_testingare read-only except the runner's rolled-back patch. - Worktree isolation: run the whole flow in a dedicated
git worktree; protected branches (main,master,develop) are never touched.
Completion criteria
.featureapproved and frozen (SHA-256 lock file exists and matches).- RED → GREEN → REFACTOR evidence captured per phase.
- Judge verdict PASS (compile clean, traceability complete, scope clean).
- Mutation runner exits 0 with
total_mutants_killed == total_points. - Scorecard records the kill rate and iteration count (≤ 3).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

