Terminal agents: making them yours — rules, skills, hooks, subagents
The “CLI and terminal AI agents” topic ends with the agent installed and doing tasks. This topic is the next layer: how to stop explaining the same things to the agent in every session. Project rules, your own commands, automatic checks and subagent helpers are all plain text files in the project folder. You can ask the agent itself to create almost all of them.
It makes sense to read this after your first real project. Before that, you don’t know yet what you keep having to repeat. The examples below use Claude Code, because these mechanisms are most developed there. Codex CLI, Gemini CLI and Cursor have their own equivalents of project rules (most often an AGENTS.md file); check their documentation for the rest.
Setting up the agent for your team: rules, skills, CLAUDE.md/AGENTS.md
By default, the agent knows nothing about a specific project’s conventions: which stack it uses, how to name files, which linter to run before a commit. You don’t need to explain this again in every session. Almost all terminal agents can read a special instruction file right from the project folder once and keep it in mind for the whole job. In Claude Code, that’s a CLAUDE.md file in the project root; if there isn’t one, it will pick up an AGENTS.md instead. In Codex it’s AGENTS.md, in Gemini CLI it’s GEMINI.md, in Cursor it’s rules in the .cursor/rules folder. It’s essentially the same principle under different names. The “AI-first design systems” topic takes a close look at such a file using the ready-made Astryx design system as the example. Here’s how to create your own from scratch, even without a ready system.
The file is plain markdown text. Ask the agent to generate it, then fine-tune it by hand:
Create a CLAUDE.md file for this project: describe the stack, the folder structure, the component naming conventions, and explicit “don’t” rules: no inline styles, no hardcoded colors instead of tokens
From then on, the agent picks up this file from the project folder on every new launch. You don’t need to repeat the rules in every prompt. Besides code conventions, this is a good place for a line like “before you start, read project.md and decisions.md”: then the agent knows not only how to write but also what has already been decided. How to keep those files is covered in the “Personal context” topic.
The next level is skills: separate instructions for a specific recurring task (“how we format commit messages,” “how to check accessibility before handing off”). The agent always keeps CLAUDE.md in context, while a skill loads only when it’s needed. The agent figures that out from the short description in the skill’s header, or you call it explicitly. You end up with a library of team procedures that grows over time, instead of bloating one shared CLAUDE.md forever. In Claude Code, a skill is a .claude/skills/<name>/ folder with a SKILL.md file. You can put templates, examples and scripts next to it.
Your own commands: a skill from a single word
There’s one more way to avoid explaining a task from scratch every time: a personal command instead of a system file for the whole project. You can call any skill from the section above by hand, by its folder name with a slash. A skill in .claude/skills/handoff/SKILL.md runs with the /handoff command. There used to be a separate mechanism for this: markdown files in the .claude/commands/ folder. It still works, and you’ll run into it in older projects and guides. But commands and skills are now merged, so for anything new, create a skill right away. After that, the same task runs from one word, without retyping the whole prompt:
/weekly-report
A command can take an argument through $ARGUMENTS. Everything you write after the command name gets substituted into the prompt text in place of this variable:
/client-brief Dawn Studio
Name skill folders in plain Latin letters: every example in the documentation looks like that, and non-Latin characters can break the call.
You can keep commands right in the project, in .claude/skills/. Then, if you hand the project to a colleague, they’ll work for them with no extra setup. Personal commands for all your projects live in ~/.claude/skills/. Your personal settings, ~/.claude/settings.json, and subagents, ~/.claude/agents/, live in the same home folder. The prompt inside the file is plain text with no special syntax. Changing how a command behaves is as simple as editing that file. Here’s an example for a designer; save it as .claude/skills/handoff/SKILL.md. The header with description at the top of the file tells the agent when to use the skill without an explicit command:
---
name: handoff
description: Builds a handoff document for the developer based on the current state of the project
---
Build a handoff document for the developer based on the current state of the project: a list of components with their states (default/hover/error/empty), the spacing and color tokens used, and a list of what isn’t implemented yet. Save it to handoff.md
Hooks: automatic reactions to the agent’s actions
One more level of setup on top of CLAUDE.md and skills is hooks. These are small scripts that run automatically on a specific event in the agent’s work, not on an explicit user command. You configure them in the .claude/settings.json file inside the project. There are many events; to start, you only need to know four. PreToolUse: before the agent performs an action, and you can block it. PostToolUse: right after an action, so you can check the result. Notification: when the agent itself needs something from a human, you can send a system notification so you don’t have to check the terminal every five minutes. Stop: the agent is about to finish, and you can keep it from stopping until, say, the tests pass.
The most practical example for a designer who is just starting to trust the agent with autonomous mode is a safety hook. The script gets the text of every command before it runs. If it finds clearly dangerous patterns (rm -rf, sudo, chmod 777), it stops the action and explains why. It doesn’t replace the care described in the “Securing a vibe-coded project” topic. It’s an extra barrier that works even when you’ve looked away from the screen.
You don’t need scripting experience to set up hooks from scratch. Ask the agent to write the hook itself:
Set up a hook that, before running any terminal command, checks it for rm -rf, sudo and chmod 777 and blocks it with an explanation if it finds one of those patterns
Several agents at once: parallel and sequential flows
One agent in one terminal isn’t the only way to work. As a project grows, it helps to know that you can run several agents at the same time. Do it deliberately, so they don’t accidentally trip over the same file.
In parallel, on independent parts of a task. If the frontend and backend (or two different screens) don’t depend on each other, open two terminals and run a separate agent session on its own task in each. They won’t get in each other’s way as long as they don’t touch the same files. So they don’t physically collide on one branch, Claude Code has built-in support for git worktree. That’s a separate working copy of the same repository in another folder, tied to its own git branch. The two agents literally work in different folders on disk and then merge into the main branch separately. This way they don’t edit the same files at the same time or get confused by each other’s changes.
Sequentially, as a pipeline of roles. Another pattern: one agent checks another. For example, one agent run writes a feature, and a second one, in a separate session with a clean context, checks the same code for bugs and mismatches with the spec. It works as an independent reviewer, not as the same conversation partner who subconsciously defends its own solution. Claude Code has a built-in mechanism for this, subagents. These are helper agent sessions with their own context and a narrow role (“reviewer,” “tester”). The main agent calls them itself as it works, so you don’t have to spell out this logic in every prompt.
This works best with a persona role that is explicitly forbidden from smoothing over inconsistencies, rather than a functional role (“tester”). A subagent playing “skeptical art director” gets a more specific instruction than “critique this.” If the data or the arguments contradict each other, it doesn’t pick the convenient version on the author’s behalf; it puts the contradiction into a separate list of questions. For a design or brief review, you can set up several such personas in parallel, each with its own narrow lens:
Set up three subagents to review the design ./mockups/checkout.png (or a frame from a link via the Figma MCP): an “accessibility advocate” (looks for problems with contrast, tap target size, keyboard navigation), a “budget hawk” (flags everything that needs custom development instead of ready components), and a “brand purist” (checks against the brand book). Each one must say explicitly when it lacks data to judge, instead of guessing. Collect their conclusions into one list, and put the disagreements between the subagents in a separate section without resolving them on their behalf
It’s the same single “picky art director” trick from the “Evaluating and critiquing AI output” topic, just split into several parallel, narrowly focused voices instead of one all-purpose critic.
If you don’t have much vibe coding experience yet, multi-agent setups are an advanced technique, and you don’t need to start there. Until you feel that one agent in one terminal has become the bottleneck, parallel flows are more likely to confuse you than speed you up. Further down the same line is an experimental feature, Agent Teams. There, several Claude Code sessions work as a team: a lead session hands out tasks, and the members talk to each other directly and pick up tasks from a shared list themselves, instead of only reporting upward. To keep them from overwriting each other, the work is split so that each one has its own set of files. The feature is experimental and turns on with the CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 variable, and you don’t need to start with it either. But it’s useful to know where this is heading.
Command examples for practice
Study the project and create a CLAUDE.md no longer than one screen: the stack, the folder structure, naming conventions and explicit ‘don’ts.’ Don’t write anything that’s already obvious from the code
This is the third time I’m explaining how we put together a developer handoff. Turn it into a skill in .claude/skills/handoff: when to use it, the steps, the output format. Show me the file before saving
Set up a hook that, before running any terminal command, checks it for rm -rf, sudo and chmod 777 and blocks it with an explanation
Set up a read-only reviewer subagent: after every major edit, it checks the result against CLAUDE.md and returns a list of violations without fixing anything
Explain in simple words the difference between CLAUDE.md, a skill, a hook and a subagent, using the example of a designer who runs one landing page and one small product. Which of these do I need first?Think back to what you explained to the agent more than twice on your last project: a rule, an output format or a sequence of steps. Write the rule into CLAUDE.md, turn the recurring procedure into a skill, and call it on a real task. Then open a new session and check that the agent follows the rule without a reminder.
Sources
- How Claude remembers your projectcode.claude.com
CLAUDE.md, and reading AGENTS.md when there’s no CLAUDE.md
- Extend Claude with skillscode.claude.com
the .claude/skills folder, calling /name, $ARGUMENTS, compatibility with .claude/commands
- Hooks referencecode.claude.com
the PreToolUse, PostToolUse, Notification and Stop events and where to configure them
- Create custom subagentscode.claude.com
subagents with their own context and restricted tools
- Orchestrate teams of Claude Code sessionscode.claude.com
experimental Agent Teams and the variable that turns them on
- Run parallel sessions with worktreescode.claude.com
built-in git worktree support
Found a mistake or an outdated fact? Write to hey@iskra.guide