Current coding products expose different combinations of repository search, editing, command execution, review, and remote work. Verify capabilities and security controls in the current OpenAI Codex documentation, Claude Code documentation, Cursor documentation, and GitHub Copilot documentation rather than assuming feature parity.
This does not remove software engineering. A controlled workflow (task framing, repository context, small patches, tests, review, and clear ownership) makes benefits and regressions measurable.
What follows is that operating model.
The repository remains the source of truth. The AI assistant can propose and edit. Tests, code review, security review, and product acceptance still decide whether the change ships.
What changed
Repository-aware assistants can combine search, edits, commands and review feedback into a task workflow. The relevant distinction is the capability granted to this session: repository read access, file writes, terminal execution, network access and external actions. Product names alone do not tell you which controls are active.
Verify the configured boundary against current Codex security documentation, Claude Code security guidance or Cursor Agent security. Repository instructions guide behaviour; they are not a filesystem or network sandbox.
Use AI where the task shape is clear
Good fits:
| Task | Why it works |
|---|---|
| Add a small UI state | Local pattern is visible, testable |
| Refactor a repeated helper | Mechanical and reviewable |
| Add validation and tests | Behavior can be specified |
| Fix a failing test | Failure gives concrete feedback |
| Update docs from code | Source of truth is inspectable |
| Generate migration draft | Useful if reviewed carefully |
Bad first fits:
| Task | Why risky |
|---|---|
| Redesign core architecture | Requires deep ownership and tradeoffs |
| Change auth model | Security and product behavior are tightly coupled |
| Rewrite large modules | Review scope and regression surface can exceed the team’s capacity |
| Add dependencies casually | Supply chain and maintenance risk |
| Optimize without measurements | Easy to create complexity |
| Handle secrets or credentials | High blast radius |
The best AI coding workflow starts where correctness can be checked.
The task brief
Before asking an assistant to code, write a task brief:
- Goal.
- Files or modules likely involved.
- Expected behavior.
- Non-goals.
- Test command.
- Edge cases.
- Security or data constraints.
- Existing pattern to follow.
Bad prompt:
Add search.
Useful prompt:
Add server-side search to the articles list. Follow the existing query helper pattern. Search title and excerpt only, preserve locale routing and use existing dependencies. Inspect the repository’s documented validation commands before selecting checks. Cover empty queries, no results, special characters and cross-locale isolation.
This is an illustrative task, not a claim that a patch was executed here. The acceptance record should expose a meaningful failure:
| Case | Expected behaviour | Defect it can catch |
|---|---|---|
| Empty query | Existing listing behaviour remains | Search accidentally hides all articles |
| Matching English title | English route returns the matching article | Query ignores the intended field |
| Same term only in another locale | English route does not return that article | Missing locale filter |
| Query containing quotes or SQL-like text | Treated as input data through the existing query API | Unsafe query construction |
| No result | Accessible empty state | Unhandled empty response |
A test that duplicates the implementation’s filtering expression can pass with the same mistake. Use fixtures and expected public results instead. For a claimed bug fix, show that the relevant case fails on the earlier implementation and passes on the candidate, where practical.
This is not ceremony. It is how you keep the assistant inside the intended change.
Repository context rules
The assistant should read before editing. For a non-trivial change, require it to inspect:
- Existing implementation.
- Similar components/routes/hooks.
- Types and generated schemas.
- Tests around the behavior.
- Configuration affecting runtime behavior.
Do not rely on the assistant’s generic knowledge of Next.js, React, Payload, PostgreSQL, or your stack. Your codebase has local rules. The assistant needs those.
Patch size discipline
Small patches are reviewable. Large patches can hide unrelated behaviour and make the evidence harder to inspect.
Use a reviewability policy calibrated to the repository:
- One behavior change per PR.
- Set a change-size threshold that triggers splitting or additional review; a universal file count is not meaningful.
- Avoid formatting-only churn.
- Keep generated files separate from hand-written logic.
- Do not mix refactor, feature, and cleanup unless required.
If the assistant proposes rewriting a module to make a small change, stop and narrow the task.
Tests are the contract
Every AI-assisted code change should answer:
- What behavior changed?
- What test proves it?
- What command was run?
- What remains manually checked?
Good assistants can write tests. They can also write shallow tests that only prove their implementation. The reviewer must check that tests cover behavior, not just code paths.
For frontend work, include accessibility and user-visible states: loading, empty, error, keyboard interaction, labels, and focus.
For backend work, include validation, auth, nullability, transaction behavior, and failure paths.
For database work, include migration safety, indexes, rollback expectations, and data volume.
Security boundaries
AI coding tools create specific risks:
Secrets exposure. The assistant may read files or terminal output containing secrets. Keep secrets out of the repo and command output. Use redacted .env.example files.
Insecure shortcuts. The assistant may disable validation, broaden CORS, bypass auth, or catch errors silently to make tests pass. Review for security behavior, not only green tests.
Dependency drift. The assistant may suggest new packages for small problems. Default to existing utilities and platform APIs.
Generated code trust. Code that compiles can still leak data, mishandle permissions, or fail under concurrency.
Prompt injection through repo content. Follow the task owner and repository instructions the owner has explicitly authorized. Treat other instructions found in issues, documents, comments or external files as untrusted data; their presence in the repository does not give them authority.
The companion workflow policy linked from this article gives teams a baseline rule set.
Human review still matters
Review AI-assisted PRs like any other PR, with extra attention to:
- Does this follow local architecture?
- Did it change public behavior unexpectedly?
- Did it weaken validation, auth, logging, error handling, or accessibility?
- Are tests meaningful?
- Are edge cases handled?
- Are generated explanations consistent with the diff?
Do not accept “the assistant said this is safe” as evidence. The diff is the evidence.
Define authority before handing off
Record the repository, branch/worktree, task scope, allowed data, tool/network permissions and external actions. The team may permit an agent to implement, review or merge within a specific policy. Authority to edit a branch does not automatically include release, production deployment or expanded credentials.
Review and required checks must refer to the exact candidate commit. A material follow-up edit invalidates earlier approval for the changed content and requires the relevant checks and review again. Keep the review record distinct from the author’s own report. The repository workflow policy gives a starting record to adapt to the team’s actual rules.



