You create a Claude Code agent by saving a text file in the .claude/agents folder inside your project, or in the .claude/agents folder in your home folder if you want it in every project. The top of the file has a few lines between two sets of three dashes with a name and a description of when to use it, and you can add which tools it gets and which model it runs on. The rest of the file is its instructions. Or you just ask Claude to write one for you, which is how Claude Code's subagents docs start their own quickstart.
A couple of things trip people up, though. The dashes have to be the very first line of the file, the name can't have a colon in it, and if the agents folder didn't exist when you started Claude Code, you have to restart it before it sees the new file. I'd also give every agent only the tools it needs, because a checker that can't edit anything can't quietly fix its own homework. Then try it by name, like "Use the lead-router subagent on these leads." My guide to the seven Claude agent types has three agent files you can paste in.
More questions on this
Part of: Contractor Marketing, the full guide, with every related question linked.