Claude-skill-registry kodex-init
Bootstrap a Kodex knowledge base by analyzing codebase structure and creating topic stubs
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/kodex-init" ~/.claude/skills/majiayu000-claude-skill-registry-kodex-init && rm -rf "$T"
skills/data/kodex-init/SKILL.mdKodex Init
Bootstrap a Kodex knowledge base by analyzing codebase structure and creating topic stubs.
Overview
This skill analyzes a codebase to identify logical topic boundaries and creates stub topics in the Kodex knowledge base. Topics are created as drafts requiring human approval before going live.
Use when:
- Setting up Kodex for a new project
- Onboarding to an unfamiliar codebase
- Refreshing topic coverage after major refactoring
Step 1: Explore Codebase Structure
Walk the directory tree to understand the project structure.
1.1 List Top-Level Directories
ls -d */ 2>/dev/null | grep -v -E '^(node_modules|vendor|\.git|dist|build|out|coverage|__pycache__|\.)'
1.2 Check Framework Indicators
Look for these files to identify the tech stack:
→ Node.js/React/Vuepackage.json
→ Flutter/Dartpubspec.yaml
→ RustCargo.toml
→ Gogo.mod
→ .NET*.csproj
/requirements.txt
→ Pythonpyproject.toml
1.3 Check Infrastructure Files
,Dockerfile
→ deployment topicdocker-compose.yml
,.github/workflows/
→ ci-cd topic.gitlab-ci.yml
,jest.config.*
,vitest.config.*
→ testing topicpytest.ini
,.env
→ configuration topicconfig/
Exclusion Patterns
Always exclude:
,node_modules/
,vendor/.git/
,dist/
,build/
,out/coverage/
,__pycache__/.cache/- Hidden directories (starting with
). - Binary and generated files
Step 2: Build Topic List
2.1 Directory-Based Topics
For each significant directory (3+ files or contains entry point):
topic_name = kebab-case(directory_name) title = Title Case(directory_name) source_files = [list of files in directory]
2.2 Standard Topics
Check for and add these standard topics when indicators exist:
| Topic | Indicators |
|---|---|
| Dockerfile, docker-compose.yml, k8s/, helm/ |
| .github/workflows/, .gitlab-ci.yml, .circleci/ |
| test/, tests/, .test., jest.config.*, pytest.ini |
| .env*, config/, settings.* |
| migrations/, schema/, prisma/, drizzle/ |
| auth/, login/, session/, jwt/ |
| routes/, controllers/, api/, endpoints/ |
2.3 Granularity Guidelines
- Target: 10-30 topics depending on codebase size
- Merge: Similar small folders into one topic
- Split: Large complex areas (20+ files) into multiple topics
- Don't: Create a topic for every single file
Step 3: Present for Approval
Display the proposed topic list to the user:
Proposed topics for this codebase: 1. [name]: Title (N files) - path/to/file1 - path/to/file2 2. [name]: Title (N files) ...
Ask user:
What would you like to do? 1. Approve all - Create these topics 2. Add a topic - I want to add another 3. Remove a topic - Remove one from the list 4. Edit a topic - Modify name or files
Handle modifications and re-display until user approves.
Step 4: Create Topics
For each approved topic, call the MCP tool:
Tool: mcp__plugin_mermaid-collab_mermaid__kodex_create_topic Args: { "project": "<absolute-path-to-cwd>", "name": "<topic-name>", "title": "<Topic Title>", "content": { "conceptual": "# <Topic Title>\n\nTopic pending documentation.\n\n## Source Files\n- path/to/file1\n- path/to/file2", "technical": "", "files": "", "related": "" } }
Step 5: Flag Topics as Incomplete
After creating all topics, flag each one as incomplete so they appear in the fix queue:
Tool: mcp__plugin_mermaid-collab_mermaid__kodex_flag_topic Args: { "project": "<absolute-path-to-cwd>", "name": "<topic-name>", "type": "incomplete", "description": "Stub topic needs detailed content based on actual codebase analysis" }
Call this for each topic created in Step 4.
Summary
After creating and flagging all topics, display:
Created N topics as drafts: - topic-1: Title 1 - topic-2: Title 2 ... All topics flagged as incomplete for review. Use /kodex-fix to fill in detailed content, or review drafts in the Kodex UI.
Error Handling
| Error | Action |
|---|---|
| Cannot read directory | Log warning, skip, continue |
| No significant directories | Warn user, ask for guidance |
| MCP tool fails | Log error, continue with remaining |
| User cancels | Exit with no changes |
MCP Tools Reference
| Tool | Purpose |
|---|---|
| Create a new topic as draft |
| Check existing topics before creating |
| Flag topic as incomplete for review |
Integration
Standalone skill - Does not require an active collab session.
Related skills:
- Fix flagged incomplete topicskodex-fix
- Query and flag existing topicsusing-kodex