Course navigation
Claude SkillsLesson 5 of 15

Build Skills from Scratch

A production-quality skill is more than a single SKILL.md. It can include reference docs and executable scripts. This lesson builds one file by file — using a code review skill as the example.

The full skill folder structure

This is the structure Anthropic uses for published skills like skill-creator. Only SKILL.md is required — every other folder is optional and added as your skill grows.

~/.claude/skills/
skill-creator/Anthropic example
├── SKILL.mdrequired
├── agents/optional
├── assets/optional
├── eval-viewer/optional
├── references/optional
├── scripts/optional
├── LICENSE.txtoptional

What each subfolder is for

Do not pre-create empty folders. Add them one at a time when you hit a real need.

SubfolderPurpose
agents/Additional SKILL.md files for sub-agents in multi-step workflows
assets/Images, icons, CSV data, or other binary resources the skill references
eval-viewer/Scripts and config to run automated tests against your skill
references/Deep documentation Claude loads only when SKILL.md tells it to
scripts/Executable helpers Claude runs via bash — only output enters context
LICENSE.txtInclude if you plan to share or publish the skill publicly

Worked example: code-review-assistant

Start small — SKILL.md only — then add subfolders when the need arises.

1

Create the folder and write SKILL.md

The description field is the most important part — write the exact phrases a user would type when asking for a code review.

mkdir -p ~/.claude/skills/code-review-assistant
code-review-assistant/SKILL.md
---
name: code-review-assistant
description: >
  Reviews Python or JavaScript code for bugs, security issues,
  and style problems. Use when the user shares code and asks for
  a review, feedback, or asks to check the code.
---

# Code Review Assistant

## Goal
Identify real problems in the code — not cosmetic preferences.
Produce a structured review a developer can act on immediately.

## Output structure
1. **Summary** — one sentence on overall code quality.
2. **Issues found** — table: | # | Severity | Location | Issue | Fix |
3. **Positives** — 2-3 things done well (keep reviews balanced).
4. **Recommended next step** — single highest-priority action.

## Severity levels
- Critical — security flaw or data loss risk
- High     — likely to cause bugs in production
- Medium   — incorrect but non-critical logic
- Low      — style, naming, minor improvements

## Guidelines
- Reference the exact line or function name, not vague locations.
- Suggest a concrete fix, not just "this is wrong".
- If using a reference file, read references/patterns.md first.
- Keep the tone constructive, not critical of the author.
2

Add a references/ file for deep guidance

Move bulky reference material out of SKILL.md. Claude reads it only when SKILL.md says “read references/patterns.md first” — zero context cost otherwise.

code-review-assistant/references/patterns.md
# Secure Coding Patterns

## Input validation
Always validate and sanitise external input before use.
- Reject unexpected types early (type checks at boundaries).
- Use allow-lists, not block-lists, for string validation.

## SQL queries
Never interpolate user input directly into queries.
Prefer parameterised queries or an ORM.

## Secrets
Never log, print, or include secrets in error messages.
Use environment variables; never hardcode credentials.
3

Add a scripts/ helper for deterministic checks

Scripts let Claude run reliable operations without consuming context for the code itself. Claude executes the script via bash and gets back only the output.

code-review-assistant/scripts/validate_syntax.py
#!/usr/bin/env python3
"""
validate_syntax.py
Checks Python files for syntax errors before review.
Claude runs this via bash; only the output enters context.
"""
import ast, sys

def validate(path: str) -> None:
    with open(path) as f:
        source = f.read()
    try:
        ast.parse(source)
        print(f"OK: {path} — no syntax errors")
    except SyntaxError as e:
        print(f"ERROR: {path} — line {e.lineno}: {e.msg}")
        sys.exit(1)

if __name__ == "__main__":
    for p in sys.argv[1:]:
        validate(p)
Add one line to SKILL.md's Guidelines: “Before reviewing, run python scripts/validate_syntax.py <file> and report any syntax errors first.”
4

Final folder layout

After the three steps above, the skill folder stays lean — only the subfolders you actually needed.

code-review-assistant/
├── SKILL.md
├── references/
│ └── patterns.md
└── scripts/
└── validate_syntax.py

When to add each subfolder

SubfolderAdd it when…
agents/Your skill needs to hand off to a specialised sub-agent (e.g. one agent extracts, another formats)
assets/Your SKILL.md references an image, logo, CSV, or other binary file
eval-viewer/You want to run automated evals to measure and improve skill quality
references/Your SKILL.md is getting too long, or it points to deep docs Claude should load on demand
scripts/You need a deterministic operation (validation, conversion, calculation) that shouldn't consume context
LICENSE.txtYou plan to share or open-source the skill
Start every skill as a single SKILL.md. Add references/ when instructions get too long, scripts/ when you need reliable calculations, and agents/ when orchestrating multiple steps.

Three ways to build a skill

ApproachBest for
Write SKILL.md by handFull control. Simple, focused skills. Easy to version-control and diff.
Ask Claude in chatClaude drafts SKILL.md from your description. Fast for simple skills — you paste and save manually.
/skill-creator pluginGuided Q&A generates all skill files. Built-in Eval, Improve, and Benchmark modes for complex skills.

The /skill-creator plugin adds four modes — Create, Eval, Improve, and Benchmark — so you can write, test, and refine a skill without leaving your terminal. Invoke /skill-creator and choose a mode; it can generate SKILL.md, reference files, and scripts in one session.

Before you continue

  • Only SKILL.md is required; add subfolders when you hit a concrete problem.
  • Put deep docs in references/; put deterministic checks in scripts/.
  • Tell SKILL.md explicitly when to load reference files or run scripts.
  • For complex skills, use the /skill-creator plugin's Eval and Improve modes.
  • Next: how to invoke and use skills effectively in your workflow.

What's Next

You've built a skill. Now let's make sure you know all the ways to invoke and use it effectively in your workflow.