AI Coding Agents in Practice: From Defining Requirements to Accepting Results

    This guide explains how to work effectively with AI coding agents—tools that can read an entire repository, plan steps, and modify code across files. It covers how the developer's role shifts to requirement definer, boundary setter, and result reviewer, plus practical guidance on environment and permission setup, task scoping, acceptance criteria, typical workflows (bug fixing, refactoring, test generation, version collaboration, documentation), integration with external systems and CI pipelines, common risks and governance, and phased adoption advice for teams.

    AI Coding Agents in Practice: From Defining Requirements to Accepting Results

    1. Rethinking the Role of AI Coding Agents

    An AI coding agent is a tool that can read an entire code repository, understand context, plan steps, and directly execute modifications. Unlike an assistant that only autocompletes code inside an editor, it can independently complete tasks spanning multiple files and run commands on its own to verify results.

    When working with this kind of tool, the most important change is the human role. In the past, a developer’s main job was translating requirements into code. Now, the developer’s core work becomes three things:

    1. Requirement definer: Describe goals, context, and constraints in clear, executable language.
    2. Boundary setter: Specify which directories, interfaces, and data may be changed, and which must remain untouched.
    3. Result reviewer: Judge whether the output is acceptable based on criteria agreed upon in advance.

    The more capable the agent, the more important human-imposed constraints become. Without boundaries, the agent may casually modify unrelated modules or introduce dependencies that don’t match the team’s style. Without acceptance criteria, the agent cannot determine what “done” means—a common outcome is that it declares success while the tests are not actually passing.

    1.1 Division of Labor with IDE-Embedded Assistants

    Editor-embedded assistants excel at local operations, such as line-by-line completion, explaining selected code, and quick renaming. Their feedback loop is short, making them well suited for fine-grained work that the developer supervises closely. AI coding agents excel at large tasks, such as batch migrations, cross-module fixes, and generating test suites. Efficiency is highest when the two types of tools have clearly divided responsibilities: the agent drives the large tasks, while the developer handles detail adjustments and final sign-off in the editor.

    1.2 Capability Overview

    Capability Category Typical Tasks
    Code development Read repository structure, implement features per requirements, modify across multiple files, install project dependencies
    Bug fixing Reproduce issues, locate root causes, modify code, run tests to confirm fixes
    Refactoring and upgrades Language type migration, framework version upgrades, module splitting, architecture adjustments
    Test building Write unit and integration tests for existing code, fix failing cases
    Version collaboration Generate commit messages, resolve merge conflicts, write merge request descriptions, assist code review
    Documentation generation README files, API docs, changelogs, architecture notes
    External integration Query databases, call internal APIs, operate browsers via standardized protocols
    Pipeline automation Run automated reviews and checks in CI pipelines

    This table describes capability categories, not a claim that every scenario should be handed to an agent. The judgment criterion is whether the task has a clear input, a verifiable output, and a rollback-safe scope of changes.

    2. Environment and Permission Preparation

    2.1 Accounts and Terms of Use

    Before formal adoption, confirm that the account type, quota, and data usage policies meet team requirements. In enterprise scenarios, verify especially whether code and logs will leave the internal network and whether a corresponding data processing agreement needs to be signed. This is a governance prerequisite and should be completed before technical rollout.

    2.2 Local Environment Requirements

    Agents typically need to run in a terminal or editor and execute the project’s build and test commands. It is recommended to standardize the following across development environments:

    1. Keep runtime versions and package manager versions consistent to avoid “works on my machine” problems.
    2. Document test and build commands in the project README so the agent can discover and execute them on its own.
    3. Pin dependency installation sources to team-approved registries to reduce supply chain risk.

    2.3 Least Privilege

    The more operations an agent can perform, the larger the risk surface. Assign permissions according to these principles:

    • Read access can be broad to facilitate code understanding.
    • Write access should be confined to the working directory; production configuration must be off-limits.
    • Destructive, deployment, or release commands must require human confirmation.
    • Network access should be limited to necessary domains or internal services.

    2.4 Secrets and Sensitive Data Management

    Secrets should be stored in environment variables or a dedicated secrets management service—never written into code, configuration files, or prompts. Before the agent reads logs, configuration, or test data, the data should be desensitized to prevent phone numbers, national ID numbers, access tokens, and similar information from entering the context.

    3. Setting Boundaries and Acceptance Criteria

    3.1 How to Describe Task Boundaries

    A good task description usually contains four elements: goal, context, scope, and forbidden zones. Here is an example:

    1. Goal: Change the pagination parameter of the order query API from page numbers to cursor-based pagination
    2. Context: The current API slows down noticeably once data volume exceeds one million records
    3. Scope: Only modify the query module and its tests under the order-service directory
    4. Forbidden: Do not modify database migration files, do not change the response field structure, do not adjust how other services call this API

    The goal should be specific enough to judge completion, the context helps the agent understand the rationale behind trade-offs, and the scope and forbidden zones prevent changes from spreading.

    3.2 Designing Acceptance Criteria

    Acceptance criteria should be automatically verifiable. Common practices include:

    1. All unit and integration tests pass.
    2. Static analysis and format checks produce no new warnings.
    3. Test coverage of new code meets the team’s agreed threshold.
    4. API behavior remains consistent with the pre-change version, proven by regression cases.

    A description like “the feature works” is not enough. The agent needs to see executable checks so it can repeatedly verify on its own before declaring a task complete.

    3.3 Project Convention Files

    Writing long-term rules into a convention file at the project root lets the agent follow the same set of agreements every time. Example:

    1. # Project Conventions
    2. - Tech stack: Frontend uses the existing component library and state management solution; introducing new libraries of the same kind is forbidden
    3. - Do not modify: Published database migration files
    4. - Commit conventions: Follow the team's existing commit message format; one commit contains only one logical change
    5. - Acceptance commands: Run the type check first, then unit tests; commit only after all pass

    This kind of file is a long-term agreement between the team and the agent. Modifying it should go through review just like modifying code.

    4. Typical Workflow Practices

    4.1 Bug Fixing

    The recommended flow: first have the agent reproduce the problem and provide reproduction steps, then ask it to locate the root cause and explain the fix approach, and finally modify the code and add regression tests. The developer should check whether the approach is reasonable at the second step, to prevent the agent from passing tests by masking symptoms.

    4.2 Refactoring and Migration

    Large-scale migrations should be split into small batches. For example, gradually migrating dynamically typed frontend code to static typing can proceed in this order:

    1. First add tests for existing modules to establish a behavior baseline.
    2. Migrate bottom-level utility functions first, following dependency order.
    3. After each batch, run the full test suite and record any uncovered risk points.
    4. Finally handle entry files and configuration.

    Each batch should be independently mergeable, so problems can be rolled back quickly.

    4.3 Test Completion

    When adding tests to existing code, first have the agent read the implementation logic and list key branches and boundary conditions, then generate test cases. Generated cases need human review on two points: whether the assertions are meaningful, and whether the tests merely mirror implementation details.

    4.4 Version Collaboration

    Agents can generate commit messages, write merge request descriptions, and offer suggestions when conflicts arise. Conflict-resolution suggestions must be manually verified, especially where business rules are involved. A merge request description should include the motivation for the change, the scope of impact, and how it was verified, so reviewers can understand it quickly.

    4.5 Documentation Generation

    API documentation, changelogs, and architecture notes can be auto-drafted from code and commit history. Version numbers, dates, and owner information in the drafts need human confirmation to avoid documents that diverge from reality.

    5. Integration with External Systems and Automation

    5.1 Connecting External Capabilities via Standardized Protocols

    When an agent needs to query databases, read tickets, or call internal APIs, standardized tool-integration protocols can be used. Follow these principles when integrating:

    • Expose only the tools necessary to complete the task.
    • Query-type tools are read-only by default; write-type tools are authorized separately.
    • Log request parameters and response summaries for every call to enable post-hoc auditing.

    5.2 Automated Review in CI

    An AI coding agent can serve as a check stage in the pipeline, running automatically when a merge request is created or updated. A typical flow:

    1. Trigger: Merge request created or updated
    2. 1. Fetch the diff of the current change
    3. 2. Provide the diff together with the team's review guidelines to the agent
    4. 3. The agent outputs a structured issue list with severity, file location, and fix suggestions
    5. 4. Critical issues block the merge; other issues appear as comments
    6. 5. A human reviews and decides whether to adopt the suggestions

    Automated review conclusions can only serve as auxiliary input. Treating them as the sole basis for merging lets false positives and false negatives directly harm delivery quality.

    6. Common Risks and Governance

    6.1 Out-of-Scope Modifications

    An agent may modify files beyond the intended scope to complete a task. Governance relies on explicit forbidden-zone descriptions, directory-level permission restrictions, and diff review before merging.

    6.2 Unreliable Conclusions

    An agent sometimes claims tests passed without actually running them. Requiring the agent to attach command output to its report, and having the developer rerun key checks, can reduce this risk.

    6.3 Sensitive Data Leakage

    Logs, configuration, and data samples may contain private information. Desensitize data before it enters the agent’s context, and restrict the agent’s network egress.

    6.4 Over-Reliance and Skill Erosion

    If team members only review and never write code over the long term, they may gradually lose understanding of underlying implementations. It is advisable to keep regular hands-on coding practice, and to have team members deeply read and write critical modules themselves.

    6.5 Cost and Traceability

    Multi-turn conversations and large-repository reads consume significant resources. Set a defined scope for each task, avoid aimless full-repository scans, and keep records of each task’s goal, output, and review for retrospectives and cost analysis.

    7. Adoption Recommendations

    On first adoption, start with low-risk tasks such as writing tests, generating documentation, and fixing well-defined small bugs. After each batch of tasks, review whether boundaries were clear and acceptance criteria effective, then gradually expand the scope of use. Teams should maintain project convention files, permission configurations, and review processes as infrastructure, not as one-time setup.

    As long as boundaries are clear, criteria are verifiable, and results are human-reviewed, AI coding agents can reliably take on large volumes of repetitive work—freeing developers to focus on requirement judgment and architectural decisions.