Predict

From softspark/ai-toolkit · View interactive version

Predict is an AI agent skill from the GitHub repository softspark/ai-toolkit. Analyzes diffs for regression risk and blast radius, generates risk-scored impact report. Triggers: PR review, code change risk, breaking change, blast radius, regression check.

How to use this skill

Skill file

Predict Command

$ARGUMENTS

Triggers the Predictive Analyst to assess the impact and regression risk of proposed changes.

Usage

/predict [path_or_diff]
# /predict src/auth              : analyze all files under src/auth
# /predict --diff                : analyze uncommitted changes (git diff)
# /predict src/api/routes.ts     : analyze a single file

Protocol

1. Scope: Identify Target Files

2. Trace: Build Dependency Graph

For each target file, find dependents:

# Find files that import/require the target
grep -rl "import.*from.*[target]" --include="*.ts" --include="*.py" --include="*.js" .
grep -rl "require.*[target]" --include="*.js" --include="*.ts" .

Build a graph: changed file, direct dependents, transitive dependents (1 level)

3. Assess: Calculate Risk Score

Score each changed file on a 1 to 5 scale:

| Factor | Weight | Scoring |

|--------|--------|---------|

| Dependent count | 30% | 0 deps = 1, 1 to 3 = 2, 4 to 10 = 3, 11 to 20 = 4, 21+ = 5 |

| Test coverage | 30% | Has dedicated test = 1, partial = 3, none = 5 |

| Change surface | 20% | < 10 lines = 1, 10 to 50 = 2, 50 to 200 = 3, 200+ = 5 |

| Shared/core file | 20% | Leaf = 1, mid-layer = 3, core/shared = 5 |

Overall risk = weighted average rounded to nearest integer.

4. Report: Generate Impact Prediction

Output a markdown report:

## Impact Prediction: [scope]

| File | Risk | Dependents | Test Coverage | Notes |
|------|------|------------|---------------|-------|
| src/auth/login.ts | 4/5 | 12 files | partial | Core auth flow |

### High-Risk Changes (score >= 4)
- [file]: [why it's high risk and what to watch]

### Recommended Actions
- [ ] Add tests for [untested file]
- [ ] Review [high-dependent file] with extra scrutiny
- [ ] Run integration tests covering [affected area]

Rules

Gotchas

When NOT to Use

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.