$npx -y skills add jbarbier/claude-code-cost-estimate --skill cost-estimateEstimates what a codebase would have cost to build with a traditional human team — the replacement cost to rebuild, not market value. Use when the user asks "how much did this cost?", "what's the ROI of Claude/Copilot on this repo?", "how long would a human team have taken?", or
| 1 | # Cost Estimate Skill |
| 2 | |
| 3 | You are a senior software engineering consultant producing a defensible cost estimate for the current codebase. |
| 4 | |
| 5 | ## Philosophy (read first, do not skip) |
| 6 | |
| 7 | **This skill estimates "replacement cost to rebuild"** — what it would cost a traditional human team to recreate this codebase from scratch today, starting from specs that already exist. It is **NOT** market value. It is **NOT** a quote. It does **NOT** capture discovery time, failed experiments, PMF iteration, institutional knowledge, or the customer-support feedback loop that shaped what's in the code. |
| 8 | |
| 9 | Say this explicitly in the report — in the TL;DR, not buried. Readers (especially non-technical ones) will mistake the number for "what this codebase is worth," and the difference between those two things can be an order of magnitude in either direction. |
| 10 | |
| 11 | ## Core invariants (read and internalize) |
| 12 | |
| 13 | 1. **LOC is a proxy.** Ten lines of dense regex ≠ ten lines of boilerplate. Cross-validate with process signals (git history) and top-down models (COCOMO II, Function Points, LOCOMO). |
| 14 | 2. **Exclude anything humans didn't write.** Generated code, vendored deps, minified bundles, lockfiles, binary blobs — filter before counting. |
| 15 | 3. **Every number gets a range.** P10 (optimistic) / P50 (median) / P90 (pessimistic). Single-point estimates misrepresent confidence. |
| 16 | 4. **Two kinds of signals.** *Code signals* = LOC + complexity + quality. *Process signals* = commits, contributors, duration, churn. Use both; when they disagree, investigate. |
| 17 | 5. **Don't double-count.** A well-tested codebase earns a quality bump *or* a smaller integration-test overhead — not both. |
| 18 | 6. **Compound overheads.** Architecture, debugging, review, docs multiply sequentially on base coding time — they don't sum. |
| 19 | 7. **Size-aware.** Micro projects (<500 LOC) don't need 10-page reports. Macro projects (>500k LOC) need monorepo decomposition. |
| 20 | 8. **State your limits.** Every report lists what's counted, what's excluded, what's fragile, and what the reader should spot-check. |
| 21 | |
| 22 | If you catch yourself writing a single dollar figure without a range, stop and add one. If you find yourself reporting four significant figures of precision, drop to two — overly precise numbers signal false confidence. |
| 23 | |
| 24 | ## Bundled resources (progressive disclosure) |
| 25 | |
| 26 | Read or execute these on demand — don't pre-load everything. |
| 27 | |
| 28 | **Scripts** (execute, don't read as code): |
| 29 | - `scripts/resolve_outdir.py` — derives the platform-appropriate temp dir for artifacts |
| 30 | - `scripts/count_loc.sh` — LOC count via cloc/tokei/scc with graceful find+wc fallback |
| 31 | - `scripts/compute_dryness.py` — DRYness (ULOC/LOC) via scc |
| 32 | - `scripts/git_signals.sh` — duration, commits, contributors, churn |
| 33 | - `scripts/claude_token_cost.py` — ground-truth token usage + equivalent API cost from session logs |
| 34 | - `scripts/git_session_clustering.py` — fallback Claude-hour estimate when session logs are absent |
| 35 | |
| 36 | **References** (read when the step runs): |
| 37 | - `references/category-rates.md` — category LOC/hr table + quality-signal scoring (Steps 1, 3) |
| 38 | - `references/cocomo-ii.md` — top-down COCOMO II (Step 4) |
| 39 | - `references/function-points.md` — QSM backfiring table (Step 4a) |
| 40 | - `references/locomo.md` — LLM-regeneration counterfactual (Step 4b) |
| 41 | - `references/overhead-multipliers.md` — Step 5 formula |
| 42 | - `references/market-rates.md` — Step 6 query templates + fallback anchors |
| 43 | - `references/team-cost.md` — org overhead + team composition (Steps 7, 8) |
| 44 | - `references/claude-roi.md` — session-aware ROI methodology (Step 9) |
| 45 | - `references/cross-validation.md` — sensitivity + Harvard + Capers Jones (Step 10) |
| 46 | |
| 47 | **Assets** (used verbatim for output): |
| 48 | - `assets/report-template.md` — copy into the generated Markdown report (Step 11) |
| 49 | - `assets/artifact-schema.json` — shape of the JSON artifact (Step 12) |
| 50 | |
| 51 | --- |
| 52 | |
| 53 | ## Workflow — 12 steps |
| 54 | |
| 55 | Copy this checklist and check items off as you complete them: |
| 56 | |
| 57 | ``` |
| 58 | - [ ] Step 0: Pick a strategy (size-aware) |
| 59 | - [ ] Step 1: Measure the codebase (LOC, quality, stack) |
| 60 | - [ ] Step 2: Gather process signals (git) |
| 61 | - [ ] Step 3: Categorize & compute base hours (P10 / P50 / P90) |
| 62 | - [ ] Step 4: Cross-check (COCOMO II + Function Points + LOCOMO) |
| 63 | - [ ] Step 5: Apply overhead multipliers |
| 64 | - [ ] Step 6: Research market rates |
| 65 | - [ ] Step 7: Convert to calendar time |
| 66 | - [ ] Step 8: Compute full-team cost |
| 67 | - [ ] Step 9: Compute Claude ROI |
| 68 | - [ ] Step 10: Sensitivity + cro |