tdd
Systematic TDD methodology for writing tests first. Use when implementing features or fixes with OMC_TDD_MODE enabled, when unsure how to structure tests, or when test-first discipline needs reinforcement. Triggers on: 'tdd', 'test first', 'test driven', 'red green refactor'.
What this skill does
# TDD Skill Write the test. Watch it fail. Make it pass. Clean up. Repeat. ## The Iron Law `NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST` If you're writing production code and no test just failed, you're doing it wrong. ## When to Apply - `OMC_TDD_MODE` is enabled (guided or enforced) - Implementing a new feature or behavior - Fixing a bug (write the test that reproduces it first) - Unsure how to structure tests for a piece of logic - When the `tdd_enforcer` hook blocks an edit ## Red-Green-Refactor Cycle ### RED: Write a Failing Test 1. Write ONE test that describes the desired behavior 2. Run the test suite 3. Verify it fails for the RIGHT reason (not a syntax error, not a missing import) 4. If it passes, your test is wrong or the feature already exists **Verification gate:** Test output shows a meaningful failure related to the behavior you're implementing. ### GREEN: Make It Pass 1. Write the MINIMUM code to make the test pass 2. No extra methods. No abstractions. No "while I'm here" additions 3. Run the test suite 4. ALL tests pass (not just the new one) **Verification gate:** Full test suite green. Zero failures. ### REFACTOR: Clean Up 1. Remove duplication introduced in the GREEN step 2. Improve naming, extract methods if warranted 3. Run the test suite after EVERY change 4. No new behavior during refactor - tests stay green throughout **Verification gate:** Tests still green. Code is cleaner. No new functionality added. ## Anti-Rationalization Table | Excuse | Counter | |--------|---------| | "I'll write tests after" | Tests written after prove nothing - they pass immediately | | "Too simple to test" | Simple code breaks. Test takes 30 seconds | | "I know this works" | Confidence is not evidence. The test IS the evidence | | "Tests will slow me down" | Debugging without tests slows you down more | | "Just a refactor" | Refactors without tests are rewrites without safety nets | | "The types guarantee correctness" | Types check structure, not behavior. Test the behavior | | "It's just a config change" | Config changes cause production outages. Test them | | "I'll TDD the next one" | You said that last time. Start now | ## Red Flags Thoughts that signal you're about to violate TDD: - "Let me just quickly implement this first..." - "This is too obvious to need a test" - "I'll come back and add tests" - "The test would just be testing the framework" - "It's only a one-line change" - "I need to see the implementation to know what to test" If you catch yourself thinking any of these: STOP. Write the test first. ## Hook Integration The `tdd_enforcer` hook gates file edits when `OMC_TDD_MODE` is enabled. This skill guides the methodology. The hook fires, you see the gate, invoke this skill for how to proceed. **Flow:** Hook blocks edit -> Read the message -> Write/update a test -> Run tests (see RED) -> Now implement (GREEN) -> Clean up (REFACTOR). ## When Stuck | Problem | Solution | |---------|----------| | Can't figure out what to test | Test the simplest case first. What's the most basic input/output? | | Test is too complex | Break the behavior into smaller units. Test each one | | Don't know the test framework | Check existing tests in the project. Copy the pattern | | Test requires too much setup | That's a design smell. Simplify the interface under test | | Multiple things need testing | One test at a time. Pick the smallest behavior first | | Existing code has no tests | Start with the change you're making. Test the new behavior | | Test passes immediately | Your test isn't testing what you think. Check assertions | | Can't make the test fail | You might be testing something already implemented. Test the GAP | ## The Bottom Line A test that exists before the code proves the code works. A test written after proves nothing but that you can reverse-engineer assertions.
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.