Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Analyze construction resources (labor, materials, equipment) from DDC CWICR database. Calculate resource requirements, productivity metrics, and optimization recommendations.
.claude/skills/datadrivenconstruction-cwicr-resource-analyzer/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-19 | ✗→✓ | ▲ Improved | 184% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 69% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 199% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 234% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 199% | 0% |
Construction projects require precise resource planning:
Traditional methods rely on experience-based estimates, leading to over/under allocation.
Data-driven resource analysis using CWICR's 27,672 resources with detailed breakdowns of labor norms, material requirements, and equipment usage.
pythonimport pandas as pd import numpy as np from typing import Dict, Any, List, Optional, Tuple from dataclasses import dataclass, field from enum import Enum from collections import defaultdict class ResourceType(Enum): """Types of construction resources.""" LABOR = "labor" MATERIAL = "material" EQUIPMENT = "equipment" SUBCONTRACT = "subcontract" class LaborCategory(Enum): """Labor skill categories.""" UNSKILLED = "unskilled" SEMI_SKILLED = "semi_skilled" SKILLED = "skilled" FOREMAN = "foreman" SUPERVISOR = "supervisor" SPECIALIST = "specialist" class EquipmentCategory(Enum): """Equipment categories.""" EARTHMOVING = "earthmoving" LIFTING = "lifting" CONCRETE = "concrete" TRANSPORT = "transport" COMPACTION = "compaction" PUMPING = "pumping" POWER_TOOLS = "power_tools" SCAFFOLDING = "scaffolding" @dataclass class LaborResource: """Represents a labor resource.""" resource_code: str description: str category: LaborCategory hourly_rate: float skill_level: int productivity_factor: float = 1.0 @dataclass class MaterialResource: """Represents a material resource.""" resource_code: str description: str unit: str unit_price: float category: str waste_factor: float = 0.05 # 5% default waste @dataclass class EquipmentResource: """Represents an equipment resource.""" resource_code: str description: str category: EquipmentCategory hourly_rate: float daily_rate: float monthly_rate: float fuel_consumption: float = 0.0 # liters per hour operator_required: bool = True @dataclass class ResourceRequirement: """Calculated resource requirement.""" resource_code: str description: str resource_type: ResourceType quantity: float unit: str unit_cost: float total_cost: float duration_hours: float = 0.0 @dataclass class ResourceSummary: """Summary of all resource requirements.""" labor_hours: float labor_cost: float material_cost: float equipment_cost: float total_cost: float labor_by_category: Dict[str, float] = field(default_factory=dict) materials_list: List[Dict[str, Any]] = field(default_factory=list) equipment_list: List[Dict[str, Any]] = field(default_factory=list) class CWICRResourceAnalyzer: """Analyze resources from CWICR database.""" def __init__(self, cwicr_data: pd.DataFrame, resources_data: Optional[pd.DataFrame] = None): self.work_items = cwicr_data self.resources = resources_data # Create indexes self._index_work_items() if resources_data is not None: self._index_resources() def _index_work_items(self): """Index work items for fast lookup.""" if 'work_item_code' in self.work_items.columns: self._work_index = self.work_items.set_index('work_item_code') else: self._work_index = None def _index_resources(self): """Index resources for fast lookup.""" if self.resources is not None and 'resource_code' in self.resources.columns: self._resource_index = self.resources.set_index('resource_code') else: self._resource_index = None def analyze_labor_requirements(self, items: List[Dict[str, Any]]) -> Dict[str, Any]: """Analyze labor requirements for work items.""" total_hours = 0.0 labor_by_category = defaultdict(float) labor_by_skill = defaultdict(float) labor_details = [] for item in items: code = item.get('work_item_code', item.get('code')) qty = item.get('quantity', 0) if self._work_index is not None and code in self._work_index.index: work_item = self._work_index.loc[code] labor_norm = float(work_item.get('labor_norm', 0) or 0) hours = labor_norm * qty total_hours += hours # Get category if available category = str(work_item.get('category', 'General')) labor_by_category[category] += hours labor_details.append({ 'work_item_code': code, 'description': work_item.get('description', ''), 'quantity': qty, 'labor_norm': labor_norm, 'total_hours': hours }) return { 'total_labor_hours': round(total_hours, 2), 'labor_by_category': dict(labor_by_category), 'crew_days_8hr': round(total_hours / 8, 1), 'crew_weeks_40hr': round(total_hours / 40, 1), 'details': labor_details } def analyze_material_requirements(self, items: List[Dict[str, Any]], include_waste: bool = True) -> Dict[str, Any]: """Analyze material requirements.""" materials = defaultdict(lambda: {'quantity': 0, 'unit': '', 'cost': 0}) total_cost = 0.0 for item in items: code = item.get('work_item_code', item.get('code')) qty = item.get('quantity', 0) if self._work_index is not None and code in self._work_index.index: work_item = self._work_index.loc[code] material_cost = float(work_item.get('material_cost', 0) or 0) * qty if include_waste: material_cost *= 1.05 # 5% waste factor total_cost += material_cost # Aggregate by category category = str(work_item.get('category', 'General')) materials[category]['cost'] += material_cost return { 'total_material_cost': round(total_cost, 2), 'by_category': dict(materials), 'waste_included': include_waste, 'waste_factor': 0.05 if include_waste else 0 } def analyze_equipment_requirements(self, items: List[Dict[str, Any]]) -> Dict[str, Any]: """Analyze equipment requirements.""" equipment_hours = defaultdict(float) total_cost = 0.0 for item in items: code = item.get('work_item_code', item.get('code')) qty = item.get('quantity', 0) if self._work_index is not None and code in self._work_index.index: work_item = self._work_index.loc[code] equipment_cost = float(work_item.get('equipment_cost', 0) or 0) * qty equipment_norm = float(work_item.get('equipment_norm', 0) or 0) * qty total_cost += equipment_cost category = str(work_item.get('category', 'General')) equipment_hours[category] += equipment_norm return { 'total_equipment_cost': round(total_cost, 2), 'equipment_hours_by_category': dict(equipment_hours), 'total_equipment_hours': sum(equipment_hours.values()) } def generate_resource_summary(self, items: List[Dict[str, Any]]) -> ResourceSummary: """Generate complete resource summary.""" labor = self.analyze_labor_requirements(items) materials = self.analyze_material_requirements(items) equipment = self.analyze_equipment_requirements(items) # Calculate labor cost avg_labor_rate = 35.0 # Default hourly rate labor_cost = labor['total_labor_hours'] * avg_labor_rate return ResourceSummary( labor_hours=labor['total_labor_hours'], labor_cost=labor_cost, material_cost=materials['total_material_cost'], equipment_cost=equipment['total_equipment_cost'], total_cost=labor_cost + materials['total_material_cost'] + equipment['total_equipment_cost'], labor_by_category=labor['labor_by_category'] ) def calculate_crew_requirements(self, labor_hours: float, project_duration_days: int, hours_per_day: int = 8) -> Dict[str, Any]: """Calculate crew size requirements.""" available_hours = project_duration_days * hours_per_day min_crew_size = labor_hours / available_hours if available_hours > 0 else 0 return { 'total_labor_hours': labor_hours, 'project_duration_days': project_duration_days, 'hours_per_day': hours_per_day, 'minimum_crew_size': round(min_crew_size, 1), 'recommended_crew_size': int(np.ceil(min_crew_size * 1.15)), # 15% buffer 'utilization_at_recommended': round(min_crew_size / np.ceil(min_crew_size * 1.15) * 100, 1) } def identify_critical_resources(self, items: List[Dict[str, Any]], top_n: int = 10) -> Dict[str, List[Dict]]: """Identify critical resources by cost impact.""" breakdowns = [] for item in items: code = item.get('work_item_code', item.get('code')) qty = item.get('quantity', 0) if self._work_index is not None and code in self._work_index.index: work_item = self._work_index.loc[code] breakdowns.append({ 'work_item_code': code, 'description': work_item.get('description', ''), 'quantity': qty, 'labor_cost': float(work_item.get('labor_cost', 0) or 0) * qty, 'material_cost': float(work_item.get('material_cost', 0) or 0) * qty, 'equipment_cost': float(work_item.get('equipment_cost', 0) or 0) * qty, 'total_cost': ( float(work_item.get('labor_cost', 0) or 0) + float(work_item.get('material_cost', 0) or 0) + float(work_item.get('equipment_cost', 0) or 0) ) * qty }) df = pd.DataFrame(breakdowns) if df.empty: return {'labor': [], 'material': [], 'equipment': [], 'total': []} return { 'labor': df.nlargest(top_n, 'labor_cost')[['work_item_code', 'description', 'labor_cost']].to_dict('records'), 'material': df.nlargest(top_n, 'material_cost')[['work_item_code', 'description', 'material_cost']].to_dict('records'), 'equipment': df.nlargest(top_n, 'equipment_cost')[['work_item_code', 'description', 'equipment_cost']].to_dict('records'), 'total': df.nlargest(top_n, 'total_cost')[['work_item_code', 'description', 'total_cost']].to_dict('records') } def analyze_productivity(self, items: List[Dict[str, Any]], actual_hours: Optional[Dict[str, float]] = None) -> Dict[str, Any]: """Analyze productivity vs planned norms.""" if actual_hours is None: return {'error': 'Actual hours required for productivity analysis'} analysis = [] for item in items: code = item.get('work_item_code', item.get('code')) qty = item.get('quantity', 0) if code in actual_hours and self._work_index is not None: if code in self._work_index.index: work_item = self._work_index.loc[code] planned_hours = float(work_item.get('labor_norm', 0) or 0) * qty actual = actual_hours[code] productivity = planned_hours / actual * 100 if actual > 0 else 0 analysis.append({ 'work_item_code': code, 'planned_hours': planned_hours, 'actual_hours': actual, 'productivity_percent': round(productivity, 1), 'variance_hours': planned_hours - actual }) df = pd.DataFrame(analysis) if df.empty: return {'items': [], 'average_productivity': 0} return { 'items': analysis, 'average_productivity': round(df['productivity_percent'].mean(), 1), 'total_variance': round(df['variance_hours'].sum(), 1), 'underperforming_items': len(df[df['productivity_percent'] < 90]) } class ResourceOptimizer: """Optimize resource allocation.""" def __init__(self, analyzer: CWICRResourceAnalyzer): self.analyzer = analyzer def suggest_material_substitutions(self, items: List[Dict[str, Any]], cost_threshold: float = 0.9) -> List[Dict]: """Suggest cheaper material substitutions.""" # Placeholder for substitution logic return [] def optimize_crew_allocation(self, labor_by_category: Dict[str, float], available_crew: Dict[str, int]) -> Dict[str, Any]: """Optimize crew allocation across categories.""" allocation = {} unmet_demand = {} for category, hours_needed in labor_by_category.items(): available = available_crew.get(category, 0) days_needed = hours_needed / 8 if available > 0: days_available = available * 1 # 1 day per person if days_available >= days_needed: allocation[category] = { 'assigned': int(np.ceil(days_needed)), 'remaining': available - int(np.ceil(days_needed)) } else: allocation[category] = {'assigned': available, 'remaining': 0} unmet_demand[category] = days_needed - days_available else: unmet_demand[category] = days_needed return { 'allocation': allocation, 'unmet_demand': unmet_demand, 'fully_staffed': len(unmet_demand) == 0 }
pythonfrom cwicr_data_loader import CWICRDataLoader # Load data loader = CWICRDataLoader() cwicr = loader.load("TR_workitems_costs_resources_DDC_CWICR.parquet") # Initialize analyzer analyzer = CWICRResourceAnalyzer(cwicr) # Define project items items = [ {'work_item_code': 'CONC-001', 'quantity': 150}, {'work_item_code': 'EXCV-002', 'quantity': 200}, {'work_item_code': 'REBAR-003', 'quantity': 15000} ] # Analyze labor labor = analyzer.analyze_labor_requirements(items) print(f"Total Labor Hours: {labor['total_labor_hours']}") print(f"Crew Days (8hr): {labor['crew_days_8hr']}")
python# Calculate required crew size labor = analyzer.analyze_labor_requirements(items) crew = analyzer.calculate_crew_requirements( labor_hours=labor['total_labor_hours'], project_duration_days=30 ) print(f"Minimum Crew: {crew['minimum_crew_size']}") print(f"Recommended Crew: {crew['recommended_crew_size']}")
pythonmaterials = analyzer.analyze_material_requirements(items, include_waste=True) print(f"Total Material Cost: ${materials['total_material_cost']:,.2f}")
pythonactual_hours = { 'CONC-001': 280, 'EXCV-002': 85, 'REBAR-003': 450 } productivity = analyzer.analyze_productivity(items, actual_hours) print(f"Average Productivity: {productivity['average_productivity']}%")
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-08 | pass→pass | 12,142 | 13,414 | +10% | 1 | 1 | 0% | 2,267 | 7,037 | +210% | 0 | 0 | — |
case-19 | fail→pass | 11,999 | 8,543 | -29% | 1 | 1 | 0% | 2,190 | 6,225 | +184% | 0 | 0 | — |
case-01 | fail→pass | 21,946 | 42,374 | +93% | 1 | 1 | 0% | 4,282 | 7,248 | +69% | 0 | 0 | — |
case-03 | fail→pass | 34,082 | 22,311 | -35% | 1 | 1 | 0% | 3,070 | 9,183 | +199% | 0 | 0 | — |
case-02 | fail→fail | 17,586 | 35,096 | +100% | 1 | 1 | 0% | 3,632 | 12,513 | +245% | 0 | 0 | — |
case-04 | fail→pass | 9,218 | 10,697 | +16% | 1 | 1 | 0% | 1,955 | 6,528 | +234% | 0 | 0 | — |
case-05 | pass→pass | 9,419 | 5,184 | -45% | 1 | 1 | 0% | 1,571 | 5,395 | +243% | 0 | 0 | — |
case-06 | fail→pass | 9,346 | 3,037 | -68% | 1 | 1 | 0% | 1,695 | 5,069 | +199% | 0 | 0 | — |
case-07 | fail→pass | 18,905 | 9,666 | -49% | 1 | 1 | 0% | 1,840 | 6,264 | +240% | 0 | 0 | — |
case-09 | fail→pass | 8,761 | 3,409 | -61% | 1 | 1 | 0% | 549 | 5,066 | +823% | 0 | 0 | — |
case-10 | pass→pass | 4,781 | 13,358 | +179% | 1 | 1 | 0% | 991 | 5,546 | +460% | 0 | 0 | — |
case-11 | fail→pass | 16,027 | 21,550 | +34% | 1 | 1 | 0% | 2,710 | 8,182 | +202% | 0 | 0 | — |
case-12 | fail→fail | 14,837 | 13,779 | -7% | 1 | 1 | 0% | 2,346 | 6,809 | +190% | 0 | 0 | — |
case-13 | fail→pass | 12,694 | 3,750 | -70% | 1 | 1 | 0% | 1,844 | 5,083 | +176% | 0 | 0 | — |
case-14 | pass→pass | 7,167 | 9,243 | +29% | 1 | 1 | 0% | 1,357 | 6,350 | +368% | 0 | 0 | — |
case-15 | fail→pass | 14,414 | 6,010 | -58% | 1 | 1 | 0% | 2,412 | 5,625 | +133% | 0 | 0 | — |
case-16 | fail→pass | 12,543 | 6,945 | -45% | 1 | 1 | 0% | 2,116 | 5,688 | +169% | 0 | 0 | — |
case-17 | pass→pass | 8,199 | 5,614 | -32% | 1 | 1 | 0% | 1,702 | 5,514 | +224% | 0 | 0 | — |
case-18 | fail→pass | 14,866 | 15,860 | +7% | 1 | 1 | 0% | 2,498 | 7,388 | +196% | 0 | 0 | — |
case-20 | pass→pass | 6,378 | 12,256 | +92% | 1 | 1 | 0% | 1,391 | 7,229 | +420% | 0 | 0 | — |
case-21 | pass→pass | 9,204 | 9,942 | +8% | 1 | 1 | 0% | 2,091 | 6,802 | +225% | 0 | 0 | — |
case-22 | pass→pass | 12,089 | 13,506 | +12% | 1 | 1 | 0% | 2,671 | 7,379 | +176% | 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, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +55 percentage points is the difference between those two pass rates over the 21 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.