/loxihart-engineering:governing-stack-costsfrom loxihart-engineering
Tracks, alerts on, and optimizes cloud infrastructure costs across the production stack — Anthropic API token spend, Supabase compute and egress, Vercel function invocations, and n8n executions. Establishes per-service budget thresholds, monthly review workflow, and quick-win optimization patterns. Use when reviewing cloud costs, setting budget alerts, an unexpected bill arrived, trying to reduce API spend, figuring out what's costing money, optimizing token usage, or setting up cost governance for a production system. Also triggers on: cost spike, cloud bill, Anthropic costs, API spend, reduce token usage, cost optimization, budget alert, Supabase bill, Vercel usage, what am I spending, cloud costs, LLM costs.
Ships in loxihart-engineering. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Covers the full production stack cost picture, not just LLM costs.
For LLM-specific optimization patterns (model routing, caching), see
ecc:cost-aware-llm-pipeline.
Set these as alerts in each service's dashboard. Adjust once you know your actual baseline.
| Service | Monthly budget | Alert at 75% | Hard alert at 100% |
|---|---|---|---|
| Anthropic API | $[set yours] | $[×0.75] | $[×1.0] |
| Supabase | $[set yours] | — | At plan limit |
| Vercel | $[set yours] | — | At plan limit |
| n8n Cloud | $[plan cost] | 75% of executions | 90% of executions |
Set Anthropic usage alerts: console.anthropic.com → Settings → Billing → Usage alerts Configure: monthly budget limit + email notification at 75% and 100%.
Run this on the 1st of each month:
instrumenting-production-stack)Use Haiku for simple tasks: classification, summarization, routing decisions, extraction. Cost: 15-25x less than Sonnet. Rule of thumb: if the task fits in under 500 tokens and doesn't require complex reasoning, Haiku is sufficient.
Cache repeated system prompts: use prompt caching (available on Claude 3.5+ models) for system prompts and static context over 1024 tokens. Cached tokens cost ~10% of normal input price.
Reduce turn count: long multi-turn conversations cost more per session. If the agent is averaging >8 turns per task, the system prompt or tool definitions may need clarification.
Log and review high-token sessions: any session over 50K tokens is worth reviewing — it may indicate a context management issue or an agent stuck in a loop.
Reduce egress: add indexes to avoid full table scans, which
return more rows than needed. Use select() with explicit column
lists instead of select *.
Connection pooling: use Supabase's built-in connection pooler (Transaction mode for serverless, Session mode for persistent) to prevent connection limit overruns that force upgrade.
Storage cleanup: delete unused storage objects and old backups. Storage costs accumulate silently.
Edge vs. Serverless routing: move lightweight middleware and simple API routes to Edge Functions (faster, cheaper) and reserve Serverless Functions for DB-connected routes.
Bundle size optimization: large bundles increase cold start time
and bandwidth. Run @next/bundle-analyzer to identify large dependencies.
Increase polling intervals: if polling every 1 minute is unnecessary, change to every 5 or 15 minutes. Polling executions count against your quota even when no data is found.
Deactivate unused workflows: inactive workflows still count as "active" in some n8n plans. Deactivate anything not running in the last 30 days.
instrumenting-production-stack) makes it possible to identify the
top cost drivers within days of a cost spike rather than weeksWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub krosebrook/loxihart-skills --plugin loxihart-engineering22 skills in this plugin
/administering-supabaseManages Supabase database operations for FlashFusion's production stack — schema design, Row Level Security policies, migrations, Edge Functions, and debugging. Active project: flashnframe-app (etctmappdhpjuwptdbeb). Use when the user mentions: Supabase, RLS, row level security, migration, schema, database, table, Edge Function, auth, policies, Postgres, supabase query, database admin, add a column, create a table, why is my query blocked, or any task involving the Supabase project or database structure.
/auditing-logicAudits code for logical errors before they become bugs — control flow gaps, data contract violations, schema/type drift, business logic inconsistencies, and silent failure paths. Produces a severity-rated issue list with a one-line diagnosis and one-line fix per finding. Use this skill whenever code is pasted with a review request, or when the user says "audit this", "check the logic", "does this make sense", "any issues with this", "logic audit", "what's wrong here", "review this function", "is this correct", or hands you any code file and wants a critical eye. Even if the user does not say "logic" — if code is present and they want feedback, use this skill. Also triggers on: "find the bug", "something feels off", "is this right", "sanity check this", "does this hold", "validate my logic", "code review", "PR review", "review this PR".
/code-auditorPerforms comprehensive codebase analysis covering architecture, code quality, security, performance, testing, and maintainability. Use when user wants to audit code quality, identify technical debt, find security issues, assess test coverage, or get a codebase health check./code-transferTransfer code between files with line-based precision. Use when users request copying code from one location to another, moving functions or classes between files, extracting code blocks, or inserting code at specific line numbers./debug-like-expertDeep analysis debugging mode for complex issues. Activates methodical investigation protocol with evidence gathering, hypothesis testing, and rigorous verification. Use when standard troubleshooting fails or when issues require systematic root cause analysis. Triggers on: debug this, root cause analysis, systematic debugging, why is this failing, trace this bug, diagnose this issue, investigation protocol, hypothesis testing./engineering-patternsProduction engineering pattern library spanning 11 phases — Foundation, Resilience, Performance, Data Integrity, Observability, Deployment, Scalability, Edge Cases, Security Deep, Compliance/DR/FinOps, and AI/HITL. Use when auditing code for production readiness, applying hardening patterns, reviewing system design, pattern audit, apply phase, harden this, production-ready, resilience patterns, observability gaps, security review, DR plan, FinOps, or AI guardrails. Use alongside engineering-staff-workflows for execution. Not for writing the implementation itself — that is engineering-staff-workflows.