From blueprint-plugin
Derives test regression plans from git history by identifying fix and feature commits lacking tests. Use to find untested bug fixes, coverage gaps, or generate prioritized test backlogs.
npx claudepluginhub laurigates/claude-plugins --plugin blueprint-pluginThis skill is limited to using the following tools:
Analyze git history to identify fix and feature commits lacking corresponding test changes, then generate a structured Test Regression Plan (TRP) document as a prioritized test backlog.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Analyze git history to identify fix and feature commits lacking corresponding test changes, then generate a structured Test Regression Plan (TRP) document as a prioritized test backlog.
Use case: Systematically close test coverage gaps by mining commit history for bug fixes and features that shipped without regression tests.
| Use this skill when... | Use alternative when... |
|---|---|
| Bug fixes ship without regression tests | You need to run existing tests (/test:run) |
| Want a prioritized test backlog from history | Writing tests for a specific feature (manual TDD) |
| Onboarding a project and assessing test health | Checking current test coverage metrics |
| Need to find which fixes lack test coverage | Designing a test strategy from scratch (/test:architecture) |
git rev-parse --git-dirfind docs/blueprint -maxdepth 1 -name 'manifest.json' -type fgit rev-list --count HEADfind . -maxdepth 3 \( -name 'vitest.config.*' -o -name 'jest.config.*' -o -name 'pytest.ini' -o -name 'pyproject.toml' -o -name 'Cargo.toml' -o -name 'go.mod' \) -type f -print -quitfind . -maxdepth 4 -type f \( -name '*.test.*' -o -name '*.spec.*' -o -name 'test_*' -o -name '*_test.*' \) -printgit log --format="%s" --max-count=10Parse these from $ARGUMENTS:
--quick: Fast scan (last 50 commits only)--since DATE: Analyze commits from specific date (e.g., --since 2024-06-01)--scope AREA: Filter to commits touching a specific area/scope (e.g., --scope auth)Default behavior without flags: Analyze last 200 commits.
For detailed templates, severity matrix, and test mapping rules, see REFERENCE.md.
Execute this test regression plan derivation workflow:
Check context values above:
/blueprint:init, then continueParse $ARGUMENTS for --quick, --since, and --scope:
--quick → scope = last 50 commits--since DATE → scope = commits from DATE to now--scope AREA → filter commits to those with scope matching AREA or touching files in AREA directoryStore scope parameters for git log commands in subsequent steps.
Scan for test framework and conventions:
*.test.ts, *.spec.ts (JS/TS)test_*.py, *_test.py (Python)*_test.rs, tests/ directory (Rust)*_test.go (Go)src/ → tests/, src/ → src/__tests__/)If no test framework detected → Warn user, continue with file-based detection only.
Extract fix and feature commits within scope:
Primary targets — fix: commits (highest priority for regression tests):
git log --format="%H %s" {scope} | grep -E "^[a-f0-9]+ fix(\(.*\))?:"
Secondary targets — feat: commits (should have accompanying tests):
git log --format="%H %s" {scope} | grep -E "^[a-f0-9]+ feat(\(.*\))?:"
Fallback — If conventional commit percentage < 20%, use keyword detection:
git log --format="%H %s" {scope} | grep -iE "(fix|bug|hotfix|patch|resolve|correct)"
For each commit, record: SHA, subject, date, files changed, scope (if conventional).
For each commit from Step 4, check for corresponding tests:
Inline test changes — Did the same commit modify test files?
git diff-tree --no-commit-id --name-only -r {SHA} | grep -E "(test|spec|_test\.|\.test\.)"
Nearby test commits — Within 5 commits after the fix, was a test commit added?
git log --format="%H %s" {SHA}..{SHA~5} | grep -iE "^[a-f0-9]+ test(\(.*\))?:|add.*test|test.*for"
Test file exists — For each modified source file, does a corresponding test file exist? Use the source-to-test mapping from Step 3 (see REFERENCE.md for rules per language).
Classify each gap using the severity matrix from REFERENCE.md:
| Severity | Criteria |
|---|---|
| Critical | fix: commit, no test changes, no test file exists for modified source |
| High | fix: commit, no inline test changes but test file exists (test not updated) |
| Medium | feat: commit, no test changes, core module affected |
| Low | feat: commit, no inline tests but nearby test commit exists |
mkdir -p docs/trpsid_registry.last_trp, increment by 1TRP-001regression-gaps-2024-q3)docs/trps/{slug}.md using template from REFERENCE.mdInclude in the document:
id, status: Active, scope, date_range, commits_analyzedIf Blueprint is initialized:
id_registry.last_trp with the new TRP numberid_registry.documents:
{
"TRP-NNN": {
"path": "docs/trps/{slug}.md",
"title": "{TRP title}",
"status": "Active",
"created": "{date}"
}
}
jq --arg now "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--arg sha "$(git rev-parse HEAD 2>/dev/null)" \
--argjson analyzed "{commits_analyzed}" \
--argjson gaps "{gaps_found}" \
'.task_registry["derive-tests"].last_completed_at = $now |
.task_registry["derive-tests"].last_result = "success" |
.task_registry["derive-tests"].stats.runs_total = ((.task_registry["derive-tests"].stats.runs_total // 0) + 1) |
.task_registry["derive-tests"].stats.items_processed = $analyzed |
.task_registry["derive-tests"].stats.items_created = $gaps |
.task_registry["derive-tests"].context.commits_analyzed_up_to = $sha' \
docs/blueprint/manifest.json > tmp.json && mv tmp.json docs/blueprint/manifest.json
Print summary:
Test Regression Plan Generated!
**Analysis Summary**
- Commits analyzed: {N} ({date_range})
- Fix commits found: {N}
- Feature commits found: {N}
**Coverage Gaps Found**
- Critical: {N} (fix commits with no tests at all)
- High: {N} (fix commits with stale test files)
- Medium: {N} (feature commits missing tests)
- Low: {N} (feature commits with nearby tests)
**Document**: docs/trps/{slug}.md (TRP-{NNN})
**Top Priority Gaps**
1. {commit subject} — {severity} — {affected file}
2. {commit subject} — {severity} — {affected file}
3. {commit subject} — {severity} — {affected file}
Prompt user for next action:
--since or --scope| Context | Command |
|---|---|
| Fix commits only | git log --format="%H %s" | grep -E "^[a-f0-9]+ fix" |
| Check test in commit | git diff-tree --no-commit-id --name-only -r {SHA} | grep -E "test|spec" |
| Files changed | git diff-tree --no-commit-id --name-only -r {SHA} |
| Fast scan | Use --quick for last 50 commits |
| Scope filter | Use --scope auth to limit to specific area |
For detailed templates, severity classification matrix, test mapping rules, and error handling, see REFERENCE.md.