Kousigan A

Category

31 posts

AI Coding

This is where I write about working with AI coding assistants every day: the prompts I use, the rules files and memory that keep an assistant on track, and MCP servers, skills and sub-agents. Every post links the official docs it relies on and says when they were checked; where I tested something myself, the post says which tool and version.

New to a term? The glossary explains it in plain English

read these first

Start here

  1. Deep 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.

  2. Deep 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.

  3. Deep 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.

newest first

All posts

  1. Deep 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.

  2. Deep 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.

  3. Deep 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.

  4. Deep 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.

  5. Deep 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.

  6. Deep 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.

  7. Deep 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.

  8. Deep 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.

  9. Deep 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.

  10. Deep 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.

  11. Deep 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.

  12. Deep 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.

  13. Deep 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.

  14. Deep 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.

  15. Deep 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.

  16. Deep 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.

  17. Deep 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.

  18. Deep 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.

  19. Deep 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.

  20. Deep 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.

  21. Deep 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.

  22. Deep 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.

  23. Deep 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.

  24. Deep 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.

  25. Deep 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.

  26. Deep 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.

  27. Deep 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.

  28. Deep 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.

  29. Deep 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.

  30. Deep 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.

  31. Deep 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.