flatten-section

barretcunningham's avatarfrom barretcunningham

Flatten a documentation section to remove nested directories. Use when you need to simplify a docs section like power/, navigation/, or appliances/ to have a flat structure with equipment pages at the root level.

⭐0starsšŸ”€0forksšŸ“View on GitHubšŸ•Updated Jan 8, 2026

When & Why to Use This Skill

This Claude skill automates the complex process of restructuring nested documentation directories into a standardized, flat file hierarchy. It optimizes documentation discoverability by consolidating equipment pages, manuals, and media assets into a single level, while simultaneously enforcing naming conventions, updating internal markdown links, and generating structured overview pages with maintenance schedules.

Use Cases

  • Case 1: Simplifying deeply nested technical documentation (e.g., moving files from 'docs/power/equipment/model/manuals/' to a root 'docs/power/' folder) to improve navigation and reduce click depth.
  • Case 2: Standardizing a knowledge base by automatically renaming files to kebab-case and ensuring all associated PDF manuals and images are co-located with their respective markdown articles.
  • Case 3: Migrating legacy documentation sections to a modern format that requires a mandatory '_overview.md' with auto-generated equipment tables and system specifications.
nameflatten-section
descriptionFlatten a documentation section to remove nested directories. Use when you need to simplify a docs section like power/, navigation/, or appliances/ to have a flat structure with equipment pages at the root level.
allowed-toolsBash(rm:*), Bash(mv:*), Bash(mkdir:*), Bash(ls:*), Bash(find:*), Read, Edit, Write, Glob, Grep

Flatten Documentation Section

Restructure a nested documentation section into a flat structure following these conventions:

Target Structure

Each section folder should contain:

  • _overview.md - Section overview with heading "# Overview" (underscore prefix ensures it sorts first in nav)
  • <equipment-name>.md - Equipment pages with kebab-case names matching the product
  • <equipment-name>-*.pdf - Associated PDF manuals in same directory
  • <equipment-name>-*.jpg/png - Associated images in same directory

Steps

  1. Identify the section to flatten (e.g., docs/power/, docs/navigation/)

  2. Delete index.md if it exists (causes duplicate nav entries)

  3. Rename systems.md to _overview.md if it exists

  4. Flatten equipment pages:

    • Move equipment/<model>.md → <model>.md
    • Move equipment/<model>/manuals/*.pdf → keep original PDF names in same directory
    • Move <subfolder>/<model>.md → <model>.md
    • Rename equipment files to match product name in kebab-case
  5. Update links in markdown files to reflect new paths (PDFs now in same directory)

  6. Update _overview.md to provide actual content:

    • Heading must be # Overview (not section-specific like "# Power Systems")
    • Brief description of the section
    • Equipment table linking to all equipment pages in the section
    • Summary of each major system with key specs from equipment pages
    • Maintenance schedule table
  7. Cleanup empty directories

Overview Template

# Overview

Brief description of this section's systems.

## Equipment

| Equipment | Description |
|-----------|-------------|
| [Product Name](product-name.md) | Brief description |

## System Name

Summary with key specs and link to [equipment page](equipment.md).

## Maintenance Schedule

| Task | Frequency |
|------|-----------|
| Task name | Weekly/Monthly/Annually |

Naming Convention

  • Equipment markdown: <manufacturer>-<model>.md (e.g., whale-supersub-smart-1100.md)
  • PDF manuals: <year>-<manufacturer>-<model>-<description>-<lang>.pdf or descriptive name
  • Images: <equipment-name>-<description>.jpg

Example

Before:

docs/power/
ā”œā”€ā”€ index.md
ā”œā”€ā”€ systems.md
ā”œā”€ā”€ equipment/
│   ā”œā”€ā”€ battery-monitor.md
│   └── battery-monitor/
│       └── manuals/
│           └── manual.pdf

After:

docs/power/
ā”œā”€ā”€ _overview.md
ā”œā”€ā”€ battery-monitor.md
└── battery-monitor-manual.pdf
flatten-section – AI Agent Skills | Claude Skills