with one click
estimate-actual
// [Planning] Use when calibrating estimates from actual code, diff, PR scope, and developer time.
// [Planning] Use when calibrating estimates from actual code, diff, PR scope, and developer time.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | estimate-actual |
| description | [Planning] Use when calibrating estimates from actual code, diff, PR scope, and developer time. |
| disable-model-invocation | true |
Codex compatibility note:
- Invoke repository skills with
$skill-namein Codex; this mirrored copy rewrites legacy Claude/skill-namereferences.- Prefer the
plan-hardskill for planning guidance in this Codex mirror.- Task tracker mandate: BEFORE executing any workflow or skill step, create/update task tracking for all steps and keep it synchronized as progress changes.
- User-question prompts mean to ask the user directly in Codex.
- Ignore Claude-specific mode-switch instructions when they appear.
- Strict execution contract: when a user explicitly invokes a skill, execute that skill protocol as written.
- Subagent authorization: when a skill is user-invoked or AI-detected and its protocol requires subagents, that skill activation authorizes use of the required
spawn_agentsubagent(s) for that task.- Do not skip, reorder, or merge protocol steps unless the user explicitly approves the deviation first.
- For workflow skills, execute each listed child-skill step explicitly and report step-by-step evidence.
- If a required step/tool cannot run in this environment, stop and ask the user before adapting.
Codex does not receive Claude hook-based doc injection. When coding, planning, debugging, testing, or reviewing, open project docs explicitly using this routing.
Always read:
docs/project-config.json (project-specific paths, commands, modules, and workflow/test settings)docs/project-reference/docs-index-reference.md (routes to the full docs/project-reference/* catalog)docs/project-reference/lessons.md (always-on guardrails and anti-patterns)Situation-based docs:
backend-patterns-reference.md, domain-entities-reference.md, project-structure-reference.mdfrontend-patterns-reference.md, scss-styling-guide.md, design-system/README.mdfeature-docs-reference.mdintegration-test-reference.mde2e-test-reference.mdcode-review-rules.md plus domain docs above based on changed filesDo not read all docs blindly. Start from docs-index-reference.md, then open only relevant files for the task.
Goal: Produce a 3-way estimation calibration report โ pre_impl_estimate (from plan) vs true_estimate (from observed scope) vs actual_time (from git/user) โ yielding two INDEPENDENT signals: developer execution variance and estimation model calibration variance.
Why two signals matter: They are confounded if not separated. If actual >> pre-impl, the bug could be (a) developer was slow, OR (b) the model under-estimated scope. Without computing TRUE from observed scope, you cannot tell which. Single-sample calibration has near-zero statistical power โ the skill always reports this.
Workflow:
--changes / --pr <n>Key Rules:
| Mode | Trigger | What's read |
|---|---|---|
| Plan-file | <path/to/plan.md> | Plan frontmatter (pre-impl estimate) + git diff scoped to plan branch |
| Changes | --changes | git diff working tree + last commit timestamps |
| PR | --pr <n> | gh pr view <n> + gh pr diff <n> + PR open/merge times |
If multiple modes detected (e.g., plan file AND --changes), prefer plan-file (carries the original estimate); use changes for the diff source.
man_days_traditional, story_points, risk_margin_pct, risk_factors, blast_radius, estimate_reasoning if presentrisk_factors), flag in report โ comparison is approximateRun (PowerShell or Bash via tool):
git diff --stat <base>..<head> โ file count, lines added/removedgit diff --name-only <base>..<head> โ file listgit log --format='%H %ai %s' <base>..<head> โ commit timelineClassify changed files:
describe|it|Fact|Test\b)python .claude/scripts/code_graph trace <file> --direction both --json for changed entry-point filesApply each tier table (UI / backend / test / risk margin / risk factors) from the inline framework below to the OBSERVED scope. Output:
true_likely_days (single midpoint)true_min_days = likely ร 0.9true_max_days = likely ร (1 + risk_margin)true_estimate = '<min>-<max>d' rangeTry in order:
ALWAYS surface the gap between elapsed time and reported coding time โ they are different signals.
scope_variance_pct = (true_likely - preimpl_likely) / preimpl_likely ร 100
exec_variance_pct = (actual_time - true_likely) / true_likely ร 100
Interpretation matrix:
| scope_var | exec_var | Verdict |
|---|---|---|
| ~0% (ยฑ15%) | ~0% (ยฑ15%) | Estimate matched scope; developer matched estimate. Healthy. |
| ~0% | >+25% | Model OK; developer slower than expected. Performance signal. |
| ~0% | <-25% | Model OK; developer faster than expected. Either skilled or scope simpler than apparent. |
| >+25% | ~0% | Model UNDER-estimated scope; developer matched the harder-than-predicted reality. Model signal โ too optimistic. |
| <-25% | ~0% | Model OVER-estimated scope; actual work was simpler. Model signal โ too pessimistic. |
| >+25% | >+25% | Both โ scope was harder AND developer slower. Disambiguate over multiple samples. |
| <-25% | <-25% | Original estimate was way over; developer also fast. Likely simple task padded heavily. |
| Layer | Pre-impl tier (from plan) | Observed tier (from diff) | Delta |
|---|---|---|---|
| UI | e.g. "Compose components into NEW screen" | e.g. "Add control to existing screen" | -1 tier (~0.7d over) |
| Backend | e.g. "NEW command on existing aggregate" | e.g. "Small update existing handler" | -1 tier (~0.5d over) |
| Tests | e.g. "13 cases" | e.g. "5 cases" | -8 cases (~0.5d over) |
| Blast | e.g. "4 areas, 1 complex" | e.g. "2 areas, 0 complex" | lower regression risk |
| Risk factors | predicted list | applicable in retrospect | call out missing/unused |
Produce a markdown report with sections:
If user wants longitudinal tracking, append the calibration row to plans/_estimation-samples.csv:
date,plan,preimpl_min,preimpl_max,true_min,true_max,actual,scope_var_pct,exec_var_pct,risk_factors_predicted,risk_factors_applicable
After โฅ5 rows, run pattern detection on the CSV: if scope_var_pct is consistently negative (model over-estimates), suggest tier adjustment; if consistently positive (under-estimates), suggest adding risk factors or widening tier.
# Estimation Calibration Report โ <plan or branch name>
## Summary
| Metric | Range / Value | Source |
| ----------------- | -------------------------- | ---------------------------------------- |
| Pre-impl estimate | <min>-<max>d (likely <m>d) | <plan path frontmatter> |
| TRUE estimate | <min>-<max>d (likely <m>d) | observed scope (post-hoc) |
| Actual time | <n>d | git <first commitโmerge>, user-confirmed |
**Scope variance** (TRUE vs pre-impl): <ยฑn>% โ <under/over/matched>
**Execution variance** (actual vs TRUE likely): <ยฑn>% โ <fast/slow/matched>
## Verdict
| Signal | Direction | Magnitude | Confidence |
| ------------------- | ----------------------------------------------- | --------- | ----------------- |
| Estimation model | <too optimistic / too pessimistic / calibrated> | <ยฑn>% | <low/medium/high> |
| Developer execution | <fast / slow / on-pace> | <ยฑn>% | <low/medium/high> |
## Per-Layer Breakdown
| Layer | Predicted tier | Observed tier | Delta |
| ------------ | ------------------ | ------------------ | --------------- |
| UI | โฆ | โฆ | โฆ |
| Backend | โฆ | โฆ | โฆ |
| Tests | โฆ cases | โฆ cases | โฆ |
| Blast radius | โฆ areas, โฆ complex | โฆ areas, โฆ complex | โฆ |
| Risk factors | <predicted list> | <applicable list> | <added/removed> |
## Calibration Suggestions
- <If single sample> No model adjustment from one data point. Logged to `plans/_estimation-samples.csv` (row N). Re-run $estimate-actual on future plans to build calibration corpus. Suggested adjustment after โฅ3-5 samples with consistent direction.
- <If pattern across samples> e.g. "UI tier 'Compose components into NEW screen' overshoots in 4/5 samples by ~0.5d โ suggest splitting into two tiers OR widening band to 1-2.5d"
## Caveats
- Actual time derived from <git/user>; <list any uncertainty: weekends, code-review days, vacations excluded?>
- Pre-impl estimate format <range/single-point/missing> โ comparison <exact/approximate>
- Confidence in TRUE estimate: <high/medium/low> โ observed scope <fully visible / partially obscured>
| Evasion | Rebuttal |
|---|---|
| "Single sample is enough โ clearly the dev was slow" | NO. Without separating scope from execution variance, you confound model error and performance. State signal + caveat. |
| "Use git timestamps as actual time" | Wrong. Includes weekends, meetings, code-review wait, sleep. Always confirm with user. |
| "Skip TRUE estimate โ just compare pre-impl vs actual" | That's the data point that's MISSING and exactly why estimates don't improve over time. Never skip Step 4. |
| "Apply hindsight to pump up TRUE estimate" | Use the SAME framework that was used for pre-impl. Hindsight bias inflates TRUE and falsely vindicates the original estimate. |
| "One signal is fine, no need to split" | Two signals is the entire point. Performance review needs execution variance; model tuning needs scope variance. Confounded data is unactionable. |
Estimation Framework โ Bottom-up first; SP DERIVED; output min-max range when likely โฅ3d. Stack-agnostic. Baseline: 3-5yr dev, 6 productive hrs/day. AI estimate assumes Claude Code + project context.
Method:
- Blast Radius pass (below) โ drives code AND test cost
- Decompose phases โ hours/phase โ
bottom_up_hours = ฮฃ phase_hourslikely_days = ceil(bottom_up_hours / 6) ร productivity_factor- Sum Risk Margin (base + add-ons) โ
max_days = likely_days ร (1 + margin)min_days = likely_days ร 0.9- Output as range when
likely_days โฅ3; single point allowed<3(still record margin)man_days_ai= same range ร AI speedupstory_pointsDERIVED fromlikely_daysvia SP-Days โ NEVER driver. Disagreement >50% โ trust bottom-upProductivity factor: 0.8 strong scaffolding+codegen+AI hooks ยท 1.0 mature default ยท 1.2 weak patterns ยท 1.5 greenfield
Cost Driver Heuristic (apply BEFORE work-type row):
- UI dominates in CRUD/business apps โ 1.5-3x backend (states, validation, responsive, a11y, polish)
- Backend dominates ONLY: multi-aggregate invariants, cross-service contracts, schema migrations, heavy query/perf, new event flows
Reuse-vs-Create axis (PRIMARY lever, per layer):
UI tier Cost Reuse component on existing screen 0.1-0.3d Add control/column to existing screen 0.3-0.8d Compose components into NEW screen 1-2d NEW screen, custom layout/states/validation 2-4d NEW shared/common component (themed, tested) 3-6d+
Backend tier Cost Reuse query/handler from new place 0.1-0.3d Small update existing handler/entity 0.3-0.8d NEW query on existing repo/model 0.5-1d NEW command/handler on existing aggregate (additive) 1-2d NEW aggregate/entity (repo, validation, events) 2-4d NEW cross-service contract OR schema migration 2-4d each Multi-aggregate invariant / heavy domain rule 3-5d Rule: Sum tiers across UI+backend+tests, apply productivity factor. Reuse short-circuits tiers โ call out.
Test-Scope drivers (compute test_count EXPLICITLY โ "+tests" hand-wave is #1 failure):
Driver Count Happy-path journeys 1 per story / AC main flow State-machine transitions reachable transitions ร allowed actors Multi-entity state combos state(A) ร state(B) โ REACHABLE only, not Cartesian Authorization matrix (owner, non-owner, elevated, unauth) ร each mutation Validation rules 1 per required field / boundary / format / cross-field UI states (per new screen/dialog) happy, loading, empty, error, partial โ present only Negative paths / invariants 1 per violatable business rule
Test tier (Trad, incl. setup+assert+flake) Cost 1-5 cases, fixtures reused 0.3-0.5d 6-12 cases, 1 new fixture 0.5-1d 13-25 cases, multi-entity setup 1-2d 26-50 cases OR new state-machine coverage 2-3d >50 cases OR full E2E journey 3-5d Test multipliers: new fixture/seed harness +0.5d ยท cross-service/bus assertion +0.3d each ยท UI E2E ร1.5 ยท each new role +1-2 cases
Blast Radius (mandatory pre-pass โ affects code AND test):
- Files/components directly modified โ count
- Of those, "complex" (>500 LOC, multi-handler, central, frequently-modified) โ count
- Downstream consumers (callers, event subscribers, cross-service) โ list
- Shared/common code touched (multi-app blast) โ yes/no
- Regression scope โ areas needing re-test
Rule: Complex touch โ add
risk_factors. Each downstream consumer โ +1-3 regression cases. Blast >5 areas OR >2 complex โ re-evaluate SPLIT before estimating.Risk Margin (drives max bound):
likely_days Base margin <1d trivial +10% 1-2d small additive +20% 3-4d real feature +35% 5-7d large +50% 8-10d very large +75% >10d +100% AND flag SHOULD SPLIT Risk-factor add-ons (additive โ enumerate in
risk_factors):
Factor +margin touches-complex-existing-feature(>500 LOC, multi-handler, central)+20% cross-service-contractchange+25% schema-migration-on-populated-data+25% new-tech-or-unfamiliar-pattern+30% regression-fan-out(โฅ3 downstream areas re-test)+20% performance-or-latency-critical+20% concurrency-race-event-ordering+25% shared-common-code(multi-consumer/multi-app)+25% unclear-requirements-or-design+30% Collapse rule: total margin >100% โ STOP, split (padding past 2x is dishonesty). Margin <15% on
likely_days โฅ5โ under-estimated, widen.
AI Mistake Prevention โ Failure modes to avoid on every task:
Check downstream references before deleting. Deleting components causes documentation and code staleness cascades. Map all referencing files before removal. Verify AI-generated content against actual code. AI hallucinates APIs, class names, and method signatures. Always grep to confirm existence before documenting or referencing. Trace full dependency chain after edits. Changing a definition misses downstream variables and consumers derived from it. Always trace the full chain. Trace ALL code paths when verifying correctness. Confirming code exists is not confirming it executes. Always trace early exits, error branches, and conditional skips โ not just happy path. When debugging, ask "whose responsibility?" before fixing. Trace whether bug is in caller (wrong data) or callee (wrong handling). Fix at responsible layer โ never patch symptom site. Assume existing values are intentional โ ask WHY before changing. Before changing any constant, limit, flag, or pattern: read comments, check git blame, examine surrounding code. Verify ALL affected outputs, not just the first. Changes touching multiple stacks require verifying EVERY output. One green check is not all green checks. Holistic-first debugging โ resist nearest-attention trap. When investigating any failure, list EVERY precondition first (config, env vars, DB names, endpoints, DI registrations, data preconditions), then verify each against evidence before forming any code-layer hypothesis. Surgical changes โ apply the diff test. Bug fix: every changed line must trace directly to the bug. Don't restyle or improve adjacent code. Enhancement task: implement improvements AND announce them explicitly. Surface ambiguity before coding โ don't pick silently. If request has multiple interpretations, present each with effort estimate and ask. Never assume all-records, file-based, or more complex path.
IMPORTANT MUST ATTENTION compute TRUE estimate using the SAME canonical framework โ fair comparison requires identical methodology
IMPORTANT MUST ATTENTION separate developer execution signal from model calibration signal โ never collapse to single verdict
IMPORTANT MUST ATTENTION never claim model adjustment from a single sample โ explicitly state "needs โฅ3 samples for signal"
IMPORTANT MUST ATTENTION never trust git timestamps as coding time โ always ask user to confirm/override
IMPORTANT MUST ATTENTION list per-layer deltas (UI/backend/tests/blast) โ aggregate variance hides where model went wrong
IMPORTANT MUST ATTENTION use min-max ranges for both pre-impl and TRUE โ comparing single points is dishonest about uncertainty
IMPORTANT MUST ATTENTION apply Blast Radius pass on observed diff before applying tier tables
IMPORTANT MUST ATTENTION persist samples to plans/_estimation-samples.csv for longitudinal calibration
IMPORTANT MUST ATTENTION state confidence per verdict โ uncertainty about actual time goes in caveats
[IMPORTANT] Use task tracking to break ALL work into small tasks BEFORE starting.
Critical Thinking Mindset โ Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence >80% to act. Anti-hallucination: Never present guess as fact โ cite sources for every claim, admit uncertainty freely, self-check output for errors, cross-reference independently, stay skeptical of own confidence โ certainty without evidence root of all hallucination.
MUST ATTENTION apply critical thinking โ every claim needs traced proof, confidence >80% to act. Anti-hallucination: never present guess as fact.
MUST ATTENTION apply AI mistake prevention โ holistic-first debugging, fix at responsible layer, surface ambiguity before coding, re-read files after compaction.
[TASK-PLANNING] Before acting, analyze task scope and systematically break it into small todo tasks and sub-tasks using task tracking.
Source: .claude/hooks/lib/prompt-injections.cjs + .claude/.ck.json
$workflow-start <workflowId> for standard; sequence custom steps manually[CRITICAL] Hard-won project debugging/architecture rules. MUST ATTENTION apply BEFORE forming hypothesis or writing code.
Goal: Prevent recurrence of known failure patterns โ debugging, architecture, naming, AI orchestration, environment.
Top Rules (apply always):
ExecuteInjectScopedAsync for parallel async + repo/UoW โ NEVER ExecuteUowTaskwhere python/where py) โ NEVER assume python/python3 resolvesExecuteInjectScopedAsync, NEVER ExecuteUowTask. ExecuteUowTask creates new UoW but reuses outer DI scope (same DbContext) โ parallel iterations sharing non-thread-safe DbContext silently corrupt data. ExecuteInjectScopedAsync creates new UoW + new DI scope (fresh repo per iteration).AccountUserEntityEventBusMessage = Accounts owns). Core services (Accounts, Communication) are leaders. Feature services (Growth, Talents) sending to core MUST use {CoreServiceName}...RequestBusMessage โ never define own event for core to consume.HrManagerOrHrOrPayrollHrOperationsPolicy names set members, not what it guards. Add role โ rename = broken abstraction. Rule: names express DOES/GUARDS, not CONTAINS. Test: adding/removing member forces rename? YES = content-driven = bad โ rename to purpose (e.g., HrOperationsAccessPolicy). Nuance: "Or" fine in behavioral idioms (FirstOrDefault, SuccessOrThrow) โ expresses HAPPENS, not membership.python/python3 resolves โ verify alias first. Python may not be in bash PATH under those names. Check: where python / where py. Prefer py (Windows Python Launcher) for one-liners, node if JS alternative exists.Test-specific lessons โ
docs/project-reference/integration-test-reference.mdLessons Learned section. Production-code anti-patterns โdocs/project-reference/backend-patterns-reference.mdAnti-Patterns section. Generic debugging/refactoring reminders โ System Lessons in.claude/hooks/lib/prompt-injections.cjs.
ExecuteInjectScopedAsync, NEVER ExecuteUowTask (shared DbContext = silent data corruption){CoreServiceName}...RequestBusMessagepython/python3 resolves โ run where python/where py first, use py launcher or nodeBreak work into small tasks (task tracking) before starting. Add final task: "Analyze AI mistakes & lessons learned".
Extract lessons โ ROOT CAUSE ONLY, not symptom fixes:
$learn.$code-review/$code-simplifier/$security/$lint catch this?" โ Yes โ improve review skill instead.$learn.
[TASK-PLANNING] [MANDATORY] BEFORE executing any workflow or skill step, create/update task tracking for all planned steps, then keep it synchronized as each step starts/completes.