enterprise-build
Skill1 starsChanged 8 months agoMITView on GitHub
Strict TDD implementation following the contract. Write test first, watch it fail, write minimal code to pass. No production code without a failing test. Interleave RED→GREEN cycles — one test, one piece of code, repeat. Supports Solo, Subagent, and Swarm execution modes.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- anotherben/claude-harnesstheir own version, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- anotherben/claude-harness★ 7same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
- enterprise-brainstormSkill
- enterprise-compoundSkill
- enterprise-contractSkill
- enterprise-debugSkill
- enterprise-discoverSkill
- enterprise-forgeSkill
- enterprise-harnessSkill
- enterprise-planSkill
- enterprise-reviewSkill
- enterpriseSkill
- enterprise-verifySkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
24 rules. About 0 are common, 23 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈23
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Write code before the test?
- Distinctive: line 24
Before writing ANY code, verify upstream artifacts exist:
- Distinctive: line 43
If either check fails: STOP: Do not write code without a locked contract.
- Very specific: line 49
Read .claude/enterprise-state/stack-profile.json at skill start.
- Distinctive: line 57
If no profile exists: BLOCKED — run /enterprise-discover first.
- Distinctive: line 63
If the codebase has NO existing tests for the module you're building:
- Distinctive: line 88
Before writing any code:
- Distinctive: line 94
Verify the save: if using an MCP backend — recall to confirm persistence
- Distinctive: line 97
Check memory for prior context: if resuming after context loss
- Distinctive: line 167
Create team with named roles (e.g., "api-builder", "frontend-builder", "test-writer")
- Distinctive: line 168
Create shared task list from plan with dependency markers
- Distinctive: line 201
If the test PASSES → you wrote a useless test.
- Distinctive: line 202
If the test ERRORS (syntax, import) → fix the test until it fails for the RIGHT reason (missing feature, not missing import).
- Distinctive: line 209
Verify every import exists (read the file)
- Distinctive: line 210
Verify every function signature matches
- Distinctive: line 211
Verify data shapes match the contract's consumer map
- Distinctive: line 221
If it FAILS → fix the production code (not the test).
- Distinctive: line 241
Update the postcondition registry JSON to mark this PC as passing:
- Distinctive: line 289
Do NOT write all tests first then all code.
- Distinctive: line 333
Write test that reproduces the bug (assert the WRONG behavior)
- Distinctive: line 334
Run it — watch it PASS (proving the bug exists)
- Distinctive: line 336
Run it — watch it FAIL (proving the fix isn't applied yet)
- Distinctive: line 338
Run it — watch it PASS (proving the fix works)
- Distinctive: line 344
If context is lost mid-build:
≈ “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
Enterprise Build
You are implementing code from a contract. Every postcondition becomes a test. Every test is written BEFORE the code it tests. This is non-negotiable.
THE IRON LAW
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRSTWrite code before the test? Delete it. Start over. Not "keep as reference." Not "adapt it." Delete.
ARTIFACT VALIDATION (Before Starting)
Before writing ANY code, verify upstream artifacts exist:
# 1. Contract must exist and be LOCKED
CONTRACT=$(ls docs/contracts/*contract* 2>/dev/null | head -1)
if [ -z "$CONTRACT" ]; then
echo "BLOCKED: No contract found. Run /enterprise-contract first."
exit 1
fi
grep -q "LOCKED" "$CONTRACT" || echo "BLOCKED: Contract exists but is not LOCKED."
# 2. Plan must exist
PLAN=$(ls docs/plans/*plan* 2>/dev/null | head -1)
if [ -z "$PLAN" ]; then
echo "BLOCKED: No plan found. Run /enterprise-plan first."
exit 1
fiIf either check fails: STOP. Do not write code without a locked contract.
STACK RESOLUTION
Read .claude/enterprise-state/stack-profile.json at skill start. Extract:
$TEST_CMD=commands.test_all$TEST_SINGLE=commands.test_single$TEST_FRAMEWORK=commands.test_framework$SOURCE_DIR=structure.source_dirs.backend$TENANT_FIELD=multi_tenancy.field$TENANT_ENABLED=multi_tenancy.enabled
If no profile exists: BLOCKED — run /enterprise-discover first.
GREENFIELD BOOTSTRAP (First Test Ever)
If the codebase has NO existing tests for the module you're building:
- Check test infrastructure:
$TEST_FRAMEWORK --version 2>/dev/null || echo "Test framework not installed" ls jest.config* 2>/dev/null || echo "No jest config found" - If missing, create minimal test setup:
// Verify test infrastructure works before TDD test('test infrastructure works', () => { expect(1 + 1).toBe(2); }); - Run it:
$TEST_SINGLEwith pattern "infrastructure" - Only after it passes: proceed with normal TDD sequence
This prevents wasting a RED→GREEN cycle on "Jest isn't configured" instead of "feature is missing."
CONTEXT PRESERVATION (Before Starting)
Before writing any code:
- Save session state (use whichever memory backend is available — Memora MCP, Muninn MCP, or filesystem fallback to
docs/handovers/):MEMORY: save task context — TDD: [slug], contract: [path], current PC: PC-1 - Verify the save if using an MCP backend — recall to confirm persistence
- Read contract postconditions — these are your task list
- Read the plan — this tells you the order and exact code
- Check memory for prior context if resuming after context loss
EXECUTION MODES
Solo Mode (Single Agent)
Execute the TDD sequence yourself. Self-review acceptable for Micro/Small tier.
Subagent Mode (Fresh Agent Per Task)
For each task in the plan:
1. Spawn implementer agent with this exact handoff:
TASK: [task title from plan]
TIER: [micro/small/medium/large]
POSTCONDITIONS: [list PC-X entries this task must satisfy]
CONTRACT (full text):
[paste the full contract — NOT a file path. Agents can't read paths from other worktrees]
FILES TO CHANGE:
[exact file paths from the plan]
TEST PATTERNS:
[paste 1-2 existing test examples from the codebase so the agent matches style]
TDD SEQUENCE:
Write test → Run RED → Write code → Run GREEN → Commit
No production code without a failing test first.
CODEBASE CONTEXT:
[key imports, function signatures, data shapes the agent will need]2. Implementer returns code + tests
3. Spawn spec-reviewer agent:
REVIEW TYPE: Spec Compliance
CONTRACT: [paste full contract]
CHANGED FILES: [list from implementer]
CHECK: For each PC-X, does a test exist that verifies the EXACT postcondition?
- Is the assertion testing the right thing (not just that code runs)?
- Does the test name reference the PC number?
- Would the test FAIL if the postcondition were violated?
VERDICT: SPEC PASS or SPEC FAIL with specific failuresLoop until spec reviewer returns SPEC PASS.
4. Spawn quality-reviewer agent:
REVIEW TYPE: Code Quality
CHANGED FILES: [list from implementer]
CHECK:
- File sizes (<400 lines)
- Tenant isolation (if $TENANT_ENABLED: every query has $TENANT_FIELD)
- Parameterized queries (no string concatenation)
- Import resolution (every import exists)
- No debug artifacts (console.log, TODO, etc.)
- Security (auth middleware, input validation)
- Pattern compliance (follows existing codebase patterns)
VERDICT: QUALITY PASS or QUALITY FAIL with specific failuresLoop until quality reviewer returns QUALITY PASS.
5. Move to next task
Critical: Spec compliance BEFORE code quality. Wrong order = failure.
Swarm Mode (Persistent Teammates)
For Large tier with independent workstreams:
- Create team with named roles (e.g., "api-builder", "frontend-builder", "test-writer")
- Create shared task list from plan with dependency markers
- Teammates claim tasks from queue, execute TDD sequence
- Dependency blocking: task B waits until task A completes
- Integration checkpoint after all parallel streams complete
THE TDD SEQUENCE (Per Postcondition)
This is mechanical. Follow exactly.
Step 1: WRITE the test
One test. One behavior. One postcondition.
test('PC-1: clicking customer opens CustomerDetailModal', () => {
// Arrange: set up the scenario
// Act: perform the action
// Assert: verify the postcondition
});Save the test file.
Step 2: RUN the test — show RED
$TEST_SINGLE --testPathPattern="<pattern>" 2>&1 | tail -20You MUST see the test FAIL. Paste the failure output.
If the test PASSES → you wrote a useless test. Delete it. Write one that tests something missing. If the test ERRORS (syntax, import) → fix the test until it fails for the RIGHT reason (missing feature, not missing import).
Step 3: WRITE minimal production code
Make the test pass. Nothing more. No "while I'm here" additions.
Before writing:
- Verify every import exists (read the file)
- Verify every function signature matches
- Verify data shapes match the contract's consumer map
Step 4: RUN the test — show GREEN
$TEST_SINGLE --testPathPattern="<pattern>" 2>&1 | tail -20You MUST see the test PASS. Paste the pass output.
If it FAILS → fix the production code (not the test).
Step 5: REFACTOR (if needed)
Improve code quality without changing behavior. Run tests again — still green.
Step 6: COMMIT
git add -A && git commit -m "feat: [what this unit does]"Step 7: SAVE PROGRESS (memory + JSON)
Save progress to both memory and the JSON postcondition registry:
MEMORY: save task progress — [slug] PC-[N] complete, [N] remainingUpdate the postcondition registry JSON to mark this PC as passing:
node -e "
const fs = require('fs');
const f = '.claude/enterprise-state/<slug>-postconditions.json';
const r = JSON.parse(fs.readFileSync(f));
const pc = r.postconditions.find(p => p.id === 'PC-<N>');
if (pc) { pc.passes = true; pc.last_verified = new Date().toISOString(); }
fs.writeFileSync(f, JSON.stringify(r, null, 2));
"Only set passes: true AFTER the test runner output confirms the test passed. Do not set it based on belief or expectation — evidence only.
Also update the pipeline state at BUILD start and completion:
# At BUILD start:
node -e "
const fs = require('fs');
const f = '.claude/enterprise-state/<slug>.json';
const s = JSON.parse(fs.readFileSync(f));
s.stages.build.status = 'in_progress';
s.stages.build.started_at = new Date().toISOString();
fs.writeFileSync(f, JSON.stringify(s, null, 2));
"
# At BUILD completion (all PCs green):
node -e "
const fs = require('fs');
const f = '.claude/enterprise-state/<slug>.json';
const s = JSON.parse(fs.readFileSync(f));
s.stages.build.status = 'complete';
s.stages.build.completed_at = new Date().toISOString();
fs.writeFileSync(f, JSON.stringify(s, null, 2));
"Step 8: REPEAT for next postcondition
IMPLEMENTATION ORDER
- Migration first (if needed) —
IF NOT EXISTS,TIMESTAMPTZ,$TENANT_FIELD(if$TENANT_ENABLED) - Backend tests + code — service layer, then routes
- Frontend tests + code — hooks, then components
- Integration checkpoint — everything wires together
Do NOT write all tests first then all code. Interleave: RED → GREEN → RED → GREEN.
Frontend Testing Guidance
For React/frontend TDD patterns, read references/frontend-testing.md. It covers:
- Component testing with React Testing Library (render, interact, assert)
- Hook testing with
renderHook - E2E testing with Playwright
- What NOT to test (don't test library internals or CSS)
- Frontend-specific RED→GREEN cycle examples
- Common gotchas (act() warnings, async updates, mock boundaries)
BUILD RULES
- Read before import — verify every function exists, signature matches, return type is right
- Scope lock — implement ONLY what the contract specifies
- No god files — 400 line soft limit. Approaching it? Extract first.
- Existing patterns — use what the codebase already uses
- Permission checks — every new write endpoint needs auth + permission scoping
- Multi-tenant — if
$TENANT_ENABLED: every INSERT needs$TENANT_FIELD, every query scopes to tenant - Verify every consumer — after changing a data source, read every file that consumes it
RATIONALIZATIONS THAT MEAN STOP
| Thought | Reality |
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
| "I'll test after" | Tests passing immediately prove nothing. |
| "I already know the fix" | Prove it by writing the test first. |
| "Need to explore first" | Fine. Throw away exploration, start with TDD. |
| "Test is hard to write" | Hard to test = hard to use. Fix the design. |
| "TDD slows me down" | TDD is faster than debugging. Every time. |
| "Just this once" | There is no "just this once." |
BUG FIX TDD SEQUENCE
For bugs, the sequence proves three things: bug existed, test catches it, fix resolves it.
- Write test that reproduces the bug (assert the WRONG behavior)
- Run it — watch it PASS (proving the bug exists)
- Invert the assertion to correct behavior
- Run it — watch it FAIL (proving the fix isn't applied yet)
- Write the fix
- Run it — watch it PASS (proving the fix works)
CONTEXT LOSS RECOVERY
If context is lost mid-build:
- Check JSON state first:
cat .claude/enterprise-state/<slug>-postconditions.json— shows exactly which PCs pass and which are still pending - Check pipeline state:
cat .claude/enterprise-state/<slug>.json— confirms you're in BUILD stage - Check memory for semantic context about decisions made
- Read the contract — postconditions are the task list
- Run existing tests — verify the JSON state matches reality
- Resume from first PC where
"passes": false - Save progress after each PC to both memory and JSON
The JSON postcondition registry is the authoritative state. A new agent reads it and knows exactly where to resume.
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.

