Token导航 LogoToken导航TokenDH.com
开发权限需确认github未标认证来源可访问许可证需确认审计通过

cwicr-resource-analyzerCWICR 资源分析器

Agent Skill

cwicr-resource-analyzer 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

376

周安装

16

GitHub Stars

111

下载量

132
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cwicr-resource-analyzer(CWICR 资源分析器)
来源仓库:https://github.com/datadrivenconstruction/ddc_skills_for_ai_agents_in_construction
仓库路径:skills/cwicr-resource-analyzer
安装命令:
npx skills add https://github.com/datadrivenconstruction/ddc_skills_for_ai_agents_in_construction --skill cwicr-resource-analyzer
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/datadrivenconstruction/ddc_skills_for_ai_agents_in_construction --skill cwicr-resource-analyzer

简介

CWICR 资源分析器拆解工作项为详细的人工、材料与设备需求。

  • 适用于精准采购计划、调度安排与资源消耗控制。
  • 基于 27,672 条标准化资源数据,提供可靠分解依据。
  • 输出结果应与项目图纸和技术说明交叉验证,确保完整性。
  • cwicr-resource-analyzer 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

CWICR Resource Analyzer

Business Case

Problem Statement

Construction projects require precise resource planning:

  • How many labor hours are needed?
  • What materials need to be procured?
  • What equipment is required and for how long?

Traditional methods rely on experience-based estimates, leading to over/under allocation.

Solution

Data-driven resource analysis using CWICR's 27,672 resources with detailed breakdowns of labor norms, material requirements, and equipment usage.

Business Value

  • Accurate planning - Based on validated resource norms
  • Cost optimization - Identify resource inefficiencies
  • Procurement support - Generate material lists
  • Labor planning - Calculate crew requirements

Technical Implementation

Python Implementation

import 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
        }

Quick Start

from cwicr_data_loader import CWICRDataLoader

# Load data
loader = CWICRDataLoader()
cwicr = loader.load("ddc_cwicr_en.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']}")

Common Use Cases

1. Crew Planning

# 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']}")

2. Material Procurement

materials = analyzer.analyze_material_requirements(items, include_waste=True)
print(f"Total Material Cost: ${materials['total_material_cost']:,.2f}")

3. Productivity Tracking

actual_hours = {
    'CONC-001': 280,
    'EXCV-002': 85,
    'REBAR-003': 450
}
productivity = analyzer.analyze_productivity(items, actual_hours)
print(f"Average Productivity: {productivity['average_productivity']}%")

Resources

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.65%
按下载量换算43

Claude

30.44%
按下载量换算40

Cursor

20.55%
按下载量换算27

Gemini CLI

8.45%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

权限需确认

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills