Skip to content

Chapter 3 · Quickstart: your first skill

In this chapter you'll build commit-crafter — a skill that writes conventional commit messages from your staged changes. It's small enough to finish in ten minutes and real enough that you'll use it every day.

By the end you will have: created the folder, written a SKILL.md, installed it, verified it triggers, and learned the draft→test→iterate loop that every good skill goes through.

1 · Capture the intent

Before writing anything, answer four questions (do this in your head, or ask your agent to interview you):

  1. What should the agent do? → Write the commit message for my staged changes.
  2. When should it trigger? → When I ask to commit, mention commit messages, or say "commit this".
  3. What does good output look like? → A conventional commit: type(scope): imperative subject, body explaining why, breaking-change footer.
  4. What must it never do? → Commit without me asking; add AI attribution footers.

Question 4 matters as much as the rest: a skill without boundaries will overreach, and overreach is what makes people uninstall skills.

2 · Create the folder

Skills live in a skills directory (see chapter 2). For a personal skill you want in every project:

mkdir -p ~/.agents/skills/commit-crafter

For a project skill shared through the repo:

mkdir -p .agents/skills/commit-crafter

Tip

Copy-paste starting point: the repo ships a scaffold at examples/skill-starter/ with the same structure annotated. Copy it instead of starting from an empty directory if you prefer.

3 · Write the SKILL.md

Create commit-crafter/SKILL.md:

---
name: commit-crafter
description: Write git commit messages from staged changes following Conventional Commits. Use when the user asks to commit, asks for a commit message, wants to fix or improve a commit message, or mentions conventional commits, semantic commits, or squash/reword.
---

# Commit Crafter

Write commit messages for staged changes using the Conventional Commits
format. The user reviews and approves before anything is committed.

## Workflow

1. Run `git status` and `git diff --staged` to see what is actually staged.
   If nothing is staged, list changed files and ask what to include — never
   stage files yourself.
2. Classify the change: what type of work is it, and does it break anything?
3. Draft the message:
   - Subject: `type(scope): imperative summary` — under 50 characters,
     no trailing period, no capital first letter after the colon.
   - Body (only when the *why* isn't obvious from the subject): explain
     motivation and consequences, not a line-by-line diff narration.
   - Breaking changes: add `!` after the type/scope **and** a
     `BREAKING CHANGE:` footer explaining the impact.
4. Validate the draft before showing it:
   `python scripts/check_message.py --file message.txt`
   Fix any violations it reports and re-run until it exits 0.
5. Show the message to the user. Commit **only** on explicit approval, with
   `git commit` (no `--no-verify`).

## Rules

- Use the exact types from [references/conventional-commits.md](references/conventional-commits.md);
  read it if unsure which type fits.
- Never add attribution footers like "Generated with ..." unless asked.
- Never commit secrets, lockfile churn the user didn't mention, or unrelated
  files.

## Examples

See [references/examples.md](references/examples.md) for staged diffs paired
with their expected messages.

Note the pieces you'd never think to add but will save you later: the "never stage files yourself" boundary, the validation step (chapter 6 builds that script), and the pointer to references.

4 · Try to break the trigger

The description decides whether the skill fires. Test it with realistic phrasings — including sloppy ones:

"commit this"                      → should trigger
"write a good commit message"      → should trigger
"reword my last commit"            → should trigger
"what does the diff do?"           → should NOT trigger
"create a git branch"              → should NOT trigger

In a fresh agent session, try one prompt that should trigger. If it loads the skill and follows the workflow — good. If it doesn't trigger, your description is missing the words the user actually said. This is the single most common fix in skill authoring: the description must contain the user's vocabulary, not yours.

Forcing a skill to load

Most agents let you invoke a skill explicitly by name (e.g. typing the skill name as a command) — useful for testing the body independent of trigger quality. Check your agent's docs for the exact syntax.

5 · Iterate like an author, not a wisher

The loop that produces good skills is always the same:

flowchart LR
    A["Draft"] --> B["Run 2–3<br>realistic prompts"]
    B --> C["Read outputs<br>critically"]
    C --> D{"Good?"}
    D -- no --> E["Improve the skill:<br>reframe > add rules"]
    E --> B
    D -- yes --> F["Ship & monitor"]

When results are wrong, the instinct is to add more rules. Resist it. Three improvements that actually work, in order of preference:

  1. Reframe — if the agent keeps misreading an instruction, rewrite it around the underlying goal ("explain why the change is needed" instead of three MUSTs about the body).
  2. Show, don't tell — add a concrete example of expected output.
  3. Move repeated work into scripts — if every run re-derives the same computation, bundle it (chapter 6).

Chapter 10 turns this loop into a repeatable, recorded process.

Where you are now

You have a working, installable skill. The rest of the tutorial upgrades it:

Chapter Upgrade
4 Description engineering and body style, systematically
5 Splitting content into references/ (the two files we linked)
6 The check_message.py validation script
8 Remembering lessons between sessions

The finished version of everything built here lives at examples/commit-crafter/.


Chapter 4 · The SKILL.md — writing descriptions that trigger and bodies that get followed.