Skip to main content

The AI-Assisted Development Lifecycle

Learning objectives
  • Walk the lifecycle from requirement to production and name the artifact and gate at each stage
  • Run the inner loop explore → plan → code → verify → commit with a coding agent
  • Match agent autonomy to the risk tier of the code being changed
  • Define "done" for AI-written code and explain why small batches matter more with agents
  • Design a bank-grade SDLC where AI assists but never approves, traceable from requirement to deployment

TL;DR​

  • AI makes writing code cheap, not deciding, verifying or owning it. Effort moves upstream (spec, plan) and downstream (verify, review).
  • Every stage produces a versioned artifact — the agent's context for the next stage — and passes a gate a human owns.
  • Inner loop: explore → plan → code → verify → commit.
  • Spec-driven development: the spec, not the chat, is the source of truth for the agent and the reviewer.
  • Autonomy follows risk: docs and tests can go to background agents; money, auth, crypto and migrations get a human author or line-by-line review.
  • Small batches: agents inflate diffs, and review quality and rollback safety fall as diffs grow.
  • In a bank, accountability never transfers to the tool: author ≠ approver, an AI is never the approver, every change traces to an approved requirement.

Why it matters​

Coding agents (AI Coding Tools & How Coding Agents Work) produce a plausible feature in minutes, which is not the same as shipping faster. Google Cloud's DORA 2024 Accelerate State of DevOps report found higher AI adoption associated with an estimated decrease in delivery stability (and a smaller one in throughput) even as individuals felt more productive; the authors' leading hypothesis was larger batch sizes. The 2025 State of AI-assisted Software Development report framed AI as an amplifier of a team's existing strengths and dysfunctions.

So the lifecycle, not the tool, decides the outcome. An agent change that silently breaks voucher stacking costs revenue at 11.11 peak; in a bank, an unreviewed agent change to transfer limits is an audit finding even if nothing broke. Interviewers ask "how does your team use AI safely?" and want gates, not a tool list.

Core concepts​

The lifecycle at a glance​

It is the classic SDLC with three differences: the first four stages become cheap enough to do every time; every artifact lives in the repo because the agent reads it next; and Learn is explicit — lessons become instructions, tests and hooks.

Stage by stage​

StageInputsAI's jobHuman's jobArtifactGate
RequirementsTicket, stakeholder notesAsk questions; list assumptions, edge cases, NFRsAnswer; set scope; involve legal, riskDecision notesPO agrees scope, non-goals
SpecDecision notes, codeDraft spec, Given/When/ThenCorrect, cut, own itdocs/specs/NNN-x.mdReviewed and merged
Design / ADRSpec, constraintsOptions, trade-off tableChoose; record whydocs/adr/NNNN-x.mdAccepted by named deciders
PlanSpec, ADR, codeOne-commit tasks, verify commands, risk flagsResize; set autonomydocs/plans/NNN-x.mdEach task verifiable, tiered
ImplementOne task, AGENTS.mdFailing test, code, iterateSteer; pair on risky tasksOne commit per taskVerify command passes
VerifyDiffTests, lint, SAST, dependency and secret scansRead resultsCI reportsAll green, no weakened tests
ReviewPR, specSelf-review; AI review commentsRead risky paths line by line; approveApproved PRHuman approval, author ≠ approver
Merge / CIApproved PRRelease notesMerge; keep main greenArtifact tied to SHAProvenance recorded
DeployArtifact, flagsRollout, rollback notesApprove; watch canaryChange recordCanary SLOs hold
OperateTelemetrySummarise alerts, draft queriesDecide, actPostmortemBack within SLO
LearnPostmortems, reviewsPropose rule, test, spec editsAccept or rejectAGENTS.md, testsLesson is executable

What teams skip:

  • Verify is not review. It is mechanical (go test -race ./..., golangci-lint run, govulncheck ./..., secret and SAST scans); the agent runs it and fixes failures before a human looks (Reviewing AI Code & CI Guardrails).
  • Review has three layers: author self-review, an AI reviewer for cheap issues, a human for judgement.
  • Deploy contains the blast radius: flags default off, canary with automatic rollback (Cloud-Native, Kubernetes & Deployment Strategies).
  • Operate: AI triage stays read-only; an agent that can restart pods is a production change actor under human controls.
  • Learn: a comment made twice goes into AGENTS.md; an escaped bug becomes a test; a dangerous agent habit becomes a blocking hook.

The inner loop: explore → plan → code → verify → commit​

Each task runs a tight loop. Anthropic's Claude Code best-practices guidance (2025) recommends this shape; most agent vendors describe a variant.

  • Explore — the agent reads packages, tests and ADRs and reports with file paths: did it find the existing idempotency helper before writing a second one?
  • Plan — a 15-line plan is far cheaper to review than a 400-line wrong diff; a wrong plan goes back to Explore.
  • Code — test first from the acceptance criterion (TDD & Testing with AI).
  • Verify — the task's command, then the wider suite: real output, not the agent's belief about it.
  • Commit — one task, one commit citing spec and task ID: a rollback point and a clean context boundary.

Tool specifics (as of 2026 — check current docs): Claude Code has a read-only plan mode, subagents for exploration, hooks on tool events (format after edits, block edits to migrations/) and instructions in CLAUDE.md; many other agents read AGENTS.md. See Prompting & Context Management for Coding Agents.

Spec-driven development​

Spec-driven development (SDD) makes a written, versioned spec the source of truth: the agent implements it task by task, tests come from its acceptance criteria, and reviewers check the diff against it, not against a chat. Durable ideas: separate what/why from how; artifacts beat conversations; tasks small enough to verify one by one; spec and behaviour change in the same PR.

Public examples (as of 2026 — check current docs): GitHub's open-source Spec Kit walks an agent through a project "constitution" of principles, then specify, plan, tasks and implement, storing each artifact as Markdown in the repo. AWS's Kiro IDE has a spec mode producing requirements.md (user stories with EARS-notation acceptance criteria), design.md and tasks.md. You need neither: docs/specs/TEMPLATE.md, docs/plans/TEMPLATE.md and the write-spec / write-plan skills in templates/ai-workflow/ do the same. The practice is in Requirements → Spec → Plan with AI.

SDD is overhead for a typo. Write a spec when the change has user-visible behaviour, crosses a service boundary, or touches a tier-3 path.

Autonomy levels matched to risk tiers​

Autonomy is set per task in the plan: A1 suggest (completions you accept line by line), A2 pair (agent edits while you watch each step), A3 supervised (agent runs a whole task; you review the diff before commit), A4 background (agent works a ticket in a sandbox and opens a PR).

Risk tierExamplesMax autonomyExtra controls
Tier 1 — LowDocs, tests for existing behaviour, internal tools, scaffolding, well-tested dependency bumpsA4Standard CI, one reviewer
Tier 2 — MediumLogic without money or identity: catalog, search ranking, notifications, admin UIsA3Spec required; owning-team reviewer
Tier 3 — HighMoney movement, ledger, pricing maths, authn/authz, crypto and keys, PII flows, DB migrations, IAMA1–A2: human writes, or reviews every agent editDomain CODEOWNERS, two approvers, ADR or threat model, staged rollout

Enforce tiers, do not just declare them: CODEOWNERS on internal/ledger/ and migrations/; permission rules and hooks in .claude/settings.json denying unattended agent edits to tier-3 paths; a CI job requiring a risk label and two approvals when they change — see Setting Up a Repo for AI Agents.

Money and migrations are tier 3 even with excellent agents because their failures are silent and hard to reverse: a wrong rounding mode passes every test the agent wrote for itself and surfaces weeks later as a reconciliation break; a table-rewriting migration locks checkout at peak (Zero-Downtime Schema Migrations). Reversibility, not difficulty, sets the tier.

Small batches​

  • Review attention collapses. The often-cited SmartBear/Cisco review study (2006) found defect detection fell off beyond roughly 200–400 lines per session. A 2,000-line agent PR gets skimmed and approved, with a human signature.
  • Coupled mistakes hide. One wrong assumption (amounts as float64) spreads across twenty files.
  • Rollback is coarse. Reverting a refactor-plus-feature PR reverts both.
  • Long sessions degrade agent quality; small tasks keep context focused.

So: one task = one commit; PRs of a few hundred lines (a norm, not a law); refactors separate from behaviour; stacked PRs and flags for big features.

Definition of done for AI-written code​

  • Implements a specific spec section or ticket, linked from the PR.
  • Every acceptance criterion has a test that failed before and passes after.
  • Tests, race detector, lint, govulncheck, secret and SAST scans pass — nothing skipped or weakened.
  • The author can explain every line and has checked each new dependency exists and is needed (agents hallucinate module paths).
  • Errors, retries and idempotency follow the spec; risky behaviour sits behind a flag; no PII in logs.
  • Spec, ADR, API docs and AGENTS.md updated in the same PR when behaviour or conventions change.
  • Human approvals present; no approver is the author or a bot.

Put it in the PR template (dot-github/pull_request_template.md) so it is checked, not remembered.

Regulated SDLC: what changes in a bank​

Banks already run controlled SDLCs: change advisory boards, IT general controls audits, PCI DSS Requirement 6 for card environments, and local rules such as the State Bank of Vietnam's Circular 09/2020/TT-NHNN on information-system security. AI sharpens four controls.

  1. Change management. Every production change needs a reason, approval, test evidence and rollback plan; the change record links to the PR, not a chat.
  2. Segregation of duties. The human driving the agent is the author, accountable for every line it wrote. An AI reviewer may comment but never counts as an approval: configure branch protection or rulesets so only human CODEOWNERS approvals count, and require approval of the most recent push. A background agent has its own least-privilege identity — it opens PRs, never merges or deploys.
  3. Traceability from requirement to deployment (below).
  4. Audit evidence and data handling — see the table's last row: sending code to an unapproved model endpoint is itself a data-protection incident (LLM Security, Privacy & Governance).

Make each arrow mechanical: ticket ID in commit messages (hook or CI check), spec path required by the PR template, SHA in build metadata, digest and change ID recorded at deploy. Mark AI involvement too — e.g. a Co-Authored-By trailer for the agent, which Claude Code can add — so "which changes were AI-assisted?" has an answer.

ControlEvidence (where)
Requirement approvedSpec merged with PO approval (repo history)
Design reviewedAccepted ADR naming deciders (docs/adr/)
Independent reviewPR approvals and reviewer identities (Git audit log)
TestedTest and scan reports tied to the SHA (CI artifacts)
Approved for productionChange record linked to PR and artifact (ITSM tool)
AI use within policyApproved tool, sanctioned endpoints only (security policy, gateway logs)

Who owns what. Product owner: scope. Feature lead: spec. Architect: decisions. PR author — the human who ran the agent: every line. Reviewers: approval. Change approver: the production change. Incident commander: incident actions. AI drafts and comments in all of these and owns none. "The AI wrote it" is never an answer in a postmortem or an audit.

Trade-offs​

ApproachStrengthsWeaknessesChoose when
Ad-hoc chat promptingFastest startNo artifacts; big unreviewed diffsThrowaway spikes
Interactive agent with a plan (A2–A3)High leverage, human steering per taskHuman attention is the bottleneckDefault for product work
Full spec-driven flowTestable criteria, audit-friendlyUp-front effort; bloatMulti-service, tier-3, regulated
Background agents (A4)Parallel throughputShifts load to reviewers; weak on ambiguityTier-1 backlog: tests, docs, upgrades
Human onlyMaximum understandingSlowestNovel crypto, ledger invariants, pressured hotfixes

In practice​

Each stage has a template in templates/ai-workflow/: Spec, Design and Plan → docs/specs/TEMPLATE.md, docs/adr/TEMPLATE.md, docs/plans/TEMPLATE.md plus the write-spec and write-plan skills; Implement → AGENTS.md, CLAUDE.md, dot-claude/settings.json, dot-claude/hooks/; Verify, Review, Merge → dot-github/workflows/ci.yml, the review-diff skill, dot-github/pull_request_template.md.

A commit message that keeps the chain intact:

feat(transfer): enforce daily limit per beneficiary

Implements docs/specs/042-beneficiary-limits.md behaviour B4, plan task T3.
Verified: go test ./internal/transfer/... -run TestBeneficiaryDailyLimit

Refs: PAY-1423
Co-Authored-By: <agent identity>
  • Spec and ADR go up as their own PR on day one; code PRs link to it.
  • Each plan task carries risk tier and autonomy, so "can a background agent take this?" is settled in planning.
  • A weekly agent retro turns repeated review comments and escaped bugs into AGENTS.md edits, tests and hooks.
  • Track change failure rate and review time, AI-assisted vs not; if failures rise, shrink batches first.

The whole lifecycle on one feature: Walkthrough: Refund API from Requirement to Production.

Common pitfalls​

  • Jumping straight to Implement. Symptom: a clean PR that does the wrong thing, built on guessed requirements.
  • AI reviewer as rubber stamp. Symptom: a segregation-of-duties audit finding; tier-3 bugs a human would have caught.
  • Weakened tests. The agent edits the assertion or adds a skip. Symptom: green CI, broken behaviour.
  • Giant PRs. Symptom: approval minutes after a 1,500-line PR opens; reverts that remove unrelated work.
  • Hallucinated dependencies. Symptom: build failures — or a supply-chain compromise via a path an attacker registered.
  • Agents with production write access. Symptom: an auto-remediation restarts the wrong deployment, with no change record.

Interview angle​

  • "How would you introduce AI coding tools in a bank?" Pilot on tier-1 work; risk-tiered autonomy; specs in the repo; CI verification; human approval with segregation of duties; traceability; approved-tool policy; delivery metrics.
  • "Who is accountable for AI-written code?" Author and approvers, as before.
  • "Doesn't the process kill the speed gain?" Drafting specs and plans is now cheap; DORA points to stability, not typing speed, as the constraint.
  • Red flags: "the AI reviews PRs, so fewer reviewers"; treating test and ledger code alike; trusting output because it compiles.

Self-check​

1. Name the artifact and gate for the Spec, Plan and Review stages.

Spec: docs/specs/NNN-feature.md, reviewed and merged with PO sign-off. Plan: docs/plans/NNN-feature.md, every task one commit with a verify command, risk tier and autonomy level. Review: an approved PR with required human approvals, approver ≠ author and never a bot.

2. Why does Plan come before Code in the inner loop, and what happens when the plan is wrong?

A short plan exposes a wrong assumption (duplicated helper, wrong table, missing idempotency) before hundreds of lines encode it. A wrong plan goes back to Explore for more reading, not forward with a patch bolted on.

3. Scenario: a background agent opened a PR changing interest rounding in a savings product. What went wrong, and which controls should have stopped it?

Interest maths is tier 3, so A4 was never allowed. The plan should have marked it A1–A2; hooks or permission rules should deny unattended edits there; CODEOWNERS and CI should force domain-owner and two approvals. Close the PR, have a human author it test-first, add the path to the deny list.

4. An auditor picks a production deployment. What do you show, and how is each link enforced?

Deployment → change record → CI build and reports for the SHA → PR with human approvals → commits citing ticket and task → spec and ADR → ticket. Enforced by commit-message checks, the PR template, branch protection, SHA in build metadata and the deploy tool's records.

5. Scenario: the team proposes counting the AI reviewer as the second approver on payment PRs. Your response?

Reject it: segregation of duties needs an accountable human independent of the author, and the model is effectively authoring tooling. Keep it as a pre-review filter; win speed with smaller PRs, stronger verification and review SLAs.

🧠 Flashcards0/8 learned · 0 retries

Exercise​

Write a one-page AI-assisted SDLC policy for a repo you know (or the Bank Transfer System):

  1. Risk tiers with path globs (internal/ledger/**, migrations/**) and maximum autonomy each.
  2. Your definition of done, in a PR template.
  3. The traceability chain with your real tools, marking which links are automatic.
  4. In a sandbox repo, run install.sh from templates/ai-workflow/, add a rule blocking agent edits under migrations/, and prove it by asking the agent to edit one.

Done when: an auditor could follow any merged PR back to an approved requirement, and the agent demonstrably cannot edit a tier-3 path unattended.

Further reading​

  • Anthropic, "Claude Code: Best practices for agentic coding" (engineering blog, 2025) and current Claude Code docs.
  • DORA, Accelerate State of DevOps Report 2024 and State of AI-assisted Software Development (2025), dora.dev.
  • Forsgren, Humble, Kim, Accelerate (2018) — small batches and the four delivery metrics.
  • GitHub Spec Kit (github.com/github/spec-kit) and Kiro docs (kiro.dev) — check current versions.
  • PCI Security Standards Council, PCI DSS v4.0, Requirement 6.
Finished this page?

Do the self-check first. Marking it complete schedules spaced reviews (1, 3, 7, 14, 30… days).