librarian
Gathering material for another agent: understanding exactly what is asked, searching with glob and grep using names, synonyms and patterns, reading only the ranges that matter, returning excerpts with paths and line numbers in a useful order, covering every place asked about, saying what was not found and where it looked, and never drawing conclusions. Read before any gathering task.
- License 许可
- Apache-2.0
- 所属仓库
- enowdev/enowxcli
- 最近更新
- 2026-10-06
- Stars
- ★ 67
- Forks
- 21
01 前言 Front Matter
- name
- librarian
- description
- Gathering material for another agent: understanding exactly what is asked, searching with glob and grep using names, synonyms and patterns, reading only the ranges that matter, returning excerpts with paths and line numbers in a useful order, covering every place asked about, saying what was not found and where it looked, and never drawing conclusions. Read before any gathering task.
03 SKILL.md 正文
Gathering material for another agent
The naive gatherer returns the first three grep hits, pastes whole files, answers a question it was not asked (often wrongly) instead of returning the material, hands over the nearest match as if it were the thing, and says nothing about what it could not find. The agent that asked will reason over what you return, so return what is there: the right excerpts, each with its path and lines, in an order that reads, every part of the request covered or reported missing, and no conclusions.
1. Parse the request
- List what is asked: names (functions, types, files, routes), concepts ("where rate limiting happens"), kinds of file (tests, config, migrations), and the scope (a folder, production code only, the whole repository).
- Turn each concept into search terms:
- synonyms: rate limiting is also
throttle,limiter,quota,429,Retry-After,too many requests,bucket; - spellings:
rateLimit,rate_limit,rate-limit,RateLimit,RATE_LIMIT, plurals, abbreviations (rl,ratelim).
- synonyms: rate limiting is also
- Make a checklist of the request's parts; with four or more, keep it in
todo. Each part ends as excerpts or as "not found". - An unclear request is read literally, and the reply says which reading was used. Nobody can answer a question while you run, so do not ask one.
2. The ground first
One step of glob calls shows the ground before any grep:
**/*rate*limit* **/middleware/** **/*.test.*
**/migrations/** **/{config,settings}* .github/workflows/*
**/Dockerfile* **/.env.example **/routes*
globandgrepskip.git,node_modulesand whatever.gitignorelists. A*in a glob also crosses/(src/*.tsmatchessrc/a/b.ts), so narrow by name or extension;reada folder to list only its own entries.globreturns 200 paths by default. A full page means the pattern needs narrowing, not that the search is over.
3. Search
grep takes a Rust regular expression: no lookaround or backreferences,
\b for word boundaries, (?i) or case_sensitive: false to ignore case.
It returns path:line:text, 200 hits by default (1000 at most), skips files
over 2 MB, and cuts long lines around the match.
exact identifier \bcreateOrder\b
TS, JS definition (function|class|interface|type|enum)\s+Name\b (const|let)\s+Name\s*=
Python ^\s*(async\s+)?def name\b ^\s*class Name\b
Go func (\([^)]*\)\s*)?Name\( type Name\s+(struct|interface)
Rust fn name\b (struct|enum|trait|type)\s+Name\b impl.*\bName\b
Java, Kotlin, C# (class|interface|enum|record)\s+Name\b fun name\(
PHP, Ruby function name\s*\( def (self\.)?name\b class Name\b
calls and imports name\( \.name\( import .*\bName\b from \S+ import .*\bname\b
routes (get|post|put|patch|delete)\(\s*["']/orders
environment (process\.env|import\.meta\.env)\.RATE_ (getenv|environ)\W+RATE_ env::var\("RATE_
config keys ^\s*rate_?limit\s*[:=] (with case_sensitive: false)
messages and codes a fixed part of the text: too many requests, rate_limited
- Batch independent searches in one step.
- Narrow with
path(a folder or one file) to leave out docs, fixtures or generated code when they were not asked for. - Too many hits: a longer pattern, a definition pattern, a narrower
path. Reading a thousand hits is not narrowing. - No hits: the other spellings, a shorter fragment, case-insensitive, the
message or code the thing produces, the file name through
glob. Only after those is it "not found". - A request about a dependency: a search from the root skips
node_modules, so givegrepthe package's folder aspath(node_modules/express/lib) andreadits files by path.
4. Follow references one hop
- From a definition to its direct callers and to what it calls; from an import to the definition; from a config key to where it is read.
- One hop, not the whole graph. Where the chain goes on, say where: "also
called from 11 places in
src/admin/, listed below by line."
5. Read the range that matters
readwithoffsetandlimitaround each hit: from a few lines above (the doc comment, decorator or attribute) to the end of the block (the function, the method, the config section).- The whole function, not the matching line; not the whole file.
- A long file comes in slices: the result ends with the lines shown and the
offsetto continue from.
6. The excerpt
src/middleware/rate-limit.ts:12-29 (definition)
```ts
export function rateLimit({ windowMs, max }: Options): Middleware {
const hits = new Map<string, number[]>();
return async (req, res, next) => {
[... lines 15-22: timestamps older than windowMs dropped ...]
if (recent.length >= max) {
res.setHeader("Retry-After", Math.ceil(windowMs / 1000));
return res.status(429).json({ code: "rate_limited" });
}
next();
};
}
```
- A heading line per excerpt:
path:start-end, then a label of a few words (definition, caller, test, config, the only writer). - The code exactly as it is in the file: no reformatting, no fixed typos, no renamed variables, and line numbers that match.
- A cut sits on its own line and says what it held:
[... lines 15-22: <what they contain> ...]. Never cut silently, and never cut the part that was asked about. - The language on the fence, so the excerpt reads as code.
7. Order and grouping
- Grouped by the parts of the request, in the order they were asked.
- Inside a part: definitions, then the main uses, then tests, then config and docs.
- Duplicates once: a block copied into three places is shown once, with the
other two as
path:line. - Many similar call sites: two or three in full, the rest one per line as
path:line: the line.
8. Say what was not found
Not found: a retry policy for outbound webhooks.
Searched: retry|backoff|attempt (case-insensitive) in src/ and lib/;
webhook in src/ (8 hits, none retries); glob **/*webhook* (2 files, read);
no retry key in config/ or .env.example.
Related, not what was asked: src/email/send.ts:40-58 retries email sends.
- Say what was searched and where, so the caller can judge the gap.
- Never hand over the nearest thing as the thing: label it "related, not what was asked", or leave it out.
9. No conclusions
- Allowed: labels ("definition", "the only caller", "test for the 429
path"), counts ("14 call sites"), and facts visible without judgement
("two functions named
rateLimit, at A and at B"). - Not allowed: "this is the bug", "the fix is", "this looks unused" (write
"no references found for
\brateLimit\boutside this file"), summaries of what the code means, opinions on its quality. - The caller decides. A conclusion drawn from a partial reading steers it wrong, and it pays for your words twice.
10. Size
- Enough to answer, not the repository: usually 5 to 20 excerpts of under
about 40 lines each. When more is relevant, give the most relevant in
full and list the rest by
path:line. - 10 to 25 tool calls for a normal request, independent ones batched.
11. The reply
The caller receives only the text from DONE: on; anything written before
it is dropped. So the material goes inside the report, indented under
DONE: so that no line of it is taken for a new field:
DONE: 9 excerpts for 3 of 3 parts; webhook retries not found.
<the excerpts, grouped by part, as in sections 6 and 7>
<the not-found block, as in section 8>
CHANGED: none
VERIFIED: every excerpt read from its file at the lines given
NEXT: nothing
Check it
- Every part of the request has excerpts or a not-found block.
- Every excerpt's path and lines match the file; every cut is marked.
- Spellings and synonyms were searched before anything was reported missing.
- No sentence judges, explains or proposes.
Avoid
The first hits only; whole files; an answer instead of material; the
nearest match passed off as the thing; silence about what was not found;
excerpts without lines; code rewritten while quoting it; one spelling
searched; reading node_modules when nobody asked about a dependency.
04 同仓库更多 Skills
demo-skill
Project-scope demo skill for tests.
writing
Writing words people read: the specific thing instead of claims, words to drop, sentences, interface copy (buttons, labels, errors, empty states, confirmations), page copy, notifications and emails, alt text and link text, numbers and dates, words that translate well, documentation and voice. Read before writing a page's copy, an interface's text or a document.
ui
Designing or restyling an interface: direction, layout, type, colour, icons, components, states, responsive behaviour. Read before building a page, a screen or a set of components.
ui-themes
Light and dark themes, and colour that holds in both: tokens with a value per theme, and what each kind of content needs to stay visible (icons, SVG drawings and line art, logos, photos, screenshots, charts, code, maps, borders, shadows, focus, form controls), switching without a flash, and checking both. Read before building a second theme or a theme toggle, and before any drawing, logo or chart on a page that has two themes.
ui-structure
Structure before styling: the blueprint written before any interface code (the screen's job, the regions its kind of page needs, their order and why, the layout skeleton in numbers, the components and their states), the anatomy and order of a homepage, a dashboard, a list, a detail page, settings, a form, sign-in, pricing, docs, an article and a checkout, and how to turn the blueprint into code (tokens, layout primitives, components, sections, page). Read first, before building or rebuilding any page or screen.
ui-stack-vue
Building interfaces in Vue 3 and Nuxt: project layout, script setup with typed defineProps, defineEmits and defineModel, attribute fallthrough, slots and scoped slots, template refs, ref, reactive and computed, watch versus watchEffect, composables and VueUse, provide and inject, Pinia, keyed v-for, transitions, Nuxt 4 (app directory, pages, layouts, useFetch and useAsyncData keys, $fetch in handlers, server routes, runtime config, useSeoMeta, NuxtImg, middleware), VeeValidate forms, Reka UI and Nuxt UI, testing, vue-tsc, and the traps. Read when the project uses Vue or Nuxt.