Ship It With AI Mihai Cvasnievschi

Appendix B. Templates

4 min read

Eleven copy-paste templates and exercises. All are starting points; customize for your team.

B.1 Architecture review prompt

Analyze the architecture of this codebase. Produce a structured architecture review document covering:

Repository and scope: [repository, affected areas and exclusions]
Business domain: [known domain and owner who can correct inferences]
Authorization: read-only investigation by default; other actions only [explicit scope]
Time budget: [bounded first pass]
Evidence available: [code, tests, docs, runtime access]
Evidence unavailable: [production state, advisories, business decisions, other gaps]
Commit reviewed: [actual git SHA; state dirty/untracked files separately]
Human review owner: [name/role]

1. Purpose. What does this service do? Who uses it? What business problem does it solve?
2. Top-level structure. Major modules, packages, or folders. One paragraph per major component.
3. Data model. Primary entities, relationships, persistence. Cite specific files and line numbers.
4. Request flows. For the three most important external entry points, trace from entry to persistence. Cite files and lines at each step.
5. Cross-cutting concerns. Authentication, authorization, logging, error handling, configuration. Where do they live?
6. Dependencies. External services, databases, message brokers, third-party APIs.
7. Test posture. Test structure, coverage, gaps.
8. Build and deployment. Cite the configuration files.
9. Risks and unknowns. Fragile code, inconsistent conventions, deprecated dependencies, unresolved patterns.

Cite specific files and line numbers throughout. Separate observed code facts,
inferred business purpose, and unverified operational claims. Configuration is not
proof of production behavior. State ambiguity and unavailable evidence. Suggest
conventions for human review; do not implement them without authorization.

B.2 AGENTS.md skeleton

This is an illustrative Java/Spring project skeleton. Replace example names, incident dates, commands and restrictions with verified project facts; the sample incidents are not reports about your repository.

Works as AGENTS.md or CLAUDE.md; check your agent's loading rules. Start short and use roughly 200 lines as a trimming guideline, not a target or universal limit. The precedence line goes first: it clarifies how these local instructions relate to the task and skills, within the agent's higher-priority rules.

# AGENTS.md

Precedence: in a conflict, the task prompt wins over this file; this file wins over any skill.

## Forbidden patterns
- Never construct SQL by string concatenation. Use bound parameters. (Reason: SQL injection.)
- Never roll your own cryptography. Use the team's approved crypto wrapper. (Reason: AES-CBC with hardcoded IV shipped to production in 2024; we are not doing that again.)
- Never modify migration history. Migrations are append-only.

## Mistake journal
- 2026-03-03: agent generated JPQL query that bypassed the multi-tenant filter. Fix: queries extend MultiTenantQueryBuilder, which enforces tenant filtering. Evidence: <commit or incident link>

## Conventions
- Constructor injection only, not field injection.
- In this project's persistence services, use transactions where consistency requires them; use @Transactional(readOnly = true) for appropriate reads and explicit write transactions for mutations. Follow the reviewed service example; this is not a universal Spring restriction.

## Build and test
- Build: mvn clean verify
- Run tests: mvn test

## Where the map lives
- Repository layout and module map: docs/architecture.md (read before touching an unfamiliar module)

## Domain glossary
- "Customer" = end user. "Counterparty" = corporate client.
- "Transfer" = intra-bank or inter-bank. "Wire" = inter-bank only.

B.3 Six-phase loop checklist (one-pager)

SIZE THE WORK
  Clear and contained: native agent, direct change, focused check.
  Unclear or dependent: inspect, settle material questions, make a short plan.
  Risky or unfamiliar: explicit outcomes, failure cases, human decisions and review.
RESEARCH AND PLAN
  Gather missing context; record decisions and dependencies when needed.
  Define "done" and the checks that assess it. Gate consequential choices.
EXECUTE
  Work directly unless sizeable independent work earns delegation's cost.
  Keep one writer per overlapping area; run dependencies in order.
  Finish the authorized scope; record material deviations. Ask only when a new
  decision or action actually needs the user's authorization.
REVIEW
  Cover intent and code quality in the normal review. Add independent reviewers
  where risk, model behavior and measured usefulness justify them.
  Keep separate judgments fresh and blind to earlier verdicts.
  Accept or rebut findings with evidence; track useful defects and false positives.
  Stop repair when no material issue remains; another round needs new evidence.
VERIFY
  Run relevant tests, build, lint, behavior or visual checks; report the evidence.
  For a behavioral fix, add a regression test where feasible. Permanent test files
  are not required for every prose or config edit; assess risk separately.
  Diagnose failures before changing checks. Protect gates from bypass; review
  legitimate test/config updates. Reuse valid results until relevant code changes.
  Held-out tests and sealed history/network are evaluation or high-assurance tools.
SHIP
  Structured commit and PR; reviewers per CODEOWNERS; normal team review.
  Record release owner/order, compatibility, success signal, intervention trigger,
  recovery approach and observation window before the production handoff.

B.4 Kill signal scoring worksheet

TASK PREREQUISITES - complete before scoring
  Proposed behavior/module/environment: ______
  Qualified evaluation owner: ______
  Consequential mistake and evidence that would expose it: ______
  Permitted actions, required approval, deployment and recovery: ______
Missing or unknown? Restrict the affected work to investigation or supervised
preparation until resolved. A green repository score authorizes no task by itself.

PREPARATION SIGNALS - 0 absent gap / 0.5 partial / 1 substantial / ? unknown
For each, record evidence, owner and next action. Never turn ? into 0.

1 Inadequate verification
  0    important outcomes/failure cases asserted; reliable runs; failures understood
  0.5  some relevant checks, with named bounded gaps
  1    absent or unreliable checks cannot expose consequential mistakes
  ?    affected behavior or assertions not investigated; coverage alone cannot settle it
2 No documentation
  0    current explanation and decisions for the affected behavior
  0.5  usable explanation with named gaps
  1    required behavior/decisions unavailable
3 Tight coupling
  0    clear contracts and understood effects of a change
  0.5  some cross-module effects, with known seams
  1    effects cannot be bounded without wider investigation
4 Scattered business rules
  0    canonical owner/source for relevant rules
  0.5  duplicated rules with known reconciliation
  1    conflicting rules without a known authority
5 Regulatory constraints
  0    required approvals and evidence supported by an established workflow
  0.5  additional preparation needed for this task's approval/evidence
  1    required approval or evidence path unavailable
6 Team cannot evaluate output
  0    qualified reviewer available for the affected domain
  0.5  expertise available with a fragile handoff
  1    no qualified evaluator: task prerequisite fails regardless of total
7 Model-context fit
  0    model works with supplied context on representative bounded tasks
  0.5  known gaps need extra documentation or supervision
  1    material misunderstanding persists in the proposed work
8 Velocity of change
  0    target versions and compatibility understood
  0.5  migration boundaries known but require care
  1    moving targets or compatibility unresolved

With no unknowns, sum and round halves upward. Author heuristic, not a safety score:
  0-1 GREEN few gaps / 2-3 YELLOW substantial preparation / 4+ RED broader preparation
Task prerequisites override every color. Investigate unknowns before assigning a color.
Allowed next task: ______  Restriction: ______  Owner/check/date: ______

B.5 90-day adoption calendar (one-pager)

BEFORE STARTING
  Approved service/account: ______  Permitted repositories/data: ______
  Responsible owner and qualified reviewer: ______
  Initial verified controls/recovery: ______  Spending limit: ______
  Baseline, comparable task sample and stop/expansion criteria: ______
CHAMPION
  Week 1      install; architecture review (B.1) on a familiar codebase; commit it
  Week 2      review instructions (B.2); add only what the pilot needs
  Weeks 3-4   cover B.3's functions on three features; size the process to each
  Month 2     three medium features; pull others into single phases
  Month 3     hand the role to a successor; AGENTS.md is team-owned
LEAD
  Week 1      classify the top 5 projects against the 8 kill signals (B.4)
  Weeks 2-4   per color, write what would have to change to move one project
  From start  record elapsed and human touch time, quality, review/rework and all costs
  Month 3     present honest results
MANAGER
  From start  confirm eligibility/budget; evaluate outcomes without individual PR quotas
  Days 61-67  take the handoff; verify the dashboard metrics are real
  Days 68-74  close the seat-vs-enterprise decision (Appendix A)
  Days 75-81  review expansion and ongoing governance; initial approval was before pilot
  Days 82-90  report observations, costs and limits; decide expand/change/stop

Reuse this measurement card; dates are examples, not a required expansion schedule. Agent-touched PR share measures adoption, not outcome.

Measure Record
Comparison Dates, model/workflow versions, task types/selection, raw attempted/completed/accepted counts and baseline
Delivery Elapsed start-to-acceptance definition; human touch time separately
Quality Escaped defects by severity, denominator and observation window; unknown follow-up
Review Reviewer effort, useful findings, rework and required expertise
Cost All billed usage and failed attempts, seats/infrastructure, amortized setup, maintenance and recurring governance
Independence Another engineer can operate the workflow and interpret the checks
Decision Expand/change/stop, limitations and next evidence needed

Grassroots track for teams without all three roles: Chapter 9. Appendix A fills a hypothetical cost comparison; do not substitute PR-cycle time for effort or cash saved.

B.6 Outer-loop contract (one-pager)

Before any unattended run, fill every line. A blank line means the loop is not ready.

WORK
  Queue: ______ (in the repo; one small, similar, reversible unit per item)
  Eligibility: every unit meets B.4 task prerequisites; independently verifiable
  and recoverable within the unattended-run controls. Green score alone is insufficient.
STOP CONDITION (machine-evaluable; the loop halts itself)
  Done when: ______ (queue empty / suite green / N units ready for review)
  Budget: max ______ tokens or $______ or ______ iterations or ______ hours - whichever hits first,
  enforced by something the loop cannot override (a usage warning is not a budget)
  Failure rule: same unit fails twice -> skip it and flag; three skipped units -> halt
EACH ITERATION
  Fresh context; state read from queue + journal in the repo
  Before a retry or resume: reconcile commit, completed writes, running processes,
  external calls and spend; make consequential operations safe to repeat
  One unit per iteration; finish it or journal why not - nothing half-applied
  Gate: ______ (tests / lint / typecheck / build), enforced by protected required checks
  Protect grader/config changes and policy rules from unilateral agent approval.
  Done-markers advance only after the trusted checks pass; the agent's report alone
  is not the acceptance gate.
ISOLATION
  Dedicated working copy and branch, never the default branch
  Verified tool/sandbox coverage; no production credentials; test network/DNS routes
MORNING REVIEW (the human floor)
  Each PR reviewed for business correctness and architectural fit
  Kill check before relaunch: oscillating diffs? budget spent but queue not shorter?
  same failure a third time? gate touched? Any yes -> do not relaunch. Read the journal,
  fix the cause first.

B.7 Context hygiene one-pager

LOAD
  Task-relevant context only. Pointers over payloads: name the files, do not
  paste them.
SESSION
  One coherent unit of work per session; preserve useful shared context.
  Save needed decisions, constraints, changed files and evidence before a handoff;
  use an existing task note or PR, and commit according to repository practice.
SIGNS TO INVESTIGATE: the agent
  re-answers a settled question; cites a stale version of a file it edited;
  forgets a constraint it honored; degrades late in a long session.
THEN
  Check for conflicting requirements, stale sources or missing access.
  Resolve the cause; save needed state before a restart or compaction.
COMPACTION (treat it as a handoff)
  Compare supported masking/summarization strategies with outcomes and usage. History is append-only on
  Fable 5.1: restart, do not edit. Give the compactor a keep-list: plan, open
  questions, deviations, commands that worked. Summaries can retain decisions
  but omit or distort details; save indispensable state durably. Do not assume
  details outside the keep-list will survive; verify the handoff before continuing.

Completed handoff example, a synthetic exercise checkpoint rather than a real session log:

Objective: add Wire priority while preserving v1 responses and retry behavior.
Accepted decisions: four enum values; omitted/null => NORMAL; only URGENT queues;
  reject urgent creation on queue outage; audit chosen priority; replay once.
Current revision: wire-v1 teaching snapshot; no Git commit SHA asserted.
Changed files: wire.py, defective.py, tests.py, verify.py, README.md; baseline.py retained.
Unresolved: real queue durability/atomicity and production consumer compatibility.
Failed approach: event-existence assertion passed while priority was omitted.
Checks run: weak-green, corrected expected-red, repaired suite green via verify.py.
Next action: qualified reviewer inspects acceptance evidence and release assumptions;
  no production deployment authorized by these model tests.

B.8 Agent-diff read order (one-pager)

1 BEFORE THE CODE
  Diff-stat against the request or plan. Ask why unexpected files changed.
2 TESTS FIRST
  Read what they assert, not whether they pass. A test written from the code
  agrees with the code; the assertion must come from the intent.
3 BOUNDARIES
  Check the team's written rules (AGENTS.md forbidden patterns, layer
  conventions). A crossing looks clean in fluent style.
4 NEW NAMES
  Grep every API, function or config key you do not recognize. No hits: the
  name may not exist.
5 LINE BY LINE
  Only now, for business correctness and architectural fit. Agent reviews, if
  used, supplement the normal human review.
OPTIONAL COMPREHENSION CHECK
  For consequential or unfamiliar work, ask about edges, ownership and failure
  modes if normal review has not established understanding. Resolve gaps before approval.

B.9 Model, harness and skill evaluation checklist (one-pager)

Run it after a model, harness or skill change, and when results deteriorate. It is not a ninth kill signal: check whether the workflow still helps in the current configuration. A model migration also needs the compatibility checks below.

BASELINE
  Choose representative tasks and fix acceptance criteria before running them.
  Include cases where an optional skill should remain inactive.
  Record the models actually used (not only the picker label when routing is on),
  effort, harness/workflow versions, sign-in surface and plan, starting commit,
  permissions and persistent-memory state. Fresh sessions start from equivalent
  saved state.
COMPARISON
  Compare the current and candidate configurations on matched tasks; document
  what changed. For an optional skill or plugin, compare native execution with
  it on/off within each model: same effort, commit, permissions and criteria,
  fresh sessions. Repeat enough to see variation; do not select only the best run.
MEASURES
  Correctness, requirements met and regressions, not process compliance alone.
  Total billed usage including cache and subagents; elapsed time, human review
  and rework. More tool calls or tokens do not automatically mean more value
  or the same percentage increase in the bill.
PROMPTS AND INSTRUCTION FILES
  Read the model guide. Re-test emphatic rules, delegation and verifier prompts;
  try retiring redundant instructions while preserving local constraints and
  security controls. Audit skill triggers and over-prescription.
  Verify instruction discovery and precedence (B.2); do not assume AGENTS.md
  or CLAUDE.md loads the same way in a new client. Confirm when an edit takes
  effect: Codex builds its instruction chain at start, so restart to reload.
MIGRATION COMPATIBILITY
  Remove API parameters the new model rejects; check supported output formats.
  Where effort controls exist, compare levels by task or phase; names do not
  transfer between models. Keep the current setting as a comparison baseline.
  Re-test custom tool schemas, including strict decoding where supported;
  check schema limits and count visible tools. Verify the client's requirements
  for history and compaction, then compare outcomes, cache use and billed cost.
DECISION
  Retain, simplify, restrict to particular tasks or manual invocation, or disable
  the optional workflow according to observed value. Record versions and the
  comparison's limits. Keep a tested fallback for a model retired from your plan. If results still deteriorate, revisit Chapter 8's signals.

B.10 Plugin vetting checklist

The marketplace is a supply-chain surface like npm. Vet each plugin as you would a dependency, then ask whether it improves the work. Superpowers is an optional candidate, not a prerequisite for this manual.

MAINTAINER
  Active in the last 90 days? More than one maintainer? A real track record?
PERMISSIONS SURFACE
  Which tools, hooks, file paths and network calls does it add? Broad requests
  need a reason. MCP annotations (read-only, destructive) are claims, not
  controls; trust them only as far as you trust the server.
CODE REVIEW
  Read the installed version's instructions, tools and hooks before adoption.
  Allow time for its actual scope; read the diff on updates.
UPDATE DISCIPLINE
  Pin the version; no auto-update. Read the diff, run the tests, ship the bump
  as a reviewed change.
BLAST RADIUS
  Inside the sandbox is bounded; a hook on the developer's machine outside it is
  unbounded. Prefer bounded; else raise the bar on everything above.
VALUE
  Compare plugin on/off on representative work, including tasks where it should
  stay inactive. Fix acceptance criteria before running either arm.
  Same model, effort, starting commit and permissions; fresh sessions. Repeat
  enough to see whether the result is stable, not one lucky run.
  Compare success and regressions, total billed usage including cache/subagents,
  elapsed time, human review and rework. Process compliance alone is not a win.
  Keep, narrow to manual invocation or disable according to the observed value.

B.11 Exercises

These exercises test judgment rather than document count. Chapters 2, 7 and 8 add a reproducible control record, reviewed architecture map and task-readiness worksheet. The Wire pack provides executable examples and fuller answer keys.

Chapter 1 - What an agent is

  1. Inspect two open-source coding agents: "Find context, tools, permissions / sandbox, skills, plugins, MCP, memory, effort and subagents. Cite the implementing file/module, or report absent/external/unknown. Distinguish documented claims from observed behavior."
  2. Compare the evidence. Different packaging and absent capabilities are valid findings; do not force the implementation into the framework.

Chapter 6 - AGENTS.md and context

  1. Pick a repository whose instruction file is empty, stale, or left by someone who moved on.
  2. Inspect the existing instructions and a relevant module. Ask which non-obvious conventions, commands or pitfalls an agent would otherwise miss; verify the answer against the code and a teammate's knowledge.
  3. Draft only the useful additions from B.2. Link to detailed docs rather than copying a repository map; avoid generic best practice.
  4. Compare a representative task with and without the proposed file in fresh sessions, using the same starting commit and acceptance criteria. Look at outcomes, review effort and usage, not just which answer reads better.
  5. Give it to a teammate new to the repo; their confusion is your next edit.

Find the dependency error

Proposed plan: run routing, API and audit workers concurrently; let each choose a priority representation; agree the record/default afterward. What must change?

Answer: settle the shared representation, defaults and failure policy before dependent implementation. Then use dependency-aware waves or one implementer, one writer per overlapping area, and an integration check. Independent exploration can propose alternatives earlier; it cannot silently commit conflicting contracts.

Find the inadequate assertion

The acceptance criterion requires chosen priority in the event. The test asserts only one event, its type and wire ID. What can still be wrong?

Answer: priority can be absent or incorrect. Assert its value against the selected input, demonstrate failure on the defect, then repair and rerun. Exercise all values to reject a hard-coded fix. Exact event equality can also be valid if the accepted contract requires it.

Choose the workflow size

Compare a help-text typo, a priority field crossing storage/API/audit/routing, and an unfamiliar ledger algorithm without a qualified reviewer.

Answer: the typo needs direct inspection, edit, focused verification and normal shipping. The priority change needs explicit decisions, ordered dependencies, failure/retry evidence and a production handoff. Restrict the ledger change while establishing evaluability and verification. Alternative artifacts and agent counts are acceptable when the decisions and controls are covered.