From design-docs
Split large CLAUDE.md into child files. Use when context files exceed line limits, are too verbose, or cover multiple distinct topics that should be separate.
How this skill is triggered — by the user, by Claude, or both
Slash command
/design-docs:context-splitThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Splits large CLAUDE.md files into smaller, focused child files when they
Splits large CLAUDE.md files into smaller, focused child files when they exceed recommended line limits or cover too many topics.
This skill splits CLAUDE.md files by:
Extract parameters from the user's request:
Required:
file: Path to CLAUDE.md file to splitOptional:
strategy: Split strategy (section | topic | custom)sections: Specific sections to extract (for custom split)preview: Show split plan without executing (default: false)Examples:
"Split the root CLAUDE.md"
CLAUDE.mdsection (auto-detect)"Split pkgs/effect-type-registry/CLAUDE.md by major sections"
pkgs/effect-type-registry/CLAUDE.mdsection"Preview split for CLAUDE.md"
CLAUDE.mdRead and analyze the CLAUDE.md file:
Metrics:
Structure analysis:
# Count sections
grep "^## " CLAUDE.md | wc -l
# Count total lines
wc -l CLAUDE.md
Example output:
Current CLAUDE.md Analysis:
- Total lines: 587
- Limit: 500
- Overage: 87 lines (17% over)
- Sections: 8
- Average lines/section: 73
- Recommendation: Split needed
Based on analysis and request, choose strategy:
Split by major sections (H2 headings):
When to use:
How it works:
Example sections:
CLAUDE.commands.mdCLAUDE.architecture.mdCLAUDE.testing.mdSplit by logical topics that may span sections:
When to use:
How it works:
Example topics:
CLAUDE.build.mdCLAUDE.types.mdCLAUDE.plugins.mdUser specifies exactly what to extract:
When to use:
How it works:
Generate split plan for review:
# CLAUDE.md Split Plan
## Current State
- File: CLAUDE.md
- Lines: 587 / 500 (87 over)
- Sections: 8
- Strategy: section
## Proposed Split
### Parent: CLAUDE.md (120 lines)
**Contents:**
- Project Overview
- Quick Reference (commands, paths)
- Child File Navigation
**Sections preserved:**
- Project Overview
- File Organization (new section listing children)
### Child 1: CLAUDE.commands.md (95 lines)
**Contents:**
- AI-Friendly Commands
- Standard Commands
- Testing Commands
- Build Commands
**Sections:**
- Commands
- Scripts Reference
### Child 2: CLAUDE.architecture.md (180 lines)
**Contents:**
- Monorepo Structure
- Package Architecture
- Build Process
- Design Documentation
**Sections:**
- Architecture
- Development Notes
### Child 3: CLAUDE.tooling.md (110 lines)
**Contents:**
- Package Manager
- Linting
- Type Checking
- Testing Framework
**Sections:**
- Tooling
### Child 4: CLAUDE.testing.md (82 lines)
**Contents:**
- Testing Strategy
- Test Organization
- Running Tests
- Coverage
**Sections:**
- Testing
## After Split
- Parent: 120 lines (76% reduction)
- Children: 4 files, avg 117 lines each
- Total: 5 files instead of 1
- All files under limit ✅
## Navigation
Parent will have:
```markdown
## Documentation Structure
This project's context is split across multiple files:
- **[Commands](./CLAUDE.commands.md)** - AI-optimized commands
- **[Architecture](./CLAUDE.architecture.md)** - System design
- **[Tooling](./CLAUDE.tooling.md)** - Development tools
- **[Testing](./CLAUDE.testing.md)** - Test strategy
Load specific files when working on related tasks.
User confirmation:
This split will create 4 new files and reduce parent by 76%.
Proceed with split? (y/n)
For each planned child file:
Convention:
CLAUDE.{topic}.md for child filesExamples:
CLAUDE.commands.mdCLAUDE.architecture.mdCLAUDE.api-design.mdCLAUDE.type-system.mdEach child file should have:
Header:
# {Topic} - {Package Name}
Context file for {topic} in {package}.
**Parent:** [Main Context](./CLAUDE.md)
---
Content:
Footer:
---
**Related Context:**
- [Commands](./CLAUDE.commands.md) - If commands needed
- [Architecture](./CLAUDE.architecture.md) - If architecture needed
---
*This is a child context file. See [CLAUDE.md](./CLAUDE.md) for overview.*
Modify parent CLAUDE.md:
Use Edit tool to remove sections that were moved to children.
Add new section directing to child files:
## Documentation Structure
This project's context is organized across multiple files for optimal
loading:
**Core Context (This File):**
- Project Overview
- Quick Reference
- File Organization
**Detailed Context (Child Files):**
- **[Commands](./CLAUDE.commands.md)** - All commands and scripts
- Load when: Running builds, tests, or development tasks
- Size: 95 lines
- **[Architecture](./CLAUDE.architecture.md)** - System architecture
- Load when: Understanding structure, making architectural changes
- Size: 180 lines
- **[Tooling](./CLAUDE.tooling.md)** - Development tooling
- Load when: Setting up environment, debugging tool issues
- Size: 110 lines
- **[Testing](./CLAUDE.testing.md)** - Testing strategy and execution
- Load when: Writing tests, debugging test failures
- Size: 82 lines
**Usage:**
Load child files when working on specific areas. The parent provides
overview and navigation.
If parent had commands/paths, keep most common ones:
## Quick Reference
**Most Used Commands:**
```bash
# Development
pnpm dev
# Testing
pnpm test
# Building
pnpm build
For full command reference: See CLAUDE.commands.md
After creating all files, validate:
Line count checks:
# Check all files are under limit
wc -l CLAUDE*.md
Parent:
Children:
Cross-references:
Provide summary of split:
# CLAUDE.md Split Complete
**Original file:** CLAUDE.md
**Strategy:** section
## Files Created
### Parent: CLAUDE.md
- **Lines:** 587 → 120 (76% reduction)
- **Contents:** Overview, navigation, quick reference
- **Status:** ✅ Under limit (500)
### Children:
1. **CLAUDE.commands.md** (95 lines)
- Commands, scripts reference
- Status: ✅ Under limit
2. **CLAUDE.architecture.md** (180 lines)
- Architecture, development notes
- Status: ✅ Under limit
3. **CLAUDE.tooling.md** (110 lines)
- Tooling configuration
- Status: ✅ Under limit
4. **CLAUDE.testing.md** (82 lines)
- Testing strategy and execution
- Status: ✅ Under limit
## Validation
- ✅ All files under line limits
- ✅ Navigation section added to parent
- ✅ Cross-references valid
- ✅ Markdown linting passed
- ✅ No duplicate content
## Usage
Load context files based on task:
- **General work:** CLAUDE.md (overview)
- **Commands:** CLAUDE.commands.md
- **Architecture:** CLAUDE.architecture.md
- **Tooling:** CLAUDE.tooling.md
- **Testing:** CLAUDE.testing.md
## Next Steps
- Review each child file for coherence
- Test loading child files in Claude Code
- Update any external references to sections
- Consider adding to .claudeignore if needed
| Strategy | When to Use | Pros | Cons |
|---|---|---|---|
| Section | Clear H2 divisions | Simple, preserves structure | Uneven files |
| Topic | Interleaved topics | Logical grouping | Requires analysis |
| Custom | Specific needs | Full control | Manual work |
Parent should retain:
Children should contain:
Good navigation tells you:
Don't split if:
Before:
After:
Before:
After:
Before:
User request: "Just extract the Testing section, it's huge"
After:
ERROR: CLAUDE.md file not found
- Path: {path}
- Fix: Check file path
INFO: CLAUDE.md appears to already be split
- Found child files:
- CLAUDE.commands.md
- CLAUDE.architecture.md
- Recommendation: Review existing split or merge first
INFO: CLAUDE.md is under line limit
- Lines: 387 / 500
- Overage: 0 lines
- Recommendation: Split not necessary, consider other optimizations
WARNING: File too small for meaningful split
- Lines: 156
- Minimum for split: 400
- Recommendation: File is fine as-is
Works well with:
/context-review - Identify split candidates/context-validate - Validate before and after/context-update - Optimize before splitting/design-validate - Ensure design doc refs workA successful split:
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Applies a firm's KYC/AML rules grid to parsed onboarding records: assigns risk rating, checks required documents, outputs rule outcomes with citations, and routes for escalation.
Generates daily or weekly digests of activity from connected sources (chat, email, docs, tasks, CRM), highlighting action items, decisions, mentions, and project updates.
npx claudepluginhub spencerbeggs/bot --plugin design-docs