Claude-skill-registry gitbook-assistant
Validates GitBook markdown syntax, helps create properly formatted blocks, and ensures documentation quality
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/gitbook-assistant" ~/.claude/skills/majiayu000-claude-skill-registry-gitbook-assistant && rm -rf "$T"
skills/data/gitbook-assistant/SKILL.mdGitBook Assistant Skill
When to Use
This skill automatically assists when:
- Editing or creating markdown documentation files in this repository
- User asks about GitBook syntax or block types
- Validation of GitBook-specific blocks is needed
- Creating new documentation content with GitBook features
- Reviewing documentation for syntax errors or improvements
Core Capabilities
1. Syntax Validation
Check documentation for proper GitBook syntax:
- Block opening/closing:
{% blockType %}...{% endblockType %} - Block type validity against official GitBook spec
- Required parameters for each block type
- Proper nesting rules
- LaTeX/KaTeX math syntax
- OpenAPI block configuration
2. Block Assistance
Help create and insert properly formatted blocks:
- Suggest appropriate block types for user intent
- Generate correctly formatted block syntax
- Provide examples from templates
- Explain block parameters and options
3. Content Enhancement
Improve documentation quality:
- Check for missing code examples
- Verify consistent terminology usage
- Suggest appropriate block types for content
- Validate accessibility considerations
- Ensure proper heading hierarchy
4. Reference Lookup
Access comprehensive GitBook format documentation:
- Full block type reference
- Syntax examples for all blocks
- Advanced features (variables, expressions, conditional content)
- OpenAPI extensions and configuration
- Best practices and limitations
Validation Process
When validating GitBook content:
-
Block Syntax Check
- Verify all blocks have proper opening/closing tags
- Check block type names match official GitBook blocks
- Validate no orphaned tags
-
Parameter Validation
- Check required parameters are present
- Verify parameter syntax and values
- Validate URL formats for embedded content
-
Nesting Rules
- Ensure blocks are nested according to GitBook rules
- Check that content blocks don't violate nesting restrictions
-
Special Syntax
- LaTeX: Verify proper
or$...$
wrapping and valid LaTeX commands$$...$$ - OpenAPI: Check valid paths and methods
- Variables: Validate
syntax and variable names{{ }} - Expressions: Check JavaScript expression syntax
- LaTeX: Verify proper
-
Accessibility
- Images have alt text
- Tables have appropriate column types
- Headings follow proper hierarchy
Common Block Types Quick Reference
Content Blocks:
- Callout boxes{% hint style="info|warning|danger|success" %}
/{% tabs %}
- Tabbed content{% tab title="..." %}
- Code blocks with syntax highlighting{% code %}
- Embedded content{% embed url="..." %}
Structural Blocks:
/{% swagger %}
- API documentation{% openapi %}
/{% stepper %}
- Step-by-step guides ⚠️ CRITICAL: No indentation inside steps{% step %}
/{% cards %}
- Card layouts{% card %}
- Multi-column layouts{% columns %}
Interactive Blocks:
- Collapsible content (or HTML{% expand title="..." %}
)<details>
- File attachments{% file src="..." %}
Nesting Restrictions:
- ⚠️
cannot be nested inside{% tabs %}
- GitBook does not support this<details>
Advanced Features:
- Variables:
{{ space.vars.variableName }} - Expressions:
{{ user.email || "guest" }} - Conditional:
{% if condition %}...{% endif %} - Reusable:
{% content ref="..." %}
Resources Available
Full Reference Documentation
resources/gitbook-format-reference.md - Comprehensive reference for all GitBook blocks, syntax, and advanced features (~8k tokens, load only when detailed lookup needed)
Block Templates
resources/templates/ - Pre-formatted templates for common blocks:
- hint.md - Callout boxes
- tabs.md - Tabbed content
- code-block.md - Code examples
- openapi.md - API documentation
- stepper.md - Step-by-step guides
- expand.md - Collapsible sections
Usage Examples
Example 1: User asks "How do I add a warning callout?"
Response approach:
- Recognize this needs a hint block with warning style
- Access template from
resources/templates/hint.md - Provide formatted syntax with example:
{% hint style="warning" %} Your warning message here {% endhint %}
Example 2: Validating existing documentation
When reviewing a file:
- Scan for all
blocks{% %} - Check each block type is valid
- Verify all blocks are properly closed
- Check parameters match requirements
- Report any issues with line numbers and suggested fixes
Example 3: Creating new guide
When user wants to create a new guide:
- Suggest appropriate block types for content structure
- Provide templates for common patterns
- Ensure proper heading hierarchy
- Add code examples with syntax highlighting
- Include hints for important information
Error Detection
Common errors to catch:
- Unclosed blocks:
without{% hint %}{% endhint %} - Invalid block types:
(should be{% note %}
){% hint %} - Missing required parameters:
without{% tab %}title="..." - Invalid LaTeX:
(should be$x * y$
)$x \cdot y$ - Broken nesting: code blocks inside other code blocks,
inside{% tabs %}<details> - Indentation inside stepper steps - causes unwanted code block rendering
- Missing alt text on images
- Invalid OpenAPI paths or methods
- Missing or malformed frontmatter
Critical Formatting Rules
MUST follow these rules to prevent GitBook rendering errors:
- No indentation inside stepper steps - GitBook creates unwanted code blocks from indented content
- Always close tags -
,{% endstep %}
,{% endhint %}
,{% endtab %}</details> - Use proper frontmatter - YAML frontmatter at top of file with
delimiters, including---
andtitle
fieldsdescription - Code blocks need wrapper - Use
for titles, not just triple backticks{% code title="..." %} - No tabs in details -
cannot be nested inside{% tabs %}
elements<details>
Frontmatter Format
REQUIRED: All documentation files must use frontmatter for titles, NOT H1 headers
Proper frontmatter format:
--- title: Page Title Here description: Brief description of the page content ---
Example:
--- title: How to Create Compressed Accounts description: Guide to create compressed accounts in Solana programs with full code examples. ---
Do NOT use H1 headers (
) for page titles. The #
title field in frontmatter sets the page title in GitBook.
Best Practices
When working with GitBook documentation:
- Page titles: Always use frontmatter
field, never H1 for page titlestitle - Frontmatter: Include both
andtitle
fields in YAML frontmatterdescription - Heading hierarchy: H1 for major sections (Overview, Next Steps), H2 in steppers and subsections, H3-H4 for subsections of H2
- Code blocks: Always specify language for syntax highlighting
- Hints: Use appropriate style (info/warning/danger/success)
- Links: Use relative paths for internal docs
- Math: Use proper LaTeX syntax with
,\cdot
, etc.\pi - Accessibility: Always include alt text for images
- Consistency: Match existing documentation style
Integration with Repository
This skill works alongside:
When invoked, prioritize:
- Technical accuracy over style
- GitBook syntax correctness
- Consistency with existing documentation
- Accessibility and usability
- Clear, concise explanations
Progressive Resource Loading
To optimize context usage:
- First invoke: Load this SKILL.md file only (~2k tokens)
- If validation needed: Scan file with regex patterns (minimal context)
- If specific block lookup needed: Load relevant template (~100 tokens)
- If comprehensive reference needed: Load full format reference (~8k tokens)
Only load the full reference when user asks specific questions about advanced features or when detailed syntax lookup is required.