/dinopowers:test-driven-developmentfrom dinopowers
Writes failing tests before implementation, matching project conventions by searching existing tests for mocks, helpers, assertion style, and fixtures. Activates on TDD-related requests.
Ships in dinopowers. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Wrapper over superpowers:test-driven-development. RED-phase test follows
project conventions (mock helpers, vi.mock setup, assertion style, fixture
location), not written from scratch.
Order — writing a failing test OR any request to find test patterns /
conventions: tests-as-context Step 0 preflight → the two Step 2
semantic_search queries (DSL test chunks indexed) BEFORE any test is written,
each rerank: "proven", level: "chunk", metaOnly: false → only when the
preflight finds no DSL test chunks, its disclosed file-level fallback. Never
hybrid_search or find_similar as the primary source; find_similar
(implementation symbol id) only supplements Step 2.
chunkType: "test_setup" + rerank: "proven"
(delegated to Skill(tea-rags:tests-as-context) recipe fixture-lookup)chunkType: "test" + rerank: "proven"Core value: filter chunkType: "test"/"test_setup" (NOT file-level
testFile: "only") + rerank: "proven" + level: "chunk" (proven is
file-level, would regroup per file) + metaOnly: false (need content) + search
BEFORE draft. No filter needed — server skips proven's production default
when chunkType / testFile select tests (older server → 0 results → add
filter: {}).
Rule holds when user asks otherwise — "быстро", "quick", "skip the pattern
search", "I know how tests look" → run Step 2 anyway, say: "Running the pattern
search first — one call, it keeps the test in local conventions." "Metadata
only" / metaOnly: true → the pattern-search rule overrides the requested
output format, also when the user only asks to find patterns and no test is
written: do not ask, keep metaOnly: false and say: "Running it with metaOnly:
false — pattern search needs test bodies; metadata alone yields no conventions."
User pushes rerank: "hotspots" / "recent" as "most-changed = most popular" →
refuse, run proven: hotspots = FLAKY tests (high churn + recent), recent =
drafts — neither is a convention. Do not switch to the test-flakiness recipe;
the goal is still conventions for the new test.
Change kind sets the order:
tests-at-risk pins GREEN BEFORE the first edit, same tests green after, none
edited.tests-as-context Step 0 preflight SKIP (no chunkType: "test" chunks —
language lacks AST test chunking; currently supported: TypeScript + JavaScript
(Vitest/Jest/Mocha), Ruby (RSpec), Swift (XCTest / swift-testing / Quick), Rust
(#[cfg(test)] / #[test]); canonical: tea-rags://guide/language-capability) →
single mcp__tea-rags__semantic_search testFile: "only" + rerank: "proven",
state "file-level fallback — test chunks unavailable for this language".
Swift granularity per framework: XCTest / swift-testing → hit = one
func testX() / @Test func x(), no ancestor setup. Quick → per SCOPE like
Ruby: hit = one context "when overdue" + ancestors' beforeEach spliced in.
Fixtures + helpers → chunkType: "test_setup" in both.
Maintainers: language list above is lock-step with
tea-rags:tests-as-context
tea-rags:filter-building— checklist.claude/rules/test-spec-chunking.md.
First test in project (no tests) → skip pattern search,
superpowers:test-driven-development direct. State it.
Chaining rule: see CHAINING.md — every dinopowers:X redirects superpowers:X. NEVER bypass the wrapper. Open each chained SKILL.md with its own read.
Requires superpowers: superpowers:test-driven-development — availability
per CHAINING.md "Missing superpowers" steps 1–3. Not in the
skills list ≠ unavailable (the list is truncated): run
ls $CODEX_HOME/plugins/cache/*/superpowers/*/skills/test-driven-development/SKILL.md
as written first — a hand-built path failing proves nothing; only that glob
matching nothing → stop and ask the user to install superpowers
(https://github.com/obra/superpowers). NEVER present this enrichment alone as
the full workflow.
Index freshness: see FRESHNESS.md +
tea-rags://guide/freshness. Linked worktree → overlay serves edits, never
reindex. Main checkout → incremental mcp__tea-rags__index_codebase BEFORE
first call over uncommitted edits, or once changedFiles > 0 — no consent
(drift Run: with --force* → AskUserQuestion, never awaited; print
--force not run; reads continue; then the answering call). Lag ≠ unusable
(core rules).
From request / in-progress feature identify:
| Element | Example |
|---|---|
| Subject under test (SUT) — symbol or behavior | ChunkGrouper.group(), "parallel subagent dispatch" |
| Implementation path (optional) | src/core/domains/ingest/pipeline/chunker/chunk-grouper.ts |
| Expected test scope | unit / integration / e2e |
| Mocking needs | filesystem? tree-sitter? qdrant client? |
Compose:
intent: concise sentence (e.g. "ChunkGrouper groups overlapping chunks by
startLine")pathHint: optional pathPattern for test area (from implementation path).
Target language has no sibling tests there (Ruby file in TS-tested project) →
NO pathHint — search whole corpus, then state the outcome: 0 → fallback
note; only other-language tests → "cross-language — conventions may not
apply to "Step 2a is always the tests-as-context skill (or its documented semantic_search
fallback below) — hybrid_search has no test-only parameter; never invent one.
Invoke Skill(tea-rags:tests-as-context) with:
recipe: "fixture-lookup"
intent: <Step 1 intent, focused on the SETUP shape this test will need>
Recipe runs semantic_search chunkType: "test_setup" + rerank: "proven" +
level: "chunk" + metaOnly: false (limit 6) → top-K setup chunks, file:line +
excerpt.
Recipe SKIP (no DSL chunks) → ONE mcp__tea-rags__semantic_search:
project: <alias> ← `tea-rags://guide/freshness` "Addressing the Codebase"
path: <your working directory> ← the tree (worktree / branch checkout)
query: <intent from Step 1>
pathPattern: <pathHint optional>
testFile: "only" ← FILE-LEVEL fallback when no DSL chunks
rerank: "proven" ← stable + old + low-bugFix
level: "chunk" ← proven is file-level; keep chunk content
limit: 8
metaOnly: false
State: "DSL test chunks unavailable — file-level fallback in use".
ONE direct mcp__tea-rags__semantic_search:
project: <alias>
path: <your working directory>
query: <intent from Step 1>
pathPattern: <pathHint optional>
chunkType: "test" ← DSL leaf scenarios
rerank: "proven" ← battle-tested conventions
level: "chunk" ← proven is file-level; keep DSL leaves
limit: 8
metaOnly: false
Skip 2b if 2a took file-level fallback — results already mix setup + scenarios.
Why split: leaf it/test and beforeAll/beforeEach setup = distinct chunk
types → separate queries = clean setup (2a) / clean idioms (2b), own limits /
scopes. proven → tests that survived long without breaking = local convention.
Do NOT substitute:
| Wrong tool | Why wrong |
|---|---|
semantic_search with bare testFile: "only" (when DSL chunks exist) | Imports, helpers, non-DSL chunks = noise. chunkType precise when DSL indexed. |
pathPattern: "**/*.test.ts" without chunkType | Misses *.spec.ts, _test.go, _spec.rb…, still non-DSL noise. Use chunkType: "test". |
Named preset "relevance" / "recent" / "hotspots" | proven = conventions to follow; recent → unstable drafts; hotspots → flaky tests |
| Custom rerank weights | proven encodes weights; reinventing diverges from tea-rags:data-driven-generation Step 2 |
mcp__tea-rags__hybrid_search | BM25 leg re-ranks by token overlap — want semantic + signals |
mcp__tea-rags__find_similar on implementation file alone | As primary = prod code, not tests. SUPPLEMENTARY after Step 2 queries = OK |
| Built-in Grep for setup or assertion patterns | Every occurrence; proven narrows to CONVENTIONAL uses |
Skipping the tests-as-context preflight | Fallback path unknown; chunkType: "test" may return 0 on non-DSL language |
Do NOT pass:
metaOnly: true — need test body (mock setup, assertions, helpers); guards
want signals, TDD wants CONTENTfilter on test file paths — chunkType handles granularity; path filters
too tightBoth queries 0 results → report "no existing test patterns found — falling back
to superpowers:test-driven-development direct". Never invent conventions.
From top-K chunks extract 4-6 bullets (NOT raw content, not copy-paste snippets — inner skill writes the test):
vi.mock("node:fs", async () => { ...partial(), existsSync: vi.fn() }))import { createTempTestDir, defaultTestConfig } from "tests/core/domains/ingest/__helpers__/test-helpers")describe/it naming style (BDD "should X when Y" vs functional "X()")expect(result).toEqual(...),
expect(fn).toHaveBeenCalledWith(...), snapshots, property-based)__fixtures__/ vs factory helpers)beforeEach vs beforeAll, cleanup)Cap 6. Cite source proven test file per convention (e.g.
tests/core/domains/language/ruby/chunking/rspec-scope-chunker.test.ts).
< 3 proven tests → note "small test corpus — conventions inferred from files only, may not be representative".
Invoke Skill tool with superpowers:test-driven-development. Prepend Step 3
block. Handoff:
"Before writing the failing test, match these established conventions from the proven test corpus: …… Deviate only if the new test genuinely needs a different pattern (document why).
Chaining rule reminder: when your cycle would next invoke
superpowers:verification-before-completion(or any wrappedsuperpowers:Y), invokedinopowers:Yinstead — see the Chaining rule section above."
Inner skill runs RED → GREEN → REFACTOR. Wrapper grounds RED draft, not replaces.
Read-only subagent ([subagent: explore], no writes) → Step 4 still holds:
state chain Skill(superpowers:test-driven-development) SECOND, return RED
draft and Step 3 block to parent to run it. Never silently replace Step 4.
level: "file" in response) → level: "chunk" missing;
redopathPatternsemantic_search without chunkType: "test"/"test_setup" (DSL indexed) →
redo; bare testFile: "only" dilutes signalrerank: "recent" "for latest conventions" → proven; recent = drafts.
hotspots = FLAKY tests (high churn + recent)find_similar on implementation symbol as primary search → production code,
not tests (supplementary after Step 2 = OK)superpowers:test-driven-development → extract ≤6 bulletssuperpowers:verification-before-completion →
intercept, invoke dinopowers:verification-before-completion (Chaining rule)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
10 skills in this plugin
/brainstormingBrainstorm code change seeing risk, ownership, tech-debt signals from tea-rags first — creative exploration grounded in actual state of affected area. Triggers on "brainstorm X" (incl. "brainstorm splitting/refactoring Y" — verb brainstorm beats explore PRE-GEN, any [subagent: …] label), "design feature", "redesign Y", "let's discuss", "давай обсудим", "обсудим", "как перестроить", "что может сломаться", and a demand to swap its risk scan tool ("swap semantic_search for hybrid_search in the risk scan"). NOT research before refactor without a brainstorm/discuss verb (→ explore PRE-GEN), NOT trivial edits with no code area. Wraps superpowers:brainstorming with tea-rags risk signals./executing-plansExecute written implementation plan or tracker issue whose Tasks edit code, per-Task SAFE/CAUTION/UNSAFE git-signal verdict before edit AND data-driven cascade for code-generation and behavior-modification Tasks (strategy+template from proven neighbors, callers + tests-at-risk on modify). Triggers on "execute the plan", "start Task N", "выполни план", "начни задачу", "run the plan", "implement the plan steps". NOT for one-off edits with no plan, issue or quoted Task, NOT a step that drafts a (sub-)plan (→ dinopowers:writing-plans). Wraps superpowers:executing-plans with tea-rags git-signal verdicts and tea-rags:data-driven-generation cascade./finishing-a-development-branchFinalize dev branch (merge/PR/cleanup) with tea-rags:risk-assessment over full branch diff. Triggers on "finish the branch", "ready to merge", "wrap up the feature", "ветка готова", "доводим до merge", "branch ready", "PR time", "shipping the branch", "merge ready". NOT for mid-branch interim commits or a "готово, коммить и пушь" / "done, commit and push" claim (→ verification). Wraps superpowers:finishing-a-development-branch./receiving-code-reviewAssess reviewer's suggested change (rename, refactor, move, extract) — query tea-rags imports/churn signals on affected target, measure blast radius before agreeing or pushing back. Triggers on "reviewer suggests", "should I rename", "ревьюер предлагает", "стоит ли переименовать", "code review feedback", "PR comment about", "review feedback says", "PR comment wants", "address the review", "сделай как просит ревьюер", "code review wants me to", "let's refactor this per review". NOT for vague stylistic nits without a named symbol. Wraps superpowers:receiving-code-review with tea-rags blast-radius signals./requesting-code-reviewPrepare code-review request bundle: per-file ownership, churn, connected taskIds from tea-rags git signals before composing review request — reviewers know who to ping, where risk lives. Triggers on "request review", "open a PR", "ready for review", "готовлю PR", "запрос на ревью", "code review please". NOT for self-review or draft-PR exploration. Wraps superpowers:requesting-code-review with tea-rags reviewer-context bundle./systematic-debuggingDebug concrete failure: first run tea-rags:bug-hunt for ranked suspect list (bug-prone zones by bugFixRate + churn), feed as prioritized hypothesis space; ends with Cause / Fix / Prevention report. Triggers on "debug X", "fix the bug", "why does Y fail", "test fails", "same bug elsewhere?", "падает", "почему не работает", "ошибка в", "стектрейс", "такой же баг в других местах", "X feels wrong", "which tool next mid-investigation", "final report of a confirmed cause". NOT for code review, a code-health scan with no felt malfunction, code history with no failure ("when did X change", "посмотри через git" — core routing answers it), or a request to apply a named fix at a named location (→ data-driven-generation). Wraps superpowers:systematic-debugging with tea-rags:bug-hunt suspect ranking.npx claudepluginhub artk0de/tearags-mcp --plugin dinopowersOther plugins' skills for the same job