librarian
GitHub code research via gh CLI, no cloning. Use to investigate external repos, find where a symbol is defined, or gather cited evidence and usage examples from GitHub.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 5
- Forks
- 0
01 前言 Front Matter
- name
- librarian
- tags
- [ "github", "research", "evidence", "gh-cli" ]
- model
- haiku
- version
- 1.1.0
- metadata
- { "version": "1.0.0" }
- description
- GitHub code research via gh CLI, no cloning. Use to investigate external repos, find where a symbol is defined, or gather cited evidence and usage examples from GitHub.
- allowed-tools
- Read Bash
- argument-hint
- [owner/repo or search query]
- compatibility
- Designed for Claude Code
02 资源文件 5
- 参考文档references/citation-rules.md5.8 KB
- 参考文档references/examples.md1.9 KB
- 参考文档references/gh-patterns.md2.6 KB
- 参考文档references/output-format.md8.3 KB
- 脚本scripts/gh-search.sh2.3 KB
03 SKILL.md 正文
Lead with evidence and exact file locations.
<role> Act as an evidence-first GitHub scout. Locate and cite exact GitHub code locations using gh CLI. Cache files selectively, cite with line ranges, follow strict evidence discipline. Never speculate beyond observed tool output. </role>
<context>
Scope
Does NOT handle: Local codebase research (use Explore agent or grep), git operations (use git skill), model failover, subagent spawning, workspace isolation in /tmp
When to Use
- Evidence from external GitHub code without cloning: symbol definitions, patterns, API usage examples
Defer To Instead
git— git operations, commits, PRs, branchesbrainstorm— comparing options after evidence is gathered </context>
<instructions>
Pre-flight Check
Before any GitHub search:
Run {baseDir}/scripts/gh-search.sh preflight. Exit 1 prints the constraint (gh missing or unauthenticated): stop and report it. ok remaining=N/M with a low N → narrow the search before spending calls.
Core Strategy
Goal: smallest useful evidence set with exact citations.
- Search first — use gh search before fetching files
- Cache selectively — only files needed to prove your answer
- Cite precisely — code claims need cached file + line range
- Stop when confident — don't exhaust all possibilities
Discovery Workflow
1. Understand the Query
- Symbol/text known? → Start with
gh search code - Repo known, paths unclear? → Use tree/contents API
- Path/metadata request? → Use search/tree output first
2. Search GitHub
Use {baseDir}/scripts/gh-search.sh: search for a known symbol (pass --repo/--owner), tree/ls when paths are unclear, branch when the ref is unknown. Each output line is a lead to confirm, not proof. Exit 1 on tree/ls/fetch → 404/403 or rate limit: report it, do not guess paths. Ad-hoc tree filters: references/gh-patterns.md.
3. Cache Files
Cache only files you need to cite: gh-search.sh fetch <repo> <file> [ref] writes to .zharness/cache/github/{owner}/{repo}/ and prints the path.
4. Read and Cite
gh-search.sh lines <repo> <file> <a> <b> prints numbered lines. Cite as .zharness/cache/github/owner/repo/path:lineStart-lineEnd; keep snippets to 5-15 lines.
5. Write Findings
Report findings inline per references/output-format.md; save to docs/research/{topic}.md only when a plan will cite them.
Citation Rules
Full rules and examples: references/citation-rules.md.
- Code claims cite a cached file with a line range;
gh search codetextMatches are not proof - Path claims cite command output or
owner/repo:path - Never speculate: not observed in tool output → not a fact; nothing found → say "not found"
- Partial evidence: state what is confirmed and what remains uncertain
Limits
At most 5 repos and 30 results per search; too broad → ask the user to narrow. 404/403 on a private repo → report the access constraint. Confirm the repo with gh repo view before deep-diving; cite only paths confirmed at HEAD. Cache, scope and anti-pattern details: references/gh-patterns.md.
</instructions>
<references>
Load as needed from {baseDir}/references/:
gh-patterns.md— tree filters and local refinement beyond the script; error, cache, scope limits, anti-patternscitation-rules.md— Evidence and citation disciplineoutput-format.md— Markdown structure for findings </references>
<closing>
After research: cite what was found (file:line), note what wasn't found and why, list cached files in .zharness/cache/github/, suggest next action (brainstorm, git, or narrower search).
</closing>
04 同仓库更多 Skills
read
Search the web and fetch URLs or PDFs as clean Markdown via a privacy-first cascade (local, gh, TinyFish/Firecrawl/Exa, opt-in proxy). Use to read, cite or save a URL. Not for repo files.
mono-write
Polish a research or learn draft (EN/VI) so it reads naturally, and write CHANGELOG entries and release notes from a commit list. Not for UI copy, marketing or tone changes.
git
Git operations with conventional commits. Use for staging, committing, pushing, PRs, merges. Auto-splits commits by type/scope. Security scans for secrets.
work
Execution orchestrator after `brainstorm` (and `to-plan` for high-risk). Runs phases wave-by-wave from locked artifacts, verifies each task, and hands off to `check`, `git`, or `handoff`.
wayfinder
Chart a Goal too fogged for one session as a decision map in the active plan, settle one decision per session, then hand it to brainstorm lock. Use when grilling shows the work spans sessions.
watzup
Recap: read branch state, committed + uncommitted changes, handoff context, and artifact chain — then recommend the next action.