skills/kb-compile/SKILL.md
Compile raw knowledge base sources into structured wiki articles.
npx skillsauth add notque/claude-code-toolkit kb-compileInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Compile raw clipped sources (research/{topic}/raw/) into structured wiki articles (research/{topic}/wiki/). Produces concept articles, source summaries, and a maintained index.
/kb compile {topic}
The topic must correspond to a directory under research/ that was initialized with kb-init.py.
Goal: Determine what needs compiling.
research/{topic}/kb.yaml to get topic config (description, source types, compile settings).research/{topic}/raw/ — these are the source markdown files. Ignore the images/ subdirectory.research/{topic}/wiki/sources/ — these are already-compiled source summaries.raw/ whose slug does not appear as a corresponding file in wiki/sources/. A slug match means raw/{slug}.md has a corresponding wiki/sources/{slug}.md.If there are no new sources, proceed directly to Phase 4 (VERIFY) to confirm index consistency.
Goal: For each new raw source, produce a wiki summary and update concept articles.
For each new raw source file (research/{topic}/raw/{slug}.md):
wiki/sources/{slug}.mdWrite a source summary file with this structure:
---
title: "{title from raw frontmatter}"
source_url: "{source URL}"
clipped_date: "{clipped date}"
type: {article|paper|note|etc}
concepts:
- concept-slug-1
- concept-slug-2
---
## Summary
{2-4 paragraph summary of the key points from the source. Write in your own words - do NOT copy verbatim from the source. Focus on the most important ideas, arguments, and conclusions.}
## Key Points
- {bullet point 1}
- {bullet point 2}
- {bullet point 3}
## Source
Raw file: [../../raw/{slug}.md](../../raw/{slug}.md)
Original: [{title}]({source_url})
Identify 3-7 concepts mentioned in this source. A concept is a distinct idea, term, technique, pattern, or named thing that appears meaningfully in the content. Use kebab-case slugs (e.g., chain-of-thought, retrieval-augmented-generation, prompt-injection). List these in the frontmatter concepts list.
For each concept identified in 2b:
If wiki/concepts/{concept}.md already exists:
sources list in the frontmatter (if not already present).related_concepts if this source suggests new connections.If wiki/concepts/{concept}.md does not exist:
wiki/sources/ files for mentions)wiki/concepts/{concept}.md with this structure:---
title: "{Concept Name (Title Case)}"
related_concepts:
- related-concept-slug
sources:
- {slug-of-first-source}
---
# {Concept Name}
{1-2 sentence definition or explanation of what this concept is.}
## Overview
{2-4 paragraphs of explanation. Cover: what it is, why it matters, how it works at a high level, and where it appears.}
## Key Properties
- {property 1}
- {property 2}
## Sources
- [{source title}](../sources/{slug}.md)
Goal: Feed filed query answers back into concept articles, compounding accumulated knowledge.
Check wiki/queries/ for any query files with filed: true in their frontmatter (and without incorporated: true, which marks already-processed queries).
For each unprocessed filed query:
query field (the original question) and sources_consulted (the articles the query drew from).sources_consulted.- [Query: {original question}](../queries/{query-filename}.md)incorporated: true to its frontmatter.If wiki/queries/ does not exist or contains no unprocessed filed queries, skip this phase and proceed to Phase 3.
Goal: Rebuild wiki/_index.md to reflect current state.
wiki/concepts/ and wiki/sources/.wiki/_index.md with this structure:---
topic: {topic}
last_compiled: "{ISO 8601 timestamp}"
entry_count: {total concepts + sources}
---
# {Topic Display Name} Knowledge Base
## Concepts ({N})
- [Concept Name](concepts/slug.md) - one-line summary
- [Concept Name](concepts/slug.md) - one-line summary
## Sources ({M})
- [Source Title](sources/slug.md) - one-line summary (from {domain})
- [Source Title](sources/slug.md) - one-line summary (from {domain})
Extract the domain from source_url in the source frontmatter for the "(from {domain})" annotation.
Goal: Confirm the wiki is internally consistent.
Run these checks:
Raw coverage: Every raw/{slug}.md file (excluding images/) has a corresponding wiki/sources/{slug}.md. Report any gaps as: "Missing source summary: {slug}".
Concept backlinks: Every concept slug listed in any wiki/sources/*.md frontmatter exists as wiki/concepts/{slug}.md. Report gaps as: "Missing concept article: {slug} (referenced in sources/{source_slug}.md)".
Index completeness: Every file in wiki/concepts/ and wiki/sources/ appears in wiki/_index.md. Report gaps as: "Not in index: {path}".
Summary: Report total counts - concepts, sources, images, gaps.
If there are gaps, offer to fix them. Do not silently patch gaps during verification - report first, then ask.
Do NOT rewrite existing concept articles from scratch. Incremental updates preserve the accumulated knowledge from prior compilations. If the existing article is good, only add what is new.
Do NOT create concepts with a single source unless the concept is clearly significant (a named algorithm, a major pattern, an established term). Single-source concepts that are not significant just create noise.
Do NOT include raw source content verbatim. Summarize and synthesize. The wiki is a compressed, queryable representation - not a mirror.
Do NOT skip _index.md maintenance. The index is the entry point for humans and LLMs querying the KB. A stale index defeats the purpose of the system. Always rebuild it after any compilation run.
Do NOT create concepts without a definition. Every concept article needs at least a one-sentence definition. A concept page with only a title and a sources list is not useful.
documentation
Document translation: quick/normal/refined modes with chunked parallel subagents and glossary support.
development
AI image generation: Gemini and Nano Banana backends; single/series/batch workflows with prompt-to-disk.
testing
Unified voice content generation pipeline with mandatory validation and joy-check. 13-phase pipeline: LOAD, GROUND, STATS-CHECKPOINT, GENERATE, HOOK-GATE, VALIDATE, REFINE, VARIETY-GATE, JOY-CHECK, ANTI-AI, CLOSE-GATE, 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".
documentation
Critique-and-rewrite loop for voice fidelity validation.