How to Use Coding Agents Efficiently and Effectively

How to Use Coding Agents Efficiently and Effectively

Cunxi Gong April 01, 2025 ai agent tutorial

Key: Precise + Concise

Agent = Model + Harness

There are countless agents and countless models. Which one should you use?

  • Is there really a best model?
  • Is there really a best agent?
  • What if costs are spiraling out of control?

Choice of Agent system

Pathway 1 Build your own agent system from scratch

Such as https://github.com/ansatzX/AIE_Brainiac

Pathway 2 Working on one of the best agent app from community

Such as Claude Code, Gemini-CLI, Codex, etc.


Cheap models maybe are not good enough.

Expensive models maybe are good but not enough.

For example, Gemini series are getting more and more stupid. GPT-5.4 is good but too expensive.

Sometimes agent applications also need purchase.

The worst situation is that you spend a lot money but get nothing done.

The Solution for Beginner

Harness

Save Tokens + Control context window

User: Observation, Design capability, Hands-on experience

Design core: programming by natural language, define the long tail

Agent:

one old blog for LLM&Agent 大语言模型与智能体:了解你的电子奴隶

I had introduced those concepts in the article. Here I repeat some core concepts.

a tool which call toll by prompt

Such as: an agent for code review, an agent for unit test, an agent for document drafting, ...

NOTICE:

  • One agent only performs one task with harness. 一个agent只干一件事
  • Optimize agent's prompt to save tokens. Efficiency is the first aim
  • Reusability is the second aim.
  • DO NOT call any skills in agent Hook. Keep it clean. Only Allowed Tools
  • If skills are needed, put skill names in prompt of agent

small case for python agent

** Always use the context7 to search the documentation of Python with current version
- Begin response by identifying the component or concept involved in task
- Provide code examples that follow Google Python Style Guide
- When suggesting solutions, explain the 'what' and 'why' to build understanding like a scientist
- Anticipate follow-up questions and address potential edge cases
- If a user's approach seems suboptimal, diplomatically suggest better alternatives 

Skill:

instruction of some real skill, which was introduced by Zirui SHENG

zxm-skill/
├── SKILL.md (main instructions)
├── FORMS.md (form-filling guide)
├── REFERENCE.md (detailed API reference)
└── scripts/
    └── work.py (utility script)

When an agent starts, only 100~300 tokens are loaded to get information of their folder tree and metadata of SKILL.md

When a SKILL is delegated to work, full content of this skill will loaded to context window.

And If some other layers are delegated, such as FORMS.md, REFERENCE.md, they will be loaded right now.

So skills save a lot of tokens after you define it.

That is layer expansion design.

Some other concepts:

MCP:

a pathway to define tools and their usage by mcp server and client.

Example, GitHub - ansatzX/Local_Read_MCP

Hooks:

a trigger which is widely used. Such as CI/CD

In agents system, if agent act on some event, such as after use the Edit/Write tool, Get response from arxiv tool, some pre-defined command will be invoked Use format checking tool and formatting tool to check code.

Most importantly, hooks are not loaded into context windows.

Slash command:

Slash command is an interactive command of CC, which allow user trigger some events of agent.

User can define own slash command.

HARNESS: If you reuse prompts pattern used more than once, create a slash command to reuse it, which ensure the quality of your prompt.

Context:

Context is not as big as model labels on its model card. Because it also contains output. If you use vllm/sglang, you will learn it.


The above are AI fundamentals

Practice | Action on Coding

Here, I provide one collection of my habits.

CyberBrain

These are not all my original ideas. A lot of them are snippets of internet resources.

Platform: macOS, with brew installed to install packages.

This powerful CyberBrain also works for other platforms if you make competitive improvements.

Git-Credential-Manager with right config

[credential]
        helper = manager
        credentialStore = cache
        cacheOptions = --timeout 3
        helper = /usr/local/share/gcm-core/git-credential-manager

Make AI cannot pollute upstream data

CC-Switch

Model switcher for Claude Code, Codex, Gemini-CLI, OpenCode and OpenClaw.

Neural Link

  • macOS iMessage: send message to your iPhone
Use imessage to send me <--> a message "Task complete" with the summary.

After you finish, use mac to say "All done" and a brief summary of what you did.
  • Pushover Hook

Pushover will send notice to your devices (Android, iOS, desktop)

If Claude Code needs Human in the loop and user dismisses it.

  • After 60s, it will send a notice to user device (iPhone)
  • After 1 hr, it will send a strong notice which overrides the mute state.
Use pushover to send me a message "Construction complete" with the summary.

Tachikoma

Make Claude Code drive other AI programming assistants.

Tachikoma

With Tachikoma, you can easily do a lot design of agents.

Such as: hierarchical systems, distributed decision-making, democratic centralism, separation of powers,

For team agents, a simple design is collab-fix, which leverages github copilot-cli, gemini-cli and other CLI tools.

Collab-fix: let three agents review your code. Only when the fix by Claude Code passed the review, this task goes to completion.

Use github copilot-cli and gemini-cli to review uncommitted changes.

or

/Tachikoma:collab-fix Fix the bug defined in the fix_plan.md file.
  1. Call claude code subagent, gemini-cli and github copilot-cli to parallel analysis codes and draft a fix_plan.md
  2. Compare three plans, pick best one plan by AskUserQuestion
  3. Ultralink: fix but not commit
  4. Let claude code gemini-cli and codex review changes
  5. Review the reviews of agents by AskUserQuestion
  6. Repeat the steps 3-5, until three agents all are satisfied or the cycles meets 5-turns. If no common agreement here, report 'what' and 'why'

This is a branch design for this workflow.

  1. Do it by typing prompt to load gemini-cli and opencode skills and prompt it ''
  2. Use slash command

It looks like first one is more flexible to expand and design. But the second one is the best engineering design.

From the context view:

  • Method 1: Agent will load the skills after you prompt your design, which makes the layer-expansion design of skills invalid.
  • Method 2: It only use bash to invoke the tools, which let the context windows of Claude Code only add the tokens of workflow text.

Actually, you start with method 1 to explore. Finally, you should deposit it as a workflow without skills, which is method 2.

In this way, you save the tokens and improve the efficiency.


Professional knowledge is required to solve professional problems. Don't blindly use various skills that look impressive; use them within your capabilities.


Scientists don't need to know programming, but they need to understand their requirements and how to communicate with software engineers.

← Back to all posts