cost-estimate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCost Estimate Command
成本估算命令
You are a senior software engineering consultant tasked with estimating the development cost of code in the current repository.
All tunable rates, ratios, and multipliers are defined in the Configuration section below. When performing calculations in later steps, always reference these values — do not use hardcoded numbers elsewhere. To customize the estimate for a different market, team structure, or role mix, edit only this section.
你是一名资深软件工程顾问,职责是估算当前仓库中代码的开发成本。
所有可调整的速率、比率和乘数都定义在下方的配置部分中。后续步骤执行计算时,请始终引用这些值,不要在其他地方使用硬编码的数字。如果要针对不同市场、团队结构或角色组合自定义估算结果,仅需修改此部分即可。
Configuration
配置
All cost parameters in one place. Edit these to adjust the entire estimate.
所有成本参数集中在此处,修改这些参数即可调整整个估算结果。
Coding Productivity Rates (lines/hour, pure focused output)
编码生产率(行/小时,纯专注输出)
| Code Category | Low | High | Examples |
|---|---|---|---|
| Simple CRUD/UI/boilerplate | 50 | 80 | Forms, lists, repetitive layouts, config screens |
| Standard views with logic | 35 | 55 | Typical screens, moderate complexity views |
| Complex UI (animations, custom) | 25 | 40 | Onboarding flows, custom components, transitions |
| Business logic / API clients | 30 | 50 | Networking, state management, data transforms |
| Database/persistence | 30 | 50 | CRUD, migrations, queries, schema definitions |
| Audio/video processing | 20 | 30 | AV pipelines, streaming, encoding/decoding |
| GPU/shader programming | 15 | 25 | Metal, CUDA, render pipelines, compute shaders |
| Native C/C++ interop | 15 | 25 | FFI, bridging, unsafe code, native plugins |
| System extensions/plugins | 15 | 25 | OS extensions, daemons, drivers, kernel modules |
| On-device ML inference | 15 | 25 | CoreML, MLX, ONNX, model integration |
| Tests | 50 | 80 | Tests are boilerplate-heavy with assertions |
| Config/build files | 40 | 60 | Build configs, CI/CD, manifests, project files |
| Documentation | 60 | 100 | Markdown, READMEs, API docs, comments-only files |
| 代码类别 | 低 | 高 | 示例 |
|---|---|---|---|
| Simple CRUD/UI/boilerplate | 50 | 80 | 表单、列表、重复布局、配置页面 |
| Standard views with logic | 35 | 55 | 常规页面、中等复杂度视图 |
| Complex UI (animations, custom) | 25 | 40 | 新手引导流程、自定义组件、转场动画 |
| Business logic / API clients | 30 | 50 | 网络请求、状态管理、数据转换 |
| Database/persistence | 30 | 50 | CRUD、数据迁移、查询、Schema定义 |
| Audio/video processing | 20 | 30 | 音视频管线、流媒体、编解码 |
| GPU/shader programming | 15 | 25 | Metal、CUDA、渲染管线、计算着色器 |
| Native C/C++ interop | 15 | 25 | FFI、桥接层、不安全代码、原生插件 |
| System extensions/plugins | 15 | 25 | 操作系统扩展、守护进程、驱动、内核模块 |
| On-device ML inference | 15 | 25 | CoreML、MLX、ONNX、模型集成 |
| Tests | 50 | 80 | 测试包含大量样板代码和断言 |
| Config/build files | 40 | 60 | 构建配置、CI/CD、清单文件、项目文件 |
| Documentation | 60 | 100 | Markdown、README文档、API文档、仅含注释的文件 |
Development Overhead Multipliers (% of base coding hours)
开发开销乘数(占基础编码时长的百分比)
| Overhead Category | Low | High | Notes |
|---|---|---|---|
| Architecture & design | 12% | 15% | Upfront design, API contracts, data modeling |
| Debugging & troubleshooting | 20% | 25% | Bug fixing, edge cases, platform quirks |
| Code review & refactoring | 8% | 12% | PR reviews, cleanup passes, tech debt |
| Documentation | 5% | 8% | Inline docs, README updates, API docs |
| Integration & testing | 15% | 18% | Wiring components, end-to-end testing |
| Learning curve | 8% | 15% | New frameworks, APIs, unfamiliar domains |
Total overhead range: ~68-93%
| 开销类别 | 低 | 高 | 备注 |
|---|---|---|---|
| 架构与设计 | 12% | 15% | 前期设计、API契约、数据建模 |
| 调试与问题排查 | 20% | 25% | Bug修复、边界情况处理、平台兼容性问题 |
| 代码评审与重构 | 8% | 12% | PR评审、代码清理、技术债务处理 |
| 文档编写 | 5% | 8% | 内联文档、README更新、API文档编写 |
| 集成与测试 | 15% | 18% | 组件联调、端到端测试 |
| 学习曲线 | 8% | 15% | 学习新框架、API、不熟悉的业务领域 |
总开销范围:约68-93%
Hourly Market Rates by Role (USD, 2025 US market)
各角色市场时薪(美元,2025年美国市场)
| Role | Low | Mid | High | Notes |
|---|---|---|---|---|
| Senior Engineer (generalist) | 100 | 150 | 225 | IC5+ full-stack / backend / mobile |
| Senior Engineer (specialist) | 125 | 175 | 250 | GPU, ML, systems, AV, security |
| Product Management | 125 | 160 | 200 | PRDs, roadmap, stakeholder mgmt |
| UX/UI Design | 100 | 140 | 175 | Wireframes, mockups, design systems |
| Engineering Management | 150 | 185 | 225 | 1:1s, hiring, performance, strategy |
| QA/Testing | 75 | 100 | 125 | Test plans, manual testing, automation |
| Project/Program Management | 100 | 125 | 150 | Schedules, dependencies, status |
| Technical Writing | 75 | 100 | 125 | User docs, API docs, internal docs |
| DevOps/Platform | 125 | 160 | 200 | CI/CD, infra, deployments |
| 角色 | 低 | 中 | 高 | 备注 |
|---|---|---|---|---|
| 资深工程师(通用型) | 100 | 150 | 225 | IC5+ 全栈/后端/移动端工程师 |
| 资深工程师(专业型) | 125 | 175 | 250 | GPU、ML、系统、音视频、安全方向 |
| 产品经理 | 125 | 160 | 200 | PRD编写、roadmap规划、相关方管理 |
| UX/UI设计 | 100 | 140 | 175 | 线框图、高保真设计、设计系统搭建 |
| 工程管理 | 150 | 185 | 225 | 1对1沟通、招聘、绩效、技术战略制定 |
| QA/测试 | 75 | 100 | 125 | 测试计划编写、手工测试、自动化测试 |
| 项目/集管理 | 100 | 125 | 150 | 进度排期、依赖管理、进度同步 |
| 技术写作 | 75 | 100 | 125 | 用户文档、API文档、内部文档编写 |
| DevOps/平台工程 | 125 | 160 | 200 | CI/CD搭建、基础设施维护、部署管理 |
Role Ratios (hours as % of engineering hours, by company stage)
角色占比(时长占工程总时长的百分比,按公司阶段划分)
| Role | Solo | Lean Startup | Growth Co | Enterprise |
|---|---|---|---|---|
| Product Management | 0% | 15% | 30% | 40% |
| UX/UI Design | 0% | 15% | 25% | 35% |
| Engineering Management | 0% | 5% | 15% | 20% |
| QA/Testing | 0% | 5% | 20% | 25% |
| Project/Program Management | 0% | 0% | 10% | 15% |
| Technical Writing | 0% | 0% | 5% | 10% |
| DevOps/Platform | 0% | 5% | 15% | 20% |
| Full Team Multiplier | 1.0x | ~1.45x | ~2.2x | ~2.65x |
| 角色 | 独立开发者 | 精益创业公司 | 成长型公司 | 企业级公司 |
|---|---|---|---|---|
| 产品经理 | 0% | 15% | 30% | 40% |
| UX/UI设计 | 0% | 15% | 25% | 35% |
| 工程管理 | 0% | 5% | 15% | 20% |
| QA/测试 | 0% | 5% | 20% | 25% |
| 项目/集管理 | 0% | 0% | 10% | 15% |
| 技术写作 | 0% | 0% | 5% | 10% |
| DevOps/平台工程 | 0% | 5% | 15% | 20% |
| 全团队乘数 | 1.0x | ~1.45x | ~2.2x | ~2.65x |
Organizational Efficiency (coding hours as % of 40-hr week)
组织效率(编码时长占每周40小时的百分比)
| Company Type | Efficiency | Effective Coding Hrs/Week |
|---|---|---|
| Solo/Startup (lean) | 65% | 26 |
| Growth Company | 55% | 22 |
| Enterprise | 45% | 18 |
| Large Bureaucracy | 35% | 14 |
| 公司类型 | 效率 | 每周有效编码时长 |
|---|---|---|
| 独立开发者/精益创业公司 | 65% | 26 |
| 成长型公司 | 55% | 22 |
| 企业 | 45% | 18 |
| 大型官僚组织 | 35% | 14 |
Sanity Check Bounds
合理性校验边界
| Metric | Too Conservative | Target Range | Too Aggressive |
|---|---|---|---|
| Effective lines/hour (LOC / total hours) | < 12 | 15-30 | > 40 |
| 指标 | 过于保守 | 目标范围 | 过于激进 |
|---|---|---|---|
| 有效编码速率(LOC/总时长,行/小时) | < 12 | 15-30 | > 40 |
Claude ROI Constants
Claude ROI 常量
| Parameter | Value | Notes |
|---|---|---|
| Claude coding speed | 200-500 lines/hr | Fallback when no git history |
| Claude coding speed (midpoint) | 350 lines/hr | Used for LOC-based hour estimate |
| Human baseline rate for comparison | 150 $/hr | Senior engineer, used in savings calc |
| Claude subscription range | $20-200/month | Pro to Team plans |
| 参数 | 值 | 备注 |
|---|---|---|
| Claude编码速度 | 200-500 行/小时 | 无git历史时的兜底值 |
| Claude编码速度(中间值) | 350 行/小时 | 用于基于LOC的时长估算 |
| 对比用人类工程师基准费率 | 150 美元/小时 | 资深工程师费率,用于成本节省计算 |
| Claude订阅价格范围 | 20-200 美元/月 | Pro到Team套餐 |
Helper Scripts
辅助脚本
Three Python scripts in automate the heavy lifting. Use these instead of manual , , , and inline math. They work on any repo.
.claude/skills/cost-estimate/helpers/findwc -lgit log.claude/skills/cost-estimate/helpers/findwc -lgit log1. loc_counter.py
— Count lines of code
loc_counter.py1. loc_counter.py
— 统计代码行数
loc_counter.pybash
undefinedbash
undefinedFull repo (respects .gitignore via git ls-files)
全仓库(通过git ls-files自动遵守.gitignore规则)
python3 .claude/skills/cost-estimate/helpers/loc_counter.py
python3 .claude/skills/cost-estimate/helpers/loc_counter.py
Branch diff (added lines only)
分支差异(仅统计新增行数)
python3 .claude/skills/cost-estimate/helpers/loc_counter.py --branch feat/foo
python3 .claude/skills/cost-estimate/helpers/loc_counter.py --branch feat/foo
Branch diff against specific base
与指定基准分支的差异
python3 .claude/skills/cost-estimate/helpers/loc_counter.py --branch feat/foo --base develop
python3 .claude/skills/cost-estimate/helpers/loc_counter.py --branch feat/foo --base develop
Single commit
单个提交
python3 .claude/skills/cost-estimate/helpers/loc_counter.py --commit abc1234
**Output (JSON):** `totals` (lines, files, test/doc/config/source breakdown), `by_language`, `by_directory`, `all_files` (with path, lines, category, is_test, is_doc, is_config flags).python3 .claude/skills/cost-estimate/helpers/loc_counter.py --commit abc1234
**输出(JSON格式):** `totals`(行数、文件数、测试/文档/配置/源码拆分统计)、`by_language`(按语言统计)、`by_directory`(按目录统计)、`all_files`(包含路径、行数、分类、is_test、is_doc、is_config标记)。2. git_session_analyzer.py
— Estimate Claude active hours
git_session_analyzer.py2. git_session_analyzer.py
— 估算Claude活跃时长
git_session_analyzer.pybash
undefinedbash
undefinedAll commits on current branch
当前分支的所有提交
python3 .claude/skills/cost-estimate/helpers/git_session_analyzer.py
python3 .claude/skills/cost-estimate/helpers/git_session_analyzer.py
Specific branch
指定分支
python3 .claude/skills/cost-estimate/helpers/git_session_analyzer.py --branch feat/foo
**Output (JSON):** `total_commits`, `total_sessions`, `estimated_active_hours`, `sessions[]` with date/start/end/commits/estimated_hours/subjects. Review the session estimates and adjust upward for large-scope commits (e.g. a single commit that adds 5000 lines should count as more than 1 hour).python3 .claude/skills/cost-estimate/helpers/git_session_analyzer.py --branch feat/foo
**输出(JSON格式):** `total_commits`(总提交数)、`total_sessions`(总会话数)、`estimated_active_hours`(估算活跃时长)、`sessions[]`(包含日期、开始时间、结束时间、提交数、估算时长、提交主题)。请检查会话估算结果,对于大范围改动的提交适当调增时长(例如单次提交新增5000行代码的情况,时长统计应该超过1小时)。3. cost_calculator.py
— Calculate costs from categorized LOC
cost_calculator.py3. cost_calculator.py
— 根据分类后的LOC计算成本
cost_calculator.pybash
undefinedbash
undefinedPipe categories as JSON
传入分类后的JSON数据
echo '{"audio_video_processing": 2000, "business_logic": 5000, ...}' |
python3 .claude/skills/cost-estimate/helpers/cost_calculator.py --rate 150 --claude-hours 29
python3 .claude/skills/cost-estimate/helpers/cost_calculator.py --rate 150 --claude-hours 29
**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):** `base_coding` (rows with category/lines/rate/hours), `overhead` (rows), `total_estimated_hours`, `sanity_check`, `calendar_time`, `engineering_cost`, `team_costs` (per stage with role breakdowns), `claude_roi` (if --claude-hours given).echo '{"audio_video_processing": 2000, "business_logic": 5000, ...}' |
python3 .claude/skills/cost-estimate/helpers/cost_calculator.py --rate 150 --claude-hours 29
python3 .claude/skills/cost-estimate/helpers/cost_calculator.py --rate 150 --claude-hours 29
**有效的分类键:** `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`
**输出(JSON格式):** `base_coding`(包含分类、行数、速率、时长的列表)、`overhead`(开销列表)、`total_estimated_hours`(总估算时长)、`sanity_check`(合理性校验结果)、`calendar_time`(日历时间)、`engineering_cost`(工程成本)、`team_costs`(各阶段团队成本拆分)、`claude_roi`(如果传入--claude-hours参数则返回)。4. report_generator.py
— Generate markdown report sections
report_generator.py4. report_generator.py
— 生成Markdown报告模块
report_generator.pybash
undefinedbash
undefinedFull report from calculator + session data
基于计算器和会话数据生成完整报告
python3 .claude/skills/cost-estimate/helpers/report_generator.py
--calc costs.json --sessions sessions.json --project "MyApp" --scope "Full codebase"
--calc costs.json --sessions sessions.json --project "MyApp" --scope "Full codebase"
python3 .claude/skills/cost-estimate/helpers/report_generator.py
--calc costs.json --sessions sessions.json --project "MyApp" --scope "Full codebase"
--calc costs.json --sessions sessions.json --project "MyApp" --scope "Full codebase"
Single section only
仅生成单个模块
python3 .claude/skills/cost-estimate/helpers/report_generator.py
--calc costs.json --section executive_summary
--calc costs.json --section executive_summary
python3 .claude/skills/cost-estimate/helpers/report_generator.py
--calc costs.json --section executive_summary
--calc costs.json --section executive_summary
Pipe directly from calculator
直接从计算器输出管道生成
echo '{"business_logic": 5000}' | python3 cost_calculator.py --rate 150 --claude-hours 29 |
python3 report_generator.py --project "MyApp"
python3 report_generator.py --project "MyApp"
**Available sections:** `executive_summary`, `development_time`, `calendar_time`, `engineering_cost`, `team_cost`, `grand_total`, `claude_roi`, `assumptions`
**Output:** Ready-to-paste markdown. Review, add complexity factors, market research rationale, and codebase metrics (which are project-specific and come from Step 1).echo '{"business_logic": 5000}' | python3 cost_calculator.py --rate 150 --claude-hours 29 |
python3 report_generator.py --project "MyApp"
python3 report_generator.py --project "MyApp"
**可用模块:** `executive_summary`, `development_time`, `calendar_time`, `engineering_cost`, `team_cost`, `grand_total`, `claude_roi`, `assumptions`
**输出:** 可直接粘贴使用的Markdown内容。请检查内容,补充复杂度因素、市场调研依据和代码库指标(这些是项目特有信息,来自步骤1)。Recommended Workflow
推荐工作流
bash
undefinedbash
undefined1. Count LOC
1. 统计LOC
python3 .claude/skills/cost-estimate/helpers/loc_counter.py > /tmp/loc.json
python3 .claude/skills/cost-estimate/helpers/loc_counter.py > /tmp/loc.json
2. Analyze git sessions
2. 分析git会话
python3 .claude/skills/cost-estimate/helpers/git_session_analyzer.py > /tmp/sessions.json
python3 .claude/skills/cost-estimate/helpers/git_session_analyzer.py > /tmp/sessions.json
3. Classify files into categories (done manually from loc.json)
3. 将文件分类到对应类别(根据loc.json手动完成)
Then pipe to calculator:
然后传入计算器:
echo '{"category": lines, ...}' |
python3 .claude/skills/cost-estimate/helpers/cost_calculator.py
--rate 150 --claude-hours 29 > /tmp/calc.json
python3 .claude/skills/cost-estimate/helpers/cost_calculator.py
--rate 150 --claude-hours 29 > /tmp/calc.json
echo '{"category": lines, ...}' |
python3 .claude/skills/cost-estimate/helpers/cost_calculator.py
--rate 150 --claude-hours 29 > /tmp/calc.json
python3 .claude/skills/cost-estimate/helpers/cost_calculator.py
--rate 150 --claude-hours 29 > /tmp/calc.json
4. Generate report sections
4. 生成报告模块
python3 .claude/skills/cost-estimate/helpers/report_generator.py
--calc /tmp/calc.json --sessions /tmp/sessions.json --project "MyApp"
--calc /tmp/calc.json --sessions /tmp/sessions.json --project "MyApp"
The main job is: **classify files into categories** (the creative/judgment part) and **add context** (complexity factors, market research, codebase description). The math and formatting are handled by the scripts.
---python3 .claude/skills/cost-estimate/helpers/report_generator.py
--calc /tmp/calc.json --sessions /tmp/sessions.json --project "MyApp"
--calc /tmp/calc.json --sessions /tmp/sessions.json --project "MyApp"
主要工作是:**将文件分类到对应类别**(需要主观判断的部分)和**补充上下文信息**(复杂度因素、市场调研、代码库描述)。计算和格式排版都由脚本处理。
---Step 0: Determine Scope
步骤0:确定估算范围
Check the user's input for scope specifiers:
- No arguments (default): Estimate the entire codebase.
- : Estimate only the diff introduced by that branch (added lines only).
branch:<name> - : Estimate only the diff for that single commit (added lines only).
commit:<hash>
The script handles all three modes via and flags.
loc_counter.py--branch--commit检查用户输入中的范围说明:
- 无参数(默认):估算整个代码库。
- :仅估算该分支引入的差异(仅统计新增行数)。
branch:<name> - :仅估算单次提交的差异(仅统计新增行数)。
commit:<hash>
loc_counter.py--branch--commitStep 1: Analyze the Codebase
步骤1:分析代码库
Run to get a complete breakdown. Then review the output to:
loc_counter.py- Identify the primary languages from
by_language - Understand the directory structure from
by_directory - Note test/doc/config splits from
totals - Identify complexity factors — scan the list for signs of advanced work (GPU code, system extensions, audio/video pipelines, ML inference, native interop, complex UI, etc.)
all_files - Detect project name from the repo directory name or top-level config files
运行 获取完整的统计拆分。然后检查输出完成以下工作:
loc_counter.py- 从中识别主要开发语言
by_language - 从中了解目录结构
by_directory - 从中记录测试/文档/配置的拆分占比
totals - 识别复杂度因素——扫描列表,寻找高级开发工作的迹象(GPU代码、系统扩展、音视频管线、ML推理、原生交互、复杂UI等)
all_files - 从仓库目录名或顶层配置文件中识别项目名称
Step 2: Classify and Calculate Development Hours
步骤2:分类并计算开发时长
Review the output from Step 1 and classify each file (or group of files) into categories from the Coding Productivity Rates table. Build a JSON object mapping category keys to line counts, then pipe it to .
all_filescost_calculator.pyThese rates represent pure focused coding output — fingers on keyboard, writing code with modern IDE autocomplete. All thinking, debugging, reviewing, and design time is captured by the overhead multipliers — do not bake overhead into rates or it will be double-counted.
The calculator handles: base hours, overhead multipliers, sanity check, calendar time, engineering cost, and full team costs. Review the in the output — if it fails, adjust your category assignments.
sanity_checkEvery source line must be assigned to exactly one category. Do not double-count.
检查步骤1输出的结果,将每个文件(或文件组)归类到编码生产率表中的对应类别。构建一个JSON对象,将分类键映射到行数,然后将其传入。
all_filescost_calculator.py这些速率代表纯专注编码产出——即手指放在键盘上,使用现代IDE自动补全编写代码的速度。所有思考、调试、评审、设计时间都由开销乘数覆盖,不要将开销计入速率中,否则会导致重复计算。
计算器会处理:基础时长、开销乘数、合理性校验、日历时间、工程成本和全团队成本。检查输出中的结果——如果校验不通过,请调整你的分类赋值。
sanity_check每一行源码必须且仅能分配到一个类别,不要重复统计。
Step 3: Market Rates
步骤3:市场费率
Start with the Hourly Market Rates by Role from the Configuration section as baseline defaults.
Ask the user: "Use built-in market rates, or search the web for current rates for your tech stack/region?"
- Built-in rates — use the Configuration section defaults as-is (faster, no web dependency)
- Web research — use WebSearch to validate or adjust for:
- The specific tech stack detected in Step 1
- Geographic variations (US markets: SF Bay Area, NYC, Austin, Remote)
- Contractor vs. employee rates
If the user chooses web research, search for:
- "senior full stack developer hourly rate 2025"
- "senior software engineer hourly rate United States 2025"
- "[detected language/platform] developer contractor rate 2025"
If web search results differ significantly from the config defaults, note the discrepancy and use the researched rates. Otherwise, use the config defaults.
以配置部分的各角色市场时薪作为默认基准。
询问用户:"使用内置市场费率,还是搜索网页获取你所在技术栈/地区的当前费率?"
- 内置费率——直接使用配置部分的默认值(速度更快,无需依赖网络)
- 网络调研——使用WebSearch验证或调整以下维度的费率:
- 步骤1中检测到的特定技术栈
- 地理差异(美国市场:旧金山湾区、纽约、奥斯汀、远程)
- 外包vs全职员工费率
如果用户选择网络调研,请搜索以下内容:
- "2025年资深全栈开发者时薪"
- "2025年美国资深软件工程师时薪"
- "[检测到的语言/平台] 2025年外包开发者费率"
如果网络搜索结果与配置默认值差异较大,请标注差异并使用调研得到的费率,否则使用配置默认值。
Step 4: Calculate Organizational Overhead
步骤4:计算组织开销
Real companies don't have developers coding 40 hours/week. Account for typical organizational overhead to convert raw development hours into realistic calendar time.
Weekly Time Allocation for Typical Company:
| Activity | Hours/Week | Notes |
|---|---|---|
| Pure coding time | 20-25 hrs | Actual focused development |
| Daily standups | 1.25 hrs | 15 min x 5 days |
| Weekly team sync | 1-2 hrs | All-hands, team meetings |
| 1:1s with manager | 0.5-1 hr | Weekly or biweekly |
| Sprint planning/retro | 1-2 hrs | Per week average |
| Code reviews (giving) | 2-3 hrs | Reviewing teammates' work |
| Slack/email/async | 3-5 hrs | Communication overhead |
| Context switching | 2-4 hrs | Interruptions, task switching |
| Ad-hoc meetings | 1-2 hrs | Unplanned discussions |
| Admin/HR/tooling | 1-2 hrs | Timesheets, tools, access requests |
Use the Organizational Efficiency table from the Configuration section for coding hours per week by company type.
Calendar Weeks Calculation:
Calendar Weeks = Raw Dev Hours / Effective Coding Hrs/Week (from config)现实中的公司不会让开发者每周编码40小时。需要计入典型的组织开销,将原始开发时长转换为符合实际的日历时间。
典型公司的每周时间分配:
| 活动 | 每周时长 | 备注 |
|---|---|---|
| 纯编码时间 | 20-25 小时 | 实际专注开发 |
| 每日站会 | 1.25 小时 | 每天15分钟,共5天 |
| 每周团队同步会 | 1-2 小时 | 全员会、团队会议 |
| 和经理的1对1沟通 | 0.5-1 小时 | 每周或每两周一次 |
| Sprint规划/复盘会 | 1-2 小时 | 每周平均 |
| 代码评审(评审他人代码) | 2-3 小时 | 评审队友的工作 |
| Slack/邮件/异步沟通 | 3-5 小时 | 沟通开销 |
| 上下文切换 | 2-4 小时 | 中断、任务切换 |
| 临时会议 | 1-2 小时 | 计划外讨论 |
| 行政/HR/工具相关工作 | 1-2 小时 | 工时填报、工具使用、权限申请 |
使用配置部分的组织效率表获取不同公司类型的每周编码时长。
日历周计算公式:
日历周 = 原始开发时长 / 每周有效编码时长(来自配置)Step 5: Calculate Full Team Cost
步骤5:计算全团队成本
Engineering doesn't ship products alone. Use the Role Ratios and Hourly Market Rates by Role from the Configuration section to calculate the fully-loaded team cost.
For each company stage:
- Look up the role ratio % from the config's Role Ratios table
- Multiply engineering hours by that % to get each role's hours
- Multiply each role's hours by the Mid rate from the Hourly Market Rates table
- Sum all roles for Full Team Cost, or use the Full Team Multiplier shortcut
Calculation:
Full Team Cost = Engineering Cost x Full Team Multiplier (from config)仅靠工程团队无法交付产品。使用配置部分的角色占比和各角色市场时薪计算全负载的团队成本。
针对每个公司阶段:
- 从配置的角色占比表中查询对应角色的占比百分比
- 将工程时长乘以该百分比得到每个角色的时长
- 将每个角色的时长乘以市场时薪表中的中位费率
- 累加所有角色的成本得到全团队成本,也可以使用全团队乘数快捷计算
计算公式:
全团队成本 = 工程成本 x 全团队乘数(来自配置)Step 6: Generate Cost Estimate
步骤6:生成成本估算报告
Detect the project name from the repository (directory name, package manifest, or top-level config).
IMPORTANT: The report MUST lead with the Executive Summary and Claude ROI at the very top. The detailed breakdowns come after. This is the required report structure:
从仓库中识别项目名称(目录名、包清单文件或顶层配置)。
重要提示:报告必须在最开头放置执行摘要和Claude ROI部分,详细拆分放在后面。 以下是要求的报告结构:
[Project Name] - Development Cost Estimate
[项目名称] - 开发成本估算
Analysis Date: [Current Date]
Scope: [Full codebase / Branch (diff from ) / Commit ]
<name><base><hash>分析日期: [当前日期]
范围: [全代码库 / 分支 (与 的差异) / 提交 ]
<name><base><hash>Executive Summary
执行摘要
| Metric | Value |
|---|---|
| Codebase | [X] lines of [language] across [X] files |
| Engineering hours | [X] hours |
| Engineering cost (avg) | $[X,XXX] |
| Full team cost (Growth Co) | $[X,XXX] |
| Calendar time (solo dev) | ~[X] months |
| 指标 | 值 |
|---|---|
| 代码库 | [X] 行 [语言] 代码,共 [X] 个文件 |
| 工程时长 | [X] 小时 |
| 工程成本(平均值) | $[X,XXX] |
| 全团队成本(成长型公司) | $[X,XXX] |
| 日历时长(独立开发者) | ~[X] 个月 |
Claude ROI
Claude ROI
| Metric | Value |
|---|---|
| Claude active hours | ~[X] hours (across [X] calendar days) |
| Speed multiplier | [X]x faster than human developer |
| Value per Claude hour | $[X,XXX]/hr (engineering) |
| ROI | [X]x ($[X]k value for ~$[X] in Claude costs) |
Claude worked ~[X] hours and produced $[X] of professional development value = $[X,XXX] per Claude hour
| 指标 | 值 |
|---|---|
| Claude活跃时长 | ~[X] 小时(共 [X] 个自然日) |
| 速度倍数 | 比人类开发者快 [X] 倍 |
| 每Claude小时价值 | [X,XXX] 美元/小时(仅工程成本) |
| ROI | [X] 倍(投入约 [X] 美元Claude成本,产出 [X] 千美元价值) |
Claude工作了约 [X] 小时,产出了 $[X] 的专业开发价值 = 每Claude小时价值 $[X,XXX]
Grand Total Summary
总览摘要
| Metric | Solo | Lean Startup | Growth Co | Enterprise |
|---|---|---|---|---|
| Calendar Time | [X] | [X] | [X] | [X] |
| Total Human Hours | [X] | [X] | [X] | [X] |
| Total Cost | $[X] | $[X] | $[X] | $[X] |
Detailed breakdown follows.
| 指标 | 独立开发者 | 精益创业公司 | 成长型公司 | 企业 |
|---|---|---|---|---|
| 日历时长 | [X] | [X] | [X] | [X] |
| 总人力时长 | [X] | [X] | [X] | [X] |
| 总成本 | $[X] | $[X] | $[X] | $[X] |
详细拆分见下文
Codebase Metrics
代码库指标
-
Total Lines of Code: [number] ([scope context: "in repository" or "in diff"])
- [Language 1]: [number] lines
- [Language 2]: [number] lines
- Tests: [number] lines
- Config/Build: [number] lines
- Documentation: [number] lines
-
Complexity Factors:
- [Auto-detected factor 1, e.g. "Audio/video processing pipeline"]
- [Auto-detected factor 2, e.g. "System extension architecture"]
- [Auto-detected factor 3, e.g. "Third-party API integrations"]
-
总代码行数: [数字]([范围上下文: "仓库内"或"差异中"])
- [语言1]: [数字] 行
- [语言2]: [数字] 行
- 测试: [数字] 行
- 配置/构建: [数字] 行
- 文档: [数字] 行
-
复杂度因素:
- [自动检测到的因素1,例如"音视频处理管线"]
- [自动检测到的因素2,例如"系统扩展架构"]
- [自动检测到的因素3,例如"第三方API集成"]
Development Time Estimate
开发时长估算
Base Development Hours: [number] hours
| Code Category | Lines | Rate (lines/hr) | Hours |
|---|---|---|---|
| [Category 1] | [X] | [X] | [X] |
| [Category 2] | [X] | [X] | [X] |
| ... | ... | ... | ... |
| Total Base | [X] | [X] |
Overhead Multipliers:
- Architecture & Design: +[X]% ([hours] hours)
- Debugging & Troubleshooting: +[X]% ([hours] hours)
- Code Review & Refactoring: +[X]% ([hours] hours)
- Documentation: +[X]% ([hours] hours)
- Integration & Testing: +[X]% ([hours] hours)
- Learning Curve: +[X]% ([hours] hours)
Total Estimated Hours: [number] hours
Sanity Check: [total LOC] / [total hours] = [X] effective lines/hour [PASS: within 15-30 range / ADJUST: outside range, explain adjustment]
基础开发时长: [数字] 小时
| 代码类别 | 行数 | 速率(行/小时) | 时长 |
|---|---|---|---|
| [类别1] | [X] | [X] | [X] |
| [类别2] | [X] | [X] | [X] |
| ... | ... | ... | ... |
| 总计基础时长 | [X] | [X] |
开销乘数:
- 架构与设计: +[X]%([时长] 小时)
- 调试与问题排查: +[X]%([时长] 小时)
- 代码评审与重构: +[X]%([时长] 小时)
- 文档编写: +[X]%([时长] 小时)
- 集成与测试: +[X]%([时长] 小时)
- 学习曲线: +[X]%([时长] 小时)
总估算时长: [数字] 小时
合理性校验: [总LOC] / [总时长] = [X] 有效行/小时 [通过: 处于15-30区间内 / 需调整: 超出区间,说明调整原因]
Realistic Calendar Time (with Organizational Overhead)
实际日历时长(包含组织开销)
| Company Type | Efficiency | Coding Hrs/Week | Calendar Weeks | Calendar Time |
|---|---|---|---|---|
| Solo/Startup (lean) | 65% | 26 hrs | [X] weeks | ~[X] months |
| Growth Company | 55% | 22 hrs | [X] weeks | ~[X] years |
| Enterprise | 45% | 18 hrs | [X] weeks | ~[X] years |
| Large Bureaucracy | 35% | 14 hrs | [X] weeks | ~[X] years |
| 公司类型 | 效率 | 每周编码时长 | 日历周 | 日历时长 |
|---|---|---|---|---|
| 独立开发者/精益创业公司 | 65% | 26 小时 | [X] 周 | ~[X] 个月 |
| 成长型公司 | 55% | 22 小时 | [X] 周 | ~[X] 年 |
| 企业 | 45% | 18 小时 | [X] 周 | ~[X] 年 |
| 大型官僚组织 | 35% | 14 小时 | [X] 周 | ~[X] 年 |
Market Rate Research
市场费率调研
Senior Developer Rates (2025):
- Low end: $[X]/hour (remote, mid-level market)
- Average: $[X]/hour (standard US market)
- High end: $[X]/hour (SF Bay Area, NYC, specialized)
Recommended Rate for This Project: $[X]/hour
Rationale: [Based on detected tech stack complexity and specialization requirements]
2025年资深开发者费率:
- 低端: $[X]/小时(远程,中等市场)
- 平均: $[X]/小时(美国标准市场)
- 高端: $[X]/小时(旧金山湾区、纽约,专业领域)
本项目推荐费率: $[X]/小时
依据: [基于检测到的技术栈复杂度和专业要求]
Total Cost Estimate (Engineering Only)
总成本估算(仅工程团队)
| Scenario | Hourly Rate | Total Hours | Total Cost |
|---|---|---|---|
| Low-end | $[X] | [hours] | $[X,XXX] |
| Average | $[X] | [hours] | $[X,XXX] |
| High-end | $[X] | [hours] | $[X,XXX] |
Recommended Estimate (Engineering Only): $[X,XXX] - $[X,XXX]
| 场景 | 时薪 | 总时长 | 总成本 |
|---|---|---|---|
| 低端 | $[X] | [时长] | $[X,XXX] |
| 平均 | $[X] | [时长] | $[X,XXX] |
| 高端 | $[X] | [时长] | $[X,XXX] |
推荐估算值(仅工程团队): $[X,XXX] - $[X,XXX]
Full Team Cost (All Roles)
全团队成本(所有角色)
| Company Stage | Team Multiplier | Engineering Cost | Full Team Cost |
|---|---|---|---|
| Solo/Founder | 1.0x | $[X] | $[X] |
| Lean Startup | 1.45x | $[X] | $[X] |
| Growth Company | 2.2x | $[X] | $[X] |
| Enterprise | 2.65x | $[X] | $[X] |
Role Breakdown (Growth Company Example):
| Role | Hours | Rate | Cost |
|---|---|---|---|
| Engineering | [X] hrs | $[X]/hr | $[X] |
| Product Management | [X] hrs | $[X]/hr | $[X] |
| UX/UI Design | [X] hrs | $[X]/hr | $[X] |
| Engineering Management | [X] hrs | $[X]/hr | $[X] |
| QA/Testing | [X] hrs | $[X]/hr | $[X] |
| Project Management | [X] hrs | $[X]/hr | $[X] |
| Technical Writing | [X] hrs | $[X]/hr | $[X] |
| DevOps/Platform | [X] hrs | $[X]/hr | $[X] |
| TOTAL | [X] hrs | $[X] |
| 公司阶段 | 团队乘数 | 工程成本 | 全团队成本 |
|---|---|---|---|
| 独立开发者/创始人 | 1.0x | $[X] | $[X] |
| 精益创业公司 | 1.45x | $[X] | $[X] |
| 成长型公司 | 2.2x | $[X] | $[X] |
| 企业 | 2.65x | $[X] | $[X] |
角色拆分(成长型公司示例):
| 角色 | 时长 | 费率 | 成本 |
|---|---|---|---|
| 工程团队 | [X] 小时 | $[X]/小时 | $[X] |
| 产品经理 | [X] 小时 | $[X]/小时 | $[X] |
| UX/UI设计 | [X] 小时 | $[X]/小时 | $[X] |
| 工程管理 | [X] 小时 | $[X]/小时 | $[X] |
| QA/测试 | [X] 小时 | $[X]/小时 | $[X] |
| 项目管理 | [X] 小时 | $[X]/小时 | $[X] |
| 技术写作 | [X] 小时 | $[X]/小时 | $[X] |
| DevOps/平台工程 | [X] 小时 | $[X]/小时 | $[X] |
| 总计 | [X] 小时 | $[X] |
Claude ROI Analysis (Detailed)
Claude ROI分析(详细)
Project Timeline:
- First commit / project start: [date]
- Latest commit: [date]
- Total calendar time: [X] days ([X] weeks)
Claude Active Hours Estimate:
- Total sessions identified: [X] sessions
- Estimated active hours: [X] hours
- Method: [git clustering / file timestamps / LOC estimate]
Value per Claude Hour:
| Value Basis | Total Value | Claude Hours | $/Claude Hour |
|---|---|---|---|
| Engineering only | $[X] | [X] hrs | $[X,XXX]/Claude hr |
| Full team (Growth Co) | $[X] | [X] hrs | $[X,XXX]/Claude hr |
Speed vs. Human Developer:
- Estimated human hours for same work: [X] hours
- Claude active hours: [X] hours
- Speed multiplier: [X]x (Claude was [X]x faster)
Cost Comparison:
- Human developer cost: $[X] (at config baseline rate)
- Estimated Claude cost: $[X] (subscription + API)
- Net savings: $[X]
- ROI: [X]x (every $1 spent on Claude produced $[X] of value)
项目时间线:
- 首次提交/项目启动: [日期]
- 最新提交: [日期]
- 总日历时长: [X] 天([X] 周)
Claude活跃时长估算:
- 识别到的总会话数: [X] 个会话
- 估算活跃时长: [X] 小时
- 计算方式: [git聚类 / 文件时间戳 / LOC估算]
每Claude小时价值:
| 价值基准 | 总价值 | Claude时长 | 每Claude小时美元价值 |
|---|---|---|---|
| 仅工程成本 | $[X] | [X] 小时 | $[X,XXX]/Claude小时 |
| 全团队(成长型公司) | $[X] | [X] 小时 | $[X,XXX]/Claude小时 |
与人类开发者的速度对比:
- 同等工作量的估算人类时长: [X] 小时
- Claude活跃时长: [X] 小时
- 速度倍数: [X]x(Claude快 [X] 倍)
成本对比:
- 人类开发者成本: $[X](按配置基准费率)
- 估算Claude成本: $[X](订阅+API费用)
- 净节省: $[X]
- ROI: [X]x(每投入1美元到Claude,产出 [X] 美元价值)
Assumptions
假设条件
- Rates based on US market averages (2025)
- Full-time equivalent allocation for all roles
- Does not include:
- Marketing & sales
- Legal & compliance
- Office/equipment
- Hosting/infrastructure
- Ongoing maintenance post-launch
- 费率基于2025年美国市场平均水平
- 所有角色均为全职等效投入
- 不包含:
- 营销与销售
- 法律与合规
- 办公场地/设备
- 托管/基础设施费用
- 上线后的持续维护成本
Step 7: Calculate Claude ROI — Value Per Claude Hour
步骤7:计算Claude ROI — 每Claude小时价值
This is the most important metric for understanding AI-assisted development efficiency. It answers: "What did each hour of Claude's actual working time produce?"
IMPORTANT: The Claude ROI results must appear in TWO places in the report:
- Executive Summary at the very top (compact table format)
- Claude ROI Analysis (Detailed) section with full breakdown
Calculate all ROI values in this step, then populate both sections when writing the report.
这是了解AI辅助开发效率最重要的指标,它回答了:"Claude每实际工作一小时能产出多少价值?"
重要提示:Claude ROI结果必须出现在报告的两个位置:
- 最顶部的执行摘要(紧凑表格格式)
- Claude ROI分析(详细) 部分(完整拆分)
在本步骤计算所有ROI值,然后在编写报告时填充到两个部分中。
7a: Determine Actual Claude Clock Time
7a:确定Claude实际工作时长
Run to automatically cluster commits into sessions and estimate active hours:
git_session_analyzer.pybash
python3 .claude/skills/cost-estimate/helpers/git_session_analyzer.pyReview the output sessions and adjust estimates upward for commits with large scope (e.g. a single commit adding thousands of lines likely took 2-4 hours, not 1 hour). Use to check the scope of low-commit sessions.
git show <hash> --statFallback (no git): Estimate from LOC using the Claude ROI Constants:
Claude active hours = Total LOC / 350 lines/hr运行 自动将提交聚类为会话并估算活跃时长:
git_session_analyzer.pybash
python3 .claude/skills/cost-estimate/helpers/git_session_analyzer.py检查输出的会话,对于大范围改动的提交适当调增估算时长(例如单次提交新增数千行代码的情况,可能需要2-4小时,而不是1小时)。使用检查提交数少的会话的改动范围。
git show <hash> --stat兜底方案(无git历史): 使用Claude ROI常量基于LOC估算:
Claude活跃时长 = 总LOC / 350 行/小时7b: Calculate ROI
7b:计算ROI
Pass to (in Step 2) to get the full ROI breakdown automatically. The calculator computes speed multiplier, value per Claude hour, cost comparison, and savings.
--claude-hourscost_calculator.py在步骤2中向传入参数即可自动获取完整的ROI拆分。计算器会计算速度倍数、每Claude小时价值、成本对比和成本节省。
cost_calculator.py--claude-hoursNotes
注意事项
Present the estimate in a clear, professional format suitable for sharing with stakeholders. Include confidence intervals and key assumptions. Highlight areas of highest complexity that drive cost.
IMPORTANT — Dollar Sign Escaping: Always escape as in the final markdown report. Bare characters are interpreted as LaTeX math delimiters by many markdown renderers (GitHub, VS Code, etc.), which mangles currency values. The function handles this automatically, but when writing prose sections manually (e.g., market rate research, rationale text, assumptions), always use for currency.
$\$$report_generator.pyfmt()\$以清晰、专业的格式呈现估算结果,适合分享给相关方。包含置信区间和关键假设。突出驱动成本的最高复杂度区域。
重要提示——美元符号转义: 在最终的Markdown报告中,始终将转义为。很多Markdown渲染器(GitHub、VS Code等)会将未转义的识别为LaTeX数学分隔符,导致货币值显示错误。的函数会自动处理转义,但手动编写的文本部分(例如市场费率调研、依据文本、假设条件)中,请始终使用表示货币符号。
$\$$report_generator.pyfmt()\$