Risk assess

From sd0xdev/sd0x-dev-flow · View interactive version

Risk assess is an AI agent skill from the GitHub repository sd0xdev/sd0x-dev-flow. Uncommitted code risk assessment with breaking change detection, blast radius analysis, and scope metrics. Use when: evaluating PR risk, pre-commit risk check, large refactoring review. Not for: security vulnerabilities (use /codex-security), code correctness (use /codex-review-fast). Output: 3-dime

How to use this skill

Skill file

Risk Assessment

When NOT to Use

Procedure

  1. Run bash "${CLAUDE_PLUGIN_ROOT}/scripts/run-skill.sh" risk-assess risk-analyze.js --json to collect deterministic scores. When the caller gave --base <ref> or --mode <fast|deep>, append it (the script defaults to HEAD and fast)
  2. Parse the JSON output — base and mode (must be what was asked for), overall_score, risk_level, dimensions, flags, gate, next_actions
  3. If risk_level = Critical (score 75-100) — highlight all breaking signals, recommend splitting PRs
  4. If risk_level = High (score 50-74) — auto-escalate to --mode deep, detail blast radius
  5. If risk_level = Medium (score 30-49) — summarize dimensions, note areas of concern
  6. If risk_level = Low (score 0-29) — brief summary, confirm safe to proceed
  7. Add qualitative interpretation beyond the scores (e.g., "high blast radius but all dependents are test files")

Script Integration

The script analyzes 3 dimensions + 2 conditional flags:

| Dimension | Weight | What It Measures |

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

| breaking_surface | 45% | Removed exports, renamed APIs, changed signatures, deleted modules |

| blast_radius | 35% | Number of files importing changed modules (grep-based) |

| change_scope | 20% | File count, LOC delta, directory span, rename ratio |

| Flag | Trigger | What It Checks |

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

| migration_safety | Migration/schema files in diff | Rollback/down file exists |

| regression_hint | (v2 stub) | Future: git history analysis |

Scoring Model

Risk Levels

| Score | Level | Gate | Exit Code |

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

| 0-29 | Low | PASS | 0 |

| 30-49 | Medium | PASS | 0 |

| 50-74 | High | REVIEW | 1 |

| 75-100 | Critical | BLOCK | 2 |

Script Failure Fallback

If the script fails, report the error and suggest running manually (in the plugin's own source checkout without the plugin loaded, the path is scripts/run-skill.sh) — keeping the caller's base and mode (main and the default fast here; omit --base main for HEAD, add --mode deep when it was asked for), and checking that the returned base and mode are those:

bash "${CLAUDE_PLUGIN_ROOT}/scripts/run-skill.sh" risk-assess risk-analyze.js --json --base main

Output Format

## Risk Assessment Report

| Field | Value |
|-------|-------|
| Score | **[N]/100** |
| Risk Level | [icon] [level] |
| Gate | [PASS/REVIEW/BLOCK] |

### Dimensions
[table of dimension scores + weights]

### Breaking Change Signals
[list of detected signals — only if any]

### Next Actions
[prioritized action items]

## Gate: [sentinel]

References

Verification

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.