tdd
Test-driven development — write the test first, watch it fail, write minimal code to pass
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Test-driven development — write the test first, watch it fail, write minimal code to pass
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Handle cross-platform compatibility including file paths, environment detection, platform-specific dependencies, and testing across Windows, macOS, and Linux. Use when dealing with platform-specific code or OS compatibility.
Use when creating, modifying, debugging, or scaffolding OMP extensions, slash commands, custom tools, event hooks, TUI primitives, ExtensionAPI integrations, .omp/extensions, .omp/commands, .omp/tools, package.json omp.extensions, or OMP lifecycle handlers.
Design Director state machine for `/supi:ui-design`. Drives 9 model-owned phases from scope selection through user review, producing a validated HTML mockup artifact.
Guides the harness-engineering pipeline — turn a codebase into one that resists agentic slop with agent-neutral docs, mechanically enforced architecture, and three runtime guardrails
Gray-area extraction stage — surfaces decisions the user must make before the plan can be authored, without expanding scope
Structured extraction of the user's seed prompt into a typed intake artifact — first stage of the UltraPlan authoring pipeline
| name | tdd |
| description | Test-driven development — write the test first, watch it fail, write minimal code to pass |
Write the failing test first. Then make it pass. Then clean up. Every time.
| Field | Value |
|---|---|
| Scope | Any code change: new feature, bug fix, refactor |
| Input | Feature request, bug report, or function signature to implement |
| Output | Test file(s) + implementation, all tests green, no dead code |
| Cycle | RED → GREEN → REFACTOR (never skip a phase) |
| Core rule | You MUST NOT write production code without a failing test |
| Mocks | Mock only external I/O (network, filesystem, third-party APIs). All internal code uses real implementations. |
// RED: test for a function that doesn't exist yet
test("parsePort returns number for valid port string", () => {
expect(parsePort("8080")).toBe(8080);
});
// Run → FAIL: parsePort is not defined
// Good: fails because the function is missing.
//
// BAD fail: "Cannot find module './parser'"
// That's an error, not a test failure. Fix the import first.
// GREEN: minimal implementation — nothing extra
function parsePort(value: string): number {
return Number(value);
}
// Run → PASS. Stop here. Don't add validation yet —
// no test demands it.
// After adding a second test for invalid input and making it green,
// you notice duplication between parsePort and parseHost.
// REFACTOR: extract shared parsing logic.
// BEFORE (duplication)
function parsePort(v: string): number { return Number(v); }
function parseHost(v: string): string { return v.trim().toLowerCase(); }
// AFTER (shared helper, both tests still green)
function sanitize(v: string): string { return v.trim(); }
function parsePort(v: string): number { return Number(sanitize(v)); }
function parseHost(v: string): string { return sanitize(v).toLowerCase(); }
Bug reported → Write failing test that reproduces it → GREEN → REFACTOR
// Bug: parsePort(" 8080 ") returns NaN instead of 8080.
// RED: write a test that exposes the bug
test("parsePort trims whitespace", () => {
expect(parsePort(" 8080 ")).toBe(8080);
});
// Run → FAIL: Expected 8080, received NaN. Good — bug reproduced.
// GREEN: fix the implementation
function parsePort(v: string): number {
return Number(v.trim()); // ← minimal fix
}
// Run → PASS. Bug fixed. Test prevents regression.
| MUST DO | MUST NOT DO |
|---|---|
| Run the test and watch it fail before writing code | Write production code before a failing test exists |
| Confirm failure is for the expected reason | Ignore why a test failed (typo ≠ missing feature) |
| Write the simplest passing implementation | Add unrequested features during GREEN |
| Keep all tests green during REFACTOR | Add new behavior during REFACTOR |
| Use real implementations for internal code | Mock internal modules to avoid setup effort |
| Write one assertion per behavior | Stuff multiple behaviors into one test |
| Test edge cases and error paths | Test only the happy path |
| Problem | Solution |
|---|---|
| Don't know how to test it | Write the API you wish existed. Write the assertion first. |
| Test too complicated | Interface too complicated. Simplify the design. |
| Must mock everything | Code too coupled. Introduce dependency injection. |
| Test setup is huge | Extract test helpers. Still complex? Simplify the production design. |
| Can't find test files / runner | Check package.json scripts, look for existing *.test.* or *.spec.* files, match the project's conventions. |