AGENT SKILL

kb-compact

Compacts KB directories — extracts legacy, unifies terminology, splits oversized notes, fixes indexes, reconciles with skill folders. Default: single directory. Use --deep for recursive bottom-up traversal.

License 许可
MIT
最近更新
2026-04-11
Stars
★ 2
Forks
0

01 前言 Front Matter

name
kb-compact
hooks
{ "PostToolUse": [ { "hooks": [ { "type": "command", "command": "uv run ${CLAUDE_SKILL_DIR}/../kb-learn/scripts/validate_kb.py --hook" } ], "matcher": "Write|Edit|Bash" } ] }
description
Compacts KB directories — extracts legacy, unifies terminology, splits oversized notes, fixes indexes, reconciles with skill folders. Default: single directory. Use --deep for recursive bottom-up traversal.
argument-hint
[--deep] [path/to/directory]

02 资源文件 4

03 SKILL.md 正文

/kb-compact

1. Configuration

Read KB config from .claude/knowledge-base/config.json (kb_roots array). Single KB: use its path. Multiple: AskUserQuestion which KB. No config: tell user "Run /kb-bootstrap to set up." and stop.

2. Input

Parse $ARGS:

  • --deep: recursive bottom-up traversal. Without it: single directory only.
  • path: optional, relative to project root or <kb_root>.
  • No path: ask user. Offer "Compact whole KB" (warn: expensive, implies --deep) or specify subfolder.

3. Folder Structure

All restructuring follows reference/folder-structure.md (canonical for clustering, unification, indexes, naming).

Sibling unification first: child folders grouped by semantically/lexicographically close names, run before other steps. 5+ siblings = medium sign; 8+ = high.

Template: assets/index-note.md

4. Orchestration

5. Changelog

Every run changing knowledge files MUST prepend to <kb-root>/CHANGELOG.md per learning/skill/reference/changelog-workflow.md.

6. User Approval

After all agents complete: present combined summary (files processed/moved/merged/split/created/deleted, terminology, legacy, indexes). AskUserQuestion: "Keep all", "Revert selectively", "Revert all". Selective: per-directory summaries, revert via git checkout -- <paths>.

7. Validation

After completing KB changes, run the validator to catch broken links, frontmatter issues, and structural errors:

uv run ${CLAUDE_SKILL_DIR}/../kb-learn/scripts/validate_kb.py --quiet --json

Fix any reported errors before finishing.

04 同仓库更多 Skills

farzadshbfn
farzadshbfn/knowledge-skills

kb-view

Opens the KB viewer in the browser. Starts a local HTTP server that renders all configured knowledge bases with working links, fuzzy search, and knowledge graph visualization.

★ 2
farzadshbfn
farzadshbfn/knowledge-skills

kb-monitor

Monitors KB usage patterns and skill health. Activates when KB access tracking detects frequently-read content that could become a skill, or when user corrections suggest a skill is underperforming. Also triggers on `this isn't working right`, `this skill keeps getting X wrong`, `convert this to a skill`, or `what should become a skill`. Tracks cross-session observations via memory.

Skill与智能体开发
★ 2
farzadshbfn
farzadshbfn/knowledge-skills

kb-mint

Mints skills from KB topics, packages skills into plugins, and prepares them for Cowork. Use when asked to create a skill from KB content, convert to a plugin, package for distribution, or make something cowork-ready. Also triggers on `convert this to a skill`, `package as plugin`, `mint a skill`, or `make this a plugin`.

Skill与智能体开发
★ 2
farzadshbfn
farzadshbfn/knowledge-skills

kb-learn

Manages a personal knowledge base with learning tracking. Modes: (1) learn from articles, (2) learn about topics, (3) fix errors. Uses markdown links with relative paths for cross-references. Maintains a rolling changelog, validates links, and keeps a markdown-compatible knowledge base. When a note reaches ~500 lines, suggests /kb-compact.

Skill与智能体开发
★ 2
farzadshbfn
farzadshbfn/knowledge-skills

kb-find

Read-only KB discovery with progressive 4-tier loading and --challenge mode for counter-evidence.

★ 2
farzadshbfn
farzadshbfn/knowledge-skills

kb-bootstrap

Sets up the knowledge base for a project or initializes the global (god) KB config. Creates the KB config, directory structure, and appends minimal instructions to the project's CLAUDE.md. Run this once when first using KB skills in a new project. Use --global to set up the global read-only KB.

★ 2