jpskill.com
💼 ビジネス コミュニティ 🟡 少し慣れが必要 👤 経営者・事業責任者・マーケ

💼 Cost出力

cost-export

発生したコストの追跡データを、外部の

⏱ 履歴書のATS最適化 1日 → 10分

📺 まず動画で見る(YouTube)

▶ 【自動化】AIガチ勢の最新活用術6選がこれ1本で丸分かり!【ClaudeCode・AIエージェント・AI経営・Skills・MCP】 ↗

※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。

📜 元の英語説明(参考)

Export cost-tracking telemetry in Prometheus textfile or webhook JSON formats — for external observability (Grafana, Datadog, custom dashboards)

🇯🇵 日本人クリエイター向け解説

一言でいうと

発生したコストの追跡データを、外部の

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o cost-export.zip https://jpskill.com/download/2227.zip && unzip -o cost-export.zip && rm cost-export.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/2227.zip -OutFile "$d\cost-export.zip"; Expand-Archive "$d\cost-export.zip" -DestinationPath $d -Force; ri "$d\cost-export.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して cost-export.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → cost-export フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

💬 こう話しかけるだけ — サンプルプロンプト

  • Cost Export で、私のビジネスを分析して改善案を3つ提案して
  • Cost Export を使って、来週の会議用の資料を作って
  • Cost Export で、現状の課題を整理してアクションプランに落として

これをClaude Code に貼るだけで、このSkillが自動発動します。

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

コストエクスポート

cost-tracking からすべての session-* および budget-config-* レコードを取得し、外部の可観測性システムで利用可能な形式で出力します。これがないと、コストデータは AgentDB 名前空間内にのみ存在しますが、これがあれば、同じデータがダッシュボードに表示されます。

使用する場面

  • Grafana / Datadog / Prometheus のメトリクスを更新するために、cost-track の実行後。
  • 外部ダッシュボードをほぼリアルタイムに保つために、/loop 5m を介した Cron ジョブとして。
  • アドホックなレポート(Slack、カスタムエンドポイント)のために、Webhook へのワンショット。

手順

  1. 形式を選択する — Prometheus / Grafana 用のテキストファイルコレクター、またはその他のすべてのための Webhook POST:

    # Prometheus node_exporter textfile collector
    node plugins/ruflo-cost-tracker/scripts/export.mjs --prometheus /var/lib/node_exporter/textfile_collector/cost_tracker.prom
    
    # Webhook (JSON を POST します。環境変数で認証を追加してください)
    EXPORT_WEBHOOK_HEADER='Authorization: Bearer $TOKEN' \
      node plugins/ruflo-cost-tracker/scripts/export.mjs --webhook https://hooks.example.com/cost-tracker
    
    # Stdout JSON (フラグがない場合のデフォルト)
    node plugins/ruflo-cost-tracker/scripts/export.mjs
  2. 出力されるものを確認する — Prometheus の出力には以下が含まれます:

    cost_tracker_total_usd                                    <gauge>
    cost_tracker_tier_total_usd{tier="opus|sonnet|haiku"}     <gauge>
    cost_tracker_session_total_usd{session="<8-char>"}        <gauge>
    cost_tracker_session_messages{session="<8-char>"}         <counter>
    cost_tracker_budget_usd                                   <gauge>  (予算が設定されている場合)
    cost_tracker_budget_utilization                           <gauge>  (使用済み / 予算)
  3. Webhook ペイロードの形式 — Webhook が受け取る JSON は stdout JSON と一致します: { exportedAt, sessions: [...], budget, totalUsd, byTier }。ヘッダーは EXPORT_WEBHOOK_HEADER='K1: V1, K2: V2' (カンマ区切り) を介して追加できます。

環境変数による上書き

環境変数 デフォルト 目的
EXPORT_NAMESPACE cost-tracking ターゲット名前空間を上書きします
EXPORT_WEBHOOK_HEADER 未設定 Webhook 認証用のカンマ区切り K: V ペア
EXPORT_QUIET=1 未設定 エラー以外の確認出力を抑制します

相互参照

  • cost-track — このスキルがエクスポートするデータを生成します
  • cost-budget-check — 同じ cost_tracker_budget_* メトリクスは Prometheus でアラート可能です
  • node_exporter textfile collector docs (Prometheus 規約) — .prom ファイルをコレクターディレクトリにドロップすると Prometheus がそれを取得します
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Cost Export

Pulls every session-* and budget-config-* record from cost-tracking and emits in formats consumable by external observability systems. Without this, cost data lives only inside the AgentDB namespace; with it, the same data lights up dashboards.

When to use

  • After any cost-track run, to refresh metrics for Grafana / Datadog / Prometheus.
  • Cron-friendly via /loop 5m to keep external dashboards near-real-time.
  • One-shot to a webhook for ad-hoc reporting (Slack, custom endpoint).

Steps

  1. Pick a format — textfile collector for Prometheus / Grafana, or webhook POST for everything else:

    # Prometheus node_exporter textfile collector
    node plugins/ruflo-cost-tracker/scripts/export.mjs --prometheus /var/lib/node_exporter/textfile_collector/cost_tracker.prom
    
    # Webhook (POSTs JSON; add auth via env)
    EXPORT_WEBHOOK_HEADER='Authorization: Bearer $TOKEN' \
      node plugins/ruflo-cost-tracker/scripts/export.mjs --webhook https://hooks.example.com/cost-tracker
    
    # Stdout JSON (default if no flag)
    node plugins/ruflo-cost-tracker/scripts/export.mjs
  2. Inspect what's emitted — Prometheus output includes:

    cost_tracker_total_usd                                    <gauge>
    cost_tracker_tier_total_usd{tier="opus|sonnet|haiku"}     <gauge>
    cost_tracker_session_total_usd{session="<8-char>"}        <gauge>
    cost_tracker_session_messages{session="<8-char>"}         <counter>
    cost_tracker_budget_usd                                   <gauge>  (if budget configured)
    cost_tracker_budget_utilization                           <gauge>  (spent / budget)
  3. Webhook payload shape — the JSON the webhook receives matches the stdout JSON: { exportedAt, sessions: [...], budget, totalUsd, byTier }. Headers may be added via EXPORT_WEBHOOK_HEADER='K1: V1, K2: V2' (comma-separated).

Env overrides

Env Default Purpose
EXPORT_NAMESPACE cost-tracking Override target namespace
EXPORT_WEBHOOK_HEADER unset Comma-separated K: V pairs for webhook auth
EXPORT_QUIET=1 unset Suppress non-error confirmation output

Cross-references

  • cost-track — produces the data this skill exports
  • cost-budget-check — the same cost_tracker_budget_* metrics are alertable in Prometheus
  • node_exporter textfile collector docs (Prometheus convention) — drop the .prom file in the collector directory and Prometheus picks it up