bus-factor
БесплатноЗапускает вложенные скриптыНе проверенBuilds a knowledge-risk heatmap of a git repository. Runs git blame across tracked files, finds the ones owned by a single person, computes a bus factor per…
от diegopacheco★ 21 звезда на GitHubОб этом скилле
Bus-Factor Map
When invoked, you measure how concentrated knowledge of a codebase is in single people, then render a light-theme website that shows the risk visually. The "bus factor" of a file is the smallest number of authors who together own more than half of its surviving lines. A bus factor of 1 means one person could leave and take the only knowledge of that file with them.
Global Context
- User request / scope: $ARGUMENTS — empty, a local path to scope to, or a GitHub repository to clone and analyze
- Engine:
scripts/bus_factor.py(zero third-party dependencies) - Template:
assets/template.html - Output:
bus-factor-report/index.htmlandbus-factor-report/data.jsonin the current directory
Rules
- The numbers come from
git blameonly. Never invent or estimate ownership, line counts, or risk scores. The engine produces every number deterministically. - Read-only against the analyzed repository. The skill only writes inside
bus-factor-report/, plus a temporary clone folder in GitHub mode that it deletes afterward. - Do not add comments to any command you run.
- If the engine prints nothing useful (no tracked source files), say so plainly instead of fabricating a report.
Step 1 — Choose the target
The scan runs against either the current repository or a GitHub repository the skill clones into a temporary folder. Decide which from $ARGUMENTS:
$ARGUMENTSis a GitHub repository — a URL likehttps://github.com/owner/repo,[email protected]:owner/repo.git, or theowner/reposhorthand → GitHub mode. Go to Step 2.$ARGUMENTSis a local path (e.g.src/,services/api) → current-repo mode scoped to that path. Skip to Step 3.$ARGUMENTSis empty — ask the user which they want withAskUserQuestion, two options:- Current repository (Recommended) — analyze the whole repo in the working directory. Skip to Step 3.
- A GitHub repo — the user supplies the clone URL (they can paste it via "Other"). Then go to Step 2.
Step 2 — Clone the GitHub repository (GitHub mode only)
Clone the full history into a temporary folder named after the repo. Full history is mandatory — a shallow clone collapses every line into one commit and destroys the blame attribution the whole analysis depends on.
tmp_root="$(mktemp -d)"
name="$(basename "<URL>" .git)"
git clone "<URL>" "$tmp_root/$name"
If the clone fails (bad URL, private repo with no access, no network), report the git error to the user and stop. Large repositories take longer to clone and to blame.
Step 3 — Run the analysis engine
In current-repo mode, confirm a git repository first; GitHub mode skips this because the fresh clone is already one:
git rev-parse --show-toplevel
If this fails, tell the user the current directory is not a git repository and stop.
The engine enumerates tracked files with git ls-files, runs git blame --line-porcelain -w -M -C on each source file, counts surviving lines per author, and computes the per-file bus factor, per-author sole ownership, per-directory rollups, and a repo-level grade. It then renders the website by injecting the data into the template. It always writes bus-factor-report/ into the current working directory and finds its own template, so invoke it by its installed absolute path.
Current-repo mode — pass
$ARGUMENTSas an optional subdirectory path, or omit it to scan the whole repository:python3 "$HOME/.claude/skills/bus-factor/scripts/bus_factor.py" $ARGUMENTSGitHub mode — run the engine inside the clone with a subshell so the report still lands in the user's current directory, then copy it out and delete the clone:
( cd "$tmp_root/$name" && python3 "$HOME/.claude/skills/bus-factor/scripts/bus_factor.py" ) cp -R "$tmp_root/$name/bus-factor-report" . rm -rf "$tmp_root"
Notes:
- The engine resolves
assets/template.htmlrelative to its own file. The renderedbus-factor-report/index.htmlis self-contained, so removing the clone afterward does not affect it. python3is required. If it is missing, tell the user to install Python 3.- On a very large repository the blame pass can take a while. If the user wants it faster, suggest scoping to a subdirectory, for example
/bus-factor src/.
Step 4 — Open the report
The report is now at bus-factor-report/index.html in the current working directory. Open it:
open bus-factor-report/index.html
On Linux use xdg-open bus-factor-report/index.html instead.
Step 5 — Summarize for the user
The engine prints a text summary to stdout. Relay the key signals in your reply:
- The repo (and, in GitHub mode, which repo was cloned) and knowledge grade (A best, F worst).
- The repo bus factor.
- How many files are single-owned and what share of the code that is.
- The person with the biggest exposure (most lines solely owned) — the "if they leave" risk.
- The top knowledge-risk files.
Установить bus-factor в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
BashReadAskUserQuestionВложенные файлы
FAQ
Что делает скилл bus-factor?
Builds a knowledge-risk heatmap of a git repository. Runs git blame across tracked files, finds the ones owned by a single person, computes a bus factor per file, directory, and author, and renders a light-theme website that shows where knowledge is concentrated. Use when the user runs /bus-factor or asks where the project's knowledge risk, single points of failure, or single-owner code lives.
Как установить скилл bus-factor?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bus-factor запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic