SKILL.md Reference for Claude Code
SKILL.md Reference for Claude Code
SKILL.md is the file format that defines Claude Code Skills.
This guide covers common sections, recommended patterns, and examples for different Skill types. Use this as a reference when creating your own Skills.
What Is SKILL.md in Claude Code?
SKILL.md is a structured Markdown file containing instructions for Claude.
File naming and location:
Skills are typically organized as simple folders containing a SKILL.md file. Check current Claude Code documentation for the active placement and management workflow.
Purpose:
When you invoke a skill directly (for example, /react-component) or when Claude selects it
automatically for a relevant task, Claude Code:
- Locates the SKILL.md file
- Reads the entire content
- Injects instructions into Claude's context
- Generates output following those instructions
Common Sections in a SKILL.md File
A typical SKILL.md file includes these sections.
1. Title
# React Component Generator
- Use a descriptive, actionable title
- Should clearly state what the Skill does
- Appears as the Skill name in listings
2. Description
Creates React functional components with TypeScript, proper typing, and accessibility
attributes.
- Brief summary (1-2 sentences)
- Explains the Skill's purpose
- Helps users understand when to use this Skill
3. Purpose (Recommended)
## Purpose
Use this Skill when creating new React components in our codebase. It ensures consistent:
Use this Skill when creating new React components in our codebase. It ensures consistent:
- TypeScript typing patterns
- Accessibility compliance (WCAG AA)
- Component file structure
- Testing setup
- More detailed than description
- Explains when to use (and not use) this Skill
- Can reference project-specific context
4. Instructions
## Instructions
Follow these rules when generating React components:
Instructions
Follow these rules when generating React components:
- File Structure
- Create .tsx file, not .jsx
- Use PascalCase for component names
- One component per file
- TypeScript
- Define Props interface before component
- Use explicit return type: React.FC
or ReactElement - Enable strict null checks
- Accessibility
- Include ARIA labels where appropriate
- Use semantic HTML (button, nav, article)
- Ensure keyboard navigation works
- Core guidance for Claude
- Be specific and actionable
- Use numbered or bulleted lists
- Include rationale when needed
5. Examples (Highly Recommended)
## Examples
Examples
Example 1: Simple Button Component
import React from 'react';
import styles from './Button.module.css';
interface ButtonProps {
label: string;
onClick: () => void;
variant?: 'primary' | 'secondary';
}
export const Button: React.FC<ButtonProps> = ({
label,
onClick,
variant = 'primary'
}) => {
return (
<button
className={`${styles.button} ${styles[variant]}`}
onClick={onClick}
aria-label={label}
>
{label}
</button>
);
};
- Show complete, working code
- Demonstrate patterns described in Instructions
- Include 2-3 examples covering common cases
6. Constraints (Optional)
## Constraints
Constraints
## Constraints
- Requires React 18+
- Assumes TypeScript 4.9 or later
- Uses CSS Modules (must be configured in build)
- Follows WCAG 2.1 Level AA standards
- Technical requirements
- Dependencies or assumptions
- Limitations or boundaries
7. Anti-Patterns (Optional)
## Avoid
Avoid
## Avoid
- Don't use `any` type for Props
- Don't use default exports
- Don't inline complex logic in JSX
- Don't use `div` for clickable elements
- What NOT to do
- Common mistakes to avoid
Example SKILL.md Files for Common Skill Types
Real-world Skill templates for different use cases.
Frontend Component Skill
# Vue Component Generator
Creates Vue 3 Composition API components with TypeScript and Pinia state.
Instructions
- Use
<script setup lang="ts">syntax - Define Props with
defineProps() - Use Pinia stores for shared state
- Include
<template>with semantic HTML - Use
<style scoped>with CSS modules
Examples
Example Skill prompt for a Vue component workflow:
# Vue Component Generator
Creates Vue 3 components that match our frontend conventions.
## Instructions
- Use <script setup lang="ts">
- Define typed props with defineProps<T>()
- Keep template structure semantic and accessible
- Prefer Pinia for shared state and local refs for view-only state
## Constraints
- Vue 3.3+
- TypeScript 5.0+
- Pinia 2.x for state management
API Endpoint Skill
# REST API Endpoint
Creates Express API endpoints following our REST conventions.
Instructions
- Route Structure:
/api/v1/resource/:id - Method Handlers: Separate files for GET, POST, PUT, DELETE
- Validation: Use Joi for request validation
- Error Handling: Return consistent error format
- Documentation: Include JSDoc for Swagger generation
Examples
Example Skill prompt for an Express API workflow:
# REST API Endpoint
Creates Express endpoints following team API conventions.
## Instructions
- Use /api/v1 resource paths
- Validate requests with Joi before handler logic
- Return JSON errors with code, message, and details
- Add JSDoc comments so Swagger docs can be generated
## Example Request
"Create a POST /api/v1/projects endpoint with Joi validation and standard error handling."
Testing Skill
# Unit Test Generator
Creates Jest/Vitest unit tests following our testing standards.
Instructions
- File naming:
ComponentName.test.ts - Structure: Describe blocks for each method/scenario
- Assertions: Use
expect()with specific matchers - Mocking: Mock external dependencies
- Coverage: Aim for >80% line coverage
Examples
Example Skill prompt for generating unit tests:
# Unit Test Generator
Creates Jest or Vitest test files that follow team testing rules.
## Instructions
- Name files ComponentName.test.ts
- Group scenarios with describe blocks
- Mock network and database dependencies
- Assert visible behavior, edge cases, and error paths
## Example Request
"Write Vitest coverage for the auth service, including invalid token and expired session cases."
Common SKILL.md Patterns
Effective patterns when writing Skills.
Pattern 1: Clear, specific rules
Good:
- Use descriptive variable names (no single letters except i, j for loops)
- Functions should do one thing (max 20 lines)
- Extract repeated logic into helper functions
Pattern 2: Code examples over descriptions
Good:
[Include actual code showing the patterns]
Pattern 3: Consistent structure
Good: Pick a structure and use it across all your team's Skills for familiarity.
Pattern 4: Project-specific context
Good:
Follow the company style guide at [link] with these additions:
- [specific team rules]
A SKILL.md File in a Real Repo Workflow
A `SKILL.md` file is valuable when teams need one reusable instruction surface for repeatable coding and review tasks.
What this shows: This screenshot uses the Claude Code repository as a practical scenario anchor for how teams keep reusable coding instructions close to their projects.
Why this scenario matters: It makes SKILL.md feel operational: this kind of file matters because teams keep reusable agent instructions close to the actual codebase they work in.
Typical assistant task: Document a reusable agent workflow in-repo so coding, review, and debugging tasks follow the same operating pattern.
Source: Claude Code Repository
When to Pick SKILL.md Reference for Claude Code vs Cursor Rules
This comparison is most useful when both options look plausible on paper but differ in operating model, team fit, and day-to-day workflow cost.
| Decision Lens | This Page's MCP Path | Competitor |
|---|---|---|
| Best For | Teams documenting reusable Claude Code workflows directly inside the repository. | Teams that want editor-scoped instruction defaults without turning them into reusable capability modules. |
| Where MCP Wins | A SKILL.md-driven workflow wins when the goal is to make operational know-how reusable inside the codebase. | |
| Tradeoff to Watch | It is more structured than rules, which may be unnecessary when the team only needs lightweight editor guidance. | |
| Choose This Path When | Choose SKILL.md patterns for reusable in-repo workflows; choose Cursor Rules for lighter editor-level constraints. | |
| Sources | ||
Frequently Asked Questions
How long should a SKILL.md file be?
Can I include links in SKILL.md?
Should I include code comments in examples?
Can I use images in SKILL.md?
What if my instructions change?
Can I have nested headings beyond H2?
Manage Skills in Verdent
Verdent provides a Skill editor with syntax highlighting, validation, and version control.
Edit SKILL.md files directly in the browser with live preview. Changes sync across all projects automatically.