Table of Contents
AI coding agents can implement changes quickly, but speed does not make the output production-ready. Robust code comes from a workflow that makes requirements explicit, keeps changes reviewable, runs deterministic checks, and limits what the agent can modify or execute.
You do not need to inspect every generated character with equal attention, but someone remains accountable for the behavior. Review the design, security boundaries, public interfaces, data changes, and final diff; use tests and automation to cover repetitive details.

1. Define the change and its acceptance criteria
Start with the user-visible behavior, constraints, and proof of completion. Include what must not change. A useful task brief contains:
- The problem and affected users.
- Expected behavior for normal, edge, and failure cases.
- Compatibility, performance, accessibility, and security requirements.
- Files or systems that are out of scope.
- Tests, commands, and manual checks that must pass.
Add expiration to password-reset tokens. Tokens must be single-use, expire after 30 minutes, and never appear in logs. Preserve the existing API response shape. Add migration, unit, integration, and clock-boundary tests. Do not change login sessions.
This is more reliable than asking the agent to “make password reset safer,” because the result can be evaluated objectively.
2. Explore before editing
Ask the agent to inspect relevant code, tests, configuration, and recent patterns before proposing a solution. Claude Code's current best-practices guide recommends an explore, plan, implement, and commit flow. Plan mode is useful for complex or unfamiliar changes because it can read and analyze without modifying files.
Read the reset-token implementation, related database models,
API handlers, and existing security tests. Identify the current flow,
assumptions, and likely migration risks. Do not edit files yet.
Then propose a plan mapped to the acceptance criteria.
Review the plan for hidden scope expansion, duplicated abstractions, migration safety, and missing rollback steps. A longer plan is not automatically better; it should identify the smallest coherent change.
3. Keep repository instructions short and enforceable
Use CLAUDE.md for stable facts the agent needs on most tasks: build commands, repository layout, coding conventions, and required validation. Claude Code loads project instructions as context, but the documentation notes that these instructions are not an enforcement mechanism.
# Project commands
- Install: pnpm install --frozen-lockfile
- Unit tests: pnpm test
- Integration tests: pnpm test:integration
- Lint and types: pnpm lint && pnpm typecheck
# Rules
- Never edit generated files in src/generated/.
- Database changes require a reversible migration.
- Do not log tokens, passwords, or request bodies.
- Add tests for every bug fix before changing implementation.
Keep lengthy procedures in dedicated documentation or reusable skills rather than turning CLAUDE.md into an archive. Record architectural decisions and recurring pitfalls, but do not automatically commit every chat summary; unreviewed notes can preserve false assumptions and conflict with the code.
Claude Code also has auto memory. Review, edit, or delete stored items that are obsolete or sensitive. The official memory documentation distinguishes contextual memory from controls that must be enforced elsewhere.
4. Implement in small, reviewable increments
Ask the agent to change one layer at a time and show the diff. A useful order is failing test, minimal implementation, integration update, and cleanup. Small commits make it easier to locate regressions and revert a mistaken approach.
Tell the agent to reuse existing project patterns before introducing a dependency or abstraction. Require justification for generated code, package updates, schema migrations, public API changes, and changes to authentication or authorization.
5. Test behavior, not just lines
An agent should run the same checks a careful contributor would run:
- Formatter, linter, and type checker.
- Unit tests for the changed behavior.
- Integration or end-to-end tests across real boundaries.
- Regression test that fails before the fix and passes after it.
- Security scanning and dependency checks used by the repository.
- Build, packaging, migration, and rollback checks where relevant.
Ask it to report the exact commands and results, including failures or skipped tests. Do not accept “tests should pass.” Verify the output in CI, where the environment is clean and the checks cannot be silently altered by the same patch.
6. Review the final diff with a clean context
After implementation, start a fresh review pass focused on the diff and requirements. A second model or agent can help find missed cases, but model diversity is not a guarantee of independence. Treat AI review as an additional reviewer, not the approval authority.
Review this pull request against the issue and acceptance criteria.
Look for correctness bugs, security problems, data-loss risks,
race conditions, compatibility changes, missing tests, and unnecessary scope.
Cite the file and code location for each finding.
Do not modify files. Separate confirmed issues from questions.
Manually inspect security-sensitive flows, database migrations, concurrency, external calls, error handling, dependency changes, and permissions. Confirm that comments and tests describe real behavior rather than rationalizing the implementation.
7. Put deterministic checks in hooks and CI
Pre-commit hooks are useful for fast local checks such as formatting, linting, generated-file validation, and secret scanning. CI should remain the authoritative gate because local hooks can be skipped.
Claude Code hooks can run commands before or after tools and can block actions. The official hooks guide explains how to enforce checks. Configure hooks carefully: they execute shell commands with the user's permissions, so a dangerous hook is a security problem of its own.
Do not replace deterministic checks with a vague AI prompt such as “is this production-ready?” Use an AI review for judgment-heavy issues, and use code for rules that can be expressed exactly.
8. Limit permissions and protect secrets
- Run the agent in the repository or a worktree, not an unrestricted home directory.
- Start with read-only or plan mode for unfamiliar code.
- Allow only required commands, paths, network access, and credentials.
- Use test accounts and non-production data.
- Keep production deploys, destructive migrations, secret rotation, and external messages behind human approval.
- Review scripts and configuration before executing them; repository instructions can be malicious.
- Never paste private keys, session tokens, customer data, or production secrets into prompts.
9. Keep context relevant
There is no universal token count at which code quality suddenly declines. Context quality matters more than a fixed threshold. Large logs, generated files, vendor directories, and repeated tool output can crowd out the requirements and current code.
Use targeted searches, read only relevant files, summarize completed phases, and start a clean session when changing from implementation to review. Keep persistent rules in project instructions and use source files—not old chat claims—as the authority.
Pull-request checklist
- The change maps to explicit acceptance criteria.
- The diff is limited to the intended scope.
- New behavior has unit and boundary-level tests.
- All required commands ran and CI passed.
- Dependencies, migrations, secrets, and permissions were reviewed.
- Error paths, retries, timeouts, and rollback were considered.
- AI review findings were verified, not copied blindly.
- A responsible human approved the change.
TipsMake's Claude Code in VS Code guide covers the editor workflow. For teams comparing assistants and review styles, see Cursor vs. GitHub Copilot.
Reader Comments 0
Sign in with email or Google to join the discussion.