Your code agent is great but it’s easy to lose control of your codebase like falling from your horse. And when you are falling, it will be very hard to go back on top. I’m sure you see of what i’m talking : Code bloat, over-engineering, complication, files explosion …
Moreover, it’s easy to burn all your tokens and your wallet with it too.
But how do you use it efficiently and accelerate your development without burning it all?
Here are some interesting steps that i try to follow to be the most efficient i can and vibes code like a pro.
1) Use /init to create a claude.md but clean it
/init lets you create a claude.md or agent.md file that gives your coding agent the context of how to code in your project.
But be careful, /init will put a lot of information inside, things that may not be very useful and will cost you a lot of credits / tokens.
The claude.md / agent.md will be added to your request each time you ask something of the agent. So removing things that are not useful will save you money and gain you precision.
Moreover, it’s very important to add how you want your agent to code. Because it tends to write state-of-the-art code with a lot of tests, fallbacks and mini-files everywhere. That is good for some specific parts, but when it does it everywhere, then you will quickly lose control of your code.
2) Use your agent on a specific part and file
Instead of saying « implement me this function please, make me magic happens« , create the file structure, the class and the general architecture yourself, and name the function. Then, with your agent, ask « implement me the function x_name in the file @src/file.py« . That will ensure that you keep control of your codebase, you understand how it works, and you don’t overcomplicate it.
To specify the file to work inside, use the @.
3) The two pass coding
When your agent has implemented your code, always do a second pass to clean the code and check it. I like to use this prompt:
« Run that code through YAGNI+SOLID+DRY+KISS principles, remove overengineering and things that could be simpler and show me what survives.«
It removes the bloated code, checks that everything is working and, more importantly, keeps it simple.
- YAGNI — don’t build for a future you’re guessing at. The cost isn’t the extra code, it’s that a speculative abstraction fixes the shape of the solution before you know the shape of the problem.
- SOLID — SRP (one reason to change, i.e. one stakeholder who requests the change), OCP (extend without editing), LSP (subtypes honour the supertype’s contract), ISP (accept the narrowest interface a function actually needs), DIP (depend on abstractions).
- DRY — about knowledge, not text. Two identical blocks that change for different reasons aren’t duplication. Sandi Metz: duplication is cheaper than the wrong abstraction.
- KISS — simple ≠ short. Simple means few interlocking concepts and easy to delete.
4) Use the plan mode / build mode
When you want to implement a larger part of your project, then it’s very important to use the plan mode first. It lets your agent analyze your code and propose a plan. And you will see, you will have a lot of changes to make to that plan.
Usually what I do is I ask to create a plan in a plan-xxx.md. Then I update the plan, refine it, simplify it. Then I switch to build mode, and ask to implement it step by step.
And at the end, I don’t forget to use the two pass coding, and check what was done.
You can easily change the plan / build mode with alt + tab
5) Use Git branch and worktree like hell
It’s very easy to ask our agent to undo or redo a modification, as it has the history of what it did. But it’s clearly not enough, especially when we have multiple agents running at the same time. For that, it’s important to have a specific branch and, at each milestone (for example after the implementation of a function), to commit the code. Because a lot of the time, especially when we are not very specific in a prompt and we don’t use the @ to work on a specific file, our agent will change other files than the ones we thought. So after the run, it’s always interesting to look at the files in the source control of our git branch. That way it’s easy to check what was changed and how.
Git also solves the problem of running several agents at the same time, with the worktrees. A worktree is a second checkout of the same repository, in its own folder and on its own branch. You give one worktree to each agent, so two agents can never fight over the same file, and you merge the branches once you are happy with what they did.
6) Run several agents at the same time
With the worktrees, you can now run several agents in parallel: one agent per terminal and per worktree, or the subagents that your main agent launches itself.
It goes much faster, but you lose what made a single agent manageable: you cannot read everything anymore. Two rules to keep it under control:
- One agent = one task = one perimeter. It’s the point 2 again, but stricter. Give to each agent its files with the @ and a task that does not touch the files of the others. Two agents on the same file will always finish by overwriting each other, and no worktree will save you at the merge.
- Activate the status display, to follow live what each agent is doing, which file it is working on and where it is waiting for you. Without it, you have several agents working blind in your repository and you discover the problem only at the end.
And the review does not change: one branch per agent, you read the diffs one by one before merging, and always use the two pass.
7) The command /clear, /new
Our agent keeps the context of what it has done. It’s good if we work on the same functionality / concept. But it costs a lot in tokens as the context gets bigger, and it can lead to bad implementations if we have changed subject. So when we change subject, do a /clear or /new to clean the context and begin on a blank page.
It will save you a lot of tokens and bad implementations.
8) The skills
Skills are little text files (that live in ~/.agents/skill) that explain a job to the agent. You can easily add skills to your agent by going to https://www.skills.sh/ without writing them.
For example, for our two pass, you can easily add a « simplify-code » skill:
---
name: simplify-code
description: Verifies code quality by applying YAGNI, SOLID, DRY, and KISS principles to remove overengineering.
---
You are an expert software architect specializing in code simplification, readability, and maintainability.
When a user provides code, your primary directive is to:
Run that code through YAGNI + SOLID + DRY + KISS principles, remove overengineering and things that could be simpler, and show me what survives.
To do this effectively, always follow this structured process:
1. **The Critique**: Briefly identify specific violations of the core principles in the provided code:
- **YAGNI (You Aren't Gonna Need It):** Flag unnecessary abstractions, premature optimizations, or features built "just in case."
- **SOLID:** Point out tight coupling, bloated interfaces, or classes/functions taking on too many responsibilities.
- **DRY (Don't Repeat Yourself):** Identify duplicated logic or boilerplate.
- **KISS (Keep It Simple, Stupid):** Highlight complex logic, deep nesting, or convoluted patterns that can be written much more directly.
2. **The Purged Code**: Output the new, refactored version of the code. It must be clean, direct, functional, and completely stripped of all overengineering.
3. **What Did Not Survive**: Provide a concise, bulleted list of the specific complexities, design patterns, or unnecessary code blocks that you deleted or simplified, explaining exactly why they were removed.
Then you can call it easily in your agent by calling @simplify-code. You can add any number of skills to improve / accelerate your coding. Your agent will also auto-invoke skills based on relevance.
9) The hooks
A skill is advice, and your agent can choose to ignore it. A hook is a command that runs every time, whatever the agent thinks. You configure them in your settings.json, and they are the way to make a rule that is really always applied:
– Format and lint after every write, so you never read a badly formatted diff
– Run your tests when the agent has finished, to see directly what it broke
– Block the edits on the sensitive files (.env, migrations, secrets)
– Send a notification or play a sound when the agent needs you
The rule is simple: if you want it sometimes, write a skill. If you want it always, write a hook. For example, you can add a rule that enforces the simplicity of your code with a hook on UserPromptSubmit.
For that you edit the file ~/.claude/settings.json and add inside :
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "echo 'Please, keep solutions simple and focused. Do not overengineer. Do not add features or error handling beyond what was asked. Respect YAGNI+SOLID+DRY+KISS.'"
}
]
}
]
}
}
10) The MCP tools
MCP tools let your agent call external tools and get results back from them. An excellent example is Playwright, which lets you launch your whole web codebase in an automated Chrome browser and lets your agent analyze it directly.
That is possible by adding MCP. What is the difference between MCP and skills? MCP are tools that are called externally by our agent and give back some result. Skills are written text notes that explain how to do something (like a recipe).
You can easily add an MCP like this:
claude mcp add --scope user playwright npx @playwright/mcp@latest
11) The advisor mode
In a lot of coding agents, it’s possible to have a generic LLM for usual tasks and a bigger LLM for planning. Bigger LLMs are more expensive, so it’s logical to call them only when we need them.
On Claude Code, we can use Sonnet for the code, and set Opus with /advisor. When Sonnet needs some advice, it calls Opus. Which makes a hybrid system with two models, saving us tokens.
12) Skip permissions (Yolo mode)
Your agent is always asking your permission? Which is nice, but can be quite tiresome, especially if you use Git like a king. So you can launch your agent in dangerous mode, where all permissions will be accepted by default.
With Claude it’s
claude --dangerously-skip-permissions
You will gain a lot of time but be careful, with great power comes great responsibility.










