gaia-shard-doc

Split a Markdown document into named shards at a chosen heading level and generate an index.md linking file.

2|Updated Apr 15, 2026
One-click install
npx skills add https://github.com/gaiastudio-ai/gaia-public --skill gaia-shard-doc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gaia-shard-doc
Source: https://github.com/gaiastudio-ai/gaia-public/tree/main/plugins/gaia/skills/gaia-shard-doc
Command: npx skills add https://github.com/gaiastudio-ai/gaia-public --skill gaia-shard-doc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Split a large Markdown document into smaller, navigable shards while preserving content and producing an index.md that links to each shard; the original document's structure and content are kept intact.

Core Features & Use Cases

  • Default split level is H2, with the option to override to H1 or H3 using --level=H1|H2|H3.
  • Preserves all content; content before the first split-level heading becomes _preamble.md, and a linking index is created.
  • Generates an index.md that links to all shards with their headings for easy navigation.
  • Asks for user confirmation before writing files; supports automatic proceeding in YOLO/non-interactive mode.
  • Handles the zero-heading edge case by emitting a clear message and not creating shards or output directories.

Quick Start

Run the shard-doc skill on a source Markdown file to produce a shard directory containing all generated shards and an index.

Frequently Asked Questions about gaia-shard-doc

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

FAQPage Schema
How do I split a large Markdown document into smaller linked files?

You can split Markdown documents by sectioning the file at a chosen heading level, which creates individual shard files alongside an index.md that links to each shard for easy navigation.

What is the best way to partition long-form technical docs by H2 headings?

Partitioning long-form technical docs by H2 headings is the default behavior, generating named shard files for each section while preserving the original document structure and content intact.

Can I split Markdown files at H1 or H3 heading levels instead of H2?

Yes, you can split Markdown files at H1 or H3 heading levels by overriding the default setting using the level configuration option to match your document's specific hierarchy.

What happens to content before the first heading when sharding Markdown?

Content before the first split-level heading becomes a dedicated preamble.md file, ensuring introductory text is preserved separately while the main sections become individual shards.

How does sharding handle a Markdown file with no headings?

When sharding a Markdown file with zero headings, the process emits a clear message and does not create any shards or output directories to prevent empty file generation.

Do I need to confirm before the tool writes the split Markdown shards?

Yes, the tool asks for user confirmation before writing the shard files, though it supports automatically proceeding in YOLO or non-interactive mode for automated documentation workflows.