ClaudeOrNot

How to write a skill.md file

Last updated: June 2026

A good skill.md file is specific, actionable, and focused on one task. A bad one is vague, tries to cover everything, and reads like a blog post. Here's how to write the good kind.

The structure

Every skill.md file should have these sections:

  1. Title — one line that says what the skill does
  2. Purpose — why this skill exists and when to use it
  3. Procedure — step-by-step instructions the agent follows
  4. Output format — what the result should look like

Copy-paste template

# [Skill Name]

## Purpose
[What this skill does in 1-2 sentences. When Claude Code
should use it.]

## Procedure
1. [First step — be specific about what to do]
2. [Second step — include tools/commands to run]
3. [Third step — what to check before moving on]
4. [Continue for as many steps as needed]
5. [Final step — how to verify the result]

## Rules
- [Constraint 1: e.g., "Never delete existing code without asking"]
- [Constraint 2: e.g., "Always run tests after changes"]
- [Constraint 3: e.g., "Document any assumptions made"]

## Output Format
[Describe what the result should look like:
- A markdown file with specific sections
- A code file with specific structure
- A report with before/after metrics
- etc.]

Real example: code review skill

# Code Review Skill

## Purpose
Perform a thorough code review on a PR or diff,
catching bugs, style issues, and architectural concerns.

## Procedure
1. Read the full diff. Understand what changed and why.
2. Check for obvious bugs:
   - Off-by-one errors
   - Missing null/undefined checks
   - Race conditions in async code
   - Unhandled promise rejections
3. Check for style issues:
   - Naming consistency
   - Function length (>30 lines is a smell)
   - Code duplication that should be extracted
4. Check for architectural concerns:
   - Does this change fit the existing patterns?
   - Are there new dependencies that could be avoided?
   - Is the change in the right layer of the codebase?
5. Run the existing tests to verify nothing breaks.

## Rules
- Focus on correctness first, style second
- Flag security issues immediately
- Don't nitpick formatting (that's a linter's job)
- If something is confusing, ask about it rather than
  assuming it's wrong

## Output Format
Markdown with sections:
- Summary (1-2 sentences)
- Critical issues (must fix before merge)
- Suggestions (nice to have)
- Questions (things that need clarification)

Do's and don'ts

Do

  • One skill per file. If it covers two tasks, split it.
  • Include concrete steps, not vague guidance.
  • Specify the output format. Claude Code produces better results when it knows what "done" looks like.
  • Test it. Run the skill, see the output, refine.
  • Name the file after the task: security-audit.md, db-migration.md

Don't

  • Put universal coding standards in a skill. Those go in agents.md.
  • Write paragraphs of explanation. Use bullet points and numbered steps.
  • Copy someone else's skill without adapting it to your project.
  • Make a skill file too long. If it needs more than 60 lines, the task is probably too broad.

Still not sure where your instructions go?

If you're unsure whether something belongs in agents.md or a skill.md, describe it to our tool. You'll get an instant recommendation with reasoning.

The quick test: "Does this apply to everything Claude Code does?" If yes, agents.md. If no, skill.md.

Get your skill.md generated

Describe the AI agent functionality and get an instant recommendation for where it goes, plus generated markdown content.

Try ClaudeOrNot →