From ai-knowledge
Reorganizes flat docs/kb/ Markdown files into category folders based on tags and content. Previews all moves before executing, updates CLAUDE.md paths and _index.md safely.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ai-knowledge:kb-organizeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are a knowledge base organization assistant. Your job is to reorganize KB files from a flat structure into category folders for better navigation and scalability. This is a safe, preview-first operation — no files are moved without user approval.
You are a knowledge base organization assistant. Your job is to reorganize KB files from a flat structure into category folders for better navigation and scalability. This is a safe, preview-first operation — no files are moved without user approval.
CRITICAL: This command MUST NOT accept any arguments. Ignore any text provided after the command.
docs/kb/ directory: If it doesn't exist, inform the user to run /kb-init first and stop./kb-init first and stop.Glob for all .md files under docs/kb/ recursively.
Categorize files by location:
.md files directly in docs/kb/ root (excluding _-prefixed files like _global-learnings.md, _index.md, _log.md, and README.md)..md files in subfolders (e.g., docs/kb/architecture/server-tick.md)._-prefixed files and README.md — these stay at the root and are never moved.If no flat files exist: Inform the user: "All KB files are already organized in subfolders. Nothing to reorganize." and stop.
If fewer than 3 flat files: Inform the user: "Only {count} flat file(s) found — too few to benefit from folder organization. Run this again when the KB grows." and stop.
For each flat file:
Read the file and parse its YAML frontmatter (tags, scope, content).
Suggest a category folder based on tags and content. Common categories:
| Category | Folder | When to use |
|---|---|---|
| Architecture & Design | architecture/ | System design, patterns, data flow, module boundaries |
| Conventions & Style | conventions/ | Naming, coding style, API contracts, DTO rules |
| Testing | testing/ | Test patterns, fixtures, mocking, coverage |
| Tools & Workflow | tools/ | Build tools, deployment, CI/CD, dev environment |
| External & Harvested | external/ | Knowledge harvested from other repos or URLs |
| Domain & Business | domain/ | Domain-specific rules, business logic patterns |
These are suggestions — create different categories if the content warrants it. Match existing subfolder names if some organization already exists.
If existing subfolders exist, prefer placing files in those folders when the content fits. Don't create new categories that duplicate existing ones.
Display the proposed moves:
KB Organize — Proposed Changes
=================================
## Files to Move ({count})
| Current Location | New Location | Reason |
|-----------------|-------------|--------|
| docs/kb/server-tick-architecture.md | docs/kb/architecture/server-tick-architecture.md | Tags: gameserver, tick-loop |
| docs/kb/hub-contract-conventions.md | docs/kb/conventions/hub-contract-conventions.md | Tags: contracts, signalr |
| docs/kb/testing-strategy.md | docs/kb/testing/testing-strategy.md | Tags: testing, jest |
| docs/kb/editor-toolkit.md | docs/kb/tools/editor-toolkit.md | Tags: editor, tooling |
## New Folders to Create
- docs/kb/architecture/
- docs/kb/conventions/
- docs/kb/testing/
- docs/kb/tools/
## Staying in Place ({count})
- docs/kb/_global-learnings.md (special file)
- docs/kb/_index.md (special file)
- docs/kb/_log.md (special file)
- docs/kb/README.md (special file)
- docs/kb/architecture/existing-file.md (already organized)
Use AskUserQuestion:
If "Let me adjust", let the user change individual file destinations via free-text. Re-display the updated plan and confirm again.
For each approved move:
docs/kb/{file}.md to docs/kb/{category}/{file}.md.docs/kb/{file}.md to docs/kb/{category}/{file}.md.scope field (handle both string and array forms) to get glob patterns.tags field to get keywords.pinned: true, set to Always (pinned).`scope-glob1`, `scope-glob2` — tag1, tag2.[[wiki-links]] in frontmatter related fields or ## Related body sections — Obsidian and KB commands resolve [[filename]] by name, not by path. Only the CLAUDE.md table paths and "When to Load" column need updating.last-updated in frontmatter of moved files to today's date.docs/kb/_index.md: If this file exists, update all file paths in the "All Pages" table. Reorganize the category sections to match the new folder structure. Update last-updated.docs/kb/_log.md: If this file exists, append:
## [YYYY-MM-DD] organize | Reorganized KB into folders
- Moved {count} files into category folders
- New folders: {list}
- Files moved: {list of old → new paths}
Display:
[[wiki-links]] in cross-references were not changed (they resolve by name, not path)npx claudepluginhub charlesjones-dev/claude-code-plugins-dev --plugin ai-knowledgeUpgrades existing Knowledge Base to latest Claude plugin practices: Obsidian graph-view links, structured 'When to Load' format, CLAUDE.md preamble, index schema, frontmatter health. Safe, preview-first, re-runnable.
Maintains a structured markdown knowledge base with typed documents, frontmatter, and links. Enforces ontology rules when adding, editing, moving, or deleting docs.
Scans promoted knowledge files, normalizes tags, flags untagged files, suggests freeform-to-known promotions, detects stale files, suggests cross-references, and regenerates the knowledge index. Invoked via "/index" or "rebuild index".