Skills
Claude Code
2026

SKILL.md — Create AI Skills for Claude Code

The complete guide to writing SKILL.md files that teach your AI assistant specialized expertise

March 2, 202610 min read

What Is SKILL.md?

SKILL.md is a file format used by Claude Code (and other AI coding tools) to define reusable instruction sets. Each skill teaches your AI assistant specialized expertise — like code review best practices, framework-specific patterns, or security auditing procedures. Skills are like portable expertise packages that your AI applies when relevant.

SKILL.md File Format

---
name: my-skill-name
description: One-line description of what this skill does
---

# Skill Title

## When to Use
Describe when this skill should be activated.

## Rules and Conventions
1. First rule or convention
2. Second rule or convention
3. Third rule or convention

## Examples

### Good Example
```typescript
// Show a code example of correct behavior
```

### Bad Example
```typescript
// Show what NOT to do
```

Where to Put SKILL.md Files

.claude/skills/

Claude Code auto-discovers skills here. Each skill can be a single SKILL.md or a directory containing SKILL.md + supporting files.

.agents/skills/

Alternative location supported by some tools. Some teams prefer this for cross-tool compatibility.

Project root

A single SKILL.md in the root works for simple projects, but subdirectories scale better.

Real-World Skill Examples

1. Code Review Skill

---
name: code-review
description: Thorough code review with security and performance checks
---
# Code Review Skill
## Checklist (in order)
1. **Security**: SQL injection, XSS, auth bypass, secrets in code
2. **Correctness**: Edge cases, null checks, error handling
3. **Performance**: N+1 queries, unnecessary re-renders, memory leaks
4. **Style**: Naming conventions, code organization, DRY violations
5. **Tests**: Missing test coverage, edge case tests, mocking approach

## Output Format
- List issues by severity: 🔴 Critical → 🟡 Warning → 🔵 Suggestion
- Include line numbers and specific fix recommendations
- Praise good patterns to reinforce best practices

2. Database Migration Skill

---
name: database-migration
description: Safe database migration patterns
---
# Database Migration Skill
## Rules
- Always include both UP and DOWN migrations
- Use snake_case for table and column names
- Add indexes to foreign key columns
- Never modify existing migrations — create new ones
- Include data backfill scripts when needed
- Test rollback before deploying

## Column Naming
- Timestamps: created_at, updated_at, deleted_at
- Foreign keys: user_id, order_id (singular_table_id)
- Booleans: is_active, has_permission (is_ or has_ prefix)

3. API Design Skill

---
name: api-design
description: RESTful API design standards
---
# API Design Skill
## Endpoints
- Plural nouns: /users, /orders, /products
- Nested for ownership: /users/:id/orders
- Actions as sub-resources: /orders/:id/cancel

## Responses
- 200: Success with data
- 201: Created with location header
- 400: Client error with { error: { code, message, details } }
- 401: Unauthenticated
- 403: Forbidden  
- 404: Not found
- 429: Rate limited with Retry-After header

Skills + MCP: The Power Combo

Skills and MCP servers complement each other perfectly. MCP gives your AI access to tools (databases, APIs, GitHub). Skills tell it how to use those tools according to your standards. For example:

  • PostgreSQL MCP + Database Migration Skill = AI writes safe, standardized migrations
  • GitHub MCP + Code Review Skill = AI creates thorough, structured PR reviews
  • Filesystem MCP + API Design Skill = AI generates consistent API endpoints

Browse Pre-Made AI Skills

Find verified SKILL.md files and Cursor rules for your tech stack