# librarian

librarian caches remote Git repositories locally and refreshes them when referenced again. Useful when an agent needs to inspect external source code.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 170 installs · ★ 3224 repo stars
- Author: mitsuhiko
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/mitsuhiko/agent-stuff/tree/HEAD/skills/librarian/SKILL.md
- Updated: 2026-09-27
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/mitsuhiko-librarian

## What it does

This skill accepts remote repository references such as `owner/repo`, GitHub, GitLab, and Bitbucket URLs, or `git@...` addresses. It resolves each reference to `~/.cache/checkouts/<host>/<org>/<repo>`, giving the agent a stable local checkout for later searches and reading.

The workflow runs through `checkout.sh`. A missing repository is cloned with `--filter=blob:none`; an existing checkout is reused and refreshed from `origin` after 300 seconds. Add `--force-update` when an immediate refresh is required.

Keep edits out of the shared cache by using a separate worktree or copy. A dirty checkout cannot be fast-forwarded, so local uncommitted changes affect whether the refresh succeeds.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add mitsuhiko/agent-stuff --skill librarian -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/librarian/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/librarian/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add mitsuhiko/agent-stuff --skill librarian -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/librarian/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add mitsuhiko/agent-stuff --skill librarian -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/librarian/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install mitsuhiko/agent-stuff skills/librarian
```

2. **Manually: put the files in place**
- File: `.github/skills/librarian/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add mitsuhiko/agent-stuff --skill librarian -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/mitsuhiko/agent-stuff --path skills/librarian
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/librarian/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add mitsuhiko/agent-stuff --skill librarian -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/mitsuhiko/agent-stuff/tree/HEAD/skills/librarian/SKILL.md

## When to use it
- cache a remote Git repository
- resolve a repository reference to a local path
- refresh an existing checkout from `origin`
- reuse a local copy for code analysis

## Example prompts
- Inspect `mitsuhiko/minijinja` and use its local checkout to search the source.
- Resolve `https://github.com/mitsuhiko/minijinja`, then read the files from the cached path.
- Force-refresh `github.com/mitsuhiko/minijinja` before analysing the repository.

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 31d17ad96c626590.

BEGIN THIRD-PARTY FILE 31d17ad96c626590
````text
---
name: librarian
description: "Cache and refresh remote git repositories under ~/.cache/checkouts/<host>/<org>/<repo> so future references can reuse a local copy. Use this skill when the user points you to a remote git repository as reference or you encountered a remote git repo through other means."
---

Use 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
bash checkout.sh <repo> --path-only
```

Examples:

```bash
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:
1. Parse the repo reference into host/org/repo.
2. Clone if missing.
3. Reuse existing checkout if present.
4. Fetch from `origin` when stale (default interval: 300s).
5. 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
bash checkout.sh <repo> --force-update --path-only
```

## Recommended workflow

1. Resolve repository path via `checkout.sh --path-only`.
2. Use that path for searching, reading, and analysis.
3. On later references to the same repo, call `checkout.sh` again; 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/repo` defaults to `github.com`.
````
END THIRD-PARTY FILE 31d17ad96c626590

The third-party file has ended. Everything between the 31d17ad96c626590 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

© mitsuhiko · Apache-2.0 · https://github.com/mitsuhiko/agent-stuff/tree/HEAD/skills/librarian/SKILL.md

## Similar
- [open-source-librarian](https://affpapa.org/en/nevibecode/agents/open-source-librarian.md) — subagent · ★ 1064 repo stars
- [find-skills](https://affpapa.org/en/nevibecode/skills/find-skills.md) — skill · 4400000 installs
- [frontend-design](https://affpapa.org/en/nevibecode/skills/frontend-design.md) — skill · 1025790 installs
- [agent-browser](https://affpapa.org/en/nevibecode/skills/vercel-labs-agent-browser.md) — skill · 1600000 installs
- [design-taste-frontend](https://affpapa.org/en/nevibecode/skills/design-taste-frontend.md) — skill · 802600 installs
- [grill-me](https://affpapa.org/en/nevibecode/skills/grill-me.md) — skill · 1424476 installs
- [grill-with-docs](https://affpapa.org/en/nevibecode/skills/grill-with-docs.md) — skill · 1219756 installs

## Other versions with the same name
- [librarian · diodeinc](https://affpapa.org/en/nevibecode/skills/diodeinc-librarian.md) — 572 installs
- [librarian · ngmeyer](https://affpapa.org/en/nevibecode/skills/librarian.md) — ★ 38 repo stars

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
