[FEATURE] Feature Enhancement: Skills Documentation Pattern Support
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Skills Documentation Pattern for Multi-Domain Projects
Summary
This is a pattern that emerged through collaborative work on the MTK (Music Theory Kit) project. It demonstrates how the Claude Code skills feature can be used to create a modular, maintainable documentation system for complex multi-domain architectures.
Result: Transformed a 497-line monolithic CLAUDE.md into a 287-line "table of contents" plus 5 specialized skills documents (~3000 lines total), with clear agent delegation strategy and zero contradictions.
The Problem
Working on a complex React/TypeScript project with multiple architectural domains:
- Theming system (dual themes: Minimalist & Glassmorphic)
- Audio synthesis and playback (Tone.js)
- Musical theory calculations (Tonal.js)
- Instrument architecture (unified domain store)
- State management (Zustand)
Challenges:
- Single CLAUDE.md file (497 lines) with duplicated patterns across domains
- Contradictions between old guidance and evolved architecture
- Difficult to find relevant guidance for specific tasks
- No clear strategy for delegating to specialized agents
- User struggling with consistency: "working on two themes across the entire website, and it is proceeding, but it seems difficult"
The Solution Pattern - Step by Step
Step 1: User Identifies Pain Point
User: "Help write a 'skill' for you to use for this theming exercise, and for the use of the component library you have already built"
Response: Created first comprehensive skills document ([theming-and-components.md]()):
- Architecture overview (ThemeContext, ThemeStore, CSS variables)
- Component library documentation (13 themed components)
- Usage patterns with code examples
- 10 DO's and 10 DON'Ts
Step 2: User Validates and Requests More
User: [Opens and reviews document] "yes please!"
Context: User was responding to offer to create additional skills for:
- Musical theory integration
- Instrument architecture patterns
- State management best practices
Step 3: Domain Decomposition
Created 4 additional comprehensive skills documents:
- audio-components-and-playback.md
- Three-layer audio architecture
- Five core audio services
- Tone.js integration patterns
- Synchronized playback coordination
- musical-theory-integration.md
- ScaleStore as single source of truth
- Pre-computed scale data (O(1) lookups)
- 150+ chord progressions
- Roman numeral conversions
- instrument-architecture-patterns.md
- Unified domain store pattern
- useInstrument hook
- Instrument lifecycle
- Creating new instruments step-by-step
- state-management-best-practices.md
- Five Zustand store categories
- Five persistence strategies
- React integration patterns
- Performance optimization
Step 4: Critical User Insight
User: "Does it make sense for each skills document to specify a suitable agent to use, or is that an anti-pattern?"
Analysis: Concluded this would be beneficial because:
- Skills documents are discovered automatically by agents
- Agent descriptions already exist (react-css-expert, tonejs-expert, etc.)
- Guides primary agent on which sub-agent to delegate to
- Reduces cognitive load
Step 5: Agent Recommendations Added
Updated all 5 skills documents with:
## Recommended Agents
This skills document is most relevant for:
- **Primary**: `react-css-expert` - For React component development with CSS styling
- **Secondary**: `frontend-developer` - For general React UI development
- **Also useful**: `ui-designer` - When creating new component designs
## When to Use This Document
Use this guidance when:
- Creating or modifying themed components
- Implementing theme switching logic
- Working with CSS custom properties
- [etc...]
Step 6: Rationalization Request
User: "These latest rules and guidance are more up to date than CLAUDE.md. Can you rationalise or update CLAUDE.md for efficiency or to remove contradictions?"
Response: Transformed CLAUDE.md into a "table of contents":
- Reduced from 497 lines → 287 lines (42% reduction)
- Fixed contradictions (Bootstrap → themed components, incorrect hook names)
- Added clear references to all 5 skills documents
- Each reference includes: emoji, when to use, key features, recommended agents
- Kept unique content (navigation patterns, build commands, testing)
Final Architecture
CLAUDE.md (287 lines) - High-level "Table of Contents"
├── Tech stack overview & context
├── Skills document references with agent recommendations
│ ├── 🎨 Theming & Components
│ │ └── Agents: react-css-expert, frontend-developer, ui-designer
│ ├── 🎵 Audio Components & Playback
│ │ └── Agents: tonejs-expert, audio-synthesis-engineer, frontend-developer
│ ├── 🎼 Musical Theory Integration
│ │ └── Agents: music-product-owner, general-purpose, backend-architect
│ ├── 🎹 Instrument Architecture Patterns
│ │ └── Agents: architecture-refactoring, react-testing-specialist, frontend-developer
│ └── 💾 State Management Best Practices
│ └── Agents: architecture-refactoring, react-testing-specialist, frontend-developer
├── Quick reference patterns (Do's/Don'ts)
└── Unique guidance (navigation, file structure, testing, build commands)
.claude/skills/ (5 specialized documents, ~3000 lines total)
├── theming-and-components.md (detailed theming & component patterns)
├── audio-components-and-playback.md (detailed audio architecture)
├── musical-theory-integration.md (detailed theory patterns)
├── instrument-architecture-patterns.md (detailed instrument patterns)
└── state-management-best-practices.md (detailed Zustand patterns)
Why This Pattern Works
1. Separation of Concerns
- CLAUDE.md: High-level overview, tech stack, quick reference
- Skills docs: Deep domain-specific patterns and best practices
2. Discoverability
- CLAUDE.md acts as index with clear "when to use X" guidance
- Emojis provide visual scanning
- Skills docs provide depth when needed
3. Agent Routing Strategy
- Primary agent consults CLAUDE.md
- Sees recommended agents for each domain
- Delegates to specialist with appropriate skills doc loaded as context
4. Maintainability
- Update patterns in one place (skills docs)
- No duplication = no contradictions
- Single source of truth per domain
5. Scalability
- Easy to add new domains (just create new skills doc + reference)
- CLAUDE.md stays stable and manageable
- Skills docs can grow independently
Key Success Factors
- User-Driven Evolution: Pattern emerged from real pain points, not prescribed upfront
- Collaborative Refinement: User asked critical questions that improved the pattern
- Iterative Development: Built one doc, validated, refined, then scaled
- Practical Focus: Emerged from actual development struggles (theme consistency)
- Forward-Looking Design: Agent recommendations create self-organizing system
Measurable Improvements
Before
- ✗ 497-line monolithic CLAUDE.md
- ✗ Duplicated patterns across domains
- ✗ Contradictions (Bootstrap vs themed components, wrong hook names)
- ✗ No agent delegation strategy
- ✗ Difficult to find relevant guidance
After
- ✓ 287-line CLAUDE.md (42% reduction) + 5 modular skills docs
- ✓ Zero duplication - single source of truth per pattern
- ✓ Zero contradictions - conflicts identified and resolved
- ✓ Clear agent routing with recommendations
- ✓ Quick discoverability via table of contents
Impact
- Documentation size: 497 lines → 3,287 lines (560% more guidance)
- Main doc size: 497 lines → 287 lines (42% reduction)
- Contradictions: Multiple → Zero
- Domains covered: Implicit → 5 explicit domains
- Agent routing: None → Clear recommendations for 10+ agents
Suggested Feature Enhancement
Consider making this pattern a first-class workflow in Claude Code:
Option 1: Guided Wizard
claude-code skills init
> Analyzing codebase architecture...
> Detected domains:
> - UI/Theming (React, CSS, components)
> - State Management (Zustand stores)
> - Audio (Tone.js integration)
> - Musical Theory (Tonal.js, custom calculations)
> - Instruments (domain stores, visualizations)
>
> Generate skills documents for these domains? [y/n]
> Include agent recommendations? [y/n]
> Create CLAUDE.md table of contents? [y/n]
Option 2: AI-Assisted Analysis
claude-code skills generate --domain "audio-synthesis" --analyze-codebase
> Analyzing audio-related code...
> Found:
> - 5 core services (MusicalAudioSequencer, AudioTransportService, etc.)
> - Tone.js integration patterns
> - Synchronized playback architecture
>
> Generating audio-components-and-playback.md...
> Recommended agents: tonejs-expert, audio-synthesis-engineer
> Add reference to CLAUDE.md? [y/n]
Option 3: Templates
Provide templates for common domains:
claude-code skills template --domain frontend-architectureclaude-code skills template --domain state-managementclaude-code skills template --domain audio-videoclaude-code skills template --domain backend-api
Example Code Snippets from Our Implementation
CLAUDE.md Reference Section
## Skills Documents Reference
MTK has comprehensive skills documentation covering specific architectural domains.
**Always consult these documents** for detailed guidance:
### 🎨 [Theming & Component Library](.claude/skills/theming-and-components.md)
**Use when**: Working with themes, CSS variables, creating/modifying UI components
- Custom themed component library (13+ components)
- Dual theme system (Minimalist & Glassmorphic)
- CSS custom properties and theme switching
- **Agents**: `react-css-expert`, `frontend-developer`, `ui-designer`
### 🎵 [Audio Components & Playback](.claude/skills/audio-components-and-playback.md)
**Use when**: Implementing audio playback, working with Tone.js, synchronized playback
- Three-layer audio architecture
- Five core audio services
- Tone.js integration patterns
- **Agents**: `tonejs-expert`, `audio-synthesis-engineer`, `frontend-developer`
Skills Document Header
# MTK Audio Components & Playback Pipeline Skill
## Recommended Agents
This skills document is most relevant for:
- **Primary**: `tonejs-expert` - For Tone.js integration, audio synthesis, and timing
- **Secondary**: `audio-synthesis-engineer` - For digital audio synthesis and signal routing
- **Also useful**: `frontend-developer` - For React component integration with audio system
## When to Use This Document
Use this guidance when:
- Implementing musical sequence playback
- Working with Tone.js Transport, synths, or samplers
- Synchronizing UI updates with audio events
- Debugging audio timing or playback issues
- Coordinating multi-instrument synchronized playback
- Creating new audio features or instruments
Real-World Benefits
For Developers
- Clear guidance on which patterns to use
- Quick discovery of relevant documentation
- Confidence in architectural decisions
- Reduced context switching
For AI Agents
- Know which specialized agent to delegate to
- Load appropriate skills doc as context
- Avoid reimplementing existing patterns
- Maintain architectural consistency
For Projects
- Scalable documentation system
- Easy to add new domains
- Single source of truth per pattern
- Living documentation that evolves with codebase
Lessons Learned
- Start with pain points: User's struggle with theme consistency led to first skills doc
- Iterate and refine: Pattern emerged through conversation, not prescribed upfront
- User insights are valuable: "Should we specify agents?" was a brilliant observation
- Think holistically: Rationalizing CLAUDE.md prevented future contradictions
- Emojis matter: Visual scanning makes table of contents much more usable
Applicability to Other Projects
This pattern works well for projects with:
- Multiple architectural domains (UI, audio, data, etc.)
- Complex patterns that need detailed documentation
- Multiple specialized agents that could benefit from clear delegation
- Evolving architecture that needs maintainable documentation
- Team collaboration where consistency matters
Conclusion
The skills documentation pattern transformed our monolithic CLAUDE.md into a maintainable, modular system that:
- Eliminates duplication and contradictions
- Provides clear agent delegation strategy
- Makes architecture discoverable
- Scales as project grows
- Serves as single source of truth
This pattern emerged naturally through user-driven, collaborative work with Claude Code's skills feature. It demonstrates how the skills system can adapt to real-world project needs.
Thank you to the Anthropic team for creating the skills feature and Claude Code. It's excellent work that enables patterns like this to emerge naturally! 🎉
---
Project: MTK (Music Theory Kit) - React/TypeScript web app
Date: January 2025
Skills Feature Version: Claude Code latest (with .claude/skills/ support)
Pattern Status: Implemented and working excellently
Proposed Solution
All the details are in the description.
Alternative Solutions
_No response_
Priority
High - Significant impact on productivity
Feature Category
Performance and speed
Use Case Example
_No response_
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗