Building Your Own Commands and Skills
Turning a workflow you repeat into a command the AI can run, so the good version happens by default.
Read first: Rules Files
Once a workflow is good, typing it out every time is waste — and worse, you will type a slightly worse version on the days you are tired. Custom commands make the good version the default one.
Start by noticing the repetition
You already have candidates. Look for the prompts you have written more than three times with only small changes:
- 1“Review this for security issues, checking for…”
The security pass from Chapter 21.
- 2“Write tests covering the normal case, empty input, and the boundaries”
Your standard test request.
- 3“Explain what this file does and where it is used, then wait”
The comprehension pattern.
- 4“Write a commit message from my staged changes”
Every single commit.
Each of those is a command waiting to exist.
Slash commands
Most agent tools let you save a prompt as a file and invoke it by name. In Claude Code that is a markdown file in .claude/commands/; other tools use their own directory but the idea is identical.
Review the staged changes for security problems. Check specifically:- secrets or credentials in source- unvalidated input reaching a query, command, or the DOM- endpoints that check authentication but not ownership- errors that leak internals to users For each issue, give the attack and the fix. If a categoryis clean, say so explicitly rather than staying silent.Now /security-review runs the full, careful version every time — including on the day you would have typed “check this for security stuff.”
Commit them to the repo
Keep commands in the project, not in your personal settings. Then everyone working on it — including future you on another machine — gets the same workflow, and improving a command improves it for the whole team in one commit.
It also makes the commands reviewable. A prompt that shapes how code gets written deserves the same scrutiny as the code.
When a script beats a prompt
Important boundary: if a task is fully deterministic, do not use a model for it. Write a script. It is faster, free, and cannot have an off day.
- 1Deterministic — write a script
Formatting, renaming by pattern, generating an index file, checking for forbidden strings.
- 2Requires judgement — write a command
Reviewing, explaining, naming things, deciding what to test.
This repository has both: scripts/validate-learn-nav.mjs checks curriculum data mechanically and fails the build, because that check has one right answer and should never be a matter of opinion.
When the tool remembers so you don't have to
There is a third case the split above misses: judgement work with a rule attached, one you keep having to restate because the model — or you, tired, at the end of the day — forgets it. That is not a script, because a step still needs a decision made. And it is not solved by a better command either, because the failure is not in the reasoning. It is in remembering the rule exists at all.
The fix is a tool that enforces the rule mechanically and leaves only the judgement to the prompt.
A script that creates the files, appends the draft entry, and runs the validator before it lets the run finish — rolling every change back if anything is wrong. Nobody has to remember to restate the rule about halfway states, because the tool will not produce one.
This is a real pattern in this repository: scaffolding a lesson runs the validator itself and cannot leave the project red.
The part that compounds
Each command you write makes the next task slightly cheaper. After a few months the accumulated set is more valuable than any individual model improvement, because it encodes how your project specifically wants to be worked on — which no vendor can ship you.
That is also the thing you take with you. Models will keep changing. A well-shaped workflow outlives whichever one you are using this year.
Key takeaways
- A prompt you have typed three times is a command waiting to be written.
- The value is consistency: your best prompt applied every time, not a shortened version from memory.
- Commit commands to the repo so the workflow is shared and reviewable.
- Deterministic work belongs in a script, not a prompt. Judgement work belongs in a command.
- A memory problem — a rule you keep forgetting to restate — is solved by a tool. A judgement problem still needs a prompt.
- Accumulated commands encode how your project wants to be worked on — that is yours, and it outlasts the model.
Quick check
Answer these to unlock the next chapter — 3 of 4 to pass. You can retake it anytime.
Answer every question to check.
Make a free account to read on
Every chapter is free — an account is how your progress, XP, and streak follow you from your laptop to your phone, and how you show up on the leaderboard. No payment, no trial.