Skip to content
Giminger ConsultingDE

Review, secure and ship agent-written code

Key takeaway

Code from coding agents needs the same quality assurance as human code, with a different emphasis: dependencies, security boundaries, error handling and understanding. An automated pipeline with tests, type checks and security scans plus a human review with a checklist is the most practical standard for start-ups.

Lessons in this path
  1. A workspace in which coding agents do good work
  2. Write tasks that agents implement correctly
  3. Review, secure and ship agent-written code

Why is “it runs” not enough?

Agent code often looks clean and works in the normal case. Problems show up with edge cases, load, missing permissions or unexpected input. There is also a less visible risk: if nobody on the team understands the code, every later change becomes more expensive. That is technical debt, and it can accumulate quickly.

For start-ups there is a business angle too. At the latest during investor due diligence or with enterprise customers, someone will ask how quality and security are ensured. A traceable process with a pipeline, reviews and documented rules is a good answer then, regardless of how much code an agent wrote.

Which checks should run automatically?

A continuous integration (CI) pipeline, meaning automated checks on every push, is the cheapest insurance. It runs regardless of whether a person or an agent wrote the code, and can be set up with GitHub Actions, GitLab CI or similar services in a few hours.

  • Tests, type checks and linter must pass before merging is possible.
  • Dependency scanning for known vulnerabilities, for example with Dependabot or similar services.
  • Secret scanning so no API keys end up in the repository.
  • Optional: static security analysis and an AI-assisted review as an additional, not sole, voice.

What does the human review focus on?

The human review should not check every line for style; tools do that. It focuses on questions machines answer poorly: does the change match the task? Is it understandable? What happens when something fails?

Review checklist for agent code
CheckQuestion
ScopeWere files outside the task changed?
DependenciesAre new packages needed, do they really exist and are they maintained?
PermissionsAre permissions checked server-side?
ErrorsAre errors surfaced rather than silently swallowed?
TestsDo the tests check behaviour or only that code runs?
UnderstandingCan someone on the team explain the change?

Ask the agent to explain the diff and question it. If the explanation does not match the code, that is a warning sign.

How secure is AI-generated code?

Agents reproduce patterns from their training data, including insecure ones. Common findings are missing input validation, overly broad database queries, insecure default configurations and secrets in code. AI features inside the product are especially sensitive: if model outputs flow unchecked into database queries, HTML or system commands, classic vulnerabilities appear. The OWASP Top 10 for LLM applications is a good checklist for this.

Going deeper: measuring quality over time

Teams that use agents heavily should track a few metrics: the share of agent changes merged without rework, the number of post-release bugs traced back to agent code, and time from task to release. From this you can see which task types agents handle well and where more context or review is needed.

Feature flags (switches that enable new functionality for only some users) and staged rollouts help as well. They turn a bug in agent code into a small problem that can be switched off quickly rather than an outage for all customers.

Example: a review finds what the tests missed

In the fictional booking start-up, the agent delivers an appointment search. All tests pass and the pipeline reports no issues. The checklist review reveals that the database query does not filter by practice. A logged-in user could in theory find appointments from other practices.

The team adds a test that covers exactly this case, has the agent fix the query and adds a rule to the context file: “Every appointment query must filter by practice_id.” Since then the bug has not reappeared, because the test and the rule catch it.

Common mistakes

  • Using an AI review as the only review.
  • Accepting new packages without checking that they exist and are maintained.
  • Fixing found bugs only in the code instead of adding a test and a rule.
  • Shipping code that nobody on the team can explain.

Frequently asked questions

Can a second agent review the first one?

As an additional check, yes; it often finds real bugs. It does not replace a person’s responsibility, especially for permissions, data and payments.

How much time does review take?

As rough orientation: a few minutes for small, well-described tasks, an hour or more for changes to data models or permissions. Smaller tasks reduce the effort considerably.

Do we need to label agent-written code?

As things stand there is generally no legal duty to label source code; this is orientation, not legal advice. Internally, though, it helps to note in commits or pull requests which changes an agent produced. That lets you analyse error sources and review effort later.

Try it yourself

Set up a CI pipeline with tests, type checks, dependency and secret scanning, and review the next three agent changes with the checklist from this lesson.

Check your result

No change is merged without a passing pipeline, and every review finding leads to a test or a rule in the context file.

Official documentation and sources

Practical guides and references