charlesjones-dev/claude-code-plugins-dev/kb-prune
Claude Code and agent skill by charlesjones-dev/claude-code-plugins-dev
- community
Checking that the SKILL.md file is still in the repository.
Clean up the team knowledge base: find duplicates, contradictions, broken links, stale articles, scoped globs that match nothing and pinned articles that cost too much context, then merge, fix or remove with your approval. Also removes a single article, or sorts articles into category folders.
Install
npx vskill@latest install charlesjones-dev/claude-code-plugins-dev/kb-pruneSKILL.md
Prune the knowledge base
Read kb-format.md first. It defines the layout, frontmatter, load modes and file-move rules used below.
Arguments (may be empty): $ARGUMENTS
| Arguments | Mode | |
|---|---|---|
| None | Audit: review the whole knowledge base | |
remove {article} | Remove one article (a file name, path or topic) | |
remove | Remove, choosing the article from a list | |
organize | Organize articles into category folders |
Every change needs the user's approval.
Step 1: Check the knowledge base
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). Then read every article under .claude/rules/kb/ and .claude/kb/ with its frontmatter, plus _index.md.
Audit mode
Find issues
- Index: scoped or on-demand articles with no line in
_index.md; lines pointing at files that don't exist, or at pinned articles; lines whose summary, keywords or "loads with" globs no longer match the article. - Load modes:
- Scoped articles whose
pathsmatch no file (check each pattern with Glob). They never load. - Pinned articles and
_index.mdagainst the budget in kb-format.md (Layout). Flag pinned articles over about 100 lines in total or more than five of them, and suggest which to scope or make on-demand. Flag an index over about 150 lines, and suggest merges. - Pinned or on-demand articles whose rules are clearly about certain folders or file types: suggest
pathsso they load only there. - Files under
.claude/rules/kb/that aren't articles (a README, log or notes). They load every session.
- Frontmatter: no frontmatter; YAML that won't parse; missing
tags,createdorlast-updated; 1.x fields (scope,pinned,related,sources) or[[name]]links, which/kb-migratefixes. Flag articles whoselast-updatedis more than 90 days old as review suggested: stable knowledge is fine, but worth a quick check. - Duplicates and merges: articles that overlap heavily, and articles on closely related topics that would read better as one (
api-auth.mdandapi-tokens.md). Shared tags are a good hint. Merging scoped articles combines theirpaths. - Contradictions: rules in different articles, or between an article and the global learnings, that conflict.
- Related: entries that point at files that don't exist (broken), usually because an article moved or was deleted.
- Global learnings (
_global-learnings.md): entries that are outdated (check whether the files or patterns they mention still exist), duplicated in another article, or area-specific, which should move to a scoped article so they stop loading every session. - Organization: if five or more articles sit loose at the root of
.claude/rules/kb/or.claude/kb/, suggest category folders (see Organize mode).
Report
With no issues: "The knowledge base is clean: {n} articles, {n} global learnings, no issues found."
Approve
Ask (Header: "KB Cleanup Plan"; Question: "Here's what I recommend. How do you want to proceed?"; Options: "Apply all" | "Let me review each one" | "Cancel"). When reviewing, ask about each action:
- index line: "Add, fix or remove the line for {article}?"
- globs that match nothing: "Fix the paths to {suggestion}, make it on-demand, or leave it?"
- pinned budget or an area-specific pinned article: "Scope {article} to {globs}, make it on-demand, or keep it pinned?"
- non-article file in
.claude/rules/kb/: "Move {file} to.claude/kb/, or delete it?" - frontmatter: "Add or fix frontmatter for {article}?" (show it)
- merge: "Merge {a} and {b} into {target}?"
- contradiction: "Which is right: '{rule a}' or '{rule b}'?"
- broken Related entry: "Point it at {new path}, or remove it?"
- duplicate: "Keep it in {article} and remove it from the global learnings?"
- global learning: "Move '{rule}' to {article}?"
Apply
Get today's date once (kb-format.md, Dates). Apply only what was approved:
- Index: add, fix or remove lines.
- Load modes: move articles between the trees and set or remove
paths(kb-format.md, Moving and deleting files). Moving doesn't changelast-updated; new or changedpathsdo. - Frontmatter: add missing fields and fix the YAML. Leave 1.x fields for
/kb-migrateand mention it. - Merges: combine the content into the target, merge
tags,paths,sourceand the Related sections, delete the merged-away file, point other articles' Related entries at the target, and update_index.md. - Contradictions: correct the wrong rule.
- Related: repoint or remove broken entries.
- Duplicates and global learnings: remove or move entries as approved. Create the target article if needed.
Update last-updated on every article whose content changed, and on no other. Remove empty sections and folders left behind.
Append to the log:
Report the files created, updated, moved and deleted, and the final count of articles by load mode with the pinned line total.
Remove mode
- Find the article. Match the argument against file names (with or without
.md), paths and titles. With several matches, or no argument, list the articles with their load modes and ask which one (Header: "KB Remove"). If nothing matches, say so and suggest/kb-query list. - Confirm. Show the file, its load mode, its
_index.mdline if any, and every article whose Related section points at it. Ask (Header: "Confirm Removal"; Options: "Delete it" | "Move it out of the knowledge base" | "Cancel"). Moving out keeps the file but stops it loading: ask where (defaultdocs/{name}.md). - Remove. Delete it (
git rmif tracked) or move it (git mv). Remove its_index.mdline. Remove its entry from other articles' Related sections, dropping a section that ends up empty, and updatelast-updatedon the articles that changed (with today's date, from kb-format.md). - Log: append
## [{date}] prune | Removed {name}with whether the file was deleted or moved, and which articles had links cleaned. - Report what was removed and which links were cleaned.
Organize mode
- Find articles loose at the root of
.claude/rules/kb/or.claude/kb/._index.md,_global-learnings.md,_log.mdandREADME.mdstay where they are. With fewer than three loose articles, say there's too little to organize yet and stop. - For each loose article, read its tags and content and suggest a category folder, reusing existing folders first:
| Folder | For | |
|---|---|---|
architecture/ | system design, patterns, data flow, module boundaries | |
conventions/ | naming, style, API contracts | |
testing/ | test patterns, fixtures, mocking | |
tools/ | build tools, deployment, CI/CD, environments | |
external/ | knowledge from other repos or websites | |
domain/ | business rules and domain logic |
Use other names when the content calls for them, and don't create a folder that duplicates an existing one.
- Show the moves:
```text KB organize ===========
| Now | Moves to | Why | |
|---|---|---|---|
| .claude/rules/kb/api-conventions.md | .claude/rules/kb/conventions/api-conventions.md | tags: api, conventions | |
| .claude/kb/release.md | .claude/kb/tools/release.md | tags: release, ci |
New folders: conventions/, tools/ Staying: _index.md, _global-learnings.md, _log.md, README.md ```
Ask (Header: "KB Organize"; Options: "Apply all" | "Let me adjust" | "Cancel"). With "Let me adjust", take new destinations as free text and show the plan again.
- Move each file (kb-format.md, Moving and deleting files), staying in the same tree so its load mode doesn't change. Update the paths in
_index.mdand in other articles' Related sections. Don't changelast-updated: the knowledge didn't change. - Append
## [{date}] prune | Organized {n} articles into folderswith the moves to the log, and report the files moved and folders created.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/ai-knowledge/skills/kb-prune/SKILL.md
Popularity
- Repository stars
- 32
- Repository forks
- 3
- 7-day trend score
- 17
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/charlesjones-dev/claude-code-plugins-dev/kb-prune)