Skip to main content

Command Palette

Search for a command to run...

Tips for AI coding agents

Updated
4 min read

I’ve been using AI coding agents for a while, and I’d like to share my findings. The findings are mainly about Claude Code, but may apply to all coding agents, like opencode, if there’s no note about it.


Intuitive API is a must.

Everything should work intuitively, based on the name. AI tends to avoid digging into the lower layer unless you explicitly instruct it to fix it. For example, if enabled: false does not work in the code below, AI will fail to fix it most of the time because it assumes that the option works as expected.

Subagents may reduce context window usage.

Use subagents proactively.

You can utilize subagents to reduce the usage of the main context window. The only thing you need to do is saying Use subagents proactively in the prompt. It’s useful when you need to do a very large task. It makes Claude Code less intelligent for tasks that require the organic analysis of multiple clues, though.

Note: I didn’t define any subagents in my repository. General subagents are enough for this trick.

The API reference document reduces the guess-and-grep loop.

If you don’t specify the name of the method you want to fix, the AI agent will guess the method/variable/module name and grep for it repeatedly until it finds the relevant code.

This means that if you can provide an API reference document listing all method names, the coding agent will be much more efficient. As a side note, the best thing is an RPC API specification file that lists all method names and only the RPC message name.

syntax = "proto3";
package delino.appcore.v1;
option go_package = "github.com/delinoio/cloud/rpc/appcore";

import "appcore/auth.proto";

service AppCore {
  rpc UpdateUserProfile(UpdateUserProfileRequest) returns (UpdateUserProfileResponse);
}

Mentioning this file would give the AI agent

  • the name of RPC methods to grep for

  • the names of RPC message types to grep for

so the AI agent will never need to repeatedly guess the names.

Provide the design document, and ask the AI agent to update it.

The source of truth was the code. And yeah, the primary source of truth is still code. But you can’t feed the whole code into AI agents, and updating code requires lots of tokens. I’m not talking about the token cost. It’s about the context window size. That’s why we need a specification document that is up-to-date with the codebase and committed to the repository.

Luckily, having one is easy. You don’t need to update it manually. Instead, instruct the AI agent to read the design document before any task, and update it as required.

You may start building in a separate session after creating a plan.

  • Applies to: Claude Code.

The plan mode is great. It’s a really wonderful feature that allows you to create a comprehensive task input prompt that mentions all the relevant files. But sometimes, Claude Code runs compaction nearly immediately after approving the plan because it does not clear the context before executing the plan. If you want, you can instruct it to write the comprehensive task prompt as a Markdown file, and /clear the context window, and paste it there.

In this way, Claude Code will run with a fresh context window, reading referenced files as required. It’s useful if you've done a lot of ping-pong with the planning agent.

Provide project structure.

You can provide the project structure using the instruction file (CLAUDE.md/AGENTS.md) or a custom command. Giving the project structure also reduces the number of tokens wasted to guess the project structure.

Personally, I prefer a monorepo, so I have commands like /work-on-devbird that mentions the relevant frontend/backend directory, the RPC definition, and the design documents.

Mention the filepath or the names of utility functions.

This is a good fit for the instruction files, like CLAUDE.md and AGENTS.md. The AI agent has limited knowledge of the project, so it may repeat the same code over and over. It isn’t good. If you instruct it to read the utility file beforehand, it will reuse the existing function.

If you don’t understand something, throw the whole text to the Plan Mode.

You don’t need to understand everything, seriously. You don’t need to give it a perfect prompt. Instead, you can use plan mode to expand your thoughts within the project context. Sometimes I didn’t understand some requirements because they are specific to the project, but Claude Code's plan mode expanded them into a concrete plan prompt. You can even ask Claude Code to ask you back. You can do clarification based on the questions the Claude Code asks.

More from this blog

한국의 학벌에 대한 생각

내 블로그의 제목이 kdy1: The way I think 인만큼 앞으로는 내 생각을 더 자주 올리려고 한다. 한국 기준으로, 학벌은 사람을 볼 때 꽤나 유용한 지표이지만, 절대적이지는 않다. 경험적인 얘기일 뿐이지만, 성균관대학교 자퇴생으로서 느낀 것들이 몇 가지 있다. 대학까지 간 사람의 학벌은 학습 능력 x 성실함 에 대체로 비례한다. 그래서 의미가

Apr 3, 20261 min read

인간 지능에 대한 메모장

최종 업데이트: 2026/03/15 지능의 유전 현재 인류 기준으로, 고지능자는 고지능 유전자가 많이 겹친 사람이다. 지능의 유전엔 X 염색체가 매우 중요한 역할을 한다. 그리고 이게 남자와 여자의 지능 분포 차이를 만든다. 극상위권에 여자가 거의 없는 이유가 이것이다. 고지능 X 염색체가 여자한테서 발현되려면 2개가 있어야 한다. 이는 인간의 생

Mar 15, 20262 min read

Ai 코딩 팁 2 (한국어)

발표 자료: https://gamma.app/docs/AI--2a52e7tk3eb1ch1 AI 활용법 관련해서 간단하게 발표를 했다. 발표 자료 앞쪽은 전에 블로그에 올린 글이랑 같은 내용이다. 이 글에서는 기존 글에서 다루지 않은 내용들을 다루겠다. 에러 메시지 및 로깅 구체적 타입 및 스키마 활용 any 타입은 사람에게도 위험하지만, AI에게는 더 위험하다. 마찬가지로, JSON.parse처럼 아무 제약 없는 파싱 느슨한 인터페이스 ...

Jan 30, 20265 min read

kdy1: The way I think

233 posts