Skip to content
AIMODELRACE

Module 2 of 6 · Intermediate · 11 min read

Apps and coding agents

Plan, build and maintain real applications with AI coding agents, without losing control of your codebase.

Key takeaways
  • 1Agents work best with a clear spec, a plan you approve, and tests as the finish line.
  • 2Keep tasks small and reviewable: one feature or fix per run.
  • 3Give the agent project context in a rules or instructions file.
  • 4Review every diff; you own the code, not the agent.

01Where AI helps

Coding agents can read a codebase, plan a change, edit many files, run commands and tests, and iterate on errors. Used well, they handle much of the implementation while you focus on product decisions, architecture and review. Used badly, they produce large, plausible changes nobody understands.

  • Scaffolding new projects and features.
  • Writing tests, migrations and repetitive code.
  • Debugging from error messages and logs.
  • Explaining unfamiliar code and documenting it.
  • Refactoring with a test suite as a safety net.

02The workflow

The Coding loops module in Loops, Graphs & Agents covers the test-driven loop in depth.

  • Describe the feature and its acceptance criteria in a short spec.
  • Ask the agent for a plan: files to change, approach, risks. Approve or adjust it.
  • Agree the tests first, then let the agent implement until they pass.
  • Review the diff, run the app yourself, and ask for fixes.
  • Commit in small steps with clear messages, on a branch.
  • Keep a project instructions file updated with conventions the agent should follow.

03Tools to reach for

Most tools let you add a project rules file (a markdown file of conventions and commands) that the agent reads at the start of each session. Use it.

  • AI code editors with chat and inline edits, for day-to-day work.
  • Terminal or cloud coding agents that run commands and tests on their own, for larger tasks.
  • AI code review in your pull-request workflow, as a second pair of eyes.
  • Hosted app builders for prototypes you may later move into a real repository.

04Prompt: project rules file

A short, specific rules file prevents the same corrections every session.

Example
# Project notes for AI agents - Stack: {{framework, language, database}}. - Run the app: {{command}}. Run tests: {{command}}. Lint and type-check: {{command}}. - Code style: {{conventions}}. Follow existing patterns in {{example folder}}. - Never commit secrets; config comes from environment variables listed in .env.example. - Ask before adding dependencies, changing the database schema, or touching {{sensitive area}}. - Definition of done: tests pass, lint is clean, and the change is described in the PR summary.

05Prompt: plan before code

Asking for a plan first catches misunderstandings while they are cheap.

Example
Feature: {{feature}}. Acceptance criteria: {{criteria}}. Don't write code yet. Read the relevant parts of the codebase and give me: 1. The files you will change or add, and why. 2. Your approach in a few bullet points. 3. The tests you will add. 4. Risks, open questions and anything in the existing code that surprised you. Keep the change as small as possible.

06Prompt: debugging

Give the agent evidence, not just 'it's broken'.

Example
Bug: {{what happens}} when {{steps to reproduce}}. Expected: {{expected}}. Error and logs: <logs>{{paste}}</logs> Find the root cause before changing anything. Explain it with the evidence, then propose the smallest fix and a regression test that fails before the fix and passes after.

07Pitfalls

The skill that matters most is now reviewing code quickly and well.

  • Giant tasks: 'build the whole app' produces a sprawling mess. Break work into reviewable pieces.
  • Context gaps: the agent doesn't know your conventions unless they are written down.
  • Silent scope creep: agents 'helpfully' refactor unrelated code. Ask for minimal changes.
  • Weakened tests: an agent may edit tests to make them pass. Forbid it and check.
  • Unreviewed security: authentication, payments and data access always need human review.
Watch out
Run agents on a branch or in a sandbox with limited credentials. Never give an agent production database access or deploy keys for routine work.

Finished reading?

Mark it complete to track your progress, then test yourself with the Build with AI: Software & Media quiz.