/ai-knowledge:kb-query <question> | search <terms> | tag:<tag> | listfrom ai-knowledge
Answers questions from a team knowledge base with cited articles, searches by keyword or tag, lists all articles with load modes, and offers to file answers back as new articles.
Ships in ai-knowledge. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Read kb-format.md first. It defines the layout, frontmatter and load modes used below.
Arguments (may be empty): $ARGUMENTS
| Arguments | Mode |
|---|---|
list | List: show every article and how it loads |
tag:{name} | Search by tag |
search {terms} | Search by keyword |
| One or two words, with no question mark or question word | Search by keyword, then offer an answer |
| Anything else | Answer the question |
| None | Ask (below) |
With no arguments, ask with AskUserQuestion:
tag:name, or list the knowledge base."Then ask for the question or search terms as free text.
Run the checks from kb-format.md: stop if there's a 1.x knowledge base (point to /kb-migrate) or no knowledge base (point to /kb-init).
Gather the articles: every .md file under .claude/rules/kb/ and .claude/kb/ except _index.md, _log.md and README.md. If there are none, say "The knowledge base has no articles yet. Add some with /kb-learn, /kb-add or /kb-discover." and stop.
List and Search modes are read-only.
For each article, read its frontmatter and title, and work out its load mode from its location and paths. Also check:
tags, created or last-updated, 1.x fields (scope, pinned, related, sources) or [[name]] links;_index.md, or an index line pointing at a missing file;paths match no file (check with Glob);Knowledge base
==============
Pinned (every session): {n} articles, {lines} lines
| Article | Tags | Updated | Notes |
|---|---|---|---|
| _global-learnings.md | global | 2026-09-14 | 12 rules |
Scoped: {n} articles (each also has an index line)
| Article | Paths | Tags | Updated | Notes |
|---|---|---|---|---|
| conventions/api-conventions.md | src/api/**, **/*.controller.ts | api, rest | 2026-08-02 | |
| testing/e2e.md | e2e/** | testing | 2026-05-30 | paths match no files |
On-demand: {n} articles
| Article | Index line | Tags | Updated | Notes |
|---|---|---|---|---|
| tools/release.md | release steps and rollback rules | release, deploy | 2026-07-11 | |
Related
- conventions/api-conventions.md → security/auth-rules.md, conventions/api-errors.md
Summary: {n} articles, {n} with problems
If there are problems, suggest the fix: /kb-prune for content, links and paths that match nothing; /kb-migrate for 1.x fields, [[name]] links and format problems; /kb-add {path} for an article added by hand.
tag:security): match the tag against each article's tags, ignoring case. Also list articles whose Related section points at a match.api matches api-conventions.md), titles and tags. Search _global-learnings.md too.KB search: "{query}"
====================
1. .claude/rules/kb/conventions/api-conventions.md (scoped: src/api/**)
tags: api, rest | see also: security/auth-rules.md | updated 2026-08-02
> matching line
> matching line
2. .claude/kb/tools/release.md (on-demand)
tags: release | updated 2026-07-11
> matching line
Linked to a match:
3. .claude/rules/kb/security/auth-rules.md, linked from api-conventions.md
Global learnings:
> matching rule
{n} matches in {n} articles.
With no matches: "Nothing in the knowledge base matches '{query}'. It has {n} articles tagged: {tags}."
When the search came from one or two words rather than search or tag:, end by offering to answer it as a question.
_index.md for the scoped and on-demand articles and their keywords.paths cover._global-learnings.md for cross-cutting rules that apply.conventions/api-conventions.md, every route is versioned")./kb-discover src/deploy, or /kb-add with a doc or URL). Answer that part from the code only if you checked the code, and say that you did.Ask (Header: "File Answer to KB?"; Question: "This answer drew on {n} articles. Save it as an article for future sessions?"; Options: "Save as an article" | "Skip"). Recommend saving when the answer drew on three or more articles, or produced a comparison, an overview or a decision record. Still offer, without pushing, when it only restated one article. With "Skip", stop; nothing is written.
Where: suggest a path and load mode. A synthesis of scoped articles about the same folders can be scoped to them; most syntheses are on-demand. Ask (Header: "KB File Location"; Options: "{suggested path} ({mode})" | "Somewhere else").
Write: get today's date once (kb-format.md, Dates). Rewrite the answer in article style: headings, imperative rules where they fit, no conversational phrasing, citations kept as paths. Frontmatter adds type: synthesis and query: "{the question}", plus tags, created and last-updated, and paths if scoped. End with a ## Related section listing the articles consulted, as paths.
Reverse links: add the new article's path to the Related section of its main sources, and update their last-updated.
Index: add its line to _index.md, whether it's scoped or on-demand.
Log: append
## [{date}] query | {topic}
- Question: "{the question}"
- Consulted: {articles}
- Filed as: {path}
Report the path, load mode, tags and links added.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub charlesjones-dev/ai-agent-plugins --plugin ai-knowledge7 skills in this plugin
/kb-addAdd knowledge to the team knowledge base from a note, project files or folders, another repo, a URL, or the project's own CLAUDE.md and docs/. Distills it into articles, picks how each one loads, records where it came from, and shows every draft before writing./kb-discoverRead the source code to find knowledge nobody wrote down (architecture, naming, API contracts, data models, error handling, configuration, testing patterns) and save it as knowledge base articles scoped to the code they describe. Shows each draft before writing./kb-initSet up a team knowledge base as Claude Code rules: .claude/rules/kb/ for articles Claude Code loads by itself and .claude/kb/ for on-demand articles. Turns auto-capture on for you unless you pass auto=off. On an existing knowledge base it doesn't redo setup: it turns auto-capture on if you never set it, keeps your earlier choice otherwise, and auto=on|off switches it. Also adds a short section to AGENTS.md so Codex and Cursor read the knowledge base (agents=off to skip). Points to /kb-migrate when the project has a 1.x knowledge base.Other plugins' skills for the same job