PTENES
MODULE 3.1

🧩 What is a Skill

Complete anatomy of a skill: YAML frontmatter, Markdown body, location on disk, and the agent's discovery and activation mechanism.

6
Topics
40
Minutes
Intermediate
Level
Theory
Type
1

📁 Anatomy: folder + SKILL.md

A skill is fundamentally a folder — not just one file. The folder name is the skill identifier; the file SKILL.md is the brain. Everything inside this folder serves the skill.

📁 formato-curso/ 📄 SKILL.md └ frontmatter + body 📁 scripts/ └ *.sh helpers 📁 references/ └ detailed docs 📄 .env.example SKILL.md --- (frontmatter YAML) name: formato-curso description: | Use when creating HTML of an INEMA.CLUB course --- (end front matter) # Workflow ## Hard Rules... 🤖 Agent skill activated body read + executed Folder = container · SKILL.md = brain · scripts/ = muscles

✓ Correct structure

  • ✓~/.claude/skills/minha-skill/SKILL.md
  • ✓kebab-case folder, SKILL.md at the root
  • ✓Optional scripts/ and references/ subfolders
  • ✓Each file has a clear responsibility

✗ Common errors

  • ✗SKILL.md loose in ~/.claude/ without a folder
  • ✗Folder with spaces or camelCase in its name
  • ✗Everything mixed together in one giant SKILL.md
  • ✗Scripts inline in markdown instead of in files
📁
Root folder
skill name
📄
SKILL.md
required
⚙️
scripts/
optional
📚
references/
optional
2

📄 YAML frontmatter

The frontmatter is the YAML block between the delimiters --- at the top of SKILL.md. This is where you declare the skill’s identity and how it should be activated.

SKILL.md — complete frontmatter YAML
---
name: formato-curso
description: |-
  Template e padrões de design para criar páginas HTML
  de cursos no formato INEMA.CLUB.
  
  Use esta skill SEMPRE que o usuário pedir para criar,
  editar ou revisar páginas HTML de curso — incluindo
  index de trilhas, páginas de módulos, componentes.
  
  SKIP: páginas web genéricas sem contexto de curso INEMA.CLUB.
---

# Formato Curso - INEMA.CLUB
# (corpo do SKILL.md começa aqui)

💡 Tip: the name field = identifier

O name in the frontmatter must be identical to the folder name. This creates consistency: the folder formato-curso/ contains an SKILL.md with name: formato-curso. The agent uses this name to refer to it in logs and to invoke it via /formato-curso.

✓ Valid frontmatter

  • ✓Delimiters --- at the beginning and end
  • ✓Indentation with 2 spaces (never tabs)
  • ✓Fields name e description present
  • ✓Clear, natural-language description

✗ Invalid frontmatter

  • ✗YAML with tabs instead of spaces
  • ✗Lack of --- of closing
  • ✗Empty or one-word description
  • ✗Unrecognized extra fields (no effect)
name
unique identifier
description
activation trigger
YAML
2 spaces, no tabs
---
required delimiters
3

📝 Markdown body

After the frontmatter, the body of SKILL.md is plain Markdown. This is where you define the skill's actual behavior: what to do, in what order, and what never to do.

SKILL.md — body structure Markdown
# Nome da Skill

Parágrafo de contexto curto — o que esta skill faz.

## Referências
Sempre leia estes arquivos antes de agir:
1. **`references/MASTER.md`** — Templates completos
2. **`references/CHECKLIST.md`** — Verificação final

## Fluxo de Trabalho
1. Entender o que será criado
2. Ler referências relevantes
3. Criar seguindo os templates
4. Verificar com o checklist

## Hard Rules
- **NUNCA** usar seta ▶ em tópicos (usar número em círculo)
- **SEMPRE** incluir INEMA.CLUB em todas as páginas
- **JAMAIS** simplificar o nav para páginas internas

Recommended sections in the body

1

Context / References

List of files the agent should read before acting. Pointer to the detailed documentation in references/.

2

Workflow

Numbered steps the agent executes in order. Includes confirmation gates before costly actions.

3

Critical Errors / Hard Rules

Unbreakable rules in ALL CAPS. What to NEVER do. Protects against the most costly and irreversible mistakes.

4

Quick reference tables

Decision tables, color mappings, component lists. Dense information in a scannable format.

💡 Ideal SKILL.md size

The SKILL.md is read in full each time it is activated. 50–150 lines is the sweet spot: dense enough to program behavior, concise enough to avoid wasting tokens. Larger content goes in references/.

## Sections
clear structure
Hard Rules
NEVER in uppercase
50–150 lines
ideal size
Links → refs
external detail
4

🗂️ Where Skills Are Located

Skills can exist at two scopes: global (available in all projects) or local (restricted to the current project). The choice depends on how specific the skill is.

🗺️ Location map

Global (~/.claude/skills/)

Reusable utility skills for any project. Examples: formato-curso, n8n-code-python, claude-api.

~/.claude/
└── skills/
    ├── formato-curso/
    ├── n8n-code-python/
    └── ads-skill/

Local (.claude/skills/)

Skills specific to the current project. They don’t appear in other repositories. Example: a skill with the client’s business logic.

meu-projeto/
└── .claude/
    └── skills/
        └── projeto-especifico/

📊 Precedence rule

When a skill with the same name exists in both scopes, the local overrides global. This lets specific projects customize a global skill’s behavior without changing the original.

✓ Use global when

  • ✓The skill is useful across multiple projects
  • ✓Contains no sensitive customer data
  • ✓It's a generic utility (formatter, analyzer)

✓ Use local when

  • ✓Contains specific business logic
  • ✓References the project’s private APIs
  • ✓Must be versioned along with the code
~/.claude/skills/
global scope
.claude/skills/
local scope
Local > Global
precedence
No conflict
distinct names
5

🔍 How the Agent Discovers and Activates

The discovery and activation process happens in two phases: passive discovery (at startup) and active activation (when the message is relevant).

Claude Code starts a session Scans ~/.claude/skills/ Injects name + description in the system prompt Match semantic request ↔ description Skill enabled Phase 1 Discovery Record Decision Execution The SKILL.md body is read ONLY during the activation step (lazy loading)

💡 Lazy loading: saving tokens

The agent does NOT read the full body of every skill in each session. Only the metadata (name + description) is injected. The full body is loaded only when the skill is activated. This keeps the context lightweight even with dozens of skills installed.

Scan
at session startup
Metadata
always injected
Body
lazy loading
Match
semantic
6

⚖️ Skill vs prompt vs command

Three tools, three purposes. Choosing the wrong one won’t break anything — but choosing the right one saves hours.

Comparison table

Criterion Skill Prompt Command
Persistence Persistent (file) Stateless Saved in config
Complexity Multi-step, scripts One-off instruction Prompt shortcut
Strict rules Yes (hard rules) No No
Auxiliary files Yes (scripts/, refs/) No No
Best for Complex workflows One-off tasks Quick shortcuts

💡 Golden rule

If you’re going to repeat the same set of steps more than 3 times, create a skill. If it’s a one-off and specific, use an inline prompt. If it’s a shortcut for a prompt you type frequently, create a slash command.

Skill
workflow + rules + scripts
Prompt
single instruction
Command
keyboard shortcut
3x rule
if you repeat it, turn it into a skill

🧩 Module Summary

✓
Skill = folder + SKILL.md — the directory is the container; SKILL.md is the required brain
✓
YAML frontmatter — name + description fields between --- delimiters; YAML with spaces, never tabs
✓
Markdown body — workflow, hard rules, references to external files; 50-150 lines is ideal
✓
Global vs. local — ~/.claude/skills/ for utilities; .claude/skills/ for project logic; local overrides global
✓
Lazy loading — only metadata injected at startup; body read only when the skill is activated
✓
Skill > prompt > command — a skill for complex, recurring workflows; use the 3x rule to decide when to create one

Next Module:

3.2 — Description and triggers: how to write the description field that makes the skill activate at the right time