install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/costs" ~/.claude/skills/majiayu000-claude-skill-registry-costs && rm -rf "$T"
manifest:
skills/data/costs/SKILL.mdsource content
Cost Dashboard Skill
Display Devflow cost tracking and spending analytics by reading session data directly.
Usage
/costs [options]
Options
| Option | Description |
|---|---|
| --period day | Show today's costs only |
| --period week | Show this week's costs |
| --period month | Show this month's costs (default) |
| --history N | Show last N sessions |
| --story KEY | Filter by story key |
Prompt
You are displaying the Devflow cost dashboard.
Arguments: $ARGUMENTS
Step 1: Read Configuration
Read the configuration file:
- Path:
tooling/.automation/costs/config.json
This contains:
: Development budget (USD)budget_dev
: Current plan (free/pro)subscription_plan
: Monthly token limitsubscription_token_limit
: Days in billing periodsubscription_billing_period_days
: Currencies to showdisplay_currencies
: Exchange ratescurrency_rates
Step 2: Find Session Files
Find all session files:
- Path pattern:
tooling/.automation/costs/sessions/*.json
Step 3: Read and Aggregate Session Data
For each session file, extract:
: Session identifiersession_id
/start_time
: Timestampsend_time
: Associated story (if any)story_key
: Array of cost entries withentries[]
,model
,input_tokens
,output_tokenscost_usd
: Aggregated totals for the sessiontotals
Identify the most recent session as the "current session".
Step 4: Calculate Metrics
Calculate:
- Current session tokens/cost: From the most recent session
- Cumulative tokens: Sum of all tokens across ALL sessions this billing period
- Cumulative cost: Sum of all
across ALL sessionscost_usd - Cost by model: Group costs by model (opus, sonnet, haiku)
- Cost by story: Group costs by story_key
- Budget usage: (cumulative_cost / budget_dev) * 100
- Subscription usage: (cumulative_tokens / subscription_token_limit) * 100
- Average cost per session: cumulative_cost / session_count
- Average tokens per session: cumulative_tokens / session_count
- Input/output ratio: total_input_tokens / total_output_tokens
- Days remaining: Calculate from billing period start
- Projected monthly cost: (cumulative_cost / days_elapsed) * 30
- Projected token usage: (cumulative_tokens / days_elapsed) * 30
Step 5: Apply Filters
Based on $ARGUMENTS:
: Filter sessions from today only--period day
: Filter sessions from last 7 days--period week
: Filter sessions from last 30 days (default)--period month
: Show only last N sessions--history N
: Filter sessions matching story_key--story KEY
Step 6: Format Output
Display the dashboard using this format:
================================================================= DEVFLOW COST DASHBOARD ================================================================= Plan: [plan] | Tokens: [cumulative]/[limit] ([%]%) | [days] days left This Session: $[current_cost] | Cumulative: $[total_cost] ================================================================= PERIOD: [period] SESSIONS: [count] --- TOKEN USAGE --------------------------------------------- This Session Cumulative Input: [current_in] [total_in] Output: [current_out] [total_out] Total: [current_total] [total_total] I/O Ratio: [ratio]:1 (higher = more input-heavy conversations) --- COST BY MODEL ------------------------------------------- [model] $[cost] ([%]%) [bar] --- COST BY STORY ------------------------------------------- [story-key] $[cost] ([%]%) (no story) $[cost] ([%]%) --- BUDGET STATUS ------------------------------------------- Spent: $[total] / $[budget] ([%]%) [================================--------------------] [%]% [WARNING] if > 75%: "Approaching budget limit!" [CRITICAL] if > 90%: "Near budget limit - consider pausing" --- PROJECTIONS (based on current usage rate) --------------- Monthly token projection: [projected] / [limit] ([%]%) Monthly cost projection: $[projected_cost] Avg cost per session: $[avg_cost] Avg tokens per session: [avg_tokens] --- RECENT SESSIONS ----------------------------------------- [session_id] [date] [tokens] $[cost] [story or "-"] [session_id] [date] [tokens] $[cost] [story or "-"] [session_id] [date] [tokens] $[cost] [story or "-"] (show last 5 sessions) --- CURRENCIES ---------------------------------------------- $[USD] | E[EUR] | L[GBP] | R$[BRL] =================================================================
Budget Warnings
Display warnings based on config thresholds:
- If budget usage >
(75%): Show [WARNING]warning_percent - If budget usage >
(90%): Show [CRITICAL]critical_percent - If subscription usage > 80%: Show token limit warning
Notes
- Format large numbers with K/M suffixes (e.g., 1.5K, 2.3M)
- Round costs to 2 decimal places
- Show percentages to 1 decimal place
- Use text-based progress bars with = and - characters
- Current session = most recent session file by timestamp
- Cumulative = sum of ALL sessions in the billing period
- If no sessions found, display a message indicating no cost data available
- Calculate days remaining: billing_period_days - days since first session of period