Skip to content
docs

Best practices

Waibee Code reads files, runs commands, and edits code on its own until the task is done. Your part is to state the task precisely and give the agent a way to check the result.

Almost all the advice below comes from one constraint: the context window fills up fast, and the fuller it gets, the weaker the replies. See Context window.

The agent reads WAIBEE.md at the start of every session, along with CLAUDE.md and AGENTS.md. The full list of files is in Instruction files. Keep the file short: it is for what the agent can’t work out from the code on its own.

Worth keepingNot needed
Non-standard build and test commandsWhat the code itself shows
Where your style departs from the language’s conventionsThe language’s standard conventions
How to run the tests and the linter in this particular projectAPI documentation (a link is better)
Branch naming and PR conventionsDetails that change often
Required environment variablesA description of every file in the project
Known pitfalls and non-obvious behaviorObvious advice like “write carefully”

Test every line with one question: would the agent start making mistakes without it? If not, delete it. If the agent keeps ignoring a rule, the file is probably too large and the rule gets lost among the rest. Keep WAIBEE.md in git.

You can move a long section into a separate file, but the cost depends on how you reference it. A line that contains only @docs/db.md pulls in the whole file, and it takes up context in every session (a file larger than 40 KB is not pulled in at all). The same path inside a sentence (“before migrations, read @docs/db.md”) stays plain text: the file does not enter the context, and the agent reads it itself when it needs it.

By default the agent asks for permission before edits and commands, except for recognized read-only commands and actions on the allow list. Pick the mode and the allow/deny lists to fit the task. See Permissions.

There are two ways to reach an external service: a command-line tool or an MCP server. The difference is cost. An MCP server’s tools take up room in every request, even if you use the server only once (see The cost in context). A CLI costs nothing until the agent calls it, and the call goes through regular Bash.

If there is a mature CLI, use the CLI. MCP is for cases where there is no CLI, or where interactive authorization and a structured response matter.

TaskCommand instead of a server
GitHub: issues, PRs, reviews, workflowsgh issue view 142, gh pr create --fill, gh pr diff, gh run list, gh api repos/{owner}/{repo}/...
Git history and change analysisgit log -S 'parseConfig' --oneline, git blame -L 40,80 file.rs, git diff main...HEAD --stat
Postgrespsql -c '\d+ orders', psql -c 'explain analyze select ...'
Kuberneteskubectl get pods -o wide, kubectl logs deploy/api --since=15m, kubectl describe pod X
Dockerdocker compose ps, docker compose logs --tail=100 api
AWS, GCPaws s3 ls s3://bucket/prefix/, aws logs tail /aws/lambda/fn --since 10m, gcloud run services describe api
HTTP and JSONcurl -s https://api.example.com/v1/health | jq ., jq '.items[] | .id' data.json
Searching code and filesrg 'TODO\(billing\)' -n, fd -e sql . migrations/
Log analysisgrep -c ERROR app.log, awk '{print $1}' access.log | sort | uniq -c | sort -rn | head

The agent learns an unfamiliar tool on its own: “figure out what flyctl can do with flyctl --help, and deploy the branch to a preview environment”.

MCP makes sense for Figma, Sentry, Jira, and the like: they either have no convenient CLI, need OAuth, or return structured data you would otherwise have to parse. Connecting a server is covered in MCP, and ready-made sets in Recommended extensions.

Also check the language server with /lsp. A binary you install once (rust-analyzer, gopls, pyright, and similar) gives the agent precise go-to-definition, reference search, and diagnostics after each file edit. See Language servers.

  • Install ready-made extensions. Plugins (/plugin) bring skills, commands, hooks, and MCP servers in one package (see Plugins). Extensions written for Claude Code work too. Where to look for them is in Finding extensions, and sets for different tasks are in Recommended extensions.
  • Write your own. Turn a frequent prompt into a /name command, and move project knowledge and procedures into a skill. See Skills and commands.
  • What to use for what. A skill is for knowledge and procedures; a command for a repeated prompt; a subagent (.waibee/agents/) for an isolated context for a narrow task; a hook for actions that must always happen; MCP for connecting external tools and data.
  • Don’t install things just in case. Every extension takes up room in the context and makes it harder for the agent to choose a tool. Keep installed what you use and turn off the rest. See The cost in context.

The more precise the prompt, the fewer corrections later. Name the files, the constraints, and an existing example to follow. The structure of a prompt and examples are in Example prompts.

There are several ways to pass context. @ completes a file path in your prompt, and the agent reads the file itself. A screenshot pasted from the clipboard (Cmd/Ctrl+V) goes to the agent as an image. If you reference an image by path with @, the agent opens it with the Read tool, and the model sees the image too. For a link, the agent opens the page with WebFetch.

When you are getting to know an unfamiliar project, ask the agent questions the way you would ask a colleague: “how is logging set up?”, “what does this function on line 134 do?”, “which edge cases does this handler cover?”.

On an unfamiliar or large task, don’t let the agent start editing right away: it risks solving the wrong problem. Walk it through in steps.

  1. Explore. “read the reports/ directory and explain how the report is built today”.
  2. Plan. “what has to change to add CSV export? write a plan”. Check the plan and correct it if needed.
  3. Implement. “follow the plan, add tests for an empty report and for Unicode, run them, and fix the failures”.

For a small, clear change (a typo, a log line, a rename), ask for it right away, without a plan.

The agent stops when the result “looks done”. If only you can check it, the whole check falls on you. Give the agent something that delivers a verdict on its own: tests, a build exit code, a linter, a comparison with a reference, a screenshot. Then the agent runs the loop itself: it makes the change, runs the check, reads the result, and fixes what is wrong.

Ready-made prompts for tests, debugging, and checking the interface are collected on the examples page.

You decide how strictly to require a check: right in the prompt (“make the change and run the tests right away”); for the whole session with /goal (the agent keeps taking turns until the goal is met or a stop condition is hit); or with a fresh look from a subagent that reviews the work. What to check yourself once the agent says “done” is in The developer’s role.

When a check gives a number (response time, size, accuracy) instead of pass or fail, you can let the agent run its own loop of experiments against that metric. See Autoresearch.

Before you take on something big, let the agent interview you with the AskUserQuestion tool and write the outcome to SPEC.md. A ready-made prompt for such an interview, and the signs of a good one, are in The developer’s role.

This is the basis of the spec-driven approach. That approach and other ways to organize the work (test-driven, author and reviewer, an autonomous run) are covered in Development workflows. What stays on you, and the signs that help you catch the agent’s mistakes, are in The developer’s role.

Correct it right away. Esc stops the current turn. You don’t have to stop it, though: a message you write while the agent is working reaches it at the next step (see Interface). If you correct the same thing twice, the context is already cluttered with failed attempts: open a new chat (/new) with a refined prompt.

Watch the context. A new chat between unrelated tasks, /btw for a side question, and other techniques are collected in Saving context.

Hand code exploration to a subagent. “use a subagent to find out how a dropped connection is handled during streaming”: the subagent reads the files it needs in its own context and returns a short summary without cluttering the main conversation. Use the same technique for review: “have a subagent check this change for edge cases”.

Sessions are saved: name them (/rename), come back to them (--resume, /sessions), and use /fork to branch off a conversation.

For parallel work, open several chats (Ctrl+N) and keep their edits in separate git worktrees so they don’t collide. All chats and their subagents are visible in the agent overview: Tab with an empty input field. How to set up an author and reviewer pair is in Development workflows.

waibee run "..." works without a conversation: in CI, a git hook, or a script. For migrations and bulk edits, run it in a loop over a list of files, and try the prompt on two or three files first. If the loop reads its list from stdin, add < /dev/null to waibee run, or the first run will consume the rest of the list (see Input from stdin). Flags, output formats, and exit codes are in Headless mode.

Ready-made prompts for common tasks, including detailed multi-part prompts, are collected in Example prompts.