From rune
Performs full codebase health assessment for legacy projects. Analyzes complexity, dependencies, dead code, tech debt, and git hotspots. Produces health score and rescue plan.
How this skill is triggered — by the user, by Claude, or both
Slash command
/rune:autopsyThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Full codebase health assessment for legacy projects. Autopsy analyzes complexity, dependency coupling, dead code, tech debt, and git hotspots to produce a health score per module and a prioritized rescue plan. Uses opus for deep analysis quality.
Full codebase health assessment for legacy projects. Autopsy analyzes complexity, dependency coupling, dead code, tech debt, and git hotspots to produce a health score per module and a prioritized rescue plan. Uses opus for deep analysis quality.
rescue (L1): Phase 0 RECON — assess damage before refactoringonboard (L2): when project appears messy during onboardingaudit (L2): Phase 3 code quality and complexity assessmentincident (L2): root cause analysis after containmentscout (L2): deep structural scan — files, LOC, entry points, importsresearch (L3): identify if tech stack is outdatedtrend-scout (L3): compare against current best practicesjournal (L3): record health assessment findingsIf the project is a GitHub repository, gather repo-level metrics before diving into code:
# Fetch via GitHub API (requires gh CLI or curl + GITHUB_TOKEN)
gh api repos/{owner}/{repo} --jq '{stars: .stargazers_count, forks: .forks_count, open_issues: .open_issues_count, license: .license.spdx_id, language: .language, topics: .topics, created: .created_at, pushed: .pushed_at}'
# Contributor count and top contributors
gh api repos/{owner}/{repo}/contributors --jq 'length'
gh api repos/{owner}/{repo}/contributors --jq '.[0:5] | .[] | "\(.login): \(.contributions)"'
# Commit frequency (last 52 weeks)
gh api repos/{owner}/{repo}/stats/commit_activity --jq '[.[] | .total] | add'
# Language byte distribution
gh api repos/{owner}/{repo}/languages
Record in working notes:
Skip this step for local-only projects with no remote.
Call rune:scout with a request for a full project map. Ask scout to return:
For each major module identified by scout, use Read to open the file and assess:
Record findings per module in a working table.
Score each module 0-100 across six dimensions:
| Dimension | Weight | Scoring criteria |
|---|---|---|
| Complexity | 20% | Cyclomatic < 5 = 100, 5-10 = 70, 10-20 = 40, > 20 = 0 |
| Test coverage | 25% | > 80% = 100, 50-80% = 60, 20-50% = 30, < 20% = 0 |
| Documentation | 15% | README + inline comments = 100, partial = 50, none = 0 |
| Dependencies | 20% | Low coupling = 100, medium = 60, high/circular = 0 |
| Code smells | 10% | No god files, no deep nesting = 100, each violation -20 |
| Maintenance | 10% | Regular commits = 100, stale > 6 months = 50, untouched > 1yr = 0 |
Compute weighted score per module. Assign risk tier:
Use Bash to gather git archaeology data:
# Most changed files (hotspots)
git log --format=format: --name-only | sort | uniq -c | sort -rg | head -20
# Files not touched in over a year
git log --before="1 year ago" --format="%H" | head -1 | xargs -I{} git diff --name-only {}..HEAD
# Authors per file (high author count = high churn risk)
git log --format="%an" -- <file> | sort -u | wc -l
# Commit velocity by month (trend detection)
git log --format="%Y-%m" | sort | uniq -c | tail -12
# Issue/PR close rate (GitHub only)
gh api repos/{owner}/{repo}/issues --jq '[.[] | select(.pull_request == null)] | length'
Identify:
Use Write to save RESCUE-REPORT.md at the project root with this structure:
# Rescue Report: [Project Name]
Generated: [date]
## Overall Health: [score]/100
## Module Health
| Module | Score | Complexity | Coverage | Coupling | Risk | Priority |
|--------|-------|-----------|----------|----------|------|----------|
| [name] | [n] | [low/med/high] | [%] | [low/med/high] | [tier] | [1-N] |
## Dependency Graph
[Mermaid flowchart of module coupling — use subgraphs for clusters]
## Language Distribution
[Mermaid pie chart — e.g., pie title Languages "TypeScript" : 65 "JavaScript" : 20 "CSS" : 15]
## Commit Velocity (Last 12 Months)
[Trend: accelerating / stable / decelerating — include monthly commit counts]
## Repo Intelligence (GitHub only)
| Metric | Value | Signal |
|--------|-------|--------|
| Stars | [n] | [community interest level] |
| Contributors | [n] | [bus factor: critical/low/healthy] |
| Open issues | [n] | [maintenance signal] |
| Commits/week | [n] | [activity: active/maintained/stale] |
| Last push | [date] | [freshness] |
## Surgery Queue (Priority Order)
1. [module] — Score: [n] — [primary reason] — Suggested pattern: [pattern]
2. ...
## Git Archaeology
- Hotspot files: [list with change frequency]
- Stale files: [list with age]
- Dead code candidates: [list]
## Immediate Actions (Before Surgery)
- [action 1]
- [action 2]
Call rune:journal to record that autopsy ran, the overall health score, and the surgery queue.
Write .rune/comprehension.json conforming to compiler/schemas/comprehension.schema.json.
This is ADDITIVE — do not modify RESCUE-REPORT.md or any other output.
Populate from the module analysis already completed in Steps 1–4:
{
"project": "<project name>",
"generated_at": "<ISO 8601 timestamp>",
"source": "autopsy",
"health_score": <overall score 0-100 from Step 3>,
"layers": [
{ "id": "<layer-id>", "name": "<human name>", "color": "<code|service|data|domain|docs|infra|concept>" }
],
"domains": [],
"modules": [
{
"id": "<relative file path>",
"name": "<module name>",
"layer": "<layer id>",
"type": "file",
"complexity": "<simple|moderate|complex — map from health score: 80+=simple, 60-79=moderate, <60=complex>",
"files": 1,
"summary": "<one-line health finding — e.g. 'Score 42/100 — high cyclomatic complexity, no tests'>"
}
],
"edges": []
}
Rules:
modules[] — include ALL modules scored in Step 3 (this is the full health inventory, not just entry points).layers[] — derive from the project's architectural layers detected by scout.health_score — MUST be the weighted overall score computed in Step 3, not an estimate.edges[] — leave empty; autopsy does not trace cross-file dependencies (that is the visualizer's job)..rune/comprehension.json — this is a generated emit, not human-written content.Output a summary of the findings:
rune:safeguard on the top-priority moduleEvery finding in the autopsy report MUST carry a confidence level:
| Level | Range | Criteria |
|---|---|---|
| High | 90-100% | Measured directly from code/git — LOC counted, tests run, deps parsed |
| Medium | 70-89% | Inferred from strong signals — file patterns, naming conventions, partial git data |
| Low | 50-69% | Estimated from weak signals — no git history, binary files, generated code |
Rules:
Confidence: [High|Medium|Low] ([n]%)Autopsy follows a broad-to-narrow pattern to avoid missing systemic issues:
Do NOT skip rounds. Round 3 cross-cutting analysis frequently reveals risks that per-module analysis misses (e.g., a "healthy" module that is the single point of failure for 10 others).
CODE QUALITY — cyclomatic complexity, nesting depth, function length
DEPENDENCIES — coupling, circular deps, outdated packages
TEST COVERAGE — line coverage, branch coverage, test quality
DOCUMENTATION — inline comments, README, API docs
MAINTENANCE — git hotspots, commit frequency, author count
DEAD CODE — unused exports, unreachable branches
## Autopsy Report: [Project Name]
### Overall Health: [score]/100 — [tier: healthy | watch | at-risk | critical]
### Module Summary
| Module | Score | Risk | Priority |
|--------|-------|------|----------|
| [name] | [n] | [tier] | [1-N] |
### Top Issues
1. [module] — [primary finding] — Recommended pattern: [pattern]
### Next Step
Run rune:safeguard on [top-priority module] before any refactoring.
Known failure modes for this skill. Check these before declaring done.
| Failure Mode | Severity | Mitigation |
|---|---|---|
| Health scores estimated without reading actual code metrics | CRITICAL | Constraint 1: scan actual code — open files, count LOC, assess nesting depth |
| Recommending refactoring everything without prioritization | HIGH | Constraint 4: rank by severity — worst health score modules first, max top-5 |
| Missing git archaeology (no hotspot/stale file analysis) | MEDIUM | Step 4 bash commands are mandatory — git log data is part of the health picture |
| Skipping RESCUE-REPORT.md write (only verbal summary) | HIGH | Step 5 write is mandatory — persistence is the point of autopsy |
| Health score not backed by all 6 dimensions scored | MEDIUM | All 6 dimensions (complexity, test coverage, docs, deps, smells, maintenance) required |
| Artifact | Format | Location |
|---|---|---|
| Health score per module | Scored table (0-100) | inline |
| RESCUE-REPORT.md | Markdown + Mermaid | project root |
| Surgery queue (priority order) | Ordered list | RESCUE-REPORT.md |
| Git archaeology findings | Bash output + summary | inline |
| Comprehension graph | JSON | .rune/comprehension.json |
| Journal entry | Text | via journal L3 |
~5000-10000 tokens input, ~2000-4000 tokens output. Opus for deep analysis. Most expensive L2 skill but runs once per rescue.
Scope guardrail: autopsy assesses — it does not refactor. All surgery is delegated to surgeon after the report is complete.
When invoked as /rune autopsy --executive, generate a board-ready HTML health assessment. Requires Business tier.
.rune/org/org.md for team structure and governance levelreport-templates/autopsy-executive.html from Business pack and populate all {{placeholder}} fields:
score / 100 * 440)EXECUTIVE-HEALTH.html at project rootEXECUTIVE-HEALTH.html — Board-ready HTML report
RESCUE-REPORT.md — Detailed technical report (standard autopsy)
.rune/retros/{date}.json — Health metrics for trend tracking
| Score Range | Color | Tier |
|---|---|---|
| 80-100 | var(--success) #10b981 | Healthy |
| 60-79 | var(--warning) #f59e0b | Watch |
| 40-59 | #f97316 (orange) | At-risk |
| 0-39 | var(--danger) #ef4444 | Critical |
.rune/org/org.md missing: skip team mapping, show modules without domain ownershipWhen invoked as /rune autopsy --external <github-url>, evaluate someone else's repo for dependency / fork / contribution decisions. Different use case from rescue mode: you cannot run their tests, cannot rely on local Read, and the decision frame is "should I trust this?" not "how do I rescue this?".
autopsy --external A vs B)graft)Use gh api exclusively — do NOT git clone. Faster + cleaner.
URL="$1" # e.g., github.com/anthropics/claude-code
OWNER_REPO=$(echo "$URL" | sed -E 's|https?://github.com/||; s|/$||')
# Core metadata
gh api "repos/${OWNER_REPO}" --jq '{
name, full_name, description, language, license: .license.spdx_id,
stars: .stargazers_count, forks: .forks_count, watchers: .subscribers_count,
open_issues: .open_issues_count, default_branch,
created: .created_at, updated: .updated_at, pushed: .pushed_at,
archived, disabled, topics
}'
# Maintainer responsiveness (issue + PR close rates)
gh api "repos/${OWNER_REPO}/issues?state=closed&per_page=100" --jq '
[.[] | select(.pull_request == null) | (.closed_at | fromdateiso8601) - (.created_at | fromdateiso8601)] | add / length / 86400' # avg days-to-close
gh api "repos/${OWNER_REPO}/pulls?state=closed&per_page=100" --jq '
[.[] | select(.merged_at != null) | (.merged_at | fromdateiso8601) - (.created_at | fromdateiso8601)] | add / length / 86400' # avg PR merge time
# Release cadence (last 10 releases)
gh api "repos/${OWNER_REPO}/releases?per_page=10" --jq '[.[] | {tag: .tag_name, published: .published_at, prerelease}]'
# Security advisories
gh api "repos/${OWNER_REPO}/security-advisories" --jq 'length' 2>/dev/null || echo "0"
# Dependabot alerts (if accessible — usually not for external repos)
gh api "repos/${OWNER_REPO}/dependabot/alerts" --jq 'length' 2>/dev/null || echo "n/a"
External evaluation uses a DIFFERENT rubric than internal rescue. Internal cares about complexity; external cares about TRUST.
Score 0-100 across five dimensions:
| Dimension | Weight | Scoring criteria |
|---|---|---|
| Activity | 25% | Last push < 30d = 100, < 90d = 80, < 1yr = 50, < 2yr = 20, > 2yr = 0 |
| Maintainership | 25% | Avg issue-close < 7d = 100, < 30d = 70, < 90d = 40, > 90d = 10. Contributor count: > 10 = bonus +15, 2-10 = no change, 1 = penalty -20 (bus factor) |
| Adoption | 15% | Stars × (production-use signal from dependents): > 10k = 100, > 1k = 70, > 100 = 40, < 100 = 10. Dependent-repo count (via gh api repos/X/Y/network/dependents if available) is the production-use proxy |
| License | 20% | Permissive (MIT/Apache/BSD) = 100. Weak copyleft (MPL/LGPL) = 80. Strong copyleft (GPL) = 40. None / proprietary = 0. Verify SPDX field; flag if null |
| Security | 15% | 0 open advisories + recent CVEs addressed = 100. 1-2 unaddressed = 50. > 3 OR critical unaddressed > 30 days = 0. Audit log: check for force-push to default branch, suspicious release commits |
Composite score with same risk tiers as internal mode (80+ healthy, 60-79 watch, 40-59 at-risk, 0-39 critical).
You can't Read every file in an external repo. Extract architecture via metadata:
gh api repos/X/Y/contents/ (folder names = module boundaries)package.json (deps), Cargo.toml, go.mod, pyproject.toml, requirements.txt. Fetch with gh api repos/X/Y/contents/package.json --jq .content | base64 -dtests/, __tests__/, *_test.go, etc. (use gh api repos/X/Y/git/trees/HEAD?recursive=1 --jq '.tree[].path' | grep -E '_test|spec').github/workflows/, .gitlab-ci.yml, etc. (presence = quality signal; recent green builds via gh api repos/X/Y/actions/runs?status=success&per_page=5)docs/ folder existencegh api search/code -X GET --field q="repo:owner/repo path:docs filename:adr*"When called as /rune autopsy --external A --external B, produce side-by-side comparison:
| Dimension | Repo A | Repo B | Winner |
|-----------------|---------------|---------------|--------|
| Activity | 95 (active) | 30 (stale) | A |
| Maintainership | 80 | 60 | A |
| Adoption | 70 | 90 | B |
| License | 100 (MIT) | 40 (GPL) | A |
| Security | 100 (clean) | 85 (1 open) | A |
| **Composite** | **89** | **57** | **A** |
Recommendation: A — significantly healthier on 4/5 dimensions.
Write EXTERNAL-REPO-REPORT.md at project root (or operator-specified path):
# External Repo Evaluation: [owner/repo]
Generated: [date]
Decision: [DEPEND | FORK | CONTRIBUTE | AVOID]
Composite Score: [N]/100 ([tier])
## Quick Verdict
[1-2 sentence summary of why this score]
## Decision Rubric (5 dimensions)
[Table per Step 2]
## Activity Signal
- Last push: [date]
- Commits last 90 days: [N]
- Trend: [accelerating | stable | decelerating]
## Maintainership Signal
- Contributor count: [N] ([bus factor: critical/low/healthy])
- Avg issue close: [N] days
- Avg PR merge: [N] days
- Top contributor: [@user] ([N]% of commits — concentration risk if > 80%)
## Adoption Signal
- Stars: [N] · Forks: [N] · Watchers: [N]
- Dependent repos: [N]
- Notable users: [list if known via gh dependents API or readme mentions]
## License
- SPDX: [identifier]
- Compatibility: [compatible with our project's license | flag legal review]
## Security
- Open advisories: [N]
- Recent CVEs: [count + latest date]
- Audit log flags: [force-push events / suspicious releases / none]
## Architecture (extracted, not read)
- Tech stack: [languages + frameworks from manifest]
- Test infrastructure: [present | absent]
- CI status: [N recent green builds | failing | none configured]
- Documentation depth: [README size + docs/ folder presence]
## Confidence
[High | Medium | Low] — based on API data completeness; external mode confidence rarely exceeds Medium because we cannot run tests or read every file.
## Recommendation
[DEPEND | FORK | CONTRIBUTE | AVOID] with rationale grounded in the dimensions above. If FORK is recommended, link to the activity signal showing why (e.g., "last push > 1 year + 12 unaddressed PRs + critical bug filed").
gh api only — do NOT git clone (external mode is API-driven by design; clones add ~30 seconds + disk usage for no analytical gain)null, GPL, or proprietarygh CLI not authenticated: fall back to curl with GITHUB_TOKEN env var; document rate-limit risk (60 unauth / 5000 auth per hour)External evaluation produces a verdict that flows to other skills:
dependency-doctor for vulnerability scan integrationgraft to plan the fork + adaptreview-intake (PR-style workflow for the contribution).rune/decisions/npx claudepluginhub rune-kit/rune --plugin @rune/analyticsPerforms a strategic first-pass review of a repository, producing an evidence-cited map of its state calibrated to a reference class. Helps decide where to engage, tread carefully, or leave alone.
Scans codebase health by identifying hotspots, risky files, and coupling patterns. Prescribes prioritized refactoring actions with ROI-based guidance. Invoke via /Vitals or rely on auto-activation when discussing code quality.
Runs a repository engineering audit with SARIF-compatible evidence, 4-level confidence scoring, and OpenSSF-style health evaluation. Use when assessing code quality or repository health.