AI agent cookbook: seven recipes for daily coding work
Seven small conventions I have kept through months of daily AI-assisted work, each one short enough to copy as written.

I took the project details out of every recipe below, so what remains is the shape. Each has a when, a snippet you can use and a one-line why. These are the conventions I hand a new agent so it works the way I do from the first prompt.
Cache-bust with a blast radius
When: editing any asset served with long/immutable caching.
While a cached response is fresh, immutable caching can keep returning visitors on the old bytes. A changed URL is the reliable way to request a new version. The usual failure is a partial bump: some pages get the new version and others still point at the year-old cached copy. So list every page that references the file, then check that only one version string remains.
git grep -nF 'app.js' -- '*.html'
git grep -ho 'app.js?v=[0-9]*' -- '*.html' | sort | uniq -c
# more than one line of output = stop, you missed a page
Why: a machine can check the whole tree for a second version string, and human memory cannot.
Recompute a CSP inline-script hash
When: you changed an inline script on a page under a strict CSP.
For a hash-authorised inline script, the CSP hash must match its exact contents, including whitespace. A changed body needs a new hash in the applicable policy. Nonce-based policies use a different mechanism. Inspect the browser’s CSP errors and the effective policy, including any response headers and HTML meta policy.
printf '%s' 'exact script content' | openssl dgst -sha256 -binary | openssl base64
# → paste as 'sha256-…' into the script-src of your headers/CSP config
Why: the script never runs and nothing on the page says so. I usually keep executable JS in external files and check that the active policy permits their source; strict-dynamic and other directives can change how a source allowlist behaves.
Recover a deployed site's config from headers
When: a static site is live but the source or deployment configuration is missing.
Served files and response headers record the current deployment. They can help reconstruct the observed behaviour, but they cannot recover all build settings, environment variables, functions, redirects for untested paths or platform rules. Some CSP can also be declared in HTML.
Capture the files and headers you can enumerate:
mkdir -p assets
curl -fsS https://example.com/ -o index.html
curl -fsS https://example.com/assets/app.css -o assets/app.css
curl -sS -D response-headers.txt -o /dev/null https://example.com/
Use GET as well as any HEAD probe, inspect representative routes and redirect chains, and compare the provider’s recorded configuration or a backup. Keep a list of what remains unrecovered before replacing a live deploy. The live-truth checklist helps establish which copy owns the current result.
Why: a recovered snapshot can be a reference without being mistaken for a complete, reproducible deployment source.
Verify before you claim it's done
When: an agent (or you) is about to say "fixed".
A log with no errors looks the same when the code works and when it never ran. A health check needs a positive signal: run the real flow and look at the output. Write that into the agent's rules so it does it unprompted.
# Never claim a change works from the absence of errors. Exercise the
# actual behaviour end-to-end (load the page, hit the endpoint, run the
# flow) and show the observed result before saying "done".
Why: the most expensive bugs are the ones that looked fine because nothing complained.
Never let an agent review its own work
When: a change matters enough that a wrong "looks good" is costly.
The agent that wrote the code still has its intent in context, so it reads the code against the plan it had in mind and misses what the code does. Hand the check to a fresh agent with an adversarial brief, ideally a different one from the bench.
codex review --uncommitted
# Reviews staged, unstaged and untracked changes.
# For a custom prompt over a tracked diff:
git diff HEAD | codex exec --sandbox read-only "Review the supplied diff.
Find concrete failures and the checks that would expose them. Do not edit files."
Why: a fresh reviewer can challenge the author’s assumptions. It may still share the same blind spots, so its verdict needs concrete supporting results and does not replace the relevant tests.
Write down what a task taught you
When: a task turned up something non-obvious you'll need again.
A new session may not retain the context behind an earlier decision. The fix is a small memory folder that grep can search. It holds one fact per file, with an index line for each so the agent can find it. Entries lean towards the why and the never-again, because false alarms and rejected ideas are the most valuable ones to keep.
---
title: Capture observed deployment behaviour from live headers
type: reference
---
Live headers expose the policy served on the requested route, not the
complete host configuration. Save GET responses and redirect evidence;
recover build settings and unseen rules from the provider or a backup.
See [[cache-bust-blast-radius]].
Why: the second time a problem comes up, the fix should take minutes, where the first time cost an afternoon.
Fan out for anything site-wide
When: a check or change spans more files than one context window holds.
On a large site, "make sure every page does X" is more than one agent can hold in context. Split the job: one lightweight sub-agent per chunk of files, run in waves, and collect only the violations. The order and the merge are set in advance, and the sub-agents do the reading in parallel.
# enumerate the work, chunk it, run N sub-agents per wave,
# each returns ONLY the violations it found — then merge + de-dupe.
# wave 1: files 1–4 → [findings]
# wave 2: files 5–8 → [findings]
# ... aggregate → unique, ranked, most-severe first
Why: many small contexts work better than one overloaded context, and the fast chunks don't wait on the slow ones.
Use this

← Previous: Decision ledgers: keep the reason behind every agent rule
Want this inside your team’s workflow? The Verified AI Operations Sprint tests one workflow in ten working days. See the sprint →