Skip to main content
skill CX Codex

carbon-card — Claude Code skill: carbon footprint report cards

Turns your Claude usage into a PNG report card with the carbon footprint, ready to post or send.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add gwittebolle/claude-carbon --skill carbon-card -a claude-code
Open on GitHub

What carbon-card does

The skill runs a bash script that hunts down your claude-carbon install. It reads the path from statusLine.command in settings.json, then falls back to CLAUDE_PLUGIN_ROOT, CLAUDE_CARBON_DIR, the newest cached marketplace copy, and finally $HOME/code/claude-carbon. Totals print first, the export directory on the last line.

Rendering is handled by Playwright's Chromium if you have it, otherwise by a headless Google Chrome, Microsoft Edge, Chromium or Brave already on the machine. With none of those, no PNG is produced. The script still exits 0, saves the summary card as an HTML page and opens it in your browser, so a screenshot is what you share. Installing a browser is left to you.

PNGs land in ~/Downloads/claude-carbon/, or in CLAUDE_CARBON_EXPORT_DIR when that variable is set, and the folder is opened in your file manager for you. On Windows, paths in environment variables and settings.json can show up as C:\Users\..., which bash cannot open, so the script pipes them through cygpath from Git for Windows. Set CLAUDE_CARBON_NO_OPEN to skip the automatic folder opening.

What it helps with

  • get a PNG card of a session's carbon footprint
  • share Claude usage totals on a social feed
  • work out CO2 emissions and API cost from the logs
  • drop the report into Downloads and open the folder
  • produce a card when Playwright is not installed

Example prompts for the agent

  • Generate my carbon footprint card
  • Run carbon-card and show me the exported file paths
  • Make the card and help me write a post with the totals

How to install carbon-card

1Skills CLI (Vercel)

npx skills add gwittebolle/claude-carbon --skill carbon-card -a claude-code

2Manually: put the files in place

~/.claude/skills/carbon-card/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/carbon-card/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about carbon-card

How do I install carbon-card in Claude Code?

Run npx skills add gwittebolle/claude-carbon --skill carbon-card -a claude-code. The skill lands at ~/.claude/skills/carbon-card/SKILL.md.

What does carbon-card do?

It runs the claude-carbon script, which totals your usage footprint and draws a summary card. You get a PNG in your Downloads folder, or an HTML page to screenshot when no browser is available.

What do I need for the PNGs to work?

Playwright's Chromium, or an installed Google Chrome, Microsoft Edge, Chromium or Brave. Without one of them the card is saved as an HTML page and opened in your browser.

Source text

SKILL.md · MIT
---
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.

```bash
#!/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")"
  [ -n "$SL_CMD" ] && [ -f "$SL_CMD" ] && REPO_DIR="$(cd "$(dirname "$SL_CMD")/.." 2>/dev/null && pwd)"
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
[ -z "$REPO_DIR" ] && REPO_DIR="$HOME/code/claude-carbon"

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

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 screenshot is enough to share it, and installing Google Chrome or Microsoft Edge gets PNGs next time. Do not present it as an error and do not run the install yourself. The offer to help with a post stands the same way.

© gwittebolle · MIT · gwittebolle/claude-carbon

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set3

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor