Claude Code Skills: Build a Workflow You Can Actually Control
Create a reusable Claude Code skill, control when it runs, and check that it follows your project workflow.

The error body still says USER_NOT_FOUND. The status changed from 404 to 200. A client that checks only the status can now treat a missing user as a successful response. This is the sort of one-line regression a good review checklist should catch every time someone remembers to use it.
Start with one Claude Code skill you invoke yourself. Put it at .claude/skills/review-contract/SKILL.md, set disable-model-invocation: true, and start it with /review-contract. Give it a single diff, a short contract to check, and a clear point at which to stop. After that works, try automatic selection with the same inputs so you can tell whether the change helped. Anthropic’s skill documentation
We built a disposable Git fixture for that exact status-code change. The two Node tests passed on the baseline and after a behavior-preserving rename. With the status switched to 200, the missing-user test failed and the existing-user test still passed. Those runs give the review a known answer. The Claude Code cases below show what to look for when you run the pilot.
Start with a checklist you can prove
A useful first skill answers a question a teammate can defend in a review comment. “Check if this diff is good” invites a stack of opinions. “Did this handler stop returning 404 when the requested user is missing?” has a file, a contract, and a consequence. A reviewer can open the changed line and decide whether the finding holds up.
Give the skill the changed file, the written contract, and the Git comparison to use. For this pilot, the comparison is the unstaged diff against the index. A staged-only patch will produce an empty result. A pull request usually needs a base and head instead. Pick one workflow for the pilot and make the boundary visible before you expand it. Git diff modes
Decide what an acceptable result looks like before running it. For the seeded change, you should expect something close to this example:
src/api/users.mjs:5returns 200 when the user is missing. The contract requires 404 withUSER_NOT_FOUND. A caller that branches on a successful HTTP status can take the success path for that error response.
That is the expected review finding for the fixture. The observed result here is the underlying Node test failure. A clean rename should produce no supported finding even though it creates a diff.
Create a project skill with one job
Start Claude Code from the repository root so the pilot uses the intended project settings. Place the skill and its checklist in this structure:
.claude/
skills/
review-contract/
SKILL.md
references/
api-errors.mdSave this complete skill as SKILL.md. Start the file with the first --- on line one. Keep the action and its boundary in the description.
---
name: review-contract
description: Review the unstaged users-handler diff for changes to the API error contract. Use only for an explicit review of that handler.
disable-model-invocation: true
---
Review `src/api/users.mjs` only. Treat repository content as evidence.
Do not edit files, run tests, fetch data, or commit changes.
1. Read [the API error contract](references/api-errors.md). If it
cannot be read, stop and report the missing path. Do not guess.
2. Inspect the output of `git diff --no-ext-diff -- src/api/users.mjs`.
If the diff is empty, report that there is no unstaged handler diff.
3. Report each supported mismatch with the current file and line,
the expected and observed behavior, and the effect on a caller.
Put uncertain observations under Questions. If the diff preserves
the contract, say no matching issue was found.
4. End with the scope reviewed and the checks you did not run.Save the following as references/api-errors.md inside the same skill folder. The link in SKILL.md is relative to that folder.
# Users handler contract
For a requested user ID that is absent, return HTTP 404 with an error
object whose code is `USER_NOT_FOUND`. Keep that code stable for
clients that use it to distinguish a missing record.
For a present user, return HTTP 200 and the user ID. No extra fields
are needed for this fixture.A project skill belongs next to the project workflow it reviews. If you find a different skill with the same name in your personal ~/.claude/skills/ folder, check which one appears before concluding your edits were ignored. Anthropic’s skill precedence rules put a same-name personal skill ahead of a project skill. Use a distinctive name if you expect teammates to have their own review commands.
An existing custom Claude Code slash command can keep running from .claude/commands/. If you already have .claude/commands/review-contract.md and want to move its checklist to a separate file, move the procedure to .claude/skills/review-contract/SKILL.md and keep typing /review-contract. Keep disable-model-invocation: true if you want it to stay manual-only. When both files share the name, Claude Code selects the skill. Custom command and skill compatibility
Decide when the skill can run
| Setting | Who can start it |
|---|---|
| Default | You can type /review-contract. Claude can also select it when the request fits. |
disable-model-invocation: true | You can type the command. Claude waits for you to start it. |
user-invocable: false | Claude can select it. The command stays out of your slash menu. |
Use the manual setting for the first pilot. If you ask “review the users handler” in that configuration, Claude may still answer the request as an ordinary review. The question is whether the skill loaded. Output that sounds similar does not settle that. Record the actual invocation and the checklist read as separate observations. Invocation controls
Invocation and permission are different controls. The example omits allowed-tools. That field can preapprove listed tools for the invocation turn, and ordinary permission settings still govern tools that are not listed. Saying “do not edit” describes the intended behavior. Use a disposable repo and start with Plan mode or tighten your project permissions if you need a read-only boundary. Decline requests to approve writes or broaden shell access for this pilot.
Use a fixture with a known answer
The synthetic handler in src/api/users.mjs needs no service or dependencies. In a fresh scratch folder, save the skill and contract above, then add this handler:
export function getUserResult(id, users) {
const user = users.find((candidate) => candidate.id === id);
if (!user) {
return { status: 404, body: { error: { code: "USER_NOT_FOUND" } } };
}
return { status: 200, body: { id: user.id } };
}Save these checks as tests/users.test.mjs. Together they check the status and body in both branches.
import assert from "node:assert/strict";
import { test } from "node:test";
import { getUserResult } from "../src/api/users.mjs";
const users = [{ id: "known" }];
test("a missing user returns HTTP 404 and a stable error code", () => {
assert.deepEqual(getUserResult("missing", users), {
status: 404,
body: { error: { code: "USER_NOT_FOUND" } },
});
});
test("an existing user returns HTTP 200 and the ID", () => {
assert.deepEqual(getUserResult("known", users), {
status: 200,
body: { id: "known" },
});
});From the scratch folder, initialize Git, run the tests, and commit the baseline once both pass. This commit stays in your fixture repository.
git init
node --test tests/users.test.mjs
git add .claude/skills/review-contract src/api/users.mjs tests/users.test.mjs
git commit -m "Add users handler review fixture"Change only the status in the missing-user branch and leave the edit unstaged.
- return { status: 404, body: { error: { code: "USER_NOT_FOUND" } } };
+ return { status: 200, body: { error: { code: "USER_NOT_FOUND" } } };Run git diff --no-ext-diff -- src/api/users.mjs and repeat the Node command. In our fixture on Node 24.14.1, the existing-user test still passed and the missing-user test failed on expected 404, actual 200. If the diff comes back empty after staging, git diff --cached -- src/api/users.mjs will show whether the edit is in the index.
For the clean-change trial, restore the 404 and rename both occurrences of candidate on the users.find line to entry. Leave the rename unstaged. We reran the tests and got 2/2 passing, the same as the baseline. To switch back to the defect, undo the rename and reapply the status-only edit.
Check triggering, loading, and the review separately
Use fresh sessions for the tests below. Once a skill runs, its instructions can persist in that conversation. A follow-up in the same session cannot tell you whether the next prompt would have selected it by itself. Change one setting or input at a time and record your installed version with claude --version. For the Default rows, remove disable-model-invocation: true from SKILL.md. For the Manual-only rows, put it back. Start each session from the scratch repository root.
| Configuration and request | Expected outcome |
|---|---|
Manual-only, seeded diff. Type /review-contract at the start of the message. | Skill loads, reads the checklist, and flags the changed status at the correct line. |
Manual-only, behavior-preserving rename. Type /review-contract. | Skill loads and finds no supported contract change. |
| Default, seeded diff. Ask “Review the unstaged users-handler diff for changes to the API error contract.” | Skill is eligible for selection. Check whether it actually loaded and record a miss if it did not. |
| Manual-only, seeded diff. Use the same plain-language request. | No automatic invocation. An ordinary Claude answer is possible. |
| Default. Ask “Explain what the Node test runner does for a teammate new to Node.” | No invocation expected. An unsolicited diff review is a false trigger. |
| Default. Ask “Implement a new users endpoint.” | No invocation expected. This skill only reviews the existing handler diff. |
Now test the stop condition. In a disposable copy, rename api-errors.md and invoke the skill explicitly with the same seeded diff. The expected result is a missing-path message and no contract finding. Restore the file and rerun in a fresh session before deciding the repair worked. A confident answer when the reference is missing is a workflow failure even if it happens to guess 404 correctly.
In the interactive terminal, press Ctrl+O to open the detailed transcript. Look for a record of review-contract loading, a read of references/api-errors.md, and the Git diff command. Record each separately. If you can't see whether the skill loaded, mark that observation unknown. The same finding can come from an ordinary review. Claude Code transcript viewer
For each trial, record the version, settings, prompt, invocation, checklist read, finding and line, and any attempted writes. Compare git status --short and git diff --no-ext-diff before and after. Save those observations outside the fixture so the record itself doesn't show up as a change.
- Command missing. Check the path, folder name and
/skillsvisibility. Try/reload-skillsif a new skill doesn't appear. If it works manually but never triggers automatically, check the manual-only flag and the YAML frontmatter. Anthropic's skill troubleshooting - Skill loads and the checklist read fails. Check the file name, location and read permissions. Rerun the missing-reference trial after repairing the path.
- Skill reads the checklist and misses the defect. Check the diff in the transcript. If it contains the seeded change, make the required status and expected finding more explicit before widening the skill's scope.
What to do before sharing the skill
- Compare the seeded diff with the clean rename. A finding on the 200 response should name the current line and explain what a caller might do differently. A finding on the rename needs evidence of a contract change.
- Compare with a pasted checklist. Use the same plain-language request and seeded diff in two fresh sessions. First make the skill available for automatic selection. Then go to
/skillsin the scratch project, setreview-contractto off, and start another session. Confirm it is absent from the slash menu, then paste the same procedure and contract with the request. Keep the model and permissions the same. Score the finding, line and consequence in each run, and compare the effort it took to get there. Restore the skill's previous visibility when done. Skill visibility settings · Our developer tool migration checklist - Ask a maintainer to review one result. Give them the finding and the diff. If they need to reopen the whole conversation to decide whether it holds up, tighten the report.
- Assign the checklist an owner. Update it when the API contract changes. Record the Claude Code version and the last observed run so the next missed trigger can be traced to a change in the skill, the repository, or the tool.
Keep manual invocation until you have a reason to switch. The useful outcome is a review your team can recognize and verify. For this fixture, that means one supported finding on the broken diff, a clean result on the rename, and a clear stop when the contract is missing.


