Skip to content
Monitoring
Skill

/carbon-card

Generate shareable PNG report cards of your Claude Code carbon footprint

From plugin
claude-carbon
2546 skills5 hooks

Claude Code

$ npx -y skills add gwittebolle/claude-carbon --skill carbon-card --agent claude-code

SKILL.md

carbon-card.SKILL.md
name: carbon-card
description: Generate shareable PNG report cards of your Claude Code carbon footprint

Run the following bash script and present the output to the user. Show the exported file paths so they can share the PNGs, and tell them the folder has been opened in their file manager. When no browser could draw them there are no PNGs: see the last paragraph.

#!/usr/bin/env bash
# Locate the install wired into the status line (honours CLAUDE_CONFIG_DIR),
# then fall back to CLAUDE_PLUGIN_ROOT / CLAUDE_CARBON_DIR / the default path.
# Windows (Git Bash): CLAUDE_* variables and the paths stored in settings.json can
# arrive in the native "C:\Users\..." spelling, which bash cannot open. cygpath
# ships with Git for Windows; everywhere else this is the identity function.
ccp() {
  case "${OSTYPE:-}" in msys*|cygwin*) ;; *) printf '%s' "$1"; return 0 ;; esac
  case "$1" in
    [A-Za-z]:[\\/]*|*\\*) cygpath -u "$1" 2>/dev/null || printf '%s' "$1" ;;
    *) printf '%s' "$1" ;;
  esac
}
CFG="$(ccp "${CLAUDE_CONFIG_DIR:-$HOME/.claude}")"
# A jq the installer fetched into the data folder (a Mac older than macOS 15 has none)
if ! command -v jq >/dev/null 2>&1 && [ -x "$CFG/claude-carbon/bin/jq" ]; then PATH="$CFG/claude-carbon/bin:$PATH"; fi
REPO_DIR=""
if command -v jq >/dev/null 2>&1 && [ -f "$CFG/settings.json" ]; then
  SL_CMD="$(jq -r '.statusLine.command // empty' "$CFG/settings.json" 2>/dev/null)"
  # statusLine.command stores a path, shell-escaped, or in double quotes on Windows:
  # unquote, expand ~ and unescape spaces
  SL_CMD="${SL_CMD#\"}"; SL_CMD="${SL_CMD%\"}"
  SL_CMD="${SL_CMD//\\ / }"; SL_CMD="${SL_CMD/#\~/$HOME}"; SL_CMD="$(ccp "$SL_CMD")"
  if [ -n "$SL_CMD" ] && [ -f "$SL_CMD" ]; then
    SL_DIR="$(dirname "$SL_CMD")"
    if [ -f "$SL_DIR/plugin-root" ]; then
      # The plugin's own status line: a small script next to a file naming the plugin's folder
      R=""; IFS= read -r R <"$SL_DIR/plugin-root" 2>/dev/null; R="$(ccp "${R%$'\r'}")"
      [ -n "$R" ] && [ -d "$R/scripts" ] && REPO_DIR="$R"
    else
      REPO_DIR="$(cd "$SL_DIR/.." 2>/dev/null && pwd)"
    fi
  fi
fi
[ -z "$REPO_DIR" ] && [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && REPO_DIR="$(ccp "$CLAUDE_PLUGIN_ROOT")"
[ -z "$REPO_DIR" ] && [ -n "${CLAUDE_CARBON_DIR:-}" ] && REPO_DIR="$(ccp "$CLAUDE_CARBON_DIR")"
if [ -z "$REPO_DIR" ]; then
  # Pure marketplace installs reach here: no statusLine.command in settings.json and
  # no CLAUDE_PLUGIN_ROOT in a skill's bash env. Pick the newest cached plugin copy,
  # the same scan as statusline.sh CACHE_LATEST.
  CACHE_LATEST=""
  for D in "$CFG/plugins/cache"/*/claude-carbon/*/; do
    [ -f "${D}scripts/generate-report.sh" ] || continue
    if [ -z "$CACHE_LATEST" ] || [ "$(printf '%s\n%s\n' "$CACHE_LATEST" "$D" | sort -V | tail -1)" = "$D" ]; then
      CACHE_LATEST="$D"
    fi
  done
  [ -n "$CACHE_LATEST" ] && REPO_DIR="${CACHE_LATEST%/}"
fi
# The /carbon-* commands are links into the install: they name it when the status line
# belongs to another tool (a clone outside the default folder, a Homebrew install).
if [ -z "$REPO_DIR" ]; then
  CMD_LNK="$(readlink "$CFG/commands/carbon-card.md" 2>/dev/null || true)"
  case "$CMD_LNK" in
    */skills/carbon-card/SKILL.md) [ -d "${CMD_LNK%/skills/*}/scripts" ] && REPO_DIR="${CMD_LNK%/skills/*}" ;;
  esac
fi
[ -z "$REPO_DIR" ] && REPO_DIR="$HOME/code/claude-carbon"

bash "$REPO_DIR/scripts/generate-report.sh"

When a line starting with `Period:` comes after the `Querying` line, say it in one sentence in the user's working language: over the first days of January the card covers the year just ended, and they can ask for the new year instead.

The script prints the export directory on its final line (`Done. <dir>/`) and a `Totals since ...` line before the exported paths. When a line starting with `Note:` comes just before the `Totals since ...` line, relay it first, in the user's working language and in one sentence: the token count on the card now includes cache reads, which is why it is much higher than on their earlier cards, and the CO2 and the API-price cost have not changed. It appears once. The directory is the user's Downloads folder (`~/Downloads/claude-carbon/`, or `CLAUDE_CARBON_EXPORT_DIR` when set), and the script has already opened it in the file manager: Finder with the summary card selected on macOS, Explorer on Windows, the default file manager on Linux (skipped when `CLAUDE_CARBON_NO_OPEN` is set or no display is available). Show the export path exactly as printed, it is already in the platform's native spelling, and say the folder should now be open in front of them.

Then, in one or two short sentences in the user's working language, encourage them to post the card (LinkedIn works well), and say you can help write the post if they want. Do not write a draft unless they ask. If they do, build it ONLY from the numbers on the `Totals since ...` line, quoted as printed with unit and factor (the car figure follows the detected locale and names its factor after "by car"), in a strictly factual register: no self-congratulation, no green-virtue framing, two hashtags at most, no credit line for the tool (the card's footer already carries it). Iterate on the wording, never on the numbers.

The PNGs come from Playwright's Chromium when it is installed, otherwise from a Google Chrome, Microsoft Edge, Chromium or Brave already on the machine, run headless (the `Exporting PNGs via ...` line names it). With none of them, or when the browser draws nothing, the script still exits 0 and makes no PNG. Its last line then starts with `No PNG:` and comes right after the `Totals since ...` line. The summary card has been saved as an HTML page in the export folder and opened in the default browser instead (or, when nothing could be opened, the line gives the page's path), scaled to fit the window, and a screenshot of it is the card. Tell the user exactly that, in their language: the card is in their browser, a screensh

Read more
@gwittebolle
Ships withclaude-carbon

Track the carbon footprint of your Claude Code sessions, in the terminal and the Claude desktop app

Stars on GitHub

Momentum

stars in total
254
Star history of gwittebolle/claude-carbon on GitHub, a chart by star-history.com

Other skills on claude-carbon.

More skills from other plugins.

agentdb-advanced

agentdb-advanced

Master advanced AgentDB features including QUIC synchronization, multi-database management, custom distance metrics, hybrid…

ruview6d104k
@ruvnet@ruvnetInstall Skill
install

install

Kubeshark installation and deployment skill. Use this skill whenever the user wants to install Kubeshark, deploy Kubeshark to a…

kubeshark13d12k
@kubeshark@kubesharkInstall Skill
scan

scan

Scan a project with sentrux to get structural health grades (A-F) across 14 dimensions including coupling, cycles, cohesion, dead…

sentrux8mo3.3k
@sentrux@sentruxInstall Skill
phone-input

phone-input

Call the user on the phone for real-time voice conversations. Use this when you need input, want to report on completed work, or…

callme7mo2.7k
@zeframlou@zeframlouInstall Skill

Questions about carbon-card.

Which coding agents can use carbon-card?
carbon-card installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.