skills/write-failing-test/SKILL.md
Write failing tests for all planned acceptance criteria from the test plan. Use after /plan-tests, before implementation. Invoke with '/write-failing-test path/to/spec.md' or 'write failing test', 'red phase', 'start TDD'.
npx skillsauth add opsmachine/om-agency write-failing-testInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Writes failing tests according to the test plan in the spec. Works autonomously through each planned test until all have properly failing tests.
TDD requires seeing tests fail before implementing. This skill executes the test plan created by /plan-tests, writing all failing tests that define the feature scope.
/plan-tests has added a test plan to the spec/plan-tests)Before writing any tests, verify ALL infrastructure is ready.
See
.claude/primitives/testing-conventions.mdfor project-specific infrastructure requirements.
Run these checks:
# 1. Docker running
docker info
# 2. Supabase running
supabase status
# 3. Test command works
npm test # Should run even if 0 tests
Required state:
127.0.0.1:54322)If ANY check fails:
supabase start")Only proceed when ALL checks pass.
CRITICAL: Skipped tests are NOT acceptable. If tests skip due to missing infrastructure, this is a BLOCKING failure. Never claim "Ready for implementation" with skipped tests.
Read the spec document. Locate the ## Test Plan section.
See shared/spec-io.md for Test Plan section structure and how to read the status field.
Gate check: Verify Test Plan **Status:** is Planned. If already Tests Written or Passing, tests have already been written — stop.
If no Test Plan section exists:
This spec doesn't have a test plan yet. Run `/plan-tests path/to/spec.md` first.
Extract from the Test Plan:
For EACH test file in the plan, perform steps 3-5. Work autonomously — do not pause between files.
The manager will review all tests together when you report back.
Write tests according to the plan. The plan tells you:
it('should...'))When expanding existing tests:
describe blocks that matchit blocks within existing structureTest Type-Specific Guidance:
For Unit/Integration tests (TypeScript/JavaScript):
See
.claude/primitives/testing-conventions.mdfor project-specific patterns and examples.
For E2E tests (Playwright/Python):
See
shared/e2e-patterns.mdfor reconnaissance-then-action pattern and server management.
Use skills/webapp-testing/scripts/with_server.py for server lifecycle management.
Meaningful Test Checklist (MUST pass all for EACH test):
Does the test CALL the code under test?
Does the assertion verify the BEHAVIOR in the criterion?
expect(response.status).not.toBe(400) (proves nothing)expect(data).toBeTruthy() (just checks something exists)expect(response.error).toMatch(/replyTo.*required/) (verifies specific behavior)Will the test PASS when the feature is correctly implemented?
Is this test deferring to a non-existent test?
See
.claude/primitives/testing-conventions.mdfor good vs bad test examples specific to this project.
Run the test using the project's test command (usually npm test).
The test MUST fail for the RIGHT reason:
Good failures (feature doesn't exist):
Bad failures (test infrastructure problems):
Skipped tests are NOT acceptable. A skipped test proves nothing. If tests skip:
If "bad failure": fix and retry (up to 3 attempts per test).
After all tests are written, update the spec's Test Plan section:
**Status:** Planned**Status:** Tests WrittenSee shared/spec-io.md for how to update the Test Plan status field.
After ALL planned tests have failing tests:
## Red Phase Complete
**Spec:** Documents/specs/42-feature-spec.md
**Tests written:** X tests across Y files
### Summary
**Expanded:** src/test/edge-functions/send-email.test.ts
- ✅ `it('accepts valid replyTo email')` - fails: "replyTo not implemented"
**Created:** src/test/edge-functions/send-email-validation.test.ts
- ✅ `it('rejects invalid replyTo format')` - fails: "validateEmail is not a function"
Ready for implementation. Run `/implement-to-pass` to continue.
THIS SKILL NOW ENDS. Do not proceed to implementation.
expect(x).toBeTruthy()Only pause and ask user for help when:
Do NOT pause for:
This skill hands off to:
/implement-to-pass - Implements code to make all tests passdata-ai
Workflow manager that orchestrates the entire skill system. Runs automatically before any implementation work. Reads state from artifacts, determines the next skill, spawns sub-agents for execution, and manages human gates. Invoke with '/workflow-router' or it runs automatically per CLAUDE.md.
tools
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
development
Supabase security best practices and patterns. Use when working with Supabase projects, creating tables, writing RLS policies, edge functions, or reviewing Supabase code. Invoke with '/supabase-security' or when asked about Supabase security.
testing
Review a spec document for completeness before approval. Use after interview, before implementation, or when asked to 'review spec', 'check spec', or 'is this spec ready'. Read-only analysis that flags gaps.