Cost management

From gonzalezpazmonica/pm-workspace · View interactive version

Cost management is an AI agent skill from the GitHub repository gonzalezpazmonica/pm-workspace. Usar cuando se gestionan timesheets, presupuestos, facturas o forecasting de costes.

How to use this skill

Skill file

Skill: Cost Management

Prerequisito: @docs/rules/domain/billing-model.md, @docs/rules/domain/cost-tracking.md

Orquesta timesheet logging, budget tracking, forecasting y generación de invoices.

Ejecución: no hay script dedicado. El agente aplica estos flujos leyendo y

escribiendo los JSONL/JSON documentados con sus herramientas. Lo único ejecutable

es el validador de contrato scripts/test-cost-center.sh y la protección de rates

en .gitignore, ambos cubiertos por tests/test-cost-management.bats.

Flujo 1 — Log de horas (`log`)

  1. Validar entrada:
  1. Leer rates de projects/{proj}/.rates.local.json si existe; si no, .flow-data/rates.json (ambos git-ignorados)
  2. Calcular cost = hours × rate_for_role
  3. Crear entrada JSONL en .flow-data/timesheets/{user}/{YYYY-MM}.jsonl
  4. Actualizar ledger: añadir entrada type "time" a .flow-data/ledger/{project}.jsonl
  5. Output: confirmación + acumulado del mes

Error handling:

Flujo 2 — Informe de costes (`report`)

Parámetros: --period {YYYY-MM}, --team {nombre}, --project {slug}, --client {slug}

  1. Recopilar timesheet entries según filtros
  2. Agregar por:
  1. Calcular KPIs: cost-per-SP, utilization-rate, burn-rate
  2. Generar tabla resumen:

```

Project │ Hours │ Cost (€) │ Team │ Status

────────────┼────────┼──────────┼───────────┼─────────

sala-reservas │ 160 │ 13,600 │ Backend │ On-budget

api-v3 │ 120 │ 14,400 │ Backend │ 5% over

```

  1. Guardar en output/cost-report-{periodo}.md

Flujo 3 — Gestión de presupuestos (`budget`)

Subcomandos:

Output: tabla con budget/actual/remaining/% spent + alertas

Project         │ Total   │ Spent  │ Remaining │ Status
────────────────┼─────────┼────────┼───────────┼──────────
sala-reservas   │ €50,000 │ €42,500 │ €7,500    │ 85% ⚠️
api-v3          │ €60,000 │ €48,000 │ €12,000   │ 80% ⚠️

Flujo 4 — Pronóstico (`forecast`)

  1. Leer ledger del proyecto
  2. Calcular (EAC lineal por burn rate de cost-tracking.md; la variante EVM BAC / CPI de billing-model.md requiere % complete):
  1. Comparar EAC vs. BAC:

Output: gráfico ASCII de proyección + recomendaciones

Forecast: EAC = €55,200 (BAC = €50,000)
Risk: 10.4% over budget
Options:
  1. Reduce scope (descope €5,200 worth of features)
  2. Extend timeline (add 2 weeks)
  3. Increase budget (request €5,200 approval)

Flujo 5 — Generación de invoices (`invoice`)

Parámetros: --client {slug}, --period {YYYY-MM}, --status draft|final

  1. Recopilar timesheet entries para cliente + período
  2. Agrupar por (project, role)
  3. Generar invoice JSON con schema de @billing-model.md
  4. Guardar en output/invoices/{client}-{YYYY-MM}.json
  5. Status = "draft" (editable), cambiar a "final" cuando aprobado
  6. Output: resumen + ruta del JSON (no se genera PDF)

Errores

| Problema | Solución |

|----------|----------|

| Horas duplicadas | Advertir, preguntar si mezclar o descartar |

| Rate no definido | Crear .flow-data/rates.json (schema en billing-model.md) |

| Proyecto sin presupuesto | Crear presupuesto con /cost-center budget --create {project} |

| Período sin datos | Mostrar período más reciente disponible |

Seguridad

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.