Risk Register Skill
When creating or updating a risk register, follow this structured process. The goal is to maintain a living document that surfaces project risks early enough to act on them — before they become incidents, missed deadlines, or scope explosions.
IMPORTANT: Always save the output as a markdown file in the project-decisions/ directory at the project root. Create the directory if it doesn't exist.
PRINCIPLE: A good risk register is not a one-time document. It should be reviewed and updated every sprint. Risks change — new ones appear, old ones are mitigated, some become reality.
0. Output Setup
mkdir -p project-decisions
# File naming:
# First time: project-decisions/YYYY-MM-DD-risk-register.md
# Updates: Edit the existing file, add to the changelog at the bottom
# If no existing register exists, create a new one
# If one exists, update it
ls project-decisions/*risk-register* 2>/dev/null
1. Risk Discovery
1a. Codebase & Technical Risks
# Complexity hotspots (high complexity = high risk of bugs)
find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" \) ! -path '*/node_modules/*' ! -path '*/dist/*' -exec wc -l {} + 2>/dev/null | sort -rn | head -15
# Files with highest churn (most changes = most fragile)
git log --name-only --since="3 months ago" --format="" -- src/ app/ 2>/dev/null | sort | uniq -c | sort -rn | head -15
# Files with most bug fixes (where problems live)
git log --name-only --since="6 months ago" --grep="fix\|bug\|hotfix" --format="" -- src/ app/ 2>/dev/null | sort | uniq -c | sort -rn | head -10
# Dependency vulnerabilities
npm audit --json 2>/dev/null | head -50
pip audit 2>/dev/null | head -20
# Outdated dependencies
npm outdated 2>/dev/null | head -20
pip list --outdated 2>/dev/null | head -20
# TODO/FIXME/HACK count (unaddressed known issues)
echo "TODO: $(grep -rn 'TODO' --include='*.ts' --include='*.js' --include='*.py' src/ app/ 2>/dev/null | grep -v 'node_modules' | wc -l)"
echo "FIXME: $(grep -rn 'FIXME' --include='*.ts' --include='*.js' --include='*.py' src/ app/ 2>/dev/null | grep -v 'node_modules' | wc -l)"
echo "HACK: $(grep -rn 'HACK' --include='*.ts' --include='*.js' --include='*.py' src/ app/ 2>/dev/null | grep -v 'node_modules' | wc -l)"
# Test coverage gaps (untested code = risk)
find src/ app/ -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" \) ! -name "*.test.*" ! -name "*.spec.*" ! -name "test_*" ! -name "*.d.ts" ! -name "index.*" ! -path '*/node_modules/*' ! -path '*/dist/*' 2>/dev/null | while read f; do
base=$(basename "$f" | sed 's/\.\(ts\|tsx\|js\|jsx\|py\)$//')
if ! find . \( -name "${base}.test.*" -o -name "${base}.spec.*" -o -name "test_${base}.*" \) ! -path '*/node_modules/*' 2>/dev/null | grep -q .; then
echo "UNTESTED: $f"
fi
done | head -20
# Single points of failure (bus factor)
for f in $(git log --name-only --since="12 months ago" --format="" -- src/ 2>/dev/null | sort -u | head -30); do
authors=$(git log --format='%aN' --since="12 months ago" -- "$f" 2>/dev/null | sort -u | wc -l)
if [ "$authors" -eq 1 ]; then
echo "BUS FACTOR 1: $f ($(git log --format='%aN' -1 -- "$f" 2>/dev/null))"
fi
done | head -15
# Missing error handling in critical paths
grep -rn "catch\|except\|rescue" --include="*.ts" --include="*.js" --include="*.py" src/ 2>/dev/null | wc -l
grep -rn "async function\|async def\|async (" --include="*.ts" --include="*.js" --include="*.py" src/ 2>/dev/null | wc -l
# Infrastructure configuration
cat docker-compose.yml Dockerfile 2>/dev/null | head -40
cat .github/workflows/*.yml 2>/dev/null | head -40
# Check for health checks and monitoring
grep -rn "health\|readiness\|liveness\|monitor\|sentry\|datadog\|prometheus" --include="*.ts" --include="*.js" --include="*.py" --include="*.yaml" --include="*.yml" . 2>/dev/null | grep -v "node_modules" | head -10
# Check for secrets management
grep -rn "process\.env\|os\.environ\|os\.Getenv" --include="*.ts" --include="*.js" --include="*.py" --include="*.go" src/ app/ 2>/dev/null | grep -v "node_modules\|test\|spec" | wc -l
ls .env .env.local .env.production 2>/dev/null
1b. Project & Delivery Risks
Evaluate from context, PRDs, recent activity:
# Recent velocity (commits per week)
for week in 4 3 2 1 0; do
start=$(date -d "$((week+1)) weeks ago" +%Y-%m-%d 2>/dev/null || date -v-$((week+1))w +%Y-%m-%d 2>/dev/null)
end=$(date -d "$week weeks ago" +%Y-%m-%d 2>/dev/null || date -v-${week}w +%Y-%m-%d 2>/dev/null)
count=$(git log --oneline --after="$start" --before="$end" 2>/dev/null | wc -l)
echo "Week -$week: $count commits"
done
# PR cycle time (how long PRs stay open)
gh pr list --state merged --limit 10 --json number,title,createdAt,mergedAt 2>/dev/null | head -40
# Open PRs (work in progress)
gh pr list --state open --json number,title,createdAt,author 2>/dev/null | head -20
# Pending issues
gh issue list --state open --limit 20 --json number,title,labels,createdAt 2>/dev/null | head -40
# Recent incidents
ls project-decisions/*incident* 2>/dev/null
# Recent scope changes or decision records
ls project-decisions/ 2>/dev/null | tail -10
# Check for deadline references
grep -rn "deadline\|due date\|launch\|go-live\|ship by\|target date" --include="*.md" . 2>/dev/null | grep -v "node_modules\|\.git" | head -10
2. Risk Categories
Technical Risks
| ID |
Risk Category |
What to Look For |
| T1 |
Architecture |
Single points of failure, monolith pain points, scaling bottlenecks, circular dependencies |
| T2 |
Code Quality |
High complexity files, low test coverage, excessive tech debt, code smells |
| T3 |
Dependencies |
Vulnerable packages, outdated major versions, unmaintained libraries, license issues |
| T4 |
Security |
Exposed secrets, injection vulnerabilities, auth gaps, data exposure |
| T5 |
Performance |
Slow queries, memory leaks, missing caching, N+1 problems |
| T6 |
Data |
Missing backups, no migration rollback, data integrity gaps, missing validation |
| T7 |
Infrastructure |
No redundancy, manual deployments, missing monitoring, no auto-scaling |
| T8 |
Integration |
Flaky third-party APIs, missing circuit breakers, undocumented API contracts |
Delivery Risks
| ID |
Risk Category |
What to Look For |
| D1 |
Timeline |
Unrealistic deadlines, scope creep, incomplete requirements, blocked tasks |
| D2 |
Resources |
Team capacity constraints, key person dependency, skill gaps, competing priorities |
| D3 |
Scope |
Vague requirements, missing acceptance criteria, unbounded features, no MVP definition |
| D4 |
Dependencies |
Cross-team blockers, external vendor timelines, design deliverables, stakeholder approvals |
| D5 |
Communication |
Unclear ownership, missing documentation, no stakeholder alignment, siloed knowledge |
Operational Risks
| ID |
Risk Category |
What to Look For |
| O1 |
Availability |
No SLA defined, missing health checks, no incident response plan, no runbooks |
| O2 |
Disaster Recovery |
No backup strategy, untested recovery, missing failover, no RTO/RPO targets |
| O3 |
Compliance |
GDPR gaps, missing audit logging, data retention policy unclear, security certifications pending |
| O4 |
Support |
No on-call rotation, missing runbooks, no escalation path, knowledge silos |
Business Risks
| ID |
Risk Category |
What to Look For |
| B1 |
Market |
Competitive pressure, changing requirements, pivoting product direction |
| B2 |
Vendor |
Vendor lock-in, pricing changes, vendor stability, contract expiry |
| B3 |
Revenue |
Payment system reliability, billing accuracy, churn risk from outages |
| B4 |
Reputation |
Data breach risk, public-facing outage risk, user trust |
3. Risk Scoring
Likelihood Scale
| Score |
Level |
Definition |
Probability |
| 1 |
Rare |
Could happen but very unlikely in the next 3 months |
< 10% |
| 2 |
Unlikely |
Possible but not expected |
10-30% |
| 3 |
Possible |
Could go either way |
30-60% |
| 4 |
Likely |
More likely than not |
60-85% |
| 5 |
Almost Certain |
Will very likely happen |
> 85% |
Impact Scale
| Score |
Level |
Definition |
Examples |
| 1 |
Negligible |
Minor inconvenience, no user impact |
Cosmetic bug, minor delay |
| 2 |
Minor |
Small user impact, easy to fix |
Edge case bug, 1-2 day delay |
| 3 |
Moderate |
Noticeable impact, workaround exists |
Feature degraded, 1 week delay |
| 4 |
Major |
Significant impact, hard to work around |
Core feature broken, 2+ week delay, partial data loss |
| 5 |
Severe |
Critical failure, no workaround |
Full outage, data breach, project cancelled, regulatory fine |
Risk Score Matrix
IMPACT
1 2 3 4 5
┌─────┬─────┬─────┬─────┬─────┐
5 │ 5 │ 10 │ 15 │ 20 │ 25 │
│ 🟡 │ 🟠 │ 🔴 │ 🔴 │ 🔴 │
L ──────┼─────┼─────┼─────┼─────┼─────┤
I 4 │ 4 │ 8 │ 12 │ 16 │ 20 │
K │ 🟢 │ 🟡 │ 🟠 │ 🔴 │ 🔴 │
E ──────┼─────┼─────┼─────┼─────┼─────┤
L 3 │ 3 │ 6 │ 9 │ 12 │ 15 │
I │ 🟢 │ 🟡 │ 🟡 │ 🟠 │ 🔴 │
H ──────┼─────┼─────┼─────┼─────┼─────┤
O 2 │ 2 │ 4 │ 6 │ 8 │ 10 │
O │ 🟢 │ 🟢 │ 🟡 │ 🟡 │ 🟠 │
D ──────┼─────┼─────┼─────┼─────┼─────┤
1 │ 1 │ 2 │ 3 │ 4 │ 5 │
│ 🟢 │ 🟢 │ 🟢 │ 🟢 │ 🟡 │
└─────┴─────┴─────┴─────┴─────┘
Score ranges:
🟢 Low (1-4): Accept — monitor, no immediate action
🟡 Medium (5-9): Mitigate — plan mitigation, review regularly
🟠 High (10-15): Act — active mitigation required, escalate
🔴 Critical (16-25): Urgent — immediate action, executive visibility
Risk Score Calculation
Risk Score = Likelihood × Impact
Example:
Risk: "Key developer leaves before project completion"
Likelihood: 3 (Possible)
Impact: 4 (Major — critical knowledge loss, 2+ week delay)
Score: 3 × 4 = 12 (🟠 High)
4. Risk Response Strategies
For each identified risk, choose a response strategy:
| Strategy |
When to Use |
Example |
| Avoid |
Eliminate the risk entirely by changing approach |
Don't use the unproven technology; use the established one instead |
| Mitigate |
Reduce likelihood or impact |
Add tests, create documentation, build redundancy |
| Transfer |
Shift risk to a third party |
Use managed service instead of self-hosting; buy insurance |
| Accept |
Risk is low enough or unavoidable |
Known minor UI bug that doesn't affect core functionality |
| Contingency |
Prepare a plan B if the risk materializes |
Rollback plan, backup vendor, alternative approach ready |
5. Risk Register Entry Format
Each risk should include:
### RISK-[ID]: [Title]
| Field | Value |
|-------|-------|
| **Category** | [Technical / Delivery / Operational / Business] |
| **Subcategory** | [T1-T8 / D1-D5 / O1-O4 / B1-B4] |
| **Description** | [What could happen and why] |
| **Trigger** | [What event or condition would cause this risk to materialize] |
| **Likelihood** | [1-5] [Rare/Unlikely/Possible/Likely/Almost Certain] |
| **Impact** | [1-5] [Negligible/Minor/Moderate/Major/Severe] |
| **Score** | [L × I] [🟢/🟡/🟠/🔴] |
| **Response** | [Avoid / Mitigate / Transfer / Accept / Contingency] |
| **Mitigation** | [Specific actions to reduce likelihood or impact] |
| **Contingency** | [What to do if the risk materializes] |
| **Owner** | [Person responsible for monitoring and acting] |
| **Status** | [Open / Mitigating / Mitigated / Accepted / Realized / Closed] |
| **Due Date** | [When mitigation should be complete] |
| **Evidence** | [Data from codebase scan, metrics, or observations] |
| **Linked Items** | [Related tickets, incidents, decisions] |
| **Last Reviewed** | [Date] |
6. Automated Risk Detection Rules
Auto-Flag as 🔴 Critical
IF any of these are true, auto-flag as critical risk:
- Dependency with known critical CVE (CVSS ≥ 9.0)
- Secrets/credentials committed to git
- Production database has no backup configured
- Zero test coverage on authentication or payment code
- Single point of failure in production architecture
- No rollback strategy for upcoming deployment
- Key person dependency on critical path with no documentation
- Deadline is < 2 weeks and > 30% of scope is incomplete
Auto-Flag as 🟠 High
IF any of these are true, auto-flag as high risk:
- Dependency with known high CVE (CVSS ≥ 7.0)
- Test coverage < 30% on modified files
- Files with > 500 lines and no tests
- Bus factor of 1 on > 5 critical files
- More than 20 unresolved TODOs/FIXMEs in critical paths
- No monitoring/alerting on production service
- Third-party API with no circuit breaker or fallback
- Sprint velocity declining for 3+ consecutive sprints
- PR cycle time > 5 days average
Auto-Flag as 🟡 Medium
IF any of these are true, auto-flag as medium risk:
- Dependencies > 6 months outdated
- No API documentation for public endpoints
- Missing .env.example or setup documentation
- No runbook for common failure scenarios
- Inconsistent error handling patterns
- Code duplication detected across > 3 files
7. Risk Trends
Track how risks change over time:
### Risk Trend: [Risk Title]
| Date | Likelihood | Impact | Score | Change | Notes |
|------|-----------|--------|-------|--------|-------|
| 2026-01-15 | 3 | 4 | 12 🟠 | — | Initial assessment |
| 2026-01-29 | 3 | 4 | 12 🟠 | → | No change, mitigation in progress |
| 2026-02-12 | 2 | 4 | 8 🟡 | ↓ | Tests added, documentation improved |
| 2026-02-19 | 2 | 3 | 6 🟡 | ↓ | Second engineer onboarded to module |
Trend: ↓ Improving
Trend symbols:
↑ Worsening (score increased)
→ Stable (no change)
↓ Improving (score decreased)
⚡ Realized (risk became an actual issue)
✅ Closed (risk eliminated or accepted and documented)
8. Review Cadence
Recommended review schedule:
| Review Type | Frequency | Who | Focus |
|------------|-----------|-----|-------|
| Quick scan | Every sprint | TPM | New risks, status updates, score changes |
| Full review | Monthly | TPM + Tech Lead | All risks, trends, mitigation effectiveness |
| Deep dive | Quarterly | Full team | Architecture risks, strategic risks, historical trends |
| Ad-hoc | As needed | TPM | After incidents, major scope changes, team changes |
Output Document Template
Save to project-decisions/YYYY-MM-DD-risk-register.md:
# Project Risk Register
**Project:** [Project Name]
**Last Updated:** YYYY-MM-DD
**Updated By:** [Name]
**Next Review:** YYYY-MM-DD
**Overall Risk Level:** [🟢 Low / 🟡 Medium / 🟠 High / 🔴 Critical]
---
## Risk Summary
| Severity | Count | Trend |
|----------|-------|-------|
| 🔴 Critical | X | [↑/→/↓] |
| 🟠 High | X | [↑/→/↓] |
| 🟡 Medium | X | [↑/→/↓] |
| 🟢 Low | X | [↑/→/↓] |
| **Total Open** | **X** | |
| Mitigated this period | X | |
| New this period | X | |
| Realized (became issues) | X | |
---
## Risk Heat Map
IMPACT
1 2 3 4 5
┌─────┬─────┬─────┬─────┬─────┐
5 │ │ │ │ R03 │ │
L ──────┼─────┼─────┼─────┼─────┼─────┤
I 4 │ │ │ R07 │ R01 │ │
K ──────┼─────┼─────┼─────┼─────┼─────┤
E 3 │ │ R09 │ R04 │ R02 │ │
L ──────┼─────┼─────┼─────┼─────┼─────┤
I 2 │ R10 │ R08 │ R06 │ │ │
H ──────┼─────┼─────┼─────┼─────┼─────┤
O 1 │ │ R11 │ R05 │ │ │
O └─────┴─────┴─────┴─────┴─────┘
D
---
## Top Risks Requiring Action
| Rank | ID | Risk | Score | Owner | Status | Due |
|------|----|------|-------|-------|--------|-----|
| 1 | R01 | [Title] | 16 🔴 | [Name] | [Status] | [Date] |
| 2 | R02 | [Title] | 12 🟠 | [Name] | [Status] | [Date] |
| 3 | R03 | [Title] | 20 🔴 | [Name] | [Status] | [Date] |
---
## Full Risk Register
### 🔴 Critical Risks
#### RISK-001: [Title]
| Field | Value |
|-------|-------|
| **Category** | [Category] |
| **Description** | [What could happen] |
| **Trigger** | [What would cause this] |
| **Likelihood** | [X] — [Level] |
| **Impact** | [X] — [Level] |
| **Score** | [XX] 🔴 |
| **Response** | [Strategy] |
| **Mitigation** | [Actions] |
| **Contingency** | [Plan B] |
| **Owner** | [Name] |
| **Status** | [Status] |
| **Due Date** | [Date] |
| **Evidence** | [Codebase findings] |
| **Last Reviewed** | [Date] |
**Trend:**
| Date | L | I | Score | Change | Notes |
|------|---|---|-------|--------|-------|
| [Date] | X | X | XX | — | [Notes] |
---
[Repeat for each risk...]
---
### 🟠 High Risks
[Same format...]
### 🟡 Medium Risks
[Same format...]
### 🟢 Low Risks
[Same format...]
---
## Realized Risks (became actual issues)
| ID | Risk | Realized Date | Impact | Incident Link |
|----|------|--------------|--------|--------------|
| R05 | [Title] | YYYY-MM-DD | [Actual impact] | [Link to incident report] |
---
## Closed Risks
| ID | Risk | Closed Date | Reason |
|----|------|------------|--------|
| R12 | [Title] | YYYY-MM-DD | [Mitigated / Accepted / No longer relevant] |
---
## Risk Metrics
| Metric | Current | Previous | Trend |
|--------|---------|----------|-------|
| Total open risks | X | X | [↑/→/↓] |
| Average risk score | X.X | X.X | [↑/→/↓] |
| Critical + High risks | X | X | [↑/→/↓] |
| Risks mitigated this period | X | X | |
| Risks realized this period | X | X | |
| Mean time to mitigate | X days | X days | [↑/→/↓] |
| Overdue mitigations | X | X | [↑/→/↓] |
---
## Upcoming Mitigation Actions
| Risk ID | Action | Owner | Due | Status |
|---------|--------|-------|-----|--------|
| R01 | [Specific action] | [Name] | [Date] | ⬜ TODO |
| R02 | [Specific action] | [Name] | [Date] | 🔄 In Progress |
| R03 | [Specific action] | [Name] | [Date] | ⬜ TODO |
---
## Review Log
| Date | Type | Reviewer | Changes Made |
|------|------|----------|-------------|
| YYYY-MM-DD | Initial creation | [Name] | Created register with X risks |
| YYYY-MM-DD | Sprint review | [Name] | Updated R01, added R15, closed R05 |
| YYYY-MM-DD | Monthly review | [Name] | Full review, re-scored 3 risks |
After saving, update the project-decisions index:
echo "# Project Decisions\n" > project-decisions/README.md
echo "| Date | Decision | Type | Status |" >> project-decisions/README.md
echo "|------|----------|------|--------|" >> project-decisions/README.md
for f in project-decisions/2*.md; do
date=$(basename "$f" | cut -d'-' -f1-3)
title=$(head -1 "$f" | sed 's/^# //')
type="Other"
echo "$f" | grep -q "risk-register" && type="Risk Register"
echo "$f" | grep -q "build-vs-buy" && type="Build vs Buy"
echo "$f" | grep -q "incident" && type="Incident Report"
echo "$f" | grep -q "scope" && type="Scope Check"
echo "$f" | grep -q "impact" && type="Impact Analysis"
echo "$f" | grep -q "tech-debt" && type="Tech Debt Report"
echo "$f" | grep -q "pentest" && type="Pentest Report"
echo "$f" | grep -qv "risk-register\|build-vs-buy\|incident\|scope\|impact\|tech-debt\|pentest" && type="Tech Decision"
status=$(grep "^**Status:\|^**Overall Risk Level:\|^**Last Updated:" "$f" | head -1 | sed 's/.*: //' | sed 's/\*//g')
echo "| $date | [$title](./$(basename $f)) | $type | $status |" >> project-decisions/README.md
done
Adaptation Rules
- Always save to file — every risk register gets persisted in
project-decisions/
- Scan the codebase — don't guess at technical risks, find them with grep, git log, npm audit
- Be specific — "authService.ts has 0% test coverage and handles password hashing" not "some code is untested"
- Include evidence — every technical risk should reference actual files, metrics, or scan results
- Score consistently — use the same likelihood and impact scales every time
- Track trends — show whether each risk is improving, stable, or worsening
- Update, don't recreate — if a risk register already exists, update it rather than starting from scratch
- Link to other documents — connect realized risks to incident reports, mitigations to tech decisions
- Assign owners — unowned risks don't get mitigated
- Flag overdue mitigations — a mitigation plan that's past due is itself a risk
- Scale to project — small project gets 5-10 risks, large project gets 20-30
- Distinguish symptoms from risks — "slow API" is a symptom, "no caching strategy for growing dataset" is the risk
Summary
End every risk register with:
- Overall risk level — 🟢/🟡/🟠/🔴 based on highest open risk
- Risk count — total open, by severity
- Top 3 risks — requiring immediate attention
- New risks — added since last review
- Trend — overall trajectory (improving / stable / worsening)
- Overdue actions — mitigations past their due date
- Next review date — when this should be updated
- File saved — confirm the document location
1---2name: risk-register3description: Creates and maintains a living project risk register by analyzing the codebase, dependencies, team structure, timeline, and technical decisions. Identifies risks, scores them by likelihood and impact, assigns owners, tracks mitigations, and flags risks that have changed since last assessment. Saves output to project-decisions/ folder. Use when the user says "risk register", "project risks", "what could go wrong", "risk assessment", "identify risks", "update risks", "risk review", "what are our risks", or "flag risks for the project".4---56# Risk Register Skill78When creating or updating a risk register, follow this structured process. The goal is to maintain a living document that surfaces project risks early enough to act on them — before they become incidents, missed deadlines, or scope explosions.910**IMPORTANT**: Always save the output as a markdown file in the `project-decisions/` directory at the project root. Create the directory if it doesn't exist.1112**PRINCIPLE**: A good risk register is not a one-time document. It should be reviewed and updated every sprint. Risks change — new ones appear, old ones are mitigated, some become reality.1314## 0. Output Setup15```bash16mkdir -p project-decisions1718# File naming:19# First time: project-decisions/YYYY-MM-DD-risk-register.md20# Updates: Edit the existing file, add to the changelog at the bottom21# If no existing register exists, create a new one22# If one exists, update it2324ls project-decisions/*risk-register* 2>/dev/null25```2627## 1. Risk Discovery2829### 1a. Codebase & Technical Risks30```bash31# Complexity hotspots (high complexity = high risk of bugs)32find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" \) ! -path '*/node_modules/*' ! -path '*/dist/*' -exec wc -l {} + 2>/dev/null | sort -rn | head -153334# Files with highest churn (most changes = most fragile)35git log --name-only --since="3 months ago" --format="" -- src/ app/ 2>/dev/null | sort | uniq -c | sort -rn | head -153637# Files with most bug fixes (where problems live)38git log --name-only --since="6 months ago" --grep="fix\|bug\|hotfix" --format="" -- src/ app/ 2>/dev/null | sort | uniq -c | sort -rn | head -103940# Dependency vulnerabilities41npm audit --json 2>/dev/null | head -5042pip audit 2>/dev/null | head -204344# Outdated dependencies45npm outdated 2>/dev/null | head -2046pip list --outdated 2>/dev/null | head -204748# TODO/FIXME/HACK count (unaddressed known issues)49echo "TODO: $(grep -rn 'TODO' --include='*.ts' --include='*.js' --include='*.py' src/ app/ 2>/dev/null | grep -v 'node_modules' | wc -l)"50echo "FIXME: $(grep -rn 'FIXME' --include='*.ts' --include='*.js' --include='*.py' src/ app/ 2>/dev/null | grep -v 'node_modules' | wc -l)"51echo "HACK: $(grep -rn 'HACK' --include='*.ts' --include='*.js' --include='*.py' src/ app/ 2>/dev/null | grep -v 'node_modules' | wc -l)"5253# Test coverage gaps (untested code = risk)54find src/ app/ -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" \) ! -name "*.test.*" ! -name "*.spec.*" ! -name "test_*" ! -name "*.d.ts" ! -name "index.*" ! -path '*/node_modules/*' ! -path '*/dist/*' 2>/dev/null | while read f; do55 base=$(basename "$f" | sed 's/\.\(ts\|tsx\|js\|jsx\|py\)$//')56 if ! find . \( -name "${base}.test.*" -o -name "${base}.spec.*" -o -name "test_${base}.*" \) ! -path '*/node_modules/*' 2>/dev/null | grep -q .; then57 echo "UNTESTED: $f"58 fi59done | head -206061# Single points of failure (bus factor)62for f in $(git log --name-only --since="12 months ago" --format="" -- src/ 2>/dev/null | sort -u | head -30); do63 authors=$(git log --format='%aN' --since="12 months ago" -- "$f" 2>/dev/null | sort -u | wc -l)64 if [ "$authors" -eq 1 ]; then65 echo "BUS FACTOR 1: $f ($(git log --format='%aN' -1 -- "$f" 2>/dev/null))"66 fi67done | head -156869# Missing error handling in critical paths70grep -rn "catch\|except\|rescue" --include="*.ts" --include="*.js" --include="*.py" src/ 2>/dev/null | wc -l71grep -rn "async function\|async def\|async (" --include="*.ts" --include="*.js" --include="*.py" src/ 2>/dev/null | wc -l7273# Infrastructure configuration74cat docker-compose.yml Dockerfile 2>/dev/null | head -4075cat .github/workflows/*.yml 2>/dev/null | head -407677# Check for health checks and monitoring78grep -rn "health\|readiness\|liveness\|monitor\|sentry\|datadog\|prometheus" --include="*.ts" --include="*.js" --include="*.py" --include="*.yaml" --include="*.yml" . 2>/dev/null | grep -v "node_modules" | head -107980# Check for secrets management81grep -rn "process\.env\|os\.environ\|os\.Getenv" --include="*.ts" --include="*.js" --include="*.py" --include="*.go" src/ app/ 2>/dev/null | grep -v "node_modules\|test\|spec" | wc -l82ls .env .env.local .env.production 2>/dev/null83```8485### 1b. Project & Delivery Risks8687Evaluate from context, PRDs, recent activity:88```bash89# Recent velocity (commits per week)90for week in 4 3 2 1 0; do91 start=$(date -d "$((week+1)) weeks ago" +%Y-%m-%d 2>/dev/null || date -v-$((week+1))w +%Y-%m-%d 2>/dev/null)92 end=$(date -d "$week weeks ago" +%Y-%m-%d 2>/dev/null || date -v-${week}w +%Y-%m-%d 2>/dev/null)93 count=$(git log --oneline --after="$start" --before="$end" 2>/dev/null | wc -l)94 echo "Week -$week: $count commits"95done9697# PR cycle time (how long PRs stay open)98gh pr list --state merged --limit 10 --json number,title,createdAt,mergedAt 2>/dev/null | head -4099100# Open PRs (work in progress)101gh pr list --state open --json number,title,createdAt,author 2>/dev/null | head -20102103# Pending issues104gh issue list --state open --limit 20 --json number,title,labels,createdAt 2>/dev/null | head -40105106# Recent incidents107ls project-decisions/*incident* 2>/dev/null108109# Recent scope changes or decision records110ls project-decisions/ 2>/dev/null | tail -10111112# Check for deadline references113grep -rn "deadline\|due date\|launch\|go-live\|ship by\|target date" --include="*.md" . 2>/dev/null | grep -v "node_modules\|\.git" | head -10114```115116## 2. Risk Categories117118### Technical Risks119120| ID | Risk Category | What to Look For |121|----|--------------|-----------------|122| T1 | **Architecture** | Single points of failure, monolith pain points, scaling bottlenecks, circular dependencies |123| T2 | **Code Quality** | High complexity files, low test coverage, excessive tech debt, code smells |124| T3 | **Dependencies** | Vulnerable packages, outdated major versions, unmaintained libraries, license issues |125| T4 | **Security** | Exposed secrets, injection vulnerabilities, auth gaps, data exposure |126| T5 | **Performance** | Slow queries, memory leaks, missing caching, N+1 problems |127| T6 | **Data** | Missing backups, no migration rollback, data integrity gaps, missing validation |128| T7 | **Infrastructure** | No redundancy, manual deployments, missing monitoring, no auto-scaling |129| T8 | **Integration** | Flaky third-party APIs, missing circuit breakers, undocumented API contracts |130131### Delivery Risks132133| ID | Risk Category | What to Look For |134|----|--------------|-----------------|135| D1 | **Timeline** | Unrealistic deadlines, scope creep, incomplete requirements, blocked tasks |136| D2 | **Resources** | Team capacity constraints, key person dependency, skill gaps, competing priorities |137| D3 | **Scope** | Vague requirements, missing acceptance criteria, unbounded features, no MVP definition |138| D4 | **Dependencies** | Cross-team blockers, external vendor timelines, design deliverables, stakeholder approvals |139| D5 | **Communication** | Unclear ownership, missing documentation, no stakeholder alignment, siloed knowledge |140141### Operational Risks142143| ID | Risk Category | What to Look For |144|----|--------------|-----------------|145| O1 | **Availability** | No SLA defined, missing health checks, no incident response plan, no runbooks |146| O2 | **Disaster Recovery** | No backup strategy, untested recovery, missing failover, no RTO/RPO targets |147| O3 | **Compliance** | GDPR gaps, missing audit logging, data retention policy unclear, security certifications pending |148| O4 | **Support** | No on-call rotation, missing runbooks, no escalation path, knowledge silos |149150### Business Risks151152| ID | Risk Category | What to Look For |153|----|--------------|-----------------|154| B1 | **Market** | Competitive pressure, changing requirements, pivoting product direction |155| B2 | **Vendor** | Vendor lock-in, pricing changes, vendor stability, contract expiry |156| B3 | **Revenue** | Payment system reliability, billing accuracy, churn risk from outages |157| B4 | **Reputation** | Data breach risk, public-facing outage risk, user trust |158159## 3. Risk Scoring160161### Likelihood Scale162163| Score | Level | Definition | Probability |164|-------|-------|-----------|------------|165| 1 | **Rare** | Could happen but very unlikely in the next 3 months | < 10% |166| 2 | **Unlikely** | Possible but not expected | 10-30% |167| 3 | **Possible** | Could go either way | 30-60% |168| 4 | **Likely** | More likely than not | 60-85% |169| 5 | **Almost Certain** | Will very likely happen | > 85% |170171### Impact Scale172173| Score | Level | Definition | Examples |174|-------|-------|-----------|---------|175| 1 | **Negligible** | Minor inconvenience, no user impact | Cosmetic bug, minor delay |176| 2 | **Minor** | Small user impact, easy to fix | Edge case bug, 1-2 day delay |177| 3 | **Moderate** | Noticeable impact, workaround exists | Feature degraded, 1 week delay |178| 4 | **Major** | Significant impact, hard to work around | Core feature broken, 2+ week delay, partial data loss |179| 5 | **Severe** | Critical failure, no workaround | Full outage, data breach, project cancelled, regulatory fine |180181### Risk Score Matrix182```183 IMPACT184 1 2 3 4 5185 ┌─────┬─────┬─────┬─────┬─────┐186 5 │ 5 │ 10 │ 15 │ 20 │ 25 │187 │ 🟡 │ 🟠 │ 🔴 │ 🔴 │ 🔴 │188L ──────┼─────┼─────┼─────┼─────┼─────┤189I 4 │ 4 │ 8 │ 12 │ 16 │ 20 │190K │ 🟢 │ 🟡 │ 🟠 │ 🔴 │ 🔴 │191E ──────┼─────┼─────┼─────┼─────┼─────┤192L 3 │ 3 │ 6 │ 9 │ 12 │ 15 │193I │ 🟢 │ 🟡 │ 🟡 │ 🟠 │ 🔴 │194H ──────┼─────┼─────┼─────┼─────┼─────┤195O 2 │ 2 │ 4 │ 6 │ 8 │ 10 │196O │ 🟢 │ 🟢 │ 🟡 │ 🟡 │ 🟠 │197D ──────┼─────┼─────┼─────┼─────┼─────┤198 1 │ 1 │ 2 │ 3 │ 4 │ 5 │199 │ 🟢 │ 🟢 │ 🟢 │ 🟢 │ 🟡 │200 └─────┴─────┴─────┴─────┴─────┘201202Score ranges:203🟢 Low (1-4): Accept — monitor, no immediate action204🟡 Medium (5-9): Mitigate — plan mitigation, review regularly205🟠 High (10-15): Act — active mitigation required, escalate206🔴 Critical (16-25): Urgent — immediate action, executive visibility207```208209### Risk Score Calculation210```211Risk Score = Likelihood × Impact212213Example:214 Risk: "Key developer leaves before project completion"215 Likelihood: 3 (Possible)216 Impact: 4 (Major — critical knowledge loss, 2+ week delay)217 Score: 3 × 4 = 12 (🟠 High)218```219220## 4. Risk Response Strategies221222For each identified risk, choose a response strategy:223224| Strategy | When to Use | Example |225|----------|------------|---------|226| **Avoid** | Eliminate the risk entirely by changing approach | Don't use the unproven technology; use the established one instead |227| **Mitigate** | Reduce likelihood or impact | Add tests, create documentation, build redundancy |228| **Transfer** | Shift risk to a third party | Use managed service instead of self-hosting; buy insurance |229| **Accept** | Risk is low enough or unavoidable | Known minor UI bug that doesn't affect core functionality |230| **Contingency** | Prepare a plan B if the risk materializes | Rollback plan, backup vendor, alternative approach ready |231232## 5. Risk Register Entry Format233234Each risk should include:235```236### RISK-[ID]: [Title]237238| Field | Value |239|-------|-------|240| **Category** | [Technical / Delivery / Operational / Business] |241| **Subcategory** | [T1-T8 / D1-D5 / O1-O4 / B1-B4] |242| **Description** | [What could happen and why] |243| **Trigger** | [What event or condition would cause this risk to materialize] |244| **Likelihood** | [1-5] [Rare/Unlikely/Possible/Likely/Almost Certain] |245| **Impact** | [1-5] [Negligible/Minor/Moderate/Major/Severe] |246| **Score** | [L × I] [🟢/🟡/🟠/🔴] |247| **Response** | [Avoid / Mitigate / Transfer / Accept / Contingency] |248| **Mitigation** | [Specific actions to reduce likelihood or impact] |249| **Contingency** | [What to do if the risk materializes] |250| **Owner** | [Person responsible for monitoring and acting] |251| **Status** | [Open / Mitigating / Mitigated / Accepted / Realized / Closed] |252| **Due Date** | [When mitigation should be complete] |253| **Evidence** | [Data from codebase scan, metrics, or observations] |254| **Linked Items** | [Related tickets, incidents, decisions] |255| **Last Reviewed** | [Date] |256```257258## 6. Automated Risk Detection Rules259260### Auto-Flag as 🔴 Critical261```262IF any of these are true, auto-flag as critical risk:263264- Dependency with known critical CVE (CVSS ≥ 9.0)265- Secrets/credentials committed to git266- Production database has no backup configured267- Zero test coverage on authentication or payment code268- Single point of failure in production architecture269- No rollback strategy for upcoming deployment270- Key person dependency on critical path with no documentation271- Deadline is < 2 weeks and > 30% of scope is incomplete272```273274### Auto-Flag as 🟠 High275```276IF any of these are true, auto-flag as high risk:277278- Dependency with known high CVE (CVSS ≥ 7.0)279- Test coverage < 30% on modified files280- Files with > 500 lines and no tests281- Bus factor of 1 on > 5 critical files282- More than 20 unresolved TODOs/FIXMEs in critical paths283- No monitoring/alerting on production service284- Third-party API with no circuit breaker or fallback285- Sprint velocity declining for 3+ consecutive sprints286- PR cycle time > 5 days average287```288289### Auto-Flag as 🟡 Medium290```291IF any of these are true, auto-flag as medium risk:292293- Dependencies > 6 months outdated294- No API documentation for public endpoints295- Missing .env.example or setup documentation296- No runbook for common failure scenarios297- Inconsistent error handling patterns298- Code duplication detected across > 3 files299```300301## 7. Risk Trends302303Track how risks change over time:304```305### Risk Trend: [Risk Title]306307| Date | Likelihood | Impact | Score | Change | Notes |308|------|-----------|--------|-------|--------|-------|309| 2026-01-15 | 3 | 4 | 12 🟠 | — | Initial assessment |310| 2026-01-29 | 3 | 4 | 12 🟠 | → | No change, mitigation in progress |311| 2026-02-12 | 2 | 4 | 8 🟡 | ↓ | Tests added, documentation improved |312| 2026-02-19 | 2 | 3 | 6 🟡 | ↓ | Second engineer onboarded to module |313314Trend: ↓ Improving315```316317Trend symbols:318```319↑ Worsening (score increased)320→ Stable (no change)321↓ Improving (score decreased)322⚡ Realized (risk became an actual issue)323✅ Closed (risk eliminated or accepted and documented)324```325326## 8. Review Cadence327```328Recommended review schedule:329330| Review Type | Frequency | Who | Focus |331|------------|-----------|-----|-------|332| Quick scan | Every sprint | TPM | New risks, status updates, score changes |333| Full review | Monthly | TPM + Tech Lead | All risks, trends, mitigation effectiveness |334| Deep dive | Quarterly | Full team | Architecture risks, strategic risks, historical trends |335| Ad-hoc | As needed | TPM | After incidents, major scope changes, team changes |336```337338## Output Document Template339340Save to `project-decisions/YYYY-MM-DD-risk-register.md`:341```markdown342# Project Risk Register343344**Project:** [Project Name]345**Last Updated:** YYYY-MM-DD346**Updated By:** [Name]347**Next Review:** YYYY-MM-DD348**Overall Risk Level:** [🟢 Low / 🟡 Medium / 🟠 High / 🔴 Critical]349350---351352## Risk Summary353354| Severity | Count | Trend |355|----------|-------|-------|356| 🔴 Critical | X | [↑/→/↓] |357| 🟠 High | X | [↑/→/↓] |358| 🟡 Medium | X | [↑/→/↓] |359| 🟢 Low | X | [↑/→/↓] |360| **Total Open** | **X** | |361| Mitigated this period | X | |362| New this period | X | |363| Realized (became issues) | X | |364365---366367## Risk Heat Map368```369 IMPACT370 1 2 3 4 5371 ┌─────┬─────┬─────┬─────┬─────┐372 5 │ │ │ │ R03 │ │373L ──────┼─────┼─────┼─────┼─────┼─────┤374I 4 │ │ │ R07 │ R01 │ │375K ──────┼─────┼─────┼─────┼─────┼─────┤376E 3 │ │ R09 │ R04 │ R02 │ │377L ──────┼─────┼─────┼─────┼─────┼─────┤378I 2 │ R10 │ R08 │ R06 │ │ │379H ──────┼─────┼─────┼─────┼─────┼─────┤380O 1 │ │ R11 │ R05 │ │ │381O └─────┴─────┴─────┴─────┴─────┘382D383```384385---386387## Top Risks Requiring Action388389| Rank | ID | Risk | Score | Owner | Status | Due |390|------|----|------|-------|-------|--------|-----|391| 1 | R01 | [Title] | 16 🔴 | [Name] | [Status] | [Date] |392| 2 | R02 | [Title] | 12 🟠 | [Name] | [Status] | [Date] |393| 3 | R03 | [Title] | 20 🔴 | [Name] | [Status] | [Date] |394395---396397## Full Risk Register398399### 🔴 Critical Risks400401#### RISK-001: [Title]402403| Field | Value |404|-------|-------|405| **Category** | [Category] |406| **Description** | [What could happen] |407| **Trigger** | [What would cause this] |408| **Likelihood** | [X] — [Level] |409| **Impact** | [X] — [Level] |410| **Score** | [XX] 🔴 |411| **Response** | [Strategy] |412| **Mitigation** | [Actions] |413| **Contingency** | [Plan B] |414| **Owner** | [Name] |415| **Status** | [Status] |416| **Due Date** | [Date] |417| **Evidence** | [Codebase findings] |418| **Last Reviewed** | [Date] |419420**Trend:**421| Date | L | I | Score | Change | Notes |422|------|---|---|-------|--------|-------|423| [Date] | X | X | XX | — | [Notes] |424425---426427[Repeat for each risk...]428429---430431### 🟠 High Risks432433[Same format...]434435### 🟡 Medium Risks436437[Same format...]438439### 🟢 Low Risks440441[Same format...]442443---444445## Realized Risks (became actual issues)446447| ID | Risk | Realized Date | Impact | Incident Link |448|----|------|--------------|--------|--------------|449| R05 | [Title] | YYYY-MM-DD | [Actual impact] | [Link to incident report] |450451---452453## Closed Risks454455| ID | Risk | Closed Date | Reason |456|----|------|------------|--------|457| R12 | [Title] | YYYY-MM-DD | [Mitigated / Accepted / No longer relevant] |458459---460461## Risk Metrics462463| Metric | Current | Previous | Trend |464|--------|---------|----------|-------|465| Total open risks | X | X | [↑/→/↓] |466| Average risk score | X.X | X.X | [↑/→/↓] |467| Critical + High risks | X | X | [↑/→/↓] |468| Risks mitigated this period | X | X | |469| Risks realized this period | X | X | |470| Mean time to mitigate | X days | X days | [↑/→/↓] |471| Overdue mitigations | X | X | [↑/→/↓] |472473---474475## Upcoming Mitigation Actions476477| Risk ID | Action | Owner | Due | Status |478|---------|--------|-------|-----|--------|479| R01 | [Specific action] | [Name] | [Date] | ⬜ TODO |480| R02 | [Specific action] | [Name] | [Date] | 🔄 In Progress |481| R03 | [Specific action] | [Name] | [Date] | ⬜ TODO |482483---484485## Review Log486487| Date | Type | Reviewer | Changes Made |488|------|------|----------|-------------|489| YYYY-MM-DD | Initial creation | [Name] | Created register with X risks |490| YYYY-MM-DD | Sprint review | [Name] | Updated R01, added R15, closed R05 |491| YYYY-MM-DD | Monthly review | [Name] | Full review, re-scored 3 risks |492```493494After saving, update the project-decisions index:495```bash496echo "# Project Decisions\n" > project-decisions/README.md497echo "| Date | Decision | Type | Status |" >> project-decisions/README.md498echo "|------|----------|------|--------|" >> project-decisions/README.md499500for f in project-decisions/2*.md; do501 date=$(basename "$f" | cut -d'-' -f1-3)502 title=$(head -1 "$f" | sed 's/^# //')503 type="Other"504 echo "$f" | grep -q "risk-register" && type="Risk Register"505 echo "$f" | grep -q "build-vs-buy" && type="Build vs Buy"506 echo "$f" | grep -q "incident" && type="Incident Report"507 echo "$f" | grep -q "scope" && type="Scope Check"508 echo "$f" | grep -q "impact" && type="Impact Analysis"509 echo "$f" | grep -q "tech-debt" && type="Tech Debt Report"510 echo "$f" | grep -q "pentest" && type="Pentest Report"511 echo "$f" | grep -qv "risk-register\|build-vs-buy\|incident\|scope\|impact\|tech-debt\|pentest" && type="Tech Decision"512 status=$(grep "^**Status:\|^**Overall Risk Level:\|^**Last Updated:" "$f" | head -1 | sed 's/.*: //' | sed 's/\*//g')513 echo "| $date | [$title](./$(basename $f)) | $type | $status |" >> project-decisions/README.md514done515```516517## Adaptation Rules518519- **Always save to file** — every risk register gets persisted in `project-decisions/`520- **Scan the codebase** — don't guess at technical risks, find them with grep, git log, npm audit521- **Be specific** — "authService.ts has 0% test coverage and handles password hashing" not "some code is untested"522- **Include evidence** — every technical risk should reference actual files, metrics, or scan results523- **Score consistently** — use the same likelihood and impact scales every time524- **Track trends** — show whether each risk is improving, stable, or worsening525- **Update, don't recreate** — if a risk register already exists, update it rather than starting from scratch526- **Link to other documents** — connect realized risks to incident reports, mitigations to tech decisions527- **Assign owners** — unowned risks don't get mitigated528- **Flag overdue mitigations** — a mitigation plan that's past due is itself a risk529- **Scale to project** — small project gets 5-10 risks, large project gets 20-30530- **Distinguish symptoms from risks** — "slow API" is a symptom, "no caching strategy for growing dataset" is the risk531532## Summary533534End every risk register with:5351. **Overall risk level** — 🟢/🟡/🟠/🔴 based on highest open risk5362. **Risk count** — total open, by severity5373. **Top 3 risks** — requiring immediate attention5384. **New risks** — added since last review5395. **Trend** — overall trajectory (improving / stable / worsening)5406. **Overdue actions** — mitigations past their due date5417. **Next review date** — when this should be updated5428. **File saved** — confirm the document location