carbon-pr — скилл для Claude Code: что делает и как установить
Подсчитывает сессии Claude Code для текущей ветки и публикует след разработки в закреплённом комментарии к пулреквесту.
npx skills add gwittebolle/claude-carbon --skill carbon-pr -a claude-codeЧто делает carbon-pr
Скилл запускает локальный скрипт generate-pr-report.sh из состава claude-carbon. Он находит путь к установке через настройки строки статуса Claude Code, переменные окружения или кэш плагинов. Для работы скрипту нужны утилита jq и авторизованный CLI gh.
Инструмент суммирует локальные сессии для ветки текущего проекта и отправляет закреплённый комментарий в открытый PR на GitHub. Если комментарий уже существует, он обновляет его на месте. С флагом --pr <номер> отчёт формируется для указанного пулреквеста, но для форков этот режим заблокирован.
Без авторизации в gh скилл не сможет опубликовать комментарий даже при тестовом запуске. Сессии привязываются строго к той ветке, на которой они завершились. Старые записи до появления колонки git_branch можно восстановить через scripts/backfill.sh.
Какие задачи решает
- показать расход токенов и число сессий Claude Code в пулреквесте
- обновить закреплённый комментарий с отчётом разработки на GitHub
- привязать локальные сессии к открытому PR через флаг
--pr - восстановить историю сессий старых веток скриптом
backfill.sh
Примеры запросов агенту
- Опубликуй отчёт о затратах сессий в текущем пулреквесте
- Обнови закреплённый комментарий с футпринтом в PR #42
- Собери статистику сессий Claude Code для текущей ветки
Как установить carbon-pr
1Через Skills CLI (Vercel)
npx skills add gwittebolle/claude-carbon --skill carbon-pr -a claude-code2Вручную: положить файлы
~/.claude/skills/carbon-pr/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/carbon-pr/
1Через Skills CLI (Vercel)
npx skills add gwittebolle/claude-carbon --skill carbon-pr -a codex2Вручную: положить файлы
.agents/skills/carbon-pr/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add gwittebolle/claude-carbon --skill carbon-pr -a cursor2Вручную: положить файлы
.cursor/skills/carbon-pr/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install gwittebolle/claude-carbon carbon-pr2Вручную: положить файлы
.github/skills/carbon-pr/SKILL.md1Через Skills CLI (Vercel)
npx skills add gwittebolle/claude-carbon --skill carbon-pr -a gemini-cli2Командой платформы
gemini skills install https://github.com/gwittebolle/claude-carbon --path skills/carbon-prВручную: положить файлы
.devin/skills/carbon-pr/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add gwittebolle/claude-carbon --skill carbon-pr -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о carbon-pr
Как установить carbon-pr в Claude Code?
Выполните команду npx skills add gwittebolle/claude-carbon --skill carbon-pr -a claude-code.
Что делает carbon-pr?
Скилл подсчитывает локальные сессии Claude Code для текущей ветки и оставляет закреплённый комментарий с отчётом в открытом пулреквесте через GitHub CLI.
Почему скилл отказывается работать с форком?
Скрипт отклоняет вызов с параметром --pr для пулреквестов из форков. В таком случае его нужно запускать без этого флага прямо из клона форка на целевой ветке.
Исходный текст
SKILL.md · MIT
---
name: carbon-pr
description: Post the development footprint of the current branch as a sticky PR comment
---
Run the following bash script from the repository the PR belongs to, and present the output to the user.
```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,
# keeping only candidates that ship the PR report script.
CACHE_LATEST=""
for D in "$CFG/plugins/cache"/*/claude-carbon/*/; do
[ -f "${D}scripts/generate-pr-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-pr-report.sh"
```
The script sums the local Claude Code sessions recorded for the current branch of the current project and posts (or updates in place) one sticky comment on the branch's open PR, through the user's own `gh` auth. Report its final line to the user as printed; never recompute or reformat the numbers.
With `--pr <number>` the script reports that PR's own branch (read through `gh`, so even `--dry-run` needs it), wherever it runs; never pass a PR number to report the current branch's sessions on another PR. It refuses a PR opened from a fork: tell the user to run it without `--pr` from the fork's clone, on the PR's branch. It also refuses a branch checked out in no worktree whose name sessions of other folders carry: say that nothing was posted and pass on its suggestion (run it from the branch's worktree, or switch to the branch in the folder its sessions ran in and run it there without `--pr`). If it reports no sessions for the branch, say that nothing was posted, that a session counts for the branch it ended on and so do its agents, except an agent that worked in a worktree of another branch and ended with this version installed (it counts there), that only sessions recorded since the `git_branch` column exists carry a branch, and that `scripts/backfill.sh` repairs older rows while their transcripts are still on disk. If it reports no open PR, suggest pushing the branch and opening one first, or passing `--pr <number>`. If the script itself is missing (an install that predates it), suggest `/carbon-update`.
© gwittebolle · MIT · gwittebolle/claude-carbon