Inject Titles Skill
This skill ensures that all Markdown files in src/content/docs have their frontmatter-defined title cleanly prepended as the primary # Title (H1) heading at the very beginning of the document body.
When to Use
Use this skill:
- When importing documents that have a frontmatter
titlebut lack the matching# Titleheading in the markdown text. - To ensure uniform, consistent document heading hierarchy across all content pages.
How it Works
The under-the-hood script:
- Recursively walks all
.mdfiles insrc/content/docs. - Reads each document using
gray-matter. - Verifies if
titleis defined in frontmatter. - Checks if the body already starts with
# Title. - Prepends
# Titleif missing, and saves the file back.
Execution
Run this command from the project root:
node .agents/skills/inject-titles/scripts/inject-titles.js