Claude Skills Guide

What Is the Best File Structure for a Complex Claude Skill

As Claude Code skills grow in sophistication, developers quickly discover that a single Markdown file no longer suffices Complex skills handling multi-step workflows, multiple tools, or extensive state management benefit from a well-organized file structure. This guide examines proven patterns for structuring complex Claude skills that scale.

The Baseline: Single File Structure

Simple skills work fine as standalone .md files. A basic skill might contain:

~/.claude/skills/
└── my-simple-skill/
    └── skill.md

The skill.md file includes your instructions, tool definitions, and examples. This approach works for skills like a simple text formatter or a single-purpose automation helper.

However, when your skill grows to handle multiple domains, manages complex state, or coordinates multiple tools, the single-file approach becomes unwieldy.

The most scalable structure separates concerns into distinct files and directories:

~/.claude/skills/
└── my-complex-skill/
    ├── skill.md              # Main entry point
    ├── README.md             # Documentation
    ├── config/
    │   └── defaults.yml      # Default configurations
    ├── lib/
    │   ├── tools.py          # Tool implementations
    │   ├── helpers.sh        # Shell helper functions
    │   └── state.json        # Persistent state
    ├── prompts/
    │   ├── system.md         # System-level instructions
    │   ├── templates/        # Reusable prompt templates
    │   │   └── analysis.md
    │   └── examples/         # Few-shot examples
    │       └── sample-input.md
    ├── tests/
    │   └── test_skill.sh    # Validation scripts
    └── .claude/
        └── commands.json    # Custom command mappings

This structure mirrors how professional developers organize code repositories, making it intuitive for anyone familiar with standard software development practices.

Breaking Down Each Component

The Main skill.md File

Your primary entry point should remain lean. Include only high-level orchestration logic:

# My Complex Skill

You are a multi-domain expert skill that handles data analysis, 
report generation, and visualization.

## Available Capabilities

- Data processing with Python and pandas
- Report generation in multiple formats
- Visualization with charts and graphs

## Workflow

1. First, analyze the input data using the analyze tool
2. Generate the report using the build-report tool
3. Create visualizations using the chart tool

For specific tasks, use the appropriate sub-skill:
- For PDF reports: reference the prompts/templates/pdf-report.md
- For Excel exports: reference the prompts/templates/excel-export.md
- For presentations: reference prompts/templates/presentation.md

Always start by understanding the user's exact requirements.

Separation of Prompts and Logic

Skills like pdf, xlsx, and pptx demonstrate this pattern well. The skill handles tool orchestration while prompt templates define specific behaviors.

Store reusable prompt segments in prompts/templates/:

# PDF Report Template

Generate a professional PDF report with the following sections:
1. Executive Summary (max 200 words)
2. Detailed Findings (use bullet points)
3. Data Tables (include all numerical data)
4. Conclusions and Recommendations

Use professional tone. Include page numbers and headers.

Configuration Management

Complex skills often need configurable behavior. Use YAML or JSON in your config/ directory:

# config/defaults.yml
# Custom configuration for the skill
output_format: markdown
default_language: python
max_lines_per_file: 500

Note: tools, auto_save, temperature, and max_tokens are not recognized by Claude Code. Configuration for Claude’s behavior belongs in the skill body as instructions, not in YAML config files.

State Management

Skills that maintain context across sessions should use a dedicated state file:

// lib/state.json
{
  "current_project": null,
  "processed_files": [],
  "last_analysis": null,
  "user_preferences": {
    "format": "markdown",
    "verbose": true
  }
}

The supermemory skill exemplifies this pattern, maintaining persistent context across Claude sessions.

Practical Example: A Multi-Tool Data Analysis Skill

Consider a skill that handles end-to-end data analysis. Here’s how to structure it:

data-analysis-skill/
├── skill.md
├── config/
│   └── analysis-profiles.yml
├── lib/
│   ├── python/
│   │   ├── analyzers.py
│   │   └── transformers.py
│   └── scripts/
│       └── validate-data.sh
├── prompts/
│   ├── system.md
│   ├── templates/
│   │   ├── statistical-analysis.md
│   │   ├── visualization-plan.md
│   │   └── report-outline.md
│   └── examples/
│       └── sales-data-example.md
└── tests/
    └── test_analyzers.py

The skill.md orchestrates the workflow:

# Data Analysis Skill

You analyze datasets and produce actionable insights.

## Tools Available

- Python with pandas for data manipulation
- Statistical analysis scripts
- Visualization generators

## Process

1. Load and validate data
2. Perform exploratory analysis
3. Generate statistical insights
4. Create visualizations
5. Compile findings into reports

For specific analysis types, refer to:
- Statistical analysis: prompts/templates/statistical-analysis.md
- Visualization: prompts/templates/visualization-plan.md

When to Split Across Files

Consider splitting your skill when any of these conditions apply:

The tdd skill demonstrates smart separation—it keeps test templates, assertion helpers, and workflow prompts in distinct files while maintaining a clean main entry point.

Avoiding Common Mistakes

A frequent error is dumping everything into skill.md. While convenient initially, this creates maintenance nightmares:

Another mistake is over-engineering simple skills. If your skill only invokes one tool and provides straightforward instructions, a single file remains the best approach.

Loading External Files in Your Skill

Claude Code skills can reference external files using relative paths. In your skill.md:

## Configuration

Load default settings from: config/defaults.yml

## Analysis Template

Use the template at: prompts/templates/analysis.md

## Examples

Refer to: prompts/examples/financial-data.md

This keeps your main file readable while accessing detailed content from dedicated files.

Conclusion

The best file structure for a complex Claude skill balances simplicity with scalability. Start with a single file and refactor when complexity demands it. Use directory structures that mirror software development best practices—separate configuration from logic, prompts from templates, and tests from implementation.

Skills like frontend-design, pdf, tdd, xlsx, and supermemory show that thoughtful organization pays dividends as skills evolve. Invest time in structuring complex skills properly, and you’ll find maintenance and collaboration much smoother.

Built by theluckystrike — More at zovo.one