Skip to content
KoishiAI
ไทย
← Contents

Chapter 12 of 12 · Agentic Engineering — A Practitioner Playbook for Production Software with AI Agents

Appendix — Checklists and Anti-patterns

A one-time project setup checklist, a checklist before every merge, the twelve anti-patterns that come up most with their remedies, and the whole playbook condensed into a single page of principles.

12.1 Project setup checklist (once)

  • AGENTS.md with a CLAUDE.md symlink — no more than 150 lines
  • A NEVER section, every item carrying its reason
  • scripts/verify.sh that actually runs and is fast enough (under 10 minutes)
  • scripts/verify-fast.sh for use inside the loop (under 60 seconds)
  • scripts/check_no_cheating.sh
  • A PreToolUse hook blocking dangerous commands and gate evasion
  • A PostToolUse hook that auto-formats
  • memory/pitfalls.md and memory/decisions.md (they may start empty)
  • docs/specs/ with a template
  • .github/PULL_REQUEST_TEMPLATE.md with a required blast-radius field
  • CODEOWNERS protecting the important files
  • CI running the same verify.sh as local
  • A feature flag system that can disable instantly
  • Guardrail metrics wired to automated rollback
  • One skill for the team’s most repeated task
  • docs/secrets-registry.md holding names only, no real values
  • gitleaks in pre-commit and as the first stage of verify.sh
  • Not a single production credential on a dev machine

12.2 Checklist before every merge

  • verify.sh green, with the real output attached to the PR
  • Tests written from the spec, not the implementation — verify by deleting the main logic; the tests must go red
  • Every rejection case from the spec covered, not just the happy path
  • No out-of-scope files touched
  • No newly added skip / xfail / noqa / type: ignore without a reason
  • The test count has not fallen
  • Blast radius filled in, and the rollback plan is realistic
  • For L3 and above: a feature flag and shadow mode exist
  • Migration is reversible, and up-down-up has been tested
  • No more than 400 changed lines
  • A commit trailer recording AI provenance
  • gitleaks green, and no credential in a fixture, snapshot or comment

12.3 The twelve most common anti-patterns

Anti-patternWhy it fails, and the remedy
One six-hour sessionContext degrades and the agent starts contradicting its own earlier work → close the session at each completed subtask, keeping state in files
A 600-line AGENTS.mdThe agent skims the middle → cut to 150 lines and move detail into skills
The same rule in three filesWithin two weeks the three disagree → one source, the rest symlinked or referenced
Letting the agent write tests after the implementationThe tests confirm what the code does, not what it should do → enforce RED first, always
Raising the loop ceiling when it will not passThe problem is the spec, not the round count → stop at three and fix the spec
An LLM judging inside the gateUnstable results, and the team learns to re-run until green → gates must be deterministic
Accepting “the tests pass”Very often the agent did not run them → require the real output, without exception
A 2,000-line PR from an agentNobody genuinely reviews it, and people approve on a glance → a 400-line ceiling enforced by CI
Installing forty MCP serversThe agent picks the wrong tool and the context fills → 5–15 that are genuinely used; the rest become scripts
Believing text in an issue or on a pageA working prompt-injection path → tool output is data, never instruction
Shipping faster without detecting fasterThe gap between shipping speed and detection speed is where users get hurt → add guardrails before adding speed
Keeping real keys in a .md and relying on agent permissionsThe denylist operates at the tool layer, not the OS, and a value in context has already left the machine → store names, inject at runtime
No owner on a PR”The agent wrote it” is not an answer when production breaks → a human is fully accountable for every PR

12.4 Every principle, on one page

  1. Correctness comes from the machine, not the model — every claim needs an artifact behind it
  2. State lives in files, not in context — a fresh session must continue from reading the repo
  3. Work must be small enough for the loop to close — if it will not close in three rounds, the problem is the spec
  4. Every loop has a ceiling and a stop condition — including detection of no progress
  5. The gate must be deterministic and hard to game — an easily gamed proxy will be gamed
  6. Tests are what a human reads line by line, not the implementation
  7. Shipping speed must be matched by damage-detection speed
  8. Humans own three things, always: the spec, the acceptance criteria, and the approval to go to production
  9. The agent should never see a secret’s value — it knows the name; the value is injected at runtime

This series is a set of practices, not a fixed standard. Adjust the numbers — the loop ceiling, PR size, thresholds — to your team’s context and your system’s risk. What should not be adjusted is the nine principles above.