Agent skill
kb-query
Query a knowledge base topic and optionally file the answer.
Install this agent skill to your Project
npx add-skill https://github.com/notque/claude-code-toolkit/tree/main/skills/kb-query
SKILL.md
KB Query Skill
Answer a question using the compiled wiki for a knowledge base topic. Reads relevant articles from the wiki, synthesizes an answer, and optionally files the response as a permanent query record that feeds back into the next compile cycle.
Invocation
/kb query {topic} "{question}"
/kb query {topic} "{question}" --no-file
{topic}— directory name underresearch/(e.g.,llm-security){question}— the question to answer (quoted string)--no-file— output only to conversation, do not save a query file
Phase 1: LOCATE
Goal: Confirm the topic exists and load its index.
- Parse the invocation to extract
{topic},{question}, and whether--no-filewas specified. - Read
research/{topic}/kb.yaml— if it does not exist, stop and report: "Topic{topic}not found. Runpython3 scripts/kb-init.py {topic}to initialize it." - Read
research/{topic}/wiki/_index.md— this is the full index of compiled concepts and source summaries. If it does not exist, stop and report: "Wiki index not found for{topic}. Run/kb compile {topic}first." - Confirm to yourself: you now have the index and know what articles are available. Do not proceed to Phase 2 until you have read the index.
Phase 2: IDENTIFY
Goal: Select the wiki articles most likely to contain the answer.
Using only the _index.md (do NOT read individual articles yet), identify the 3-10 most relevant concept and/or source articles for this question.
For each selected article, note:
- Its path relative to
research/{topic}/wiki/ - One sentence of reasoning: why this article is likely relevant to the question
Prefer concept articles for questions about ideas, patterns, or mechanisms. Prefer source articles for questions about specific documents, papers, or implementations.
If the index contains no obviously relevant entries, select the closest 3 and note the uncertainty.
Phase 3: SYNTHESIZE
Goal: Read the selected articles and produce a comprehensive answer.
- Read each article identified in Phase 2.
- Synthesize an answer to the question. Requirements:
- Answer directly — lead with the answer, not with preamble
- Cite sources inline using this format:
[Source: concept-name](concepts/concept-name.md)or[Source: source-slug](sources/source-slug.md) - If multiple articles address the same point, synthesize them rather than listing them separately
- If the articles contradict each other, note the contradiction and your best synthesis
- If the KB does not contain enough information to fully answer the question, say so explicitly. Name what is missing and which raw sources, if any, could be added to fill the gap.
- Aim for 300-1200 words. Shorter if the answer is simple. Longer only when the question requires depth.
Do NOT draw on general knowledge when the KB has relevant content. Prefer KB sources. If you must supplement with general knowledge (because the KB is silent on a point), mark it clearly: "(from general knowledge, not in KB)".
Phase 4: FILE
Goal: Persist the query and answer as a permanent wiki record.
If --no-file was specified: output the answer to the conversation and stop. Do not save any file.
Otherwise:
-
Derive a slug from the question:
- Lowercase, strip punctuation, replace spaces with hyphens
- Max 60 characters
- Example: "What is prompt injection?" →
what-is-prompt-injection
-
Get today's date in
YYYY-MM-DDformat. -
Write the answer to
research/{topic}/wiki/queries/{date}-{slug}.mdwith this structure:
---
query: "{the exact question asked}"
date: "{ISO 8601 timestamp, e.g. 2026-04-02T14:30:00}"
sources_consulted:
- concepts/relevant-concept.md
- sources/relevant-source.md
filed: true
---
# {the question, as a title}
{the full synthesized answer, with inline citations}
Populate sources_consulted with the relative paths (within wiki/) of every article you read during Phase 3.
- Confirm to the user: "Answer filed to
research/{topic}/wiki/queries/{date}-{slug}.md. It will be incorporated into concept articles during the next/kb compile {topic}run."
Anti-Patterns
Do NOT answer from general knowledge if the KB has relevant content. The point of the system is to build and use a local knowledge base. Bypassing it defeats the flywheel.
Do NOT read every wiki file. Use the _index.md to select relevant articles. Reading every file wastes time and context on irrelevant material.
Do NOT write query files longer than 1500 words. If the answer requires more than that, it is probably two separate questions. Answer the specific question asked.
Do NOT omit sources_consulted. This field is the data the flywheel uses during the next compile run. An empty or incomplete list breaks the feedback loop.
Do NOT skip filing unless --no-file was explicitly specified. Filed queries accumulate domain knowledge. Each one makes the next query better.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
voice-writer
Unified voice content generation pipeline with mandatory validation and joy-check. 9-phase pipeline: LOAD, GROUND, GENERATE, VALIDATE, REFINE, JOY-CHECK, OUTPUT, CLEANUP. Use when writing articles, blog posts, or any content that uses a voice profile. Use for "write article", "blog post", "write in voice", "generate content", "draft article", "write about".
image-auditor
Non-destructive image validation for accessibility and health.
video-editing
Video editing pipeline: cut footage, assemble clips via FFmpeg and Remotion.
comment-quality
Review and fix temporal references in code comments.
e2e-testing
Playwright-based end-to-end testing workflow.
anti-ai-editor
Remove AI-sounding patterns from content.
Didn't find tool you were looking for?