About librarian
librarian is a skill for maintaining reusable local checkouts of remote Git repositories. It parses repository references, reuses cached clones, and refreshes them on a schedule, with a fast-forward update when safe.
Key features
- 01Parse common Git repository references
- 02Cache checkouts under a predictable path
- 03Use partial clones with blob filtering
- 04Refresh stale repositories every five minutes
- 05Fast-forward clean checkouts when possible
Use cases
- 01Search and analyze a remote repository locally
- 02Reuse an existing checkout across repository references
- 03Force an immediate refresh before inspection
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ mitsuhiko/ agent-stuff --skill librarianAfter installing, type/librarianin Claude Code to confirm it loaded.
Bundled filescheckout.sh
Details
From the project READMEUse this skill when the user points you to a remote git repository (GitHub/GitLab/Bitbucket URLs, git@..., or owner/repo shorthand).
The goal is to keep a reusable local checkout that is:
- stable (predictable path)
- up to date (periodic fetch + fast-forward when safe)
- efficient (partial clone with
--filter=blob:none, no repeated full clones)
Cache location
Repositories are stored at:
~/.cache/checkouts/<host>/<org>/<repo>
Example:
github.com/mitsuhiko/minijinja → ~/.cache/checkouts/github.com/mitsuhiko/minijinja
Command
bash checkout.sh <repo> --path-only
Examples:
bash checkout.sh mitsuhiko/minijinja --path-only
bash checkout.sh github.com/mitsuhiko/minijinja --path-only
bash checkout.sh https://github.com/mitsuhiko/minijinja --path-only
The script will:
- Parse the repo reference into host/org/repo.
- Clone if missing.
- Reuse existing checkout if present.
- Fetch from
originwhen stale (default interval: 300s). - Attempt a fast-forward merge if the checkout is clean and has an upstream.
Update strategy
- Default behavior is throttled refresh (every 5 minutes) to avoid unnecessary network calls.
- Force immediate refresh with:
bash checkout.sh <repo> --force-update --path-only
Recommended workflow
- Resolve repository path via
checkout.sh --path-only. - Use that path for searching, reading, and analysis.
- On later references to the same repo, call
checkout.shagain; it will find and update the cached checkout.
If edits are needed
Prefer not to edit directly in the shared cache. Create a separate worktree or copy from the cached checkout for task-specific modifications.
Notes
owner/repodefaults togithub.com.