| name | modular-skills |
| description | Design skills as modular building blocks for predictable token usage and maintainable architecture. Use when creating new skills that need modular structure, refactoring large skills into components, or optimizing skill token consumption. |
| category | workflow-optimization |
| tags | architecture, modularity, tokens, skills, design-patterns |
| dependencies | |
| tools | skill-analyzer, token-estimator, module-validator |
| usage_patterns | skill-design, architecture-review, token-optimization, refactoring-workflows |
| complexity | intermediate |
| estimated_tokens | 1200 |
Modular Skills Design
Overview
This skill provides a framework for designing modular skills that maintain predictable token usage and sustainable architecture. It helps users break down complex, monolithic skills into focused, manageable modules that are easier to test, maintain, and optimize.
The framework implements progressive disclosure principles where skills start with essential information and provide deeper details only when needed. This approach keeps context windows efficient while ensuring comprehensive functionality is available when required.
Key Benefits
- Predictable Resource Usage: Modular design keeps token consumption under control and performance consistent
- Maintainable Architecture: Shallow dependencies and clear boundaries make skills easier to understand and modify
- Scalable Development: Hub-and-spoke model allows skills to grow without becoming unwieldy
- Better Testing: Focused modules are easier to test in isolation and compose into larger workflows
- Tool Integration: Executable components automate common patterns and reduce manual overhead
Core Components
- skill-analyzer: Complexity analysis and modularization recommendations
- token-estimator: Usage forecasting and cost optimization guidance
- module-validator: Structural quality checks and compliance validation
Design Principles
- Single Responsibility: Each module serves one clear purpose
- Loose Coupling: Minimal dependencies between modules
- High Cohesion: Related functionality grouped together
- Clear Boundaries: Well-defined interfaces and responsibilities
What It Is
This skill provides a framework for designing modular skills. We've found that by breaking down large, complex skills into smaller, more manageable modules, we can create a more maintainable and predictable architecture. This approach also helps us keep our token usage in check.
This skill is based on Anthropic's Agent Skills best practices, and it's built around the idea of progressive disclosure: start with a high-level overview, and then provide more detail as needed.
Quick Start
Skill Analysis
# Check if your skill needs modularization (works from skill directory)
python scripts/analyze.py
# Analyze with custom threshold (default: 150 lines)
python scripts/analyze.py --threshold 100
# Or import directly in Python:
from abstract.skill_tools import analyze_skill
analysis = analyze_skill(".", threshold=100)
Token Usage Planning
# Estimate token consumption for your skill (works from skill directory)
python scripts/tokens.py
# Or import directly in Python:
from abstract.skill_tools import estimate_tokens
tokens = estimate_tokens("SKILL.md")
Module Validation
# Validate modular structure and patterns
python scripts/abstract_validator.py --scan
# Generate full validation report
python scripts/abstract_validator.py --report
# Auto-fix issues (dry run first)
python scripts/abstract_validator.py --fix --dry-run
Implementation Workflow
- Assess: Use
skill_analyzer.pyto identify complexity and modularization needs - Design: Break large skills into focused modules based on single responsibility
- Estimate: Use
token_estimator.pyto optimize for context window efficiency - Validate: Run
abstract_validator.pyto ensure proper structure and patterns - Iterate: Refine based on validation feedback and usage patterns
When to Use It
Use this skill when you're designing or restructuring skills
Perfect for:
- Creating new skills that will be >150 lines or cover multiple distinct topics
- Breaking down complex, monolithic skills into focused, maintainable modules
- Planning skill architecture with predictable token usage
- Refactoring overlapping skills into clear, single-responsibility modules
- Architecture reviews and maintainability planning
Don't use when:
- Just evaluating existing skill quality (use skills-eval instead)
- Writing prose for humans (use writing-clearly-and-concisely)
- Need specific improvement recommendations (use skills-eval's improvement-suggester)
Key differentiator: This skill focuses on design patterns and architecture, while skills-eval focuses on evaluation and improvement.
Integration with skills-eval
- Use skills-eval first to identify what needs improvement
- Switch to modular-skills for architectural changes
- Return to skills-eval for quality validation
Common Tasks
Here are a few common ways we use the tools:
- To assess the complexity of a skill, use the
skill-analyzer. This helps us decide if a skill needs to be modularized. - To design the modules, we follow the detailed workflow in the
guide.md. - To see examples of how to implement the patterns, we reference the
../../docs/examples/modular-skills/directory. - To validate the structure of our modules, we run the
module-validatorbefore deploying. - To estimate token usage, we use the
token-estimator. This helps us make design decisions based on their impact on the context window.
Detailed Resources
For comprehensive implementation details and advanced techniques:
- Core Workflow: See
modules/core-workflow.mdfor detailed modularization process - Implementation Patterns: See
modules/implementation-patterns.mdfor coding and structure patterns - Migration Guide: See
modules/antipatterns-and-migration.mdfor converting existing skills - Design Philosophy: See
modules/design-philosophy.mdfor underlying principles and thinking - Troubleshooting: See
modules/troubleshooting.mdfor common issues and solutions - Tools: Python analysis utilities in
../../scripts/directory:skill_analyzer.py- Complexity analysis and recommendationstoken_estimator.py- Token usage estimation with dependenciesabstract_validator.py- Pattern validation and auto-fixing
- Examples: See
../../docs/examples/modular-skills/directory for concrete implementations