AI Coding Agents: A Practical Guide to the Nine Core Modules
This guide breaks down AI coding agents into nine practical modules, moving from first setup and daily commands to tool integration, reusable skills, plugin systems, development workflows, core architecture, and enterprise deployment. Each module covers the key concepts, implementation tips, sample code, and adoption advice, helping individual developers, team leads, and architects build a clear capability map for using coding agents safely and effectively.
Introduction: Why You Need a “Full-Picture” Practical Guide
AI coding agents are reshaping how software gets built. Unlike traditional code completion tools that only predict the next few lines at the cursor, these agents can read requirements, search repositories, plan steps, call tools, and run verification, forming a closed loop of “understand, plan, execute, and get feedback.” Many teams have found that in scenarios such as boilerplate code, unit tests, bug fixes, and code review, these tools can noticeably shorten delivery cycles.
However, real-world adoption often runs into resistance at different levels:
- Individual developers: unfamiliar with command-line interaction, and generated code that “looks right but fails when run”;
- Team leads: prompts scattered across individuals, hard to turn into organizational assets;
- Architects: worried about code leakage, supply chain risk, and runaway usage costs.
The root of these problems is usually not the model itself, but the lack of a complete “capability map” on the user’s side. Referencing the content framework of similar Chinese tutorials, this article abstracts the topic into nine modules: the first three help individuals use the tools smoothly, the middle three make capabilities easy to integrate and extend, and the last three make engineering controllable and manageable at the enterprise level. The discussion stays at the level of general concepts and open protocols, without binding to any specific product. Each module includes concepts, key points, sample code, and practical recommendations.
Module 1: Getting Started — Run Your First Closed Loop in 30 Minutes
Goal: Complete installation and configuration, and get the agent to deliver its first runnable, verifiable result.
Key steps:
- Prepare the environment: confirm the runtime version, package manager, and network proxy, and make sure your version control tool has an initialized repository;
- Initialize project conventions: have the agent read through the repository and generate a document describing the project structure, build and test commands, code conventions, and directory responsibilities;
- Assign the first task: pick a small requirement with clear boundaries, and ask for “implementation + tests + change notes” delivered together;
- Acceptance: build locally, run the tests, and then decide whether to commit.
A sample project convention file:
# Project Conventions- Stack: <language/framework and version>- Build: <command> Test: <command> Lint: <command>- Directory roles: src=business code, tests=tests, docs=design docs- Constraints: do not modify generated directories; external interface changes must update the contract docs
This loop may look simple, but it establishes the trust foundation for all later advanced usage. Many “the output is unusable” problems stem precisely from a missing convention file or from no one explaining the project structure to the agent.
Module 2: Command Reference — Turn Frequent Operations into Short Commands
The essence of slash commands is to turn common prompts and workflows into reusable instructions, saving you from repeatedly typing long prompts. By purpose, they fall into four categories:
| Category | Example commands (illustrative) | Purpose |
|---|---|---|
| Context management | initialize, compact, clear | Control how much content enters the model’s view |
| Development workflow | review changes, run tests, generate docs | Standardize team development actions |
| Session state | usage stats, switch model, switch permission mode | Keep control of cost and risk |
| Configuration management | memory and rules, key bindings, custom commands | Capture individual and team preferences |
“Compacting the context” is especially worth attention. A model’s context window is limited, and in the mid-to-late stage of a long task, historical messages may crowd out useful information. When compacting, be explicit about what to keep, such as the original requirement, confirmed designs, the to-do list, and unresolved issues.
> Compact context: keep the original requirement, confirmed plan, to-do list, and remaining risks; summarize the rest> Review current changes: list issues one by one across four dimensions: correctness, security, performance, maintainability
A custom command only needs a descriptive file explaining the execution steps to be recognized and invoked by the agent. A team can turn a code review checklist into a single command, ensuring a consistent standard for every review.
Module 3: Interaction Modes and Tool Extensions — Make Operations More Efficient and Safer
- Keyboard-first editing mode: borrowing from Vim-like key designs, use shortcuts to complete multi-line edits, quick jumps, and mode switches, reducing back-and-forth with the mouse;
- Tiered permission modes: control the agent’s behavior boundaries across three levels: “auto-execute / confirm each step / read-only analysis,” with stricter levels as the default for production repositories;
- Background tasks: move time-consuming commands like builds and tests to the background while continuing the conversation, then retrieve results when tasks finish;
- Custom tools: register locally executable capabilities (such as querying internal docs or triggering pipelines) declaratively, and constrain input formats and accessible scope;
- Output format control: agree to return changes in a unified patch format, making them easy to review and apply.
Module 4: Model Context Protocol — Connecting External Data and Systems
A model only holds the general knowledge from its training and does not understand an enterprise’s databases, ticketing systems, or monitoring platforms. The widely adopted “Model Context Protocol” approach is to build a standard interface between the model client and external capabilities: external systems register capabilities as servers, the client discovers and dispatches them uniformly, and the model side can use them without custom code. There are three typical capability primitives:
- Tools: operations the model can trigger, such as query, create, update;
- Resources: data the model can read, such as docs, table schemas, metric definitions;
- Prompt templates: reusable preset instructions.
A sample server capability declaration:
{"tools": [{"name": "query_order_status","description": "Query read-only status by order ID, limited to authorized environments","inputSchema": {"type": "object","properties": { "order_id": { "type": "string" } },"required": ["order_id"]}}]}
Connecting external systems must hold to four bottom lines:
- Least privilege: database accounts are read-only, and write operations go through approval;
- Externalized credentials: keys are injected by a key management service and never written into config files;
- Full auditing: record the caller, tool name, parameter summary, and result status;
- Timeouts and rate limits: avoid one call bringing down a production system.
Module 5: Skills — Turn Business “Know-How” into Reusable Capabilities
A skill uses a declaration file (often described in Markdown with metadata) to define a working method, telling the agent “when facing a certain type of task, follow which steps, based on which standards, and produce which outputs.” Compared with ad-hoc prompts, skills can be versioned, reviewed, and shared.
---name: api-reviewdescription: Use when reviewing changes to external interfaces---1. Check field and error-code compatibility against the interface contract docs2. Confirm that authentication, rate limiting, and idempotency design are complete3. Output an issue list sorted by severity, with fix suggestions
Three points matter for writing a good skill: clear trigger conditions, executable steps, and positive and negative examples. Common enterprise cases like “how to use the internal framework” and “specific industry coding rules” can all be captured as skills, giving newcomers the team’s experience from day one.
Module 6: Plugin System — Make Capabilities Pluggable Building Blocks
A plugin usually packages commands, skills, external integrations, and configuration into a distribution unit, supporting installation from a marketplace as well as local development. Its lifecycle includes discovery, installation, enablement, configuration, and uninstallation.
In-house enterprise plugins can be more valuable, such as “pre-commit compliance checks” and “requirements document generation.” It is worth noting that third-party plugin sources must be trustworthy, that you should review their declared permission scope before installation, and that you should pin versions in production to avoid behavior changes from arbitrary upgrades.
Module 7: Hands-On Development — Sub-Agents, Language Services, and Automated Delivery
- Parallel sub-agents: split “research, implement, review” across multiple sub-agents, each with its own independent context, so the main session only receives conclusion summaries and avoids being filled with process details;
- Language Server Protocol integration: give the agent structured information such as go-to-definition, find references, and type diagnostics, significantly reducing “fix one thing, break a bunch”;
- Tests first: add failing cases first, then implement the code, and finally run regression checks, so correctness can be judged by machines;
- Continuous integration hookup: add static checks, unit tests, builds, and change-note generation to the pipeline, and only proceed to human review after everything passes.
A sample task orchestration:
Task: add a timeout reminder to the order module1. Research sub-agent -> output a list of relevant files and the call chain2. Implementation sub-agent -> submit a patch and unit tests3. Review sub-agent -> output a risk list4. Main session summary -> generate change notes and a rollback plan
Module 8: Principles and Technology — Building a Coding Agent from Scratch
Broken down to its minimal core, a coding agent is “model + tools + loop”:
while not done:action = model.decide(context, tools) # Plan: call a tool or give a conclusionif action.type == "tool":result = executor.run(action) # Execute: run in a restricted environment with a time limitcontext.append(result) # Observe: write the result back as new contextelse:done = True
Around this loop, engineering needs to solve five things:
- Context engineering: retrieval, summarization, and eviction to ensure relevant information stays in the window;
- Tool design: precise descriptions, strict parameter validation, and readable error messages;
- Execution environment: restricted directories, timeout control, and network allowlists;
- Evaluation system: use a fixed task set to measure task success rate, average steps, and cost per task;
- Observability: record the decision and time cost of each step for later review.
Once you understand the principles, you can judge whether a phenomenon is a model capability issue, a prompt design issue, or an execution environment issue.
Module 9: Enterprise Deployment — Making Technology Choices Actually Land
Enterprises generally advance along three paths:
- Unified client + centralized configuration: distribute standardized configuration and skill libraries to everyone, lowering the barrier to use;
- Centralized gateway: route all requests through a unified entry point to achieve authentication, auditing, rate limiting, and cost accounting;
- Platform embedding: embed capabilities into code hosting, requirements management, and continuous integration platforms, integrating them with the development workflow.
On the model side, you can choose between private inference services and cloud-hosted model services. Among domestic cloud services, Baidu AI Cloud can provide a container platform to host controlled execution environments and object storage to archive build artifacts and audit logs, and, together with log services, monitoring and alerting, and identity and access management, form a fairly complete support system.
Isolation and compliance are the focus:
- Execution environments use disposable containers that restrict file system and network access;
- Sensitive code goes through intranet or private deployment and must not be sent externally;
- Build a usage dashboard that tracks call volume and cost by team.
For measurement, it is recommended to focus on four metrics: adoption rate, defect escape rate, requirement delivery cycle, and cost per task, using data to drive continuous optimization.
Suggested Learning Path
| Stage | Duration | Focus | Acceptance signal |
|---|---|---|---|
| Individual onboarding | Weeks 1-2 | Modules 1-3 | Can independently complete a small requirement and pass tests |
| Capability expansion | Weeks 3-4 | Modules 4-6 | Integrate internal systems and capture team skills |
| Engineering integration | Weeks 5-8 | Modules 7-8 | Sub-agent collaboration and pipeline integration |
| Enterprise governance | Weeks 9-12 | Module 9 | Pass security review and form quantified benefits |
Conclusion
The upper limit of an AI coding agent’s capability depends on how the user organizes it: at the individual stage it is about proficiency, at the team stage it is about standardization, and at the enterprise stage it is about governance. The nine modules are not nine isolated features, but a progression path from “can use it” to “use it well” to “controllable and manageable.” It is recommended to land module by module: first validate value with one closed loop, then capture experience with skills and plugins, and finally ensure long-term operation with isolation, auditing, and measurement.
