The trigger line
The trigger is the sentence that decides whether the agent reads the rest of the file. Write it with the vocabulary your tasks actually contain: file names, commands, error strings, ticket labels. "Use when a pull request changes a database migration" is a trigger. "Use when relevant" is not.
Compare a weak trigger with a usable one:
Weak: Use for testing tasks.
Better: Use when the task mentions pytest, a file under tests/,
or a test failure in CI output.
If your agent platform supports metadata fields, the trigger belongs in the description field as well, since that is what gets scanned before the body loads the Claude skill authoring guide.
The inputs list
Name every file, field, environment variable, or command output the agent must read before starting. This is the section that prevents the most common failure, which is an agent guessing at repository structure. Be literal:
pyproject.toml for dependency versions
- the failing test's full output, not a summary
docs/schema.sql for current table definitions
- the pull request diff, limited to
src/
If an input is missing, say what happens. "If docs/schema.sql is absent, stop and report" is a stop condition, which is the next section.
Numbered steps in imperative mood
Write steps as commands, not descriptions: "Read", "Run", "Compare", "Write". Number them so a reviewer can point at step 4, and so the agent has a stable order. Keep the freedom level matched to the risk. Anthropic's guidance distinguishes high freedom (text instructions for tasks where several approaches work), medium freedom (a template or parameterized script), and low freedom (one exact command, no variation) for fragile operations like migrations the Claude skill authoring guide. A migration skill should be low freedom. A code review skill can be high freedom.
Stop conditions
This is the section teams skip and then regret. A stop condition ends the loop. Agent systems are built as trigger, action, and stop condition because without an explicit stop the loop either runs forever or stops at an arbitrary point the MindStudio explainer. Four stop conditions cover most engineering skills:
| Stop condition | Example wording | Why it matters |
|---|
| Success | Tests pass and the diff touches only the target module | Prevents cleanup work outside scope |
| Size | Diff is under 80 changed lines, else stop and report | Caps blast radius and review effort |
| Missing input | docs/schema.sql absent, stop and say so | Stops the agent inventing a schema |
| Ambiguity | Two valid places to put the helper, stop and ask | Turns a silent choice into a decision |
Write numbers, not adjectives. "Under 80 changed lines" can be checked. "Small diff" cannot.
The worked example
Include one real example: a short input, the steps applied, and the output a reviewer accepted. One good example does more for consistency than three paragraphs of explanation. Keep it short and redact anything sensitive. This is also where you encode team taste, such as naming conventions or where tests live, without spending tokens on a tutorial.