bmad-shard-doc

Splits large markdown documents into section files using markdown-tree-parser.

Updated Mar 20, 2026
One-click install
npx skills add https://github.com/LinCie/bearuang --skill bmad-shard-doc-lincie
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: bmad-shard-doc
Source: https://github.com/LinCie/bearuang/tree/main/.opencode/skills/bmad-shard-doc
Command: npx skills add https://github.com/LinCie/bearuang --skill bmad-shard-doc-lincie

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @kayvan/markdown-tree-parser.

What problem does it solve? Large markdown documents become hard to navigate, edit, and load into AI context. This Skill splits a monolithic markdown file into smaller, organized section files so each part can be managed and referenced independently. ## Core Features & Use Cases - Automated Sharding: Runs npx @kayvan/markdown-tree-parser explode to split a markdown file by level 2 sections into a destination folder. - Guided Workflow: Walks through source selection, destination confirmation, execution, output verification, and completion reporting with halt conditions on errors. - Original Document Handling: Offers delete, archive, or keep options for the source file after sharding to avoid duplicate content. - Use Case: You have a 2,000-line architecture.md file. Shard it into per-section files with an index.md so each section can be loaded on demand. ## Quick Start Shard the document docs/architecture.md into smaller section files using the default destination folder.

Frequently Asked Questions about bmad-shard-doc

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I split a large markdown file into smaller files?▼

Run the sharding workflow with your source markdown path, and it executes npx @kayvan/markdown-tree-parser explode to split the file by level 2 sections. Output files and an index.md are written to a destination folder named after the source file.

What tool splits markdown documents by section headings?▼

The @kayvan/markdown-tree-parser npm package splits markdown documents via its explode command. It parses the heading tree and writes each level 2 section as a separate file plus an index.md in the destination folder.

Can I choose a custom destination folder for sharded markdown files?▼

Yes, the workflow suggests a default folder named after the source file in the same location, but you can enter a custom path instead. It verifies the folder exists or can be created and checks write permissions before running.

What happens to the original markdown file after sharding?▼

You choose to delete it, move it to an archive subfolder, or keep it. Deleting or archiving is recommended because keeping both versions can cause duplicate content and confusion about which version to load.

Why does markdown sharding fail or produce no output files?▼

Sharding halts if the source file is missing, is not a .md file, the destination lacks write permissions, or the npx command fails. The workflow verifies output files and index.md exist before reporting completion.