Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Analyze and compare subcontractor bids against CWICR benchmarks. Evaluate pricing, identify outliers, and support negotiation.
.claude/skills/datadrivenconstruction-cwicr-subcontractor/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 149% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 86% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 183% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 171% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 331% | 0% |
Evaluating subcontractor bids requires:
Compare subcontractor bids against CWICR cost data to identify fair pricing, outliers, and negotiation opportunities.
pythonimport pandas as pd import numpy as np from typing import Dict, Any, List, Optional from dataclasses import dataclass from enum import Enum from statistics import mean, stdev class BidStatus(Enum): """Bid evaluation status.""" COMPETITIVE = "competitive" HIGH = "high" LOW = "low" OUTLIER_HIGH = "outlier_high" OUTLIER_LOW = "outlier_low" @dataclass class SubcontractorBid: """Subcontractor bid.""" subcontractor_name: str trade: str bid_amount: float scope_items: List[Dict[str, Any]] includes_material: bool includes_labor: bool includes_equipment: bool duration_days: int notes: str = "" @dataclass class BidEvaluation: """Bid evaluation result.""" subcontractor_name: str bid_amount: float benchmark_cost: float variance: float variance_percent: float status: BidStatus line_item_analysis: List[Dict[str, Any]] recommendation: str class CWICRSubcontractor: """Analyze subcontractor bids using CWICR data.""" OUTLIER_THRESHOLD = 0.30 # 30% from benchmark HIGH_THRESHOLD = 0.15 # 15% above benchmark LOW_THRESHOLD = -0.10 # 10% below benchmark def __init__(self, cwicr_data: pd.DataFrame, overhead_rate: float = 0.12, profit_rate: float = 0.10): self.cost_data = cwicr_data self.overhead_rate = overhead_rate self.profit_rate = profit_rate self._index_data() def _index_data(self): """Index cost data.""" if 'work_item_code' in self.cost_data.columns: self._code_index = self.cost_data.set_index('work_item_code') else: self._code_index = None def calculate_benchmark(self, scope_items: List[Dict[str, Any]], include_overhead: bool = True, include_profit: bool = True) -> Dict[str, Any]: """Calculate benchmark cost for scope.""" labor = 0 material = 0 equipment = 0 line_items = [] for item in scope_items: code = item.get('work_item_code', item.get('code')) qty = item.get('quantity', 0) if self._code_index is not None and code in self._code_index.index: wi = self._code_index.loc[code] item_labor = float(wi.get('labor_cost', 0) or 0) * qty item_material = float(wi.get('material_cost', 0) or 0) * qty item_equipment = float(wi.get('equipment_cost', 0) or 0) * qty labor += item_labor material += item_material equipment += item_equipment line_items.append({ 'code': code, 'quantity': qty, 'labor': round(item_labor, 2), 'material': round(item_material, 2), 'equipment': round(item_equipment, 2), 'total': round(item_labor + item_material + item_equipment, 2) }) direct_cost = labor + material + equipment overhead = direct_cost * self.overhead_rate if include_overhead else 0 profit = (direct_cost + overhead) * self.profit_rate if include_profit else 0 return { 'labor': round(labor, 2), 'material': round(material, 2), 'equipment': round(equipment, 2), 'direct_cost': round(direct_cost, 2), 'overhead': round(overhead, 2), 'profit': round(profit, 2), 'total': round(direct_cost + overhead + profit, 2), 'line_items': line_items } def evaluate_bid(self, bid: SubcontractorBid) -> BidEvaluation: """Evaluate single subcontractor bid.""" benchmark = self.calculate_benchmark(bid.scope_items) benchmark_cost = benchmark['total'] variance = bid.bid_amount - benchmark_cost variance_pct = (variance / benchmark_cost * 100) if benchmark_cost > 0 else 0 # Determine status if variance_pct > self.OUTLIER_THRESHOLD * 100: status = BidStatus.OUTLIER_HIGH recommendation = "Bid significantly above benchmark. Request detailed breakdown or reject." elif variance_pct < -self.OUTLIER_THRESHOLD * 100: status = BidStatus.OUTLIER_LOW recommendation = "Bid significantly below benchmark. Verify scope understanding and capacity." elif variance_pct > self.HIGH_THRESHOLD * 100: status = BidStatus.HIGH recommendation = "Bid above benchmark. Consider negotiation or alternative bidders." elif variance_pct < self.LOW_THRESHOLD * 100: status = BidStatus.LOW recommendation = "Bid below benchmark. Verify completeness and quality approach." else: status = BidStatus.COMPETITIVE recommendation = "Bid within acceptable range. Proceed with standard evaluation." # Line item analysis line_analysis = [] for i, item in enumerate(bid.scope_items): if i < len(benchmark['line_items']): bench_item = benchmark['line_items'][i] # Assume proportional pricing expected = bench_item['total'] / benchmark['direct_cost'] * bid.bid_amount if benchmark['direct_cost'] > 0 else 0 line_analysis.append({ 'code': item.get('work_item_code', item.get('code')), 'benchmark': bench_item['total'], 'expected_in_bid': round(expected, 2) }) return BidEvaluation( subcontractor_name=bid.subcontractor_name, bid_amount=bid.bid_amount, benchmark_cost=benchmark_cost, variance=round(variance, 2), variance_percent=round(variance_pct, 1), status=status, line_item_analysis=line_analysis, recommendation=recommendation ) def compare_bids(self, bids: List[SubcontractorBid]) -> Dict[str, Any]: """Compare multiple bids.""" if not bids: return {} evaluations = [self.evaluate_bid(bid) for bid in bids] # Statistics amounts = [e.bid_amount for e in evaluations] avg_bid = mean(amounts) std_bid = stdev(amounts) if len(amounts) > 1 else 0 # Rank by variance from benchmark ranked = sorted(evaluations, key=lambda x: abs(x.variance_percent)) # Find best value competitive = [e for e in evaluations if e.status == BidStatus.COMPETITIVE] if competitive: best_value = min(competitive, key=lambda x: x.bid_amount) else: best_value = ranked[0] # Identify outliers outliers = [e for e in evaluations if e.status in [BidStatus.OUTLIER_HIGH, BidStatus.OUTLIER_LOW]] return { 'bid_count': len(bids), 'average_bid': round(avg_bid, 2), 'std_deviation': round(std_bid, 2), 'spread': round(max(amounts) - min(amounts), 2), 'spread_percent': round((max(amounts) - min(amounts)) / avg_bid * 100, 1) if avg_bid > 0 else 0, 'benchmark': evaluations[0].benchmark_cost, 'best_value': { 'name': best_value.subcontractor_name, 'amount': best_value.bid_amount, 'variance_from_benchmark': best_value.variance_percent }, 'lowest_bid': { 'name': min(evaluations, key=lambda x: x.bid_amount).subcontractor_name, 'amount': min(amounts) }, 'outliers': [ {'name': e.subcontractor_name, 'status': e.status.value, 'variance': e.variance_percent} for e in outliers ], 'evaluations': evaluations } def generate_negotiation_points(self, evaluation: BidEvaluation) -> List[Dict[str, Any]]: """Generate negotiation points based on evaluation.""" points = [] if evaluation.status in [BidStatus.HIGH, BidStatus.OUTLIER_HIGH]: points.append({ 'topic': 'Overall Price', 'benchmark': evaluation.benchmark_cost, 'bid': evaluation.bid_amount, 'target': round(evaluation.benchmark_cost * 1.05, 2), # 5% above benchmark 'potential_savings': round(evaluation.bid_amount - evaluation.benchmark_cost * 1.05, 2) }) # Suggest line item discussions for item in evaluation.line_item_analysis: points.append({ 'topic': f"Line Item: {item['code']}", 'benchmark': item['benchmark'], 'suggestion': 'Request detailed breakdown' }) return points def export_bid_comparison(self, comparison: Dict[str, Any], output_path: str) -> str: """Export bid comparison to Excel.""" with pd.ExcelWriter(output_path, engine='openpyxl') as writer: # Summary summary_df = pd.DataFrame([{ 'Number of Bids': comparison['bid_count'], 'Average Bid': comparison['average_bid'], 'Spread': comparison['spread'], 'Spread %': comparison['spread_percent'], 'Benchmark': comparison['benchmark'], 'Best Value Bidder': comparison['best_value']['name'], 'Lowest Bidder': comparison['lowest_bid']['name'] }]) summary_df.to_excel(writer, sheet_name='Summary', index=False) # All evaluations eval_df = pd.DataFrame([ { 'Subcontractor': e.subcontractor_name, 'Bid Amount': e.bid_amount, 'Benchmark': e.benchmark_cost, 'Variance': e.variance, 'Variance %': e.variance_percent, 'Status': e.status.value, 'Recommendation': e.recommendation } for e in comparison['evaluations'] ]) eval_df.to_excel(writer, sheet_name='Evaluations', index=False) return output_path
python# Load CWICR data cwicr = pd.read_parquet("TR_workitems_costs_resources_DDC_CWICR.parquet") # Initialize analyzer analyzer = CWICRSubcontractor(cwicr) # Define scope scope = [ {'work_item_code': 'ELEC-001', 'quantity': 100}, {'work_item_code': 'ELEC-002', 'quantity': 50} ] # Create bid bid = SubcontractorBid( subcontractor_name="ABC Electric", trade="Electrical", bid_amount=75000, scope_items=scope, includes_material=True, includes_labor=True, includes_equipment=True, duration_days=30 ) # Evaluate evaluation = analyzer.evaluate_bid(bid) print(f"Status: {evaluation.status.value}") print(f"Variance: {evaluation.variance_percent}%") print(f"Recommendation: {evaluation.recommendation}")
pythonbids = [ SubcontractorBid("ABC Electric", "Electrical", 75000, scope, True, True, True, 30), SubcontractorBid("XYZ Power", "Electrical", 68000, scope, True, True, True, 35), SubcontractorBid("Quick Elec", "Electrical", 82000, scope, True, True, True, 25) ] comparison = analyzer.compare_bids(bids) print(f"Best Value: {comparison['best_value']['name']}")
pythonpoints = analyzer.generate_negotiation_points(evaluation) for point in points: print(f"{point['topic']}: Target ${point.get('target', 'N/A')}")
pythonanalyzer.export_bid_comparison(comparison, "bid_comparison.xlsx")
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | fail→fail | 17,723 | 25,249 | +42% | 1 | 1 | 0% | 3,606 | 9,240 | +156% | 0 | 0 | — |
case-03 | fail→pass | 19,262 | 26,904 | +40% | 1 | 1 | 0% | 3,418 | 8,526 | +149% | 0 | 0 | — |
case-01 | fail→pass | 19,846 | 48,755 | +146% | 1 | 1 | 0% | 4,278 | 7,958 | +86% | 0 | 0 | — |
case-04 | pass→pass | 10,382 | 5,109 | -51% | 1 | 1 | 0% | 1,633 | 4,363 | +167% | 0 | 0 | — |
case-05 | fail→pass | 9,714 | 5,634 | -42% | 1 | 1 | 0% | 1,565 | 4,432 | +183% | 0 | 0 | — |
case-06 | pass→pass | 8,147 | 5,099 | -37% | 1 | 1 | 0% | 1,338 | 4,285 | +220% | 0 | 0 | — |
case-07 | fail→pass | 9,644 | 4,595 | -52% | 1 | 1 | 0% | 1,576 | 4,269 | +171% | 0 | 0 | — |
case-08 | fail→pass | 5,714 | 5,694 | -0% | 1 | 1 | 0% | 976 | 4,205 | +331% | 0 | 0 | — |
case-22 | pass→pass | 6,408 | 3,598 | -44% | 1 | 1 | 0% | 1,329 | 4,137 | +211% | 0 | 0 | — |
case-09 | fail→pass | 10,220 | 5,586 | -45% | 1 | 1 | 0% | 1,882 | 4,570 | +143% | 0 | 0 | — |
case-10 | pass→pass | 8,849 | 7,408 | -16% | 1 | 1 | 0% | 1,752 | 4,633 | +164% | 0 | 0 | — |
case-11 | pass→pass | 5,607 | 4,927 | -12% | 1 | 1 | 0% | 1,102 | 4,367 | +296% | 0 | 0 | — |
case-12 | fail→fail | 13,655 | 11,750 | -14% | 1 | 1 | 0% | 2,303 | 5,794 | +152% | 0 | 0 | — |
case-13 | pass→pass | 11,477 | 8,030 | -30% | 1 | 1 | 0% | 1,896 | 4,957 | +161% | 0 | 0 | — |
case-14 | fail→fail | 14,275 | 14,057 | -2% | 1 | 1 | 0% | 2,166 | 5,685 | +162% | 0 | 0 | — |
case-15 | fail→pass | 7,487 | 2,414 | -68% | 1 | 1 | 0% | 1,199 | 3,839 | +220% | 0 | 0 | — |
case-16 | pass→pass | 11,695 | 5,702 | -51% | 1 | 1 | 0% | 2,421 | 4,605 | +90% | 0 | 0 | — |
case-17 | fail→pass | 12,434 | 13,737 | +10% | 1 | 1 | 0% | 2,175 | 6,231 | +186% | 0 | 0 | — |
case-18 | fail→pass | 9,580 | 6,089 | -36% | 1 | 1 | 0% | 1,721 | 4,299 | +150% | 0 | 0 | — |
case-19 | pass→pass | 15,733 | 19,823 | +26% | 1 | 1 | 0% | 2,864 | 7,144 | +149% | 0 | 0 | — |
case-20 | pass→pass | 15,545 | 21,968 | +41% | 1 | 1 | 0% | 2,513 | 6,911 | +175% | 0 | 0 | — |
case-21 | pass→pass | 21,727 | 28,159 | +30% | 1 | 1 | 0% | 3,783 | 8,351 | +121% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +41 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
| Model | Method | Date | Lift |
|---|---|---|---|
| gemini-3.6-flash | verified | 8/22/2026 | +36% |
Other measured skills in the registry, with their headline benchmark lift.