tests-as-context
Agentic-only enrichment skill — surfaces DSL test chunks (chunkType "test"
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Agentic-only enrichment skill — surfaces DSL test chunks (chunkType "test"
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Decide HOW to write new code by inspecting git signals on neighbors — pulls strategy and templates from proven, low-churn nearby implementations rather than guessing from training data. Triggers on "implement function X", "add method to class Y", "write a helper for Z", "напиши функцию", "добавь метод". NOT for discovery or exploration — use tea-rags:explore for that. This skill activates ONCE the agent is about to write code.
Agentic-only enrichment skill — surface battle-tested reference code from project as templates for generation / modification. Three-level locality cascade (target subdomain → domain → project), quality gate by overlay labels + project-wide proven rerank preset. Returns ranked list of reference chunks + locality annotation (L1 / L2 / L3 / none). Invoked by `tea-rags:data-driven-generation` Step 2 (TEMPLATE), `dinopowers:writing-plans` (per code-gen Task), `dinopowers:executing-plans` (per Task during execute). Skipped when no `positiveIds` / `positiveCode` and no `behaviorQuery` available.
Run automated TeaRAGs install wizard from scratch — detects environment, installs deps (Node.js, tea-rags, Ollama/ONNX, Qdrant), tunes performance, configures MCP server. Progress saves to ~/.tea-rags/setup-progress.json for resumable install. Triggers on "install tea-rags", "set up TeaRAGs MCP", "configure tea-rags from scratch", "поставить tea-rags в проект". NOT for tuning an existing install — use tune for that.
Agent-only. Raise test coverage above a failed pre-commit threshold: locate the
Brainstorm 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", "design feature", "refactor Y", "let's discuss", "давай обсудим", "как перестроить", "что может сломаться". NOT for trivial edits or stylistic questions with no code area to enrich. Wraps superpowers:brainstorming with tea-rags risk-signal enrichment step.
Execute written implementation plan whose Tasks edit code, per-Task SAFE/CAUTION/UNSAFE git-signal verdict before edit AND code-style cascade for code-generation Tasks (style from silo authors, strategy+template from proven neighbors). Triggers on "execute the plan", "start Task N", "выполни план", "начни задачу", "run the plan", "implement the plan steps". NOT for one-off edits without a written plan. Wraps superpowers:executing-plans with tea-rags git-signal verdicts and tea-rags:data-driven-generation cascade.
| name | tests-as-context |
| description | Agentic-only enrichment skill — surfaces DSL test chunks (chunkType "test" |
Five recipes turn DSL test chunks into review / verify / refactor / TDD enrichment. Owned by tea-rags, used by dinopowers wrappers and other tea-rags skills.
semantic_search call. No retry loops,
no expansion. Caller composes recipes if needs multiple.chunkType, not testFile — chunkType: "test" and
chunkType: "test_setup" are chunk-level DSL filters. testFile: "only" =
file-level fallback, only when DSL chunks absent.user-invocable: false in frontmatter. Recipes = building
blocks consumed by other skills, not surfaced to user.Read prime digest from session context. Locate ## Signal thresholds — <lang>
section.
Test corpus present if ≥1 git.chunk.* signal line shows a test: row with
numeric thresholds, e.g.
- **git.chunk.commitCount**
- source: low ≤1 / typical ≤2 / high ≤3 / extreme >7
- test: low ≤1 / typical ≤1 / high ≤2 / extreme >4
Test corpus absent if every git.chunk.* line shows test: — or no test:
row at all.
Prime digest not in context (fresh subagent / cold session): issue ONE cheap probe call to determine DSL availability without scanning digest:
mcp__tea-rags__semantic_search:
project: <alias>
query: "test"
filter: { must: [{ key: "chunkType", match: { value: "test" } }] }
limit: 1
metaOnly: true
Empty result → DSL test chunks absent. Non-empty → present, proceed to Step 1. Probe bounded (limit=1, metaOnly=true), runs only when prime digest missing.
If absent — return verdict, stop:
SKIP — no DSL test chunks indexed for <project>. Possible reasons:
(a) primary language has no DSL test chunker
(currently supported: TypeScript Vitest/Jest/Mocha, Ruby RSpec —
see src/core/domains/ingest/pipeline/chunker/hooks/<lang>/)
(b) .contextignore excludes test directories
(c) project has no tests
Caller should fall back to language-neutral guidance without
test-context enrichment.
Caller decides how to degrade (often: emit generic placeholder line in its output bundle, proceed without test data).
Dispatch on caller-provided recipe parameter. Each recipe owns its query,
filter, rerank, output format.
tests-at-riskPurpose: for edited / diffed / refactor-target source files (or a single symbol's file), surface leaf-scope test chunks exercising affected scenarios.
Caller inputs:
affectedFiles: relative paths — array. Single-element array OK for
refactor/rename callers (receiving-code-review). Multi-file diff callers
(requesting-code-review, verification-before-completion) pass full set.intent: one-sentence change description ("error handling in payments",
"refactor reranker scoring", "rename ChunkGrouper.group to aggregate")Call:
mcp__tea-rags__semantic_search:
project: <alias from prime digest>
query: <intent>
chunkType: "test"
filter: { must_not: [{ key: "relativePath", match: { any: <affectedFiles> } }] }
rerank: { custom: { similarity: 0.7, age: -0.1, churn: 0.2 } }
limit: 12
metaOnly: false ← need content + describe-it path
Filter form: raw must_not on relativePath excludes affected source files
themselves (want tests describing them, not source chunks ranked back). Works
for any array size, incl single-element (receiving-code-review case) — no
brace-expansion edge cases.
Rerank shape rationale: tests-at-risk favours tests semantically referencing
change intent (similarity, 0.7), prefers fresher over legacy (negative age
weight), slightly weights active scenarios (churn) — stale tests on dead paths
downranked. imports weight intentionally absent: test chunks rarely imported
by other modules, signal near-zero for this corpus.
Output: ranked list, one entry per leaf scope:
- <relativePath>:<startLine> — <parentSymbolId or describe-it path>
<one-line excerpt from inherited setup or assertion>
age: <ageDays> | churn: <commitCount> | bugFix: <bugFixRate or "—">
Empty result: return single line
no scenarios obviously bound to this change found — caller should still run general verification.
Empty ≠ SKIP; preflight passed, no semantic match.
fixture-lookupPurpose: before drafting new mock setup or fixture, find existing fixture chunks with similar shape.
Caller inputs:
intent: setup intent, natural language ("user with admin role", "temp
directory with config file", "mocked qdrant client returning empty")Call:
mcp__tea-rags__semantic_search:
project: <alias>
query: <intent>
chunkType: "test_setup"
rerank: "proven" ← stable + old + low-bugFix + multi-author
limit: 6
metaOnly: false ← need setup content
"proven" preset weights:
{similarity: 0.2, stability: 0.3, age: 0.3, bugFix: -0.15, ownership: -0.05}.
Surfaces battle-tested fixtures established as project convention.
Output: top-K fixture chunks:
- <relativePath>:<startLine> — <fixture description>
<content excerpt: 5-8 lines, the setup body>
Empty result: return
no proven fixture matches — drafting from scratch is acceptable. Caller
(typically TDD wrapper) proceeds with generic fixture pattern.
regression-archaeologyPurpose: identify when a test (by proxy, a feature contract) was first introduced.
Caller inputs:
intent: feature or scenario description ("retry after 5xx", "user signup
with invalid email")subjectPath (optional): pathPattern scope to moduleCall:
mcp__tea-rags__semantic_search:
project: <alias>
query: <intent>
chunkType: "test"
pathPattern: <subjectPath if provided, else omit>
rerank: { custom: { similarity: 0.2, age: 0.8 } }
limit: 8
metaOnly: true ← need metadata (taskIds, ageDays)
Custom rerank, heavy age weight, surfaces oldest semantic matches. Caller sorts
results ascending by git.chunk.ageDays for introduction order.
Output:
- <relativePath>:<startLine> — <describe-it path>
introduced: <ageDays> days ago | taskIds: [<tickets>] | author: <blameDominant>
Empty result: return
no test history found for this scenario — either the scenario was never tested or pre-dates indexed history.
test-flakinessPurpose: identify unstable test zones (high churn / bugFixRate on test code) or unstable fixture infra (flaky setup).
Caller inputs:
intent: scope description ("payments tests", "ingest pipeline test setup")target: "scenarios" | "infra" — selects chunkTypesubjectPath (optional): pathPattern scopeCall:
mcp__tea-rags__semantic_search:
project: <alias>
query: <intent>
chunkType: "test" if target=="scenarios" else "test_setup"
pathPattern: <subjectPath if provided, else omit>
rerank: "hotspots"
limit: 10
metaOnly: true
"hotspots" preset captures recent churn + ownership concentration +
bugFixRate; on test chunks maps to "scenarios / infra that keep breaking and
getting rewritten".
Output:
- <relativePath>:<startLine> — <describe-it path or fixture name>
churn: <commitCount> | bugFix: <bugFixRate> | age: <ageDays> | owner: <blameDominant>
Empty result: no flaky zones in scope — test suite stable here.
spec-extractionPurpose: living-doc TOC of scenarios a module must satisfy.
Caller inputs:
modulePath: relative path or pathPattern of test file / dir being documented
(e.g. tests/core/domains/explore/reranker.test.ts or
tests/core/domains/explore/**)intent (optional): high-level theme to bias query; omit for full-module
enumerationCall:
mcp__tea-rags__semantic_search:
project: <alias>
query: <intent if provided, else generic theme like "scenarios">
pathPattern: <modulePath>
chunkType: "test"
limit: 50
metaOnly: true
Why semantic_search not find_symbol: find_symbol(relativePath:) returns a
file-level outline, does NOT accept a filter param, so can't narrow to
chunkType: "test" inside the tool. pathPattern + chunkType combo on
semantic_search enumerates DSL leaf scenarios of the test surface directly,
full describe-it path in parentSymbolId / symbolId.
Output: scenario TOC, grouped by parentSymbolId (describe block):
## <Top-level describe>
- <nested describe> > <it scope> — <relativePath>:<startLine>
- <nested describe> > <it scope> — <relativePath>:<startLine>
## <Next top-level describe>
...
Empty result: module has no test scenarios — undocumented contract.
Return recipe's formatted output. Caller (dinopowers wrapper, search-cascade direct user, another tea-rags skill) embeds block in its own format — review bundle line, verification ladder annotation, debug context paragraph.
This skill never invokes another Skill(...). Leaf in call chain.
Outputs MUST NOT name:
vitest, jest, mocha, pytest, unittest, rspec,
minitest, go test, dotnet test, JUnit, phpunitexpect, assert, should, chai, sinonnpm, pnpm, yarn, bundle, pip, poetry, cargoWhen suggesting next action, use generic phrasing:
Caller agent resolves actual command from project context (package.json
scripts, Makefile, CI config, README) — not from this skill.
chunkType filter →
restart; bare testFile: "only" is wrong tool.semantic_search calls for one recipe → recipes single-shot; multi-call
belongs to caller.metaOnly: true for fixture-lookup or tests-at-risk → wrong; these
recipes need content for caller to extract conventions / describe-it path.