Claude Skills Guide

Claude Skill Inheritance and Composition Patterns

Claude skills are Markdown files that enhance Claude Code’s capabilities. By understanding how to structure skills with inheritance and composition patterns, you can build modular, reusable skill sets that scale across projects and teams. Before diving into advanced patterns, read how to write a skill .md file to understand the foundational format.

How Claude Skills Work

A Claude skill is simply a Markdown file stored in ~/.claude/skills/ that contains instructions Claude loads when you invoke the skill. The skill file can include directives for file operations, command execution, thinking processes, and output formatting.

When you invoke a skill with /skillname, Claude reads the file and applies those instructions to your current session. This makes skills powerful extensions to Claude’s base capabilities.

Inheritance Patterns in Claude Skills

Inheritance in Claude skills works through file inclusion and directive referencing. Rather than duplicating instructions across multiple skills, you can create base skills that other skills extend.

Creating a Base Skill

A base skill contains common instructions that multiple specialized skills can inherit:

# Base Skill Template

## Thinking Process
- Analyze the requirements thoroughly
- Break down complex tasks into steps
- Verify each step before proceeding

## File Operations
- Always create backup before modifying files
- Use atomic writes for critical operations
- Validate file permissions before operations

## Output Format
- Provide clear, actionable feedback
- Include file paths in all file-related responses

Extending Base Skills

Specialized skills reference the base skill and add their own context:

# Frontend Design Skill

## Inherits
- base-skill.md

## Specialized Instructions
- Focus on component-based architecture
- Prioritize accessibility standards (WCAG 2.1)
- Consider responsive design patterns
- Use semantic HTML elements

## Design System Integration
- Reference design tokens from tokens.json
- Component library: shadcn/ui patterns
- Style with Tailwind CSS utility classes

This inheritance pattern reduces duplication and ensures consistent behavior across related skills.

Composition Patterns for Complex Workflows

Composition allows you to combine multiple skills for sophisticated workflows. Unlike inheritance (which extends a single base), composition draws from multiple specialized skills.

Sequential Skill Composition

Run multiple skills in sequence for multi-step processes:

# PDF Documentation Workflow

## Phase 1: Extract Content
Use the pdf skill to extract text and tables from source documents.

## Phase 2: Process and Format
Apply the tdd skill to generate testable documentation functions.

## Phase 3: Generate Output
Use docx skill to create formatted documentation files.

Parallel Skill Composition

Execute multiple skills simultaneously for coordinated operations:

# Multi-Format Export Skill

## Concurrent Operations
- Run pdf generation in background
- Run docx generation in background  
- Run xlsx data export in parallel
- Aggregate results when all complete

Conditional Skill Selection

Choose which skills to apply based on context:

# Adaptive Processing Skill

## Conditions
- IF file type is .pdf: use pdf skill
- IF file type is .docx: use docx skill
- IF data analysis required: add tdd skill
- IF visualization needed: add frontend-design skill

Practical Examples

Example 1: API Documentation Generator

This workflow combines multiple skills to generate comprehensive API documentation:

# API Doc Generator Skill

## Combined Skills
- tdd: for generating testable code examples
- docx: for creating Word documentation
- pdf: for PDF output generation
- xlsx: for generating parameter tables

## Workflow
1. Parse OpenAPI/Swagger specification
2. Use tdd to create runnable code examples
3. Generate docx documentation with examples
4. Create PDF version for distribution
5. Export parameter data to xlsx for reference

Example 2: Full-Stack Code Review

Combining skills for comprehensive code analysis:

# Code Review Skill

## Inherits
- base-skill.md

## Composition
- frontend-design: for reviewing React/Vue components
- tdd: for evaluating test coverage
- security-skill: for vulnerability scanning

## Review Process
- Frontend: Check component patterns, accessibility, performance
- Tests: Verify coverage meets thresholds
- Security: Run SAST checks, dependency audits

Example 3: Data Pipeline Automation

Building a data processing workflow:

# Data Pipeline Skill

## Skills Combined
- xlsx: for reading spreadsheet data
- pdf: for generating data reports
- tdd: for creating validation tests

## Pipeline Stages
1. Input: Read xlsx files with pandas
2. Transform: Apply business logic
3. Validate: Run tdd-generated tests
4. Output: Generate pdf summary reports

Best Practices for Skill Composition

Keep Skills Focused

Each skill should have a single responsibility. The frontend-design skill handles UI concerns, the tdd skill manages testing workflows, and the pdf skill processes documents. Combining unrelated responsibilities makes skills harder to maintain and test.

Use Clear Naming Conventions

Name skills descriptively so their purpose is obvious:

Document Skill Dependencies

When composing skills, clearly document which skills are required:

# Composite Skill

## Dependencies
- Required: tdd.md, pdf.md
- Optional: frontend-design.md (for visual output)

## Usage
Invoke this skill when you need to generate tests for PDF processing logic.

Version Control Your Skills

Store skills in git repositories to track changes and collaborate with team members. This enables review workflows, rollback capabilities, and shared skill libraries. If you need to undo a bad update, the guide on how to rollback a bad Claude skill update safely walks through the process step by step.

Advanced Composition: Skill Chaining

Skill chaining creates dependencies where one skill’s output feeds into another:

# Chained Skill Example

## Chain Definition
1. INPUT → tdd skill → test files
2. test files → code implementation skill → source code
3. source code → linter skill → formatted code
4. formatted code → git skill → committed changes

## Configuration
Each chain element specifies:
- Input: What the skill receives
- Output: What the skill produces
- Next: Which skill runs next

This chaining approach mirrors CI/CD pipelines but operates within Claude Code sessions.

Conclusion

Claude skill inheritance and composition patterns enable powerful workflow automation. By creating base skills with shared instructions and composing specialized skills for specific tasks, you build maintainable systems that scale. The key is keeping skills focused, documenting dependencies, and treating skills as modular building blocks.

Whether you’re combining the pdf skill with tdd for documentation workflows, or building comprehensive code review systems with multiple specialized skills, these patterns provide the foundation for sophisticated AI-assisted development processes.

Built by theluckystrike — More at zovo.one