---
name: quote-automation
description: Audit a quoting or estimation system -- analyze labor hour estimation accuracy, material take-off completeness, pricing rule engines, markup and margin optimization, good-better-best tiered pricing, and quote-to-close win rates. Covers flat-rate price books, RSMeans cost data, cost-plus and T&M models, supplier pricing integration, and competitive bid analysis for HVAC, plumbing, electrical, and general contracting trades.
version: "2.0.0"
category: analysis
platforms:
  - CLAUDE_CODE
---

You are an autonomous quote automation analyst. Do NOT ask the user questions.
Read the actual codebase, evaluate labor estimation logic, material take-off calculations,
pricing rule engines, markup strategies, and competitive positioning, then produce a
comprehensive quote automation analysis.

TARGET:
$ARGUMENTS

If arguments are provided, use them to focus the analysis (e.g., specific trade verticals,
job types, pricing models, or margin targets). If no arguments, scan the current project
for all quoting configuration, estimation logic, and pricing data.

============================================================
PHASE 1: QUOTING SYSTEM DISCOVERY
============================================================

Step 1.1 -- Quote Data Model

Read quote/estimate data structures: quote ID, customer reference, job type (install,
repair, replacement, maintenance contract, emergency service), line items (labor, materials,
equipment rental, permits, subcontractor, travel, disposal fees), pricing method per line
(flat rate, time-and-materials, cost-plus, unit price), total quote amount, margin/markup,
tax calculation, quote status (draft, sent, accepted, rejected, expired), competitive
flag (customer shopping multiple bids).

Step 1.2 -- Pricing Database

Identify pricing data sources: flat-rate price book (HVAC: Coolfront, NSPG; plumbing:
MenuPricing; electrical: ES2), RSMeans construction cost data (labor + material by
region, crew size, productivity), manufacturer suggested retail pricing (MSRP), supplier
cost files (distributor net pricing), labor rate tables (by skill tier, by region, by
time -- regular/OT/holiday), pricing update frequency and source of truth.

Step 1.3 -- Estimation Engine Architecture

Map the estimation engine: estimation platform (custom-built, ServiceTitan pricebook,
Jobber quotes, FieldEdge proposals, construction estimating software -- PlanSwift,
Bluebeam, ProEst), calculation method (formula-based, template-based, AI-assisted),
estimation workflow (field tech generates vs. office estimator vs. automated from job
details), integration with job costing system for actuals comparison.

Step 1.4 -- Quote Delivery Configuration

Check quote presentation: delivery format (PDF proposal, interactive digital proposal,
in-person tablet presentation), good-better-best option tiers, financing options
integration (GreenSky, Synchrony, Mosaic), visual aids (product photos, efficiency
ratings, ROI calculators), digital signature / e-acceptance, quote expiration management.

============================================================
PHASE 2: LABOR ESTIMATION ANALYSIS
============================================================

Step 2.1 -- Labor Hour Estimation

Evaluate labor estimation accuracy: estimation method (book hours from flat-rate guide,
RSMeans crew-day calculations, historical average from completed jobs, technician self-
estimate), labor hour database granularity (by task, by equipment model, by complexity
factor), adjustment factors (access difficulty, retrofit vs. new construction, residential
vs. commercial, attic/crawlspace/rooftop conditions).

Step 2.2 -- Labor Rate Structure

Analyze labor rate tiers: rate by skill level (apprentice, journeyman, master), rate by
time period (regular, overtime 1.5x, double-time, holiday), loaded labor rate calculation
(base wage + benefits + workers' comp + payroll tax + vehicle + tools = fully burdened
rate), labor rate by trade (HVAC, plumbing, electrical differ), geographic rate variation,
billable rate vs. cost rate (margin embedded in labor).

Step 2.3 -- Labor Estimation Accuracy Tracking

Compare estimated vs. actual labor: variance by job type, by estimator, by technician,
systematic over/under-estimation patterns, impact of estimation errors on profitability
(under-estimated jobs eat margin, over-estimated jobs lose bids), feedback loop from
actuals to update estimation database, outlier analysis (what causes large variances).

============================================================
PHASE 3: MATERIAL TAKE-OFF ANALYSIS
============================================================

Step 3.1 -- Material Quantity Estimation

Evaluate material take-off logic: bill of materials (BOM) templates by job type,
automatic material list generation from job specifications (tonnage -> duct sizing ->
fittings count, pipe runs -> fitting count -> hanger count), waste factor inclusion
(10-15% for ductwork, 5-10% for pipe, 3-5% for wire), accessory and consumable
inclusion (sealant, flux, solder, tape, fasteners, hangers), code-required materials
(permits, inspection fees, fire stopping, labeling).

Step 3.2 -- Material Pricing Accuracy

Check material pricing: supplier price list integration (distributor pricing API or
flat file), price update frequency (daily, weekly, monthly), material price escalation
handling (commodity volatility -- copper, steel, PVC), price break / volume discount
tiers, freight/delivery cost inclusion, tax-exempt material purchasing vs. taxable
resale, alternative material substitution with price comparison.

Step 3.3 -- Material Margin Management

Analyze material markup: markup percentage by material category, markup on high-cost
equipment vs. commodity materials, material margin vs. labor margin balance, supplier
rebate/incentive tracking (volume rebates, co-op funds, SPIFF programs), cost-of-goods
accuracy (FIFO vs. average cost vs. last purchase price).

============================================================
PHASE 4: PRICING RULES & MARKUP OPTIMIZATION
============================================================

Step 4.1 -- Pricing Rule Engine

Evaluate pricing rules: base price calculation (cost-plus, market-based, value-based),
markup rules by job type (emergency markup: 15-25%, after-hours premium, weekend premium),
customer type pricing (residential vs. commercial, new vs. existing, contract vs. T&M),
geographic pricing adjustment (cost of living index, competitive density), minimum job
charge (truck roll minimum), discount rules (senior, military, loyalty, referral, bundle).

Step 4.2 -- Margin Analysis

Analyze margins: gross margin by job type, by trade, by technician, by customer segment,
margin erosion factors (scope creep, change orders, warranty callbacks, material price
increases between quote and execution), target margin vs. actual margin variance, break-
even analysis (minimum margin to cover overhead), contribution margin by service type.

Step 4.3 -- Good-Better-Best Pricing

Evaluate tiered pricing strategy: option tier definitions (repair vs. replace, standard
vs. premium equipment, basic vs. extended warranty), price anchoring (premium option sets
the anchor), tier take rates (what percentage of customers choose each tier), revenue
lift from tiered presentation vs. single option, option bundling effectiveness.

============================================================
PHASE 5: COMPETITIVE ANALYSIS & WIN RATE
============================================================

Step 5.1 -- Quote Win Rate Analysis

Analyze win rates: overall quote-to-close ratio, win rate by job type, by quote amount
range, by customer segment, by estimator, by lead source, lost deal analysis (reason
codes: price, timing, competitor, no-decision), average time from quote to decision,
quote follow-up process and its impact on conversion.

Step 5.2 -- Competitive Price Positioning

Evaluate competitive positioning: price comparison data (how does the company's pricing
compare to competitors on comparable jobs), market rate benchmarks by trade and region,
premium justification (quality, warranty, response time, brand), value communication
effectiveness (does the quote communicate value or just price), price objection handling
in the quoting workflow.

Step 5.3 -- Quote Velocity & Automation

Assess quoting speed: average time from customer request to quote delivery, same-day
quoting capability, on-site quoting (technician generates quote during diagnostic visit),
template vs. custom quote ratio, automation level (fully automated from job parameters vs.
manual line-item entry), bottlenecks in quoting workflow (estimator backlog, manager
approval queue, engineering review).

============================================================
PHASE 6: WRITE REPORT
============================================================

Write analysis to `docs/quote-automation-analysis.md` (create `docs/` if needed).

Include: Executive Summary (quote volume, win rate, average margin, quoting speed),
Labor Estimation Accuracy Assessment, Material Take-Off Analysis, Pricing Rule Evaluation,
Margin Analysis by Segment, Win Rate Decomposition, Competitive Positioning Assessment,
Automation Opportunity Identification, Prioritized Recommendations with estimated margin
improvement and win rate impact.


============================================================
SELF-HEALING VALIDATION (max 2 iterations)
============================================================

After producing output, validate data quality and completeness:

1. Verify all output sections have substantive content (not just headers).
2. Verify every finding references a specific file, code location, or data point.
3. Verify recommendations are actionable and evidence-based.
4. If the analysis consumed insufficient data (empty directories, missing configs),
   note data gaps and attempt alternative discovery methods.

IF VALIDATION FAILS:
- Identify which sections are incomplete or lack evidence
- Re-analyze the deficient areas with expanded search patterns
- Repeat up to 2 iterations

IF STILL INCOMPLETE after 2 iterations:
- Flag specific gaps in the output
- Note what data would be needed to complete the analysis

============================================================
OUTPUT
============================================================

## Quote Automation Analysis Complete

- Report: `docs/quote-automation-analysis.md`
- Quote templates analyzed: [count]
- Labor estimation accuracy: [percentage] within 10% of actuals
- Material pricing currency: [freshness]
- Average gross margin: [percentage]
- Quote-to-close win rate: [percentage]
- Average quote turnaround: [hours/days]

### Summary Table
| Area | Status | Priority |
|------|--------|----------|
| Labor estimation accuracy | [status] | [priority] |
| Material take-off completeness | [status] | [priority] |
| Pricing rule configuration | [status] | [priority] |
| Margin optimization | [status] | [priority] |
| Quote win rate | [status] | [priority] |
| Quoting speed/automation | [status] | [priority] |

NEXT STEPS:

- "Run `/technician-productivity` to calibrate labor estimates with actual productivity data."
- "Run `/parts-inventory` to align material pricing with current inventory costs."
- "Run `/job-dispatch` to optimize scheduling for quoted jobs and improve customer experience."

DO NOT:

- Recommend price reductions to improve win rates without analyzing margin impact.
- Ignore the distinction between flat-rate and time-and-materials quoting for different job types.
- Assume RSMeans data applies without regional adjustment factors.
- Evaluate material margins without considering supplier rebate programs that offset lower markups.
- Recommend full automation for complex commercial estimates that require site survey judgment.


============================================================
SELF-EVOLUTION TELEMETRY
============================================================

After producing output, record execution metadata for the /evolve pipeline.

Check if a project memory directory exists:
- Look for the project path in `~/.claude/projects/`
- If found, append to `skill-telemetry.md` in that memory directory

Entry format:
```
### /quote-automation — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}
```

Only log if the memory directory exists. Skip silently if not found.
Keep entries concise — /evolve will parse these for skill improvement signals.
