opsx:tdd

opsx:tdd is a skill for Claude Code from yuritoledo/openspec-tdd. It costs 47 tokens per session (2,503 once invoked), scanned A, original, MIT.

A test-first workflow for OpenSpec changes. It creates real failing tests from Markdown specification files before the feature is implemented.

In plain words
What is it for?
Use it after proposing an OpenSpec change and before applying it to generate and run contract tests from the change specifications.
Why use it?
It checks that tests describe the required behavior before coding starts, instead of relying on placeholder tests that prove nothing.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions CLAUDE.md; names the AskUserQuestion tool; mentions AGENTS.md.

Part of the openspec-tdd plugin — 1 skill shipped together

Good fit Use it after proposing an OpenSpec change and before applying it to generate and run contract tests from the change specifications.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/yuritoledo/openspec-tdd/opsx-tdd
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add yuritoledo/openspec-tdd --skill opsx-tdd
Clone the repo
git clone --depth 1 https://github.com/yuritoledo/openspec-tdd

Made for: Claude Code.

Or install openspec-tdd, the plugin that ships this one along with the rest of its 1 skill.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for opsx:tdd

README.md
[![agentmods](https://agentmods.dev/badge/skills/yuritoledo/openspec-tdd/opsx-tdd/github.svg)](https://agentmods.dev/skills/yuritoledo/openspec-tdd/opsx-tdd)
Your own site
<a href="https://agentmods.dev/skills/yuritoledo/openspec-tdd/opsx-tdd"><img src="https://agentmods.dev/badge/skills/yuritoledo/openspec-tdd/opsx-tdd/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for opsx:tdd

Your own site · 80×15
<a href="https://agentmods.dev/skills/yuritoledo/openspec-tdd/opsx-tdd"><img src="https://agentmods.dev/badge/skills/yuritoledo/openspec-tdd/opsx-tdd.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,503 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00047 $0.02503
Opus 5 $0.00023 $0.01252
Sonnet 5 $0.00009 $0.00501
Haiku 4.5 $0.00005 $0.00250

Measured 9d ago against content hash 54cc6e6d4be3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

opsx:tdd scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/openspec-tdd/skills/opsx-tdd/SKILL.md · 196 lines

How it starts

The opening of the file, as written. The whole thing — 196 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Write real failing test files from a change's specs/**/*.md and confirm a solid RED — tests that exercise the true contract and fail only because the implementation is missing — before implementation begins. Never expect.fail("TDD Red Phase") placeholders: those prove nothing, get fully rewritten at green, and leave the feature with zero real coverage.

Reads directly from the canonical spec files. Re-run after a spec change and tests regenerate from source-of-truth automatically.

Input: Optionally specify a change name. If omitted, infer from conversation context or prompt.

Steps

  1. Discover project conventions (do this first — never hardcode)

    This plugin runs in any repo. Detect the host project's testing setup, in priority order:

    1. .openspec-tdd.json at repo root, if present. Fields (all optional):
      {
        "testRunner": "npx vitest run",   // command to run a single test file
        "renderHelper": "@/test/render",  // import path for the project's custom render()
        "canonicalTest": "src/example.test.tsx", // a file to mirror for imports/mocks
        "testIdQuery": "getByTestId",     // how the project queries test ids
        "testFileGlob": "**/*.test.{ts,tsx}"
      }
      
    2. CLAUDE.md / AGENTS.md / .cursorrules — read for testing conventions, the canonical-reference test file, render-helper location, and selector rules.
    3. package.json — infer the runner from scripts.test / devDependencies (vitestnpx vitest run; jestnpx jest; bunbun test; otherwise node --test). Infer React/Testing-Library presence from deps.
    4. Fallback defaults — bare vitest, plain testing-library render, getByTestId.

    Announce what you detected: "Runner: · Render helper: <path|none> · Canonical ref: <file|none>". See references/frameworks.md for per-runner commands and references/non-react.md / references/e2e.md for non-component scenarios.

  2. Select the change

    If a name is provided, use it. Otherwise:

    • Infer from conversation context
    • Auto-select if only one active change exists
    • If ambiguous, run openspec list --json and use AskUserQuestion tool to let user select

    Announce: "Using change: "

  3. Parse scenarios from specs

    find openspec/changes/<name>/specs -name "*.md" 2>/dev/null
    

    If no specs/**/*.md exist in the change, stop:

    "No spec files found in openspec/changes/<name>/specs/. Run opsx:propose first to generate specs with #### Scenario: blocks, then re-run /opsx:tdd."

    Parse every specs/**/*.md file. For each file:

    a. Extract scenarios — collect every #### Scenario: block with its parent ### Requirement: name and its WHEN / THEN lines.

    If a file has no #### Scenario: blocks, skip it and note it in the report.

    b. Derive the test file path — in priority order:

    1. design.md Implementation Map: scan openspec/changes/<name>/design.md for a markdown table with columns Capability, File (or similar). Extract the row matching this capability's name.
      | `ability-card` | `features/combat/AbilityCard.tsx` | `AbilityCard` |
      
    2. design.md file path mentions: scan design.md for any .ts / .tsx paths that mention the capability name or a related module.
    3. Project search: find . \( -name "*.ts" -o -name "*.tsx" \) | grep -v node_modules | grep -i <capability> — pick the best match (non-test file).
    4. Prompt the user: use AskUserQuestion with the capability name and a list of candidate paths found. Never guess silently.

    Test file = implementation file path with .test.ts / .test.tsx extension, same directory. Example: features/combat/AbilityCard.tsxfeatures/combat/AbilityCard.test.tsx.

    c. Translate THEN clauses to assertion intent — for each scenario, capture the full THEN text. Step 4 uses this to write the real assertion body.

Read the full file on GitHub · 196 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 196 lines · 47 tokens per session scan A 54cc6e6d4be3

Subscribe to this mod's changes

opsx:tdd is a skill published in the GitHub repository yuritoledo/openspec-tdd (6 stars, last pushed 2mo ago), licensed MIT. It adds 47 tokens to every session and 2,503 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.