Non-negotiable rules:
- Use the helper scripts under
.agents/skills/cost-estimate/helpers/ instead of redoing LOC,
session, or cost math manually.
- Keep scope explicit: full repo,
branch:<name>, or commit:<hash>.
- Separate raw engineering hours from organizational overhead and team multipliers.
- Keep the pricing rubric and report schema in references, not inline in the invocation path.
- Treat external market-rate research as optional. Use built-in rates unless the user explicitly
requests a different market or region.
Cost Estimate
Inputs
$request: Optional scope or estimation guidance such as branch:feat/foo, commit:abc1234,
region hints, or desired audience
Goal
Produce a credible estimate that:
- measures the requested code scope with the helper scripts
- classifies code into the right productivity buckets
- computes engineering hours and costs without double-counting overhead
- translates that estimate into realistic calendar and team-cost views
- reports assumptions, confidence, and Claude ROI clearly
Step 0: Resolve scope and mode
Parse the request into one of:
- full repository
branch:<name>
commit:<hash>
If the request is ambiguous, infer full repository by default. If the user supplied region or
market hints, carry them into the final rate discussion. Otherwise use the built-in baseline rates.
Success criteria: The estimation target and pricing basis are explicit before running scripts.
Step 1: Measure the real code surface with the helper scripts
Use the helper toolchain in .agents/skills/cost-estimate/helpers/:
loc_counter.py
git_session_analyzer.py
cost_calculator.py
report_generator.py
Run loc_counter.py for the resolved scope to capture:
- total lines
- file counts
- language breakdown
- directory breakdown
- source vs test vs config vs docs
- per-file category candidates from
all_files
Run git_session_analyzer.py when git history is available so Claude ROI can use actual session
estimates rather than LOC fallback.
Rules:
- prefer the script output over ad hoc
find, wc, or inline arithmetic
- if scope is a branch or commit, measure the diff rather than the full repository
- if git history is missing or unhelpful, fall back to LOC-based Claude hour estimates later
Success criteria: You have structured JSON for scope size and, when possible, active-session estimates.
Step 2: Classify the code into productivity buckets
Review the loc_counter.py output and map every relevant source line into exactly one category.
Use references/estimation-rates.md for:
- category keys
- productivity ranges
- overhead ranges
- market-rate baselines
- role multipliers
- organizational efficiency constants
- Claude ROI constants
Classification rules:
- assign each source line once
- keep tests, config/build, and documentation separate from product code
- detect specialized work such as GPU, native interop, audio/video, system extensions, or on-device ML
- do not inflate complexity without file-level evidence
- group files when a directory clearly shares one category, but call out exceptional files separately
Success criteria: There is a complete category-to-line-count JSON payload for the calculator.
Step 3: Run the calculator and sanity-check the output
Pipe the category totals into cost_calculator.py.
The calculator should produce:
- base coding hours
- overhead hours
- total estimated hours
- sanity-check effective lines/hour
- calendar-time tables
- engineering-only cost
- full-team cost
- Claude ROI fields when Claude hours are available
Rules:
- do not bake overhead into the category assignment; the calculator already adds overhead
- if the sanity check falls outside the target range, adjust category assignments or explain why this repo is legitimately outside the norm
- use built-in market rates by default unless the user explicitly requested a different market basis
Success criteria: The calculator output is internally consistent and the sanity check has been reviewed.
Step 4: Refine Claude ROI and confidence
If session data exists, inspect it and adjust only when the default commit-density heuristic is
obviously understating large-scope work. If session data is missing, use the fallback Claude
productivity constant from references/estimation-rates.md.
Report:
- estimated Claude active hours
- speed multiplier vs the baseline human rate
- value per Claude hour
- headline ROI and savings
Also state confidence:
- high when scope, category mix, and history are clean
- medium when history or categorization is incomplete
- low when the request is intentionally approximate or the repo is only partially available
Success criteria: The ROI story is explicit, bounded, and not overstated.
Step 5: Generate the report body
Use report_generator.py to generate the markdown backbone, then refine the narrative where needed.
Load references/report-contract.md for the required report structure and minimum sections.
The final estimate should cover:
- executive summary
- codebase metrics
- development-time estimate
- calendar-time view
- engineering-only cost
- full-team cost
- Claude ROI
- assumptions and caveats
Rules:
- lead with the executive summary and Claude ROI
- keep the report stakeholder-readable, not tool-dump heavy
- mention the scope basis explicitly
- preserve escaped currency formatting when editing prose manually
Success criteria: The estimate is readable, structured, and aligned with the report contract.
Guardrails
- Do not add
disable-model-invocation; this is a read-heavy analysis workflow.
- Do not add
paths:; this is a generic estimation skill.
- Do not keep pricing tables, role matrices, or full report templates inline in
SKILL.md.
- Do not replace helper-script output with manual math unless the helper chain is unavailable.
- Do not present a cost number without the scope, assumptions, and confidence level.
- Do not claim region-specific market validation unless the user explicitly requested it and that research was actually performed.
When To Load References
references/estimation-rates.md
Use for the productivity buckets, overhead rates, market-rate baselines, team multipliers,
efficiency constants, and Claude ROI fallback constants.
references/report-contract.md
Use for the mandatory section order, reporting contract, and required caveats.
Helper Scripts
.agents/skills/cost-estimate/helpers/loc_counter.py
- full repo: no flags
- branch diff:
--branch <name> (optionally --base <base>)
- single commit:
--commit <hash>
- output: JSON with
totals, by_language, by_directory, all_files
.agents/skills/cost-estimate/helpers/git_session_analyzer.py
- all commits: no flags
- specific branch:
--branch <name>
- output: JSON with
total_commits, total_sessions, estimated_active_hours, sessions[]
.agents/skills/cost-estimate/helpers/cost_calculator.py
- input: pipe category JSON on stdin
- flags:
--rate <hourly>, --claude-hours <N>
- valid category keys:
simple_crud_ui_boilerplate, standard_views, complex_ui, business_logic, database_persistence, audio_video_processing, gpu_shader, native_interop, system_extensions, on_device_ml, tests, config_build, documentation
- output: JSON with
base_coding, overhead, total_estimated_hours, sanity_check, calendar_time, engineering_cost, team_costs, claude_roi
.agents/skills/cost-estimate/helpers/report_generator.py
- flags:
--calc <costs.json>, --sessions <sessions.json>, --project <name>, --scope <desc>
- single section:
--section <name>
- available sections:
executive_summary, development_time, calendar_time, engineering_cost, team_cost, grand_total, claude_roi, assumptions
- output: ready-to-paste markdown
Use these directly. The judgment work in this skill is classification, calibration, and explanation,
not reimplementing the scripts.
Output Contract
Report:
- resolved scope and pricing basis
- key repo metrics and complexity drivers
- engineering hours and sanity-check result
- engineering-only and team-cost ranges
- Claude ROI and confidence level
- assumptions, caveats, and any missing-data limitations
1---2name: cost-estimate3description: Estimate what a codebase, branch diff, or single commit would COST to build — evidence-driven, not a guess: measure the real scope with the helper scripts (LOC counter + git session analyzer), classify every source line into one productivity bucket, run the cost calculator for engineering hours, organizational overhead, calendar and team-cost views plus Claude ROI, and sanity-check the effective lines/hour — runs as a forked analysis workflow with its own reasoning budget, isolated from the main flow. Keeps raw engineering hours separate from overhead and team multipliers, never presents a number without scope, assumptions, and a confidence level, and never claims region-specific market rates unless the user asked and that research was actually done. Use when the user asks to estimate development cost, effort, engineering hours, or ROI.4---5
6<EXTREMELY-IMPORTANT>
7This skill is an evidence-driven estimation workflow.
8
9Non-negotiable rules:
101. Use the helper scripts under `.agents/skills/cost-estimate/helpers/` instead of redoing LOC,
11 session, or cost math manually.
122. Keep scope explicit: full repo, `branch:<name>`, or `commit:<hash>`.
133. Separate raw engineering hours from organizational overhead and team multipliers.
144. Keep the pricing rubric and report schema in references, not inline in the invocation path.
155. Treat external market-rate research as optional. Use built-in rates unless the user explicitly
16 requests a different market or region.
17</EXTREMELY-IMPORTANT>
18
19# Cost Estimate
20
21## Inputs
22
23- `$request`: Optional scope or estimation guidance such as `branch:feat/foo`, `commit:abc1234`,
24 region hints, or desired audience
25
26## Goal
27
28Produce a credible estimate that:
29
30- measures the requested code scope with the helper scripts
31- classifies code into the right productivity buckets
32- computes engineering hours and costs without double-counting overhead
33- translates that estimate into realistic calendar and team-cost views
34- reports assumptions, confidence, and Claude ROI clearly
35
36## Step 0: Resolve scope and mode
37
38Parse the request into one of:
39
40- full repository
41- `branch:<name>`
42- `commit:<hash>`
43
44If the request is ambiguous, infer full repository by default. If the user supplied region or
45market hints, carry them into the final rate discussion. Otherwise use the built-in baseline rates.
46
47**Success criteria**: The estimation target and pricing basis are explicit before running scripts.
48
49## Step 1: Measure the real code surface with the helper scripts
50
51Use the helper toolchain in `.agents/skills/cost-estimate/helpers/`:
52
53- `loc_counter.py`
54- `git_session_analyzer.py`
55- `cost_calculator.py`
56- `report_generator.py`
57
58Run `loc_counter.py` for the resolved scope to capture:
59
60- total lines
61- file counts
62- language breakdown
63- directory breakdown
64- source vs test vs config vs docs
65- per-file category candidates from `all_files`
66
67Run `git_session_analyzer.py` when git history is available so Claude ROI can use actual session
68estimates rather than LOC fallback.
69
70Rules:
71
72- prefer the script output over ad hoc `find`, `wc`, or inline arithmetic
73- if scope is a branch or commit, measure the diff rather than the full repository
74- if git history is missing or unhelpful, fall back to LOC-based Claude hour estimates later
75
76**Success criteria**: You have structured JSON for scope size and, when possible, active-session estimates.
77
78## Step 2: Classify the code into productivity buckets
79
80Review the `loc_counter.py` output and map every relevant source line into exactly one category.
81
82Use `references/estimation-rates.md` for:
83
84- category keys
85- productivity ranges
86- overhead ranges
87- market-rate baselines
88- role multipliers
89- organizational efficiency constants
90- Claude ROI constants
91
92Classification rules:
93
94- assign each source line once
95- keep tests, config/build, and documentation separate from product code
96- detect specialized work such as GPU, native interop, audio/video, system extensions, or on-device ML
97- do not inflate complexity without file-level evidence
98- group files when a directory clearly shares one category, but call out exceptional files separately
99
100**Success criteria**: There is a complete category-to-line-count JSON payload for the calculator.
101
102## Step 3: Run the calculator and sanity-check the output
103
104Pipe the category totals into `cost_calculator.py`.
105
106The calculator should produce:
107
108- base coding hours
109- overhead hours
110- total estimated hours
111- sanity-check effective lines/hour
112- calendar-time tables
113- engineering-only cost
114- full-team cost
115- Claude ROI fields when Claude hours are available
116
117Rules:
118
119- do not bake overhead into the category assignment; the calculator already adds overhead
120- if the sanity check falls outside the target range, adjust category assignments or explain why this repo is legitimately outside the norm
121- use built-in market rates by default unless the user explicitly requested a different market basis
122
123**Success criteria**: The calculator output is internally consistent and the sanity check has been reviewed.
124
125## Step 4: Refine Claude ROI and confidence
126
127If session data exists, inspect it and adjust only when the default commit-density heuristic is
128obviously understating large-scope work. If session data is missing, use the fallback Claude
129productivity constant from `references/estimation-rates.md`.
130
131Report:
132
133- estimated Claude active hours
134- speed multiplier vs the baseline human rate
135- value per Claude hour
136- headline ROI and savings
137
138Also state confidence:
139
140- high when scope, category mix, and history are clean
141- medium when history or categorization is incomplete
142- low when the request is intentionally approximate or the repo is only partially available
143
144**Success criteria**: The ROI story is explicit, bounded, and not overstated.
145
146## Step 5: Generate the report body
147
148Use `report_generator.py` to generate the markdown backbone, then refine the narrative where needed.
149
150Load `references/report-contract.md` for the required report structure and minimum sections.
151
152The final estimate should cover:
153
154- executive summary
155- codebase metrics
156- development-time estimate
157- calendar-time view
158- engineering-only cost
159- full-team cost
160- Claude ROI
161- assumptions and caveats
162
163Rules:
164
165- lead with the executive summary and Claude ROI
166- keep the report stakeholder-readable, not tool-dump heavy
167- mention the scope basis explicitly
168- preserve escaped currency formatting when editing prose manually
169
170**Success criteria**: The estimate is readable, structured, and aligned with the report contract.
171
172## Guardrails
173
174- Do not add `disable-model-invocation`; this is a read-heavy analysis workflow.
175- Do not add `paths:`; this is a generic estimation skill.
176- Do not keep pricing tables, role matrices, or full report templates inline in `SKILL.md`.
177- Do not replace helper-script output with manual math unless the helper chain is unavailable.
178- Do not present a cost number without the scope, assumptions, and confidence level.
179- Do not claim region-specific market validation unless the user explicitly requested it and that research was actually performed.
180
181## When To Load References
182
183- `references/estimation-rates.md`
184 Use for the productivity buckets, overhead rates, market-rate baselines, team multipliers,
185 efficiency constants, and Claude ROI fallback constants.
186
187- `references/report-contract.md`
188 Use for the mandatory section order, reporting contract, and required caveats.
189
190## Helper Scripts
191
192- `.agents/skills/cost-estimate/helpers/loc_counter.py`
193 - full repo: no flags
194 - branch diff: `--branch <name>` (optionally `--base <base>`)
195 - single commit: `--commit <hash>`
196 - output: JSON with `totals`, `by_language`, `by_directory`, `all_files`
197
198- `.agents/skills/cost-estimate/helpers/git_session_analyzer.py`
199 - all commits: no flags
200 - specific branch: `--branch <name>`
201 - output: JSON with `total_commits`, `total_sessions`, `estimated_active_hours`, `sessions[]`
202
203- `.agents/skills/cost-estimate/helpers/cost_calculator.py`
204 - input: pipe category JSON on stdin
205 - flags: `--rate <hourly>`, `--claude-hours <N>`
206 - valid category keys: `simple_crud_ui_boilerplate`, `standard_views`, `complex_ui`, `business_logic`, `database_persistence`, `audio_video_processing`, `gpu_shader`, `native_interop`, `system_extensions`, `on_device_ml`, `tests`, `config_build`, `documentation`
207 - output: JSON with `base_coding`, `overhead`, `total_estimated_hours`, `sanity_check`, `calendar_time`, `engineering_cost`, `team_costs`, `claude_roi`
208
209- `.agents/skills/cost-estimate/helpers/report_generator.py`
210 - flags: `--calc <costs.json>`, `--sessions <sessions.json>`, `--project <name>`, `--scope <desc>`
211 - single section: `--section <name>`
212 - available sections: `executive_summary`, `development_time`, `calendar_time`, `engineering_cost`, `team_cost`, `grand_total`, `claude_roi`, `assumptions`
213 - output: ready-to-paste markdown
214
215Use these directly. The judgment work in this skill is classification, calibration, and explanation,
216not reimplementing the scripts.
217
218## Output Contract
219
220Report:
221
2221. resolved scope and pricing basis
2232. key repo metrics and complexity drivers
2243. engineering hours and sanity-check result
2254. engineering-only and team-cost ranges
2265. Claude ROI and confidence level
2276. assumptions, caveats, and any missing-data limitations