From tdk-utils
Split large markdown documents into smaller files by heading level. Replaces extracted sections with Obsidian [[wikilinks]] in the original. Use when: document exceeds 200+ lines, needs modularization, or sections should be independently navigable.
How this skill is triggered — by the user, by Claude, or both
Slash command
/tdk-utils:shard-docThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Split large markdown documents into smaller section files by heading level, replace extracted content with Obsidian `[[wikilinks]]`, and generate a navigation index.
Split large markdown documents into smaller section files by heading level, replace extracted content with Obsidian [[wikilinks]], and generate a navigation index.
python .claude/skills/shard-doc/scripts/shard_doc.py <input.md> <output-dir> [options]
Note: output-dir is required (no default). Agent determines the optimal path.
| Flag | Description | Default |
|---|---|---|
--depth N | Heading level to split on (1-6) | 2 (H2) |
--backup | Create .bak before rewriting original | off |
--no-rewrite | Skip wikilink replacement in original | off |
--dry-run | Zero file writes, print report only | off |
--json | Output report as JSON (for agent parsing) | off |
--implode | Reconstruct original from shard folder (input=dir, output=file) | off |
# Basic sharding at H2 level with backup
python scripts/shard_doc.py docs/architecture.md docs/architecture/ --backup --json
# Dry run preview (no files written)
python scripts/shard_doc.py docs/big-doc.md docs/big-doc/ --dry-run
# Split at H3 level, no rewrite
python scripts/shard_doc.py docs/guide.md docs/guide/ --depth 3 --no-rewrite --json
# Reconstruct original from shards (implode)
python scripts/shard_doc.py docs/architecture/ docs/architecture.md --implode --json
docs/architecture/
├── index.md # TOC with wikilinks to all sections
├── 01-database-design.md # Section shard with parent backlink
├── 02-api-endpoints.md
└── 03-authentication.md
Each shard includes > Parent: [[../original|original]] backlink.
Original file becomes a hub with summaries + [[wikilinks]].
When a previously sharded document needs re-sharding:
> Full details: [[...]] pattern--implode shard-dir/ reconstructed.md then shard again--depth 3 (or deeper)Content before the first split-level heading (preamble) is NOT stored in shards. After implode, check if preamble needs to be prepended manually from the hub file's header content.
npx claudepluginhub vinhltt/tdk --plugin tdk-utilsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.