cost-estimation-resource
Calculate construction costs using resource-based method. Estimate project costs from work items, physical resource norms, and current prices.
What this skill does
# Cost Estimation - Resource Method
## Business Case
### Problem Statement
Traditional costing challenges:
- Fixed unit prices become outdated
- No visibility into cost components
- Difficult to adjust for conditions
- Limited cost analysis capability
### Solution
Resource-based costing separates physical resource consumption (norms) from prices, enabling accurate, adjustable, and transparent cost estimation.
## Technical Implementation
```python
import pandas as pd
from typing import Dict, Any, List, Optional
from dataclasses import dataclass, field
from enum import Enum
class ResourceType(Enum):
LABOR = "labor"
MATERIAL = "material"
EQUIPMENT = "equipment"
SUBCONTRACTOR = "subcontractor"
@dataclass
class Resource:
code: str
name: str
resource_type: ResourceType
unit: str
unit_price: float
currency: str = "USD"
@dataclass
class ResourceNorm:
resource_code: str
consumption: float # Units per work item unit
waste_factor: float = 1.0 # 1.1 = 10% waste
@dataclass
class WorkItem:
code: str
name: str
unit: str
resources: List[ResourceNorm] = field(default_factory=list)
@dataclass
class CostLineItem:
work_item_code: str
work_item_name: str
quantity: float
unit: str
labor_cost: float
material_cost: float
equipment_cost: float
subcontractor_cost: float
total_cost: float
class ResourceBasedEstimator:
"""Calculate costs using resource-based method."""
def __init__(self):
self.resources: Dict[str, Resource] = {}
self.work_items: Dict[str, WorkItem] = {}
self.overhead_rate: float = 0.15
self.profit_rate: float = 0.10
def add_resource(self, resource: Resource):
"""Add resource to database."""
self.resources[resource.code] = resource
def add_work_item(self, work_item: WorkItem):
"""Add work item with resource norms."""
self.work_items[work_item.code] = work_item
def load_resources_from_df(self, df: pd.DataFrame):
"""Load resources from DataFrame."""
for _, row in df.iterrows():
resource = Resource(
code=row['code'],
name=row['name'],
resource_type=ResourceType(row['type'].lower()),
unit=row['unit'],
unit_price=float(row['unit_price']),
currency=row.get('currency', 'USD')
)
self.add_resource(resource)
def load_work_items_from_df(self, items_df: pd.DataFrame, norms_df: pd.DataFrame):
"""Load work items and norms from DataFrames."""
# Group norms by work item
norms_grouped = norms_df.groupby('work_item_code')
for _, row in items_df.iterrows():
code = row['code']
resources = []
if code in norms_grouped.groups:
item_norms = norms_grouped.get_group(code)
for _, norm_row in item_norms.iterrows():
resources.append(ResourceNorm(
resource_code=norm_row['resource_code'],
consumption=float(norm_row['consumption']),
waste_factor=float(norm_row.get('waste_factor', 1.0))
))
work_item = WorkItem(
code=code,
name=row['name'],
unit=row['unit'],
resources=resources
)
self.add_work_item(work_item)
def calculate_work_item_cost(self, work_item_code: str, quantity: float) -> CostLineItem:
"""Calculate cost for a work item quantity."""
if work_item_code not in self.work_items:
raise ValueError(f"Work item {work_item_code} not found")
work_item = self.work_items[work_item_code]
labor_cost = 0.0
material_cost = 0.0
equipment_cost = 0.0
subcontractor_cost = 0.0
for norm in work_item.resources:
if norm.resource_code not in self.resources:
continue
resource = self.resources[norm.resource_code]
resource_qty = quantity * norm.consumption * norm.waste_factor
resource_cost = resource_qty * resource.unit_price
if resource.resource_type == ResourceType.LABOR:
labor_cost += resource_cost
elif resource.resource_type == ResourceType.MATERIAL:
material_cost += resource_cost
elif resource.resource_type == ResourceType.EQUIPMENT:
equipment_cost += resource_cost
elif resource.resource_type == ResourceType.SUBCONTRACTOR:
subcontractor_cost += resource_cost
total = labor_cost + material_cost + equipment_cost + subcontractor_cost
return CostLineItem(
work_item_code=work_item_code,
work_item_name=work_item.name,
quantity=quantity,
unit=work_item.unit,
labor_cost=round(labor_cost, 2),
material_cost=round(material_cost, 2),
equipment_cost=round(equipment_cost, 2),
subcontractor_cost=round(subcontractor_cost, 2),
total_cost=round(total, 2)
)
def calculate_estimate(self, items: List[Dict[str, Any]]) -> Dict[str, Any]:
"""Calculate full estimate from list of items."""
line_items = []
totals = {
'labor': 0.0,
'material': 0.0,
'equipment': 0.0,
'subcontractor': 0.0,
'direct': 0.0
}
for item in items:
code = item['work_item_code']
qty = float(item['quantity'])
line = self.calculate_work_item_cost(code, qty)
line_items.append(line)
totals['labor'] += line.labor_cost
totals['material'] += line.material_cost
totals['equipment'] += line.equipment_cost
totals['subcontractor'] += line.subcontractor_cost
totals['direct'] += line.total_cost
# Calculate overhead and profit
overhead = totals['direct'] * self.overhead_rate
subtotal = totals['direct'] + overhead
profit = subtotal * self.profit_rate
grand_total = subtotal + profit
return {
'line_items': line_items,
'totals': {
'labor': round(totals['labor'], 2),
'material': round(totals['material'], 2),
'equipment': round(totals['equipment'], 2),
'subcontractor': round(totals['subcontractor'], 2),
'direct_cost': round(totals['direct'], 2),
'overhead': round(overhead, 2),
'overhead_rate': self.overhead_rate,
'subtotal': round(subtotal, 2),
'profit': round(profit, 2),
'profit_rate': self.profit_rate,
'grand_total': round(grand_total, 2)
},
'summary': {
'item_count': len(line_items),
'labor_pct': round(totals['labor'] / totals['direct'] * 100, 1) if totals['direct'] > 0 else 0,
'material_pct': round(totals['material'] / totals['direct'] * 100, 1) if totals['direct'] > 0 else 0,
'equipment_pct': round(totals['equipment'] / totals['direct'] * 100, 1) if totals['direct'] > 0 else 0
}
}
def adjust_prices(self, factor: float, resource_type: ResourceType = None):
"""Adjust resource prices by factor."""
for code, resource in self.resources.items():
if resource_type is None or resource.resource_type == resource_type:
resource.unit_price *= factor
def apply_regional_factor(self, factor: float):
"""Apply regional cost factor to all resources."""
self.adjust_prices(factor)
def get_resource_breakdown(self, work_item_code: str, quantity: float) -> pd.DataFrame:
"""Get detailed resource breRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.