一键导入
kb-migrate
Audit, clean, reorg, and migrate an existing KB to the current schema — idempotent, human-gated at each phase.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Audit, clean, reorg, and migrate an existing KB to the current schema — idempotent, human-gated at each phase.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Audit code quality against KB-defined properties, invariants, and naming conventions.
Quality and compliance audit — combines code-quality and spec-compliance into one actionable report.
Periodic friction analysis — proposes new skills, deterministic tools, and adaptations.
Propose bounded self-improvement loops from KB, code, tests, issues, and CI signals.
Run a bounded verification-first improvement loop from an approved loop spec.
Health check + pipeline pre-flight — verifies roster install integrity and that the project's dev environment (build/test/lint/format) is actually runnable before work starts.
| name | kb-migrate |
| description | Audit, clean, reorg, and migrate an existing KB to the current schema — idempotent, human-gated at each phase. |
| when_to_use | Use to audit, clean, reorg, and migrate an existing KB to the current schema. Trigger: 'migrate the KB', KB schema upgrade. |
| version | 1.0.1 |
You perform a structured, human-gated migration of an existing project KB to the current roster schema. Five sequential phases: audit, cleanup, reorg, frontmatter migration, verify.
Idempotency guarantee: running this skill twice on the same KB produces no additional changes. Files with schema-version: 2 in frontmatter are skipped in Phase D.
[ -d kb ] && echo "KB present" || echo "KB absent — nothing to migrate"
If no kb/ directory: report "No KB found. Run /roster-init to bootstrap one." and stop.
Run all available auditors on the existing KB:
ambiguity-auditor on all KB files. Collect: undefined terms, vague quantifiers, contradictions.spec-compliance-auditor if codebase is present. Collect: spec vs code divergences.check-kb-links: node scripts/check-kb-links.js (or npm run check:kb-links). Collect: broken relative links.Produce a Findings Summary:
## Audit Findings
### Broken links (N)
- <file>: [link] → <target> (not found)
### Ambiguity issues (N)
- <file>: <issue>
### Spec compliance issues (N)
- <file>: <issue>
### Migration candidates (files without schema-version: 2)
- <file>: status=<old-value>
Present findings to the human. Gate: proceed to Phase B only after human acknowledges.
For each finding from Phase A:
After all items are resolved or explicitly deferred:
## Cleanup Summary
Applied: N fixes
Deferred: M items (listed)
Gate: human confirms cleanup is complete.
Compare current KB structure against the schema tier (minimal/standard/large) appropriate for the project size:
Minimal (<5 files): index.md, spec.md, glossary.md
Standard (5-15 files): + architecture.md, properties.md, decisions/, reports/
Large (>15 files): + modules/, runbooks/
Identify:
index.md (orphaned)index.md but no file (broken index entries)decisions/)Propose restructuring as a diff: "Move X to Y", "Add index entry for Z", "Create missing file W". Human approves the reorg plan. Apply approved moves/creates.
Gate: human confirms reorg is acceptable.
For each KB file (excluding reports/):
schema-version: 2 is already present → skip this file (idempotent no-op).status value: draft → live-doctrine, reviewed → live-doctrine, stale → historicalstatus is already a new-format value (live-doctrine, superseded, historical, derived) → keep it, still add schema-version: 2schema-version: 2superseded-by: null if file is a spec file (spec.md, architecture.md, properties.md, glossary.md)supersedes: null if file is in decisions/Produce a migration plan listing every file and change before writing anything:
Migration plan:
kb/spec.md: status draft → live-doctrine, add schema-version: 2, add superseded-by: null
kb/decisions/001-auth.md: status reviewed → live-doctrine, add schema-version: 2, add supersedes: null
kb/reports/audit-2025-01.md: (skip — reports/ excluded)
...
Gate: human approves the migration plan before any writes.
Apply changes file by file. Update last-updated to today's date on each modified file.
check-kb-links. Must report 0 broken links.ambiguity-auditor on migrated files. Report any new issues (there should be none from frontmatter-only changes).schema-version: 2.Report:
## Migration Complete
Files migrated: N
Files skipped (already current): M
Broken links remaining: 0
Ambiguity issues introduced: 0
If any check fails, report specifically and stop — do not mark migration complete.