| name | risk-analysis |
| description | Deep risk analysis for code changes. Systematically evaluates potential regressions, edge cases, cross-platform issues, and unintended consequences before implementation. Asks the model to slow down and think through all codepaths, configurations, and failure modes. |
| last_updated | "2026-02-12T00:00:00.000Z" |
| tools_required | [] |
| agent_type | main_agent |
RISK_ANALYSIS
Systematic risk analysis for proposed code changes. Use this skill to surface unintended consequences, regressions, and edge cases before committing to an implementation.
See Also
When to Use
- Before implementing a fix or feature that touches shared infrastructure
- When a change modifies validation, serialization, or data flow logic
- When introducing new defaults, fallbacks, or silent error handling
- When changing behavior that downstream consumers depend on
- When the blast radius of a change is unclear
- When working on cross-platform code (macOS, Windows, Linux)
- When modifying configuration schemas, API contracts, or IPC channels
Process
IMPORTANT: Take your time with this analysis. Do not rush. Trace every codepath. Consider every consumer. Think about users on different machines, OS versions, network conditions, and configurations. The goal is to find problems before they reach users.
Phase 1: Understand the Change Surface
Before assessing risk, build a complete picture of what the change touches.
-
Identify the exact change: What code is being added, modified, or removed? Get specific -- file paths, function names, line ranges.
-
Map all callers and consumers: Trace every place the modified code is called from. Use grep/search to find:
- Direct function/method calls
- Import references
- IPC channel consumers (both main and renderer)
- Config files that reference the changed behavior
- Tests that exercise the changed codepaths
-
Identify the data flow: Trace data through the change:
- What inputs does the modified code receive? What shapes/types can they have?
- What outputs does it produce? Who consumes those outputs?
- Are there intermediate transformations (serialization, parsing, normalization)?
- Does the data cross process boundaries (main <-> renderer, main <-> MCP)?
-
Check for implicit contracts: Look for undocumented assumptions:
- Does anything depend on the current error behavior (catching specific error codes/messages)?
- Are there side effects that consumers rely on (logging, metrics, state mutations)?
- Does the change affect timing or ordering guarantees?
Phase 2: Systematic Risk Assessment
Work through each category below. For every risk identified, assign a severity and likelihood.
Severity scale: CRITICAL (data loss, security hole, app crash) | HIGH (feature broken, user-facing error) | MEDIUM (degraded experience, misleading behavior) | LOW (cosmetic, minor inconvenience)
Likelihood scale: CERTAIN (will happen) | LIKELY (probable in normal use) | POSSIBLE (edge case but realistic) | UNLIKELY (requires unusual conditions)
2a. Regression Risks
2b. Cross-Platform Risks
2c. Configuration & Environment Risks
2d. Concurrency & Timing Risks
2e. Data Integrity Risks
2f. Security & Privacy Risks
2g. Performance Risks
2h. Downstream & Integration Risks
Phase 3: Edge Case Exploration
For the specific change being analyzed, enumerate concrete edge cases:
- Boundary values: Empty strings, null/undefined, zero-length arrays, maximum-size inputs
- Missing data: What if a field that's usually present is absent?
- Malformed data: What if the input is the wrong type, has unexpected nesting, or contains special characters?
- Partial failures: What if the operation succeeds partially (e.g., 3 of 5 items processed)?
- Stale state: What if cached data is outdated or references deleted resources?
- Version skew: What if the client and server are on different versions?
Phase 4: Mitigation Assessment
For each identified risk:
- Can it be prevented? (Schema validation, type narrowing, guard clauses)
- Can it be detected? (Logging, monitoring, error reporting)
- Can it be recovered from? (Retry logic, fallback behavior, user intervention)
- Can it be tested? (Unit test, integration test, manual verification)
Output Format
## Risk Analysis: [Change Description]
### Change Summary
[1-3 sentence description of what's being changed and why]
### Change Surface
- Files modified: [list]
- Callers/consumers: [list]
- Data flow: [brief description]
### Risks Identified
#### [Risk Title] — Severity: [X] | Likelihood: [X]
**What**: [Description of the risk]
**How it manifests**: [Concrete scenario where this causes a problem]
**Who is affected**: [Which users/configurations/platforms]
**Mitigation**: [How to prevent or handle this]
**Test coverage**: [How to verify the mitigation works]
[Repeat for each risk]
### Edge Cases
| Scenario | Expected Behavior | Risk |
|----------|-------------------|------|
| [case] | [what should happen] | [what could go wrong] |
### Recommendation
[SAFE TO PROCEED / PROCEED WITH MITIGATIONS / NEEDS REDESIGN / STOP]
**If PROCEED WITH MITIGATIONS:**
1. [Specific mitigation to implement before or alongside the change]
2. [Specific test to add]
3. [Specific monitoring to enable]
**If NEEDS REDESIGN:**
[Explain why and suggest alternative approaches]
### Residual Risk
[What risks remain even after mitigations? Are they acceptable?]
Anti-Patterns to Watch For
These patterns frequently cause unintended consequences:
- Silent fallbacks: Catching errors and returning defaults. The caller never knows something went wrong. Bugs hide for weeks.
- Global behavior changes: Modifying a shared utility, validator, or config parser. Every consumer is affected.
- In-place mutation: Modifying objects that other code holds references to. Side effects propagate unpredictably.
- Stripping data before logging: You fix the immediate error but lose the ability to diagnose the root cause.
- Changing error messages: Downstream code (including AI models) may match on error text. Changing messages changes behavior.
- Implicit ordering dependencies: Assuming services initialize in a specific order, events fire in sequence, or promises resolve in order.
- Platform-specific defaults: Using
os.homedir() or path.sep correctly in one place but hardcoding / or ~ in another.
- Feature flag interactions: A change that's safe when a flag is off but breaks when the flag is on (or vice versa).
Important
- Trace the full codepath, not just the immediate change. Most regressions happen two or three hops away from the modified code.
- Think about users who aren't like you. Different OS, different locale, different settings, different MCP servers, first-time users vs power users.
- Consider the temporal dimension. What happens on first run after upgrade? What about data created by old code but read by new code?
- Don't dismiss unlikely risks if the severity is critical. A 5% chance of data loss is not acceptable.
- When in doubt, flag it. It's better to surface a risk that turns out to be a non-issue than to miss one that causes a regression.