/sd0x-dev-flow:test-deepfrom sd0x-dev-flow
Orchestrates context-aware test execution with smart test selection, progressive test ladder (unit -> integration -> e2e), failure triage, and safe fixer application. Use for failure analysis and targeted test runs.
Ships in sd0x-dev-flow. 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.
Read when SKILL.md points to them.
When test failures occur, dispatch background triage:
Agent({
description: "Analyze test failure root cause and suggest fixes",
subagent_type: "verify-app",
prompt: Analyze the following test failure: <failure output> Identify root cause and suggest minimal fix.
})
| Scenario | Alternative |
|---|---|
| Writing new tests | /post-dev-test |
| Reviewing test coverage | /codex-test-review |
| Generating unit tests | /codex-test-gen |
| Full manual test run | /verify |
| Code review | /codex-review-fast |
❌ git add | git commit | git push — per @rules/git-workflow.md
This skill runs tests and may apply safe fixers, but does not commit. To commit, offer the menu per rules/git-workflow.md § Proactive Offer — a commit option on any real branch, a push option only where review-state.js offer allows one — and invoke /smart-commit --execute on selection; never print the command for the user to copy.
flowchart TD
U[User: /test-deep] --> S[Phase 0: Test Selection]
S --> |git diff mapping| T[Test Targets]
S --> |no mapping| F1[Framework --changedSince]
S --> |low confidence| F2[Full Suite]
T --> L[Phase 1: Progressive Ladder]
F1 --> L
F2 --> L
L --> |unit| R1[Run Unit Tests]
R1 --> |pass| R2[Run Integration Tests]
R1 --> |fail| TR[Phase 2: Triage Pipeline]
R2 --> |pass| R3[Run E2E Tests]
R2 --> |fail| TR
R3 --> |pass| DONE[All Pass]
R3 --> |fail| TR
TR --> P[Parser: Structured Tags]
P --> LLM[LLM: Root Cause + Action]
LLM --> FC[Phase 3: Fixer Catalog Lookup]
FC --> SG{Safety Gate}
SG --> |safe| AUTO[Auto-run Fix]
SG --> |side-effect| ASK[AskUserQuestion]
SG --> |destructive| BLOCK[Manual Only]
AUTO --> L
ASK --> |approved| L
Map code changes to test targets. See references/test-selection.md for full strategy.
Strategy priority:
| Priority | Method | When |
|---|---|---|
| 1 | Git diff filename mapping | Default — map changed files to test files via Glob |
| 2 | Framework native | Jest --changedSince, Vitest --changed |
| 3 | Full suite fallback | Config change, no mapping, --all flag |
Steps:
--branch uses merge-base)Full suite escalation triggers: config file changed, CI/CD file changed, package dependency changed, no test files mapped, --all flag.
Execute tests layer-by-layer with fail-fast.
| Layer | Directory Pattern | Timeout | Fail Behavior |
|---|---|---|---|
| Unit | test/unit/**, test/scripts/lib/**, unclassified | 60s | Fail-fast → triage |
| Integration | test/integration/** | 300s | Fail-fast → triage |
| E2E | test/e2e/** | 600s | Enter triage |
Fail-fast rule: Unit fail → skip integration + e2e. Integration fail → skip e2e.
Override: --no-fail-fast disables this behavior (run all layers regardless).
Layer detection: Classify test files by directory prefix. Files not matching any integration/e2e pattern → treat as unit.
Execution: Run tests using project's configured test command (from package.json scripts or CLAUDE.md). Capture stdout/stderr and exit code.
When failures occur, analyze and classify. See references/triage-pipeline.md for full spec.
Extract structured tags from test output (no classification — just structure):
| Tag | Description |
|---|---|
exit_code | Process exit code |
error_signatures[] | Regex-matched error patterns |
failing_tests[] | Failed test names |
failing_files[] | Failed test file paths |
env_hints[] | Environment clues (testnet, localhost, etc.) |
stack_depth | Stack trace line count |
Feed parser tags + compressed output to LLM for classification:
| Classification | Definition | Typical Action |
|---|---|---|
code_bug | Logic error in code | Fix code |
infra | Infrastructure issue (port, dependency) | Restart / reinstall |
environment | External precondition unmet | Fixer catalog action |
flaky | Non-deterministic failure | Retry + quarantine tag |
Mandatory secret redaction before LLM analysis — per @rules/logging.md:
references/triage-pipeline.md for redaction patternsRoute suggested_fixer through safety gate:
| Tier | Auto-run? | Confirmation | Examples |
|---|---|---|---|
safe | Yes | None | retry, clear_cache |
side-effect | No | AskUserQuestion | reinstall_deps, restart_server |
destructive | Blocked | Manual only | Reset state, drop tables |
Default-deny: Unknown fixer → side-effect tier (require confirmation).
Lookup fixer from catalog, check tier, execute or prompt. See references/fixer-catalog.md for full catalog.
Core fixers (plugin-shipped):
| Fixer | Tier | Description |
|---|---|---|
retry | safe | Re-run failing tests |
clear_cache | safe | Clear build/test cache |
reinstall_deps | side-effect | Remove node_modules + reinstall |
restart_server | side-effect | Kill + restart dev server |
port_cleanup | side-effect | Kill process on conflicting port |
Host extensions: Project-specific fixers in .claude/test-deep/fixers.md. Schema validation at load — missing required fields or invalid tier → rejected with warning.
Fixer loop: After safe/approved fixer runs, re-enter progressive ladder for failed tests only. Max 1 fixer retry per failure to prevent infinite loops.
Write per-run artifacts for comparison and debugging.
Location: .claude/cache/test-deep/<runId>/
Run ID format: <timestamp>-<shortSHA>-<pid>
| File | Content |
|---|---|
metadata.json | Run config: selected tests, ladder config, changed files |
results.json | Per-layer results: pass/fail, duration, exit codes |
triage.json | Parser tags, LLM classification, fixer chosen, outcome |
output.log | Compressed test output (secret-redacted) |
TTL: Keep last 5 runs. Prune older on new run start.
latest symlink: Points to most recent run directory.
| Flag | Default | Description |
|---|---|---|
--all | false | Force full test suite |
--layer <unit|integration|e2e> | all | Run only specified layer |
--no-fail-fast | false | Run all layers regardless of failures |
--no-fix | false | Triage only, skip fixer execution |
--focus <path> | — | Limit test selection to path |
--branch | false | Use merge-base diff instead of working tree |
## Test Deep Report
### Test Selection
- Changed files: N
- Mapped test files: N (N unit, N integration, N e2e)
- Selection method: git diff mapping | framework native | full suite
### Results
| Layer | Tests | Passed | Failed | Skipped | Duration |
|-------|-------|--------|--------|---------|----------|
### Failure Triage
| # | Test | Classification | Root Cause | Fixer | Tier |
|---|------|---------------|------------|-------|------|
### Actions Taken
- [N] fixer_id: outcome
### Gate
✅ All Pass | ⛔ N failures pending resolution
git add / git commit / git push executedreferences/test-selection.md — Git diff mapping strategy + full suite escalationreferences/triage-pipeline.md — Parser tags + LLM prompt + safety gatereferences/fixer-catalog.md — Core fixers + host extensions + safety tiers@rules/logging.md — Secret redaction policy@rules/docs-writing.md — Output format conventionsWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub sd0xdev/sd0x-harness --plugin sd0x-dev-flow102 skills in this plugin
/adrWrite an Architecture Decision Record (ADR) for a feature — Context / Decision / Status / Consequences / Alternatives, filed as docs/features/<feature>/adr-<NNN>-<title>.md with a 3-digit zero-padded number. Handles the Superseded case: bidirectional linking when a new ADR replaces an old one. Use when: recording why an architectural approach was chosen, documenting a decision so it doesn't get re-litigated, marking a prior decision as superseded. Not for: feature-level technical design (use /tech-spec), task progress tracking (use /create-request), bulk backfill of historical decisions (a separate request — this skill writes one ADR at a time)./agentctl-setupInstall and set up the optional agentctl mod (task scope, refusal before execution, evidence that goes stale, model-free hand-over) — checks the environment, installs after approval, builds the first task line, optional deny rules, uninstall/architectureArchitecture design and documentation. Produces 3-architecture.md with component diagrams, data flow, integration points, and architecture decisions. Reads existing tech-spec as input. Use when: designing system architecture, documenting component interactions, creating architecture docs, producing 3-architecture.md. Not for: tech spec writing (use tech-spec), code implementation (use feature-dev), architecture consulting only (use codex-architect)./askContext-aware Q&A with auto context gathering. Use when: user has a quick question about codebase, git history, rules, docs, or skills during development. Not for: code changes (use feature-dev), code review (use codex-review-fast), deep research (use deep-research), full code trace (use code-explore). Output: structured answer with source attribution./best-practicesIndustry best practices conformance audit with mandatory adversarial debate. Produces audit artifact: verdict (OK/WARN/FAIL) + gap roadmap + debate proof. Use when: auditing current implementation against industry standards, checking compliance with best practices, benchmarking implementation quality, verifying a codebase meets a standard. Not for: broad research/discovery without audit target (use /deep-research), code review (use /codex-review), architecture design (use /codex-architect)./bug-fixBug fix workflow. Use when: fixing bugs, resolving issues, regression fixes. Not for: new features (use feature-dev), understanding code (use code-explore). Output: fix + regression test + review gate.Other plugins' skills for the same job