Kousigan A

Series

31 parts

AI-Assisted Engineering

A working guide to AI coding agents: set up the project, plan, check, secure, review and release, then build AI features with evals and RAG.

For developers who already use a coding agent, such as Claude Code, GitHub Copilot, Cursor or Codex, and want it to do reliable work.

New to coding agents? Part 2 is the gentlest start: one task, from plan to check. Each part is based on the tools' official docs and says when they were last checked.

Start with part 1

Parts 1 to 5

Coding agent foundations

For developers starting to work with a coding agent day to day.

  1. part 1Deep dive10 min

    Beyond AGENTS.md: the six layers of a coding agent project

    How to structure an AI coding agent project beyond one instructions file: rules, skills, sub-agents, MCP, project docs and checks, plus three prompts.

  2. part 2Deep dive9 min

    Don't let your coding agent code first: plan, then approve

    A coding agent workflow with a stop before any code: investigate, plan, approve, implement and verify, plus the plan modes of seven agents.

  3. part 3Deep dive12 min

    Skills vs agents vs MCP: one rule, six coding tools mapped

    One rule for when to use a skill, sub-agent, MCP server or hook, and a table of where six coding agents keep each one, from their official docs.

  4. part 4Deep dive11 min

    "Looks good" isn't evidence: how to verify AI-generated code

    AI-generated code is not done when it compiles. Check the requirement, the diff, tests and static checks, and get a review from outside the model that wrote it.

  5. part 5Deep dive9 min

    Not every repeated prompt deserves an agent skill

    How to tell which repeated coding agent work deserves a skill, what a good SKILL.md holds, and how to keep it from going stale, with two prompts to copy.

Parts 6 to 10

Security and quality

For anyone giving an agent real access: permissions, untrusted input, quality gates. Team leads start here.

  1. part 6Deep dive14 min

    Coding agent permissions: five boundaries a prompt can't set

    Least privilege for AI coding agents: scope files, commands, network, secrets and actions, see what six agents document, and audit access with one prompt.

  2. part 7Deep dive11 min

    A README can give your coding agent orders you never wrote

    How prompt injection reaches a coding agent through README files, issues, comments, logs and tool output, and how to limit what an injected instruction can do.

  3. part 8Deep dive11 min

    Coding agent fixes can break callers: map the system first

    Before a coding agent edits code that crosses files, have it map entry points, call paths, data flow, boundaries and callers, with a file cited for every claim.

  4. part 9Deep dive10 min

    Make a coding agent prove its fix before you accept it

    Get evidence before you accept a coding agent's fix: a reproduction, a failing test that passes after the fix, one hypothesis at a time and a two-attempt limit.

  5. part 10Deep dive13 min

    A checklist the agent can skip: turn it into quality gates

    Turn your definition of done into gates that block: agent hooks, pre-commit, required CI checks and rulesets, and which failures still need a person.

Parts 11 to 15

Review and delivery

For developers shipping agent-written code: review, dependencies, parallel work, context, release.

  1. part 11Deep dive12 min

    How to review AI-generated code in risk order: seven passes

    Review AI-generated code in risk order: the requirement, the diff, risky areas, callers, tests and side effects, then a slow read where risk is highest.

  2. part 12Deep dive9 min

    Coding agent dependencies: check the name before you approve

    Before a coding agent adds a package, check it is needed, exists under that exact name, and what its licence, upkeep, install scripts and lockfile diff bring.

  3. part 13Deep dive11 min

    Parallel coding agents clash over files: split by ownership

    Parallel coding agents only pay off when tasks are separate, so split work by owner, agree the interface first, use one worktree each and merge one at a time.

  4. part 14Deep dive12 min

    Coding agent context fills up: put constraints in a file

    Context engineering for coding agents in a long task: what fills the window, what survives compaction, when to clear, and a handoff note to copy.

  5. part 15Deep dive11 min

    Releasing AI-generated code: the agent prepares, you approve

    A release process for AI-assisted software: what a coding agent may prepare, what a person must authorise, and where flags, canaries and rollback fit.

Parts 16 to 19

Software engineering discipline

For keeping changes small, data safe, APIs stable and speed measured.

  1. part 16Deep dive10 min

    AI coding agent scope creep: keep the fix, list the cleanup

    Keep a coding agent to the task: state the scope and non-goals, back them with edit settings, spot unrelated edits and split the cleanup off.

  2. part 17Deep dive11 min

    AI-generated database migrations meet real rows and old code

    How to review a database migration a coding agent wrote: existing rows, old code still running, PostgreSQL locks, and what a rollback cannot bring back.

  3. part 18Deep dive11 min

    API breaking changes from AI code: guard the contract file

    Guard against API breaking changes in AI-written code: protect the OpenAPI file, diff it on every pull request, test consumers, deprecate before removing.

  4. part 19Deep dive9 min

    An AI speed-up claim is a prediction until you measure it

    Check a coding agent's claim that code is faster: a baseline, a realistic workload, a profile, repeated runs, latency percentiles and memory use.

Parts 20 to 25

Production AI engineering

For running AI features in production: threat models, tracing, cost, decisions, boundaries.

  1. part 20Deep dive10 min

    Threat model an LLM feature before you give it tools

    Threat model an LLM feature: map trust boundaries, run STRIDE, check the OWASP 2025 LLM risks, and keep authorisation in the tools and the data layer.

  2. part 21Deep dive10 min

    LLM observability: trace every step, prompts off by default

    Trace an LLM feature in production with OpenTelemetry: one trace per request, the fields to record, and the prompts and secrets to keep out.

  3. part 22Deep dive12 min

    Failed attempts burn tokens too: measure LLM cost per task

    Measure AI usage as cost per successful task: what drives the bill, prompt caching, model choice, batch APIs, budgets, and usage commands in five coding agents.

  4. part 23Deep dive11 min

    Coding agents forget the why: architecture decision records

    Write architecture decision records a coding agent can use: the parts to include, where to keep them, how to supersede one, and a prompt to check a plan.

  5. part 24Deep dive11 min

    Coding agents can cross module boundaries: make a check fail

    Give coding agents module boundaries a tool can check: a public surface, one dependency direction, owners in CODEOWNERS and folder-scoped instructions.

  6. part 25Deep dive9 min

    Six engineering decisions to keep human with AI agents

    See which engineering decisions stay human when a coding agent writes the code, how to sort them by reversibility and reach, and what the agent prepares.

Parts 26 to 31

Advanced AI application engineering

For building AI features: evals, model routing, structured outputs, RAG, agent state, feedback loops.

  1. part 26Deep dive13 min

    Unit tests miss LLM output that varies: build an eval suite

    Build an eval suite for an LLM feature: real and edge-case inputs, a grader per property, several runs per case, and a rerun on every prompt or model change.

  2. part 27Deep dive12 min

    LLM model routing: test on evals, pin it, fall back safely

    Choose an LLM per task with your own eval set, route by task type, classifier or failed check, keep fallbacks on the same contract, and pin versions.

  3. part 28Deep dive10 min

    Valid JSON, wrong values: validate LLM structured outputs

    Get reliable JSON from an LLM: structured outputs or strict tool calling, Pydantic validation, refusals and cut-offs, bounded retries and schema versions.

  4. part 29Deep dive14 min

    RAG retrieval: get the right chunk into the top k

    Build RAG retrieval in steps: clean and chunk documents, filter by permission, use hybrid search, rerank, cite the chunk, and test retrieval on its own.

  5. part 30Deep dive10 min

    AI agent state management: resume a run without paying twice

    Design state for an AI agent you build: task state in your own store, a checkpoint per step, tool calls safe to retry, and long-term memory that expires.

  6. part 31Deep dive13 min

    LLM feedback loop: turn production failures into eval cases

    Run an LLM feedback loop: collect user feedback, read failing traces, name failure types, fix one layer, and keep each fixed failure as an eval case.