LearnThatStack Ace your next interview

Agentic Coding Workflows

Commands for Claude Code 2.1, Codex CLI and Git Checked Sep 2026 21 commands

The model

  • An agent takes a goal and works in a loop. It reads the repo, edits files, runs commands, checks the output and tries again. Autocomplete only suggests text at your cursor.
  • An agent stops when its checks pass, not when the goal is met. Its summary is a claim. The diff and the test output are the evidence.
  • You write the spec and do the review. The person who submits a change owns every line of it, even the lines an agent wrote.
  • Permissions and a sandbox limit what a bad run can do. Prompt rules don't, because a model can misread them or obey hostile text in the repo.
  • Give an agent more autonomy only where a failure is small, easy to spot and easy to undo.
Youspec and reviewAgentplans and loopsSandboxbranch, shell, testsMain branchprotectedPLANtask + criteriaplan for approvalACTedit, runtest output and errorsREVIEWdiff + evidencemerge after review
The agent repeats the ACT steps until its checks pass. You approve the plan, read the evidence and merge. The agent never merges its own work.

What an agent is

the loop, the kinds of agent, and your new job

Agent or autocomplete

Say what makes a coding tool an agentIt takes a goal and loops. It edits files, runs commands and retries on failure.
Say what autocomplete doesIt predicts text near your cursor. Nothing changes until you accept it.
Say what vibe coding isAccepting AI code without reading it. Andrej Karpathy coined the term in 2025.
Tell vibe coding and agentic coding apartVibe coding is about skipping review. Agentic coding is about autonomy.

TipVibe coding suits a throwaway prototype. Keep it away from production code, private data and money.

TrapAn agent run whose diff nobody reads is still vibe coding.

Five kinds of coding agent

Name the agent that works in your editorAn IDE agent, like the one in Cursor or GitHub Copilot.
Name the agent that works in your shellA terminal agent, like Claude Code or Aider.
Name the agent you hand a task to and check on laterA cloud agent, like OpenAI Codex cloud or Google Jules.
Name the agent that turns an issue into a PRAn issue-to-PR agent, like GitHub Copilot cloud agent.
Name the agent that runs on an event or a timerA CI or scheduled agent, like the Claude Code GitHub Action.

TipOne product often covers several kinds. Compare where it runs, what it may touch and how much supervision it needs.

How your job changes

Say where a developer's time goes nowLess typing. More writing specs, reviewing plans and diffs, and designing checks.
Keep your skills sharpCode and debug by hand now and then. Explain agent code without the agent's help.

TipKeep tasks that teach juniors the basics. Don't hand every small task to a model.

TrapYou still need to read code well. You can't catch a wrong API or a weak test you don't understand.

Spec & size the task

tell the agent what done means

Write a task spec

GOAL Rate-limit POST /loginACCEPT 11th try in 60s gets a 429VERIFY npm test test/login.test.jsFILES src/routes/login.js onlyFOLLOW the pattern in signup.jsNON-GOALS new dependencies, other routesIF UNSURE stop and ask
List what a spec holdsThe outcome, key files, edge cases, limits, non-goals and the checks to pass.
Show the code style you wantPoint to a current example in the repo instead of listing rules.

TrapLeave out non-goals and the agent may refactor code you never asked it to touch.

Acceptance criteria

Say what acceptance criteria areObservable conditions that must hold at the end. They tell the agent when to stop.
Make a criterion the agent can checkTie it to a command, a test or an output it can inspect.
Rewrite "improve the parser""Reject an unterminated quote and keep quoted commas."
Add negative criteriaNo new dependency, no schema change, no change to the public API.

TipThe agent gathers the evidence. A person still judges whether the work is complete and safe.

Trap"Clean" and "fast" can't be checked. Give a threshold the agent can measure.

Size the task

Size a task for one agent runOne outcome, a few files, and a check that runs in one session.
Split a multi-day projectSettle the design with people, then split along stable interfaces.
Keep a task for yourselfWhen requirements are open, you can't check success, or it needs human judgment.

Trap"Modernize the platform" is too big. Run a discovery task first, then delegate the pieces.

Plan & supervise a run

approve the plan, then watch and steer

Plan, act, review

Name the three steps of the loopPlan the work, act on one bounded step, review the result against the criteria.
Start Claude Code in plan modeclaude --permission-mode planIt reads and proposes, but edits nothing.
Say what a good plan coversAssumptions, interfaces, risks, files to change, checks and rollback.
Fix a plan before you approve itMake the product calls yourself. Correct the scope and cut unsafe steps.

TipKeep plans light for small tasks. Add detail as the impact and the risk grow.

TrapAn approved plan can still be wrong. Check each result against it as the run goes.

Supervise and steer

Say what supervising an agent meansWatching its direction and evidence, not only its last message.
Say what needs your attentionWrites, network calls, new dependencies, destructive commands and design calls.
Know when to stop a runWhen it repeats a failure or leaves its scope. Press Esc in Claude Code.
Correct it mid-task without losing progressPause at a stable point. Say what's wrong, and have it restate the plan.

TipProgress is the verified state of the repo, not the length of the chat.

Trap"Try again" changes nothing. Give it concrete evidence or a corrected constraint.

Permissions & sandboxes

limit what an agent can touch

Approval gates and permission modes

Say what an approval gate doesIt pauses the agent and shows the exact action and what it can affect.
Name actions that always need a gateOut-of-scope writes, installs, network, secrets, prod and destructive commands.
Accept file edits without askingclaude --permission-mode acceptEdits
Run Claude Code in YOLO modeclaude --dangerously-skip-permissionsNo approval prompts at all.
Let Codex edit files, ask before leaving the sandboxcodex --sandbox workspace-write --ask-for-approval on-request
Turn off Codex's sandbox and promptscodex --yolo

TipToo many prompts train people to click yes. Let low-risk actions run without asking.

TrapUse YOLO mode only in a throwaway container with no real credentials and little network access.

Allowlist in .claude/settings.json

{"permissions": { "allow": ["Bash(npm run test *)"], "ask": ["Bash(npm install *)"], "deny": ["Bash(git push *)", "Read(./.env)"]}}
Say which rule Claude Code checks firstdeny, then ask, then allow. Anything unmatched asks you, except reads and searches.
Allow tools for one headless runclaude -p "fix the test" --allowedTools "Bash(npm run test *)" "Edit"
Keep out of every allowlistShells, interpreters, network tools, installers, secrets and prod commands.

TrapA rule that looks narrow can leak. Allow bash or python and the agent can run anything.

Sandbox the agent

Name the ways to sandbox an agentA container, a VM, or an OS sandbox like Seatbelt on macOS or bubblewrap on Linux.
List what a sandbox should limitFiles, processes, network, environment variables, CPU, memory and run time.
Say what prompt injection isHostile text in code, issues, docs or tool output that tries to steer the agent.
Contain a prompt injectionTreat what the agent reads as data. Enforce permissions outside the model.

TipLimit the network too. Without that, a hijacked agent can send out files like your SSH keys.

TrapA sandbox limits the damage. It doesn't make the code correct, so the diff still needs review.

Worktrees, branches & merges

run agents side by side and merge their work

One worktree per agent

.git../auth../cart../docsagent/authagent/cartagent/docs
worktreesOne .git holds every commit. Each agent gets its own folder, on its own branch.
Give an agent its own folder and branchgit worktree add ../auth -b agent/auth
Remove a worktree after the mergegit worktree remove ../auth
Remove one that has uncommitted editsgit worktree remove --force ../auth

TipGit won't check out a branch that another worktree already has, so two agents can't share one.

TrapAgents in separate worktrees still share ports, databases, caches and credentials. Give each its own.

Branches and commits

Start a task branch from a known basegit switch -c agent/issue-42 origin/main
Save a checkpoint before a risky stepgit add -Agit commit -m "checkpoint: tests pass"
Squash checkpoints before reviewgit rebase -i origin/main
Write the commit messageExplain what the change is for, as in any other commit.

TrapLook for unrelated cleanup, generated files or dependency bumps hidden in one big commit.

Merge parallel work

Split work so agents don't collideOne module per agent, a shared base commit and agreed interfaces.
Pick the merge orderFoundation first. Then rebase the others and rerun their checks.
Resolve a semantic conflictGo back to the spec. Don't just keep both versions.
Run several agents on one problemOnly for independent tasks with clear outputs. One coordinator merges the results.

TipTightly coupled work is often faster done in sequence than by parallel agents and a hard merge.

TrapSeparately correct branches can break each other. Run integration tests after each merge.

Cloud & CI agents

hand off a task and review what comes back

Issue to pull request

Say what a background agent isIt runs in an isolated environment and returns a branch or PR.
Hand an issue to Copilot cloud agentAssign it to Copilot. It pushes to a copilot/ branch and opens a draft PR.
Ask Copilot for changesMention @copilot in a PR comment.
Run CI on Copilot's PRBy default, someone with write access must approve the workflow runs.

TipThe issue is the spec. Give it a clear description and acceptance criteria.

TrapThe agent never merges its own PR. Branch protection and code owners still apply.

Cloud agents

Use a cloud agent day to dayHand off a bounded task and review it later.
Say what Codex cloud and Devin hand backCodex cloud returns a diff to open as a PR. Devin leaves a draft PR.
Say how Google Jules starts a taskIt shows a plan to approve before it changes code.

TrapTreat its PR like one from an outside contributor. Read every change and rerun trusted checks.

Agents in CI and on a schedule

Cap the spend of a headless runclaude -p "<task>" --max-budget-usd 5
Run Codex without its interactive UIcodex exec "<task>"
Pick jobs for a scheduled agentDependency bumps, flaky tests and doc checks.
Lock down each runShort-lived tokens, limited network, cost caps.

TrapKeep scheduled agents off production fixes and vague features. A human reviews before any merge.

Review & verify

check the work, not the agent's summary

Review an agent's PR

Say what green CI provesOnly that the configured checks passed. They may miss what you asked for.
List the files the agent changedgit diff --stat main...HEAD
Check an API you don't recognizeLook it up in the official docs. Invented names look plausible.
Know who answers for the codeThe person who submits it. You can't question the agent like a colleague.

TrapAn agent can weaken a test or update a snapshot to turn CI green. Review test changes with extra care.

Catch fake success

Say what reward hacking isPassing the check without reaching the goal.
Spot the usual tricksDeleted tests, weaker assertions, hard-coded outputs, edited CI config.
Diff only the test filesgit diff main...HEAD -- '*test*'
Search the code for skipped tests and TODOsgit grep -nF -e '.skip(' -e '.only(' -e TODO
Decide if the work is really doneCheck it against your own list of files, tests and behavior, not its summary.

TrapTelling the model not to cheat barely works. In METR's tests it hardly changed how often models did it.

Tests as guardrails

Start from tests a human reviewedCover the expected behavior, the boundaries and the failures.
Stop the agent editing the testsMake test files read-only for the task. Gate snapshot and CI changes.
Check the tests catch real bugsnpx stryker runMutation testing breaks the code on purpose. Good tests fail.

TrapA test guards nothing if the agent can edit, skip or delete it without approval.

Verify beyond the tests

Run the real pathUse it as a user would. Check the logs, the data and the API responses.
Add checks for a risky changeStatic analysis, dependency review, security tests and a preview environment.
Spot a plausible-but-wrong fixIt checks identity but not permission, or treats a timeout as an empty result.
Catch one before it mergesReproduce the bug and write a failing test before the fix.

TrapPlausible-but-wrong fixes compile and pass tests but solve a different problem. Polish lowers your guard.

Fix a run gone wrong

loops, scope creep and long tasks

Stuck repeating a fix

Say why an agent loopsA wrong hypothesis it won't drop, an error lost in a long context, or missing facts.
Break the loopStop it. Say what failed and why, then ask for hypotheses and a test to pick one.
Drop its edits since the checkpointgit reset --hard <checkpoint>
Stop the next loop soonerSet retry and cost limits, so a loop ends on its own.

TrapMore retries add cost and confusion, not progress. A polluted session needs a fresh start.

Scope creep

Say what scope creep isThe agent changes more than the task needs, like refactors or dependency bumps.
Prevent scope creepAllowed files, explicit non-goals, a small diff budget and a reviewed plan.
Undo its edits to one filegit restore --source=main -- <file>

TrapUseful extras still make the change harder to review. Have it list side issues, not fix them.

Long tasks and handoffs

GOAL rate-limit POST /loginDONE middleware and tests, a1b2c3dDECIDED in-memory store, no RedisREJECTED per-IP limit, breaks on proxyVERIFY npm test test/login.test.jsNEXT add the Retry-After header
Say why agents degrade on long tasksThe context fills with logs and failed attempts, so it forgets constraints.
Say what context compaction doesIt swaps the history for a short summary. Exact errors and reasons can get lost.
Say where the handoff goesIn a file outside the chat, with the work committed.
Start the next sessionHave it read the note, check the repo and restate the constraints.

TipThe repo and its tests are the source of truth. A summary only points to them.

TrapWrite down the approaches that failed, or the next session will try them again.

Cost & team policy

budgets, autonomy, review load and incidents

Cost and payoff

Pick the model for a taskFast and cheap for routine edits. Strong for hard planning and debugging.
Cut the cost of each runNarrow tasks, lean rules files, filtered tool output and capped retries.
Say when delegation pays offWhen the task is costly by hand, easy to specify and cheap to verify.
Measure the payoffPilot on comparable work. Count spec, review and rework time, not lines generated.

TrapA cheap model that fails again and again can cost more than one careful run on a strong one.

Match autonomy to risk

Score a task's riskImpact, reversibility, visibility, data sensitivity, novelty and test strength.
Run a low-risk taskThe agent edits and runs checks on its own, in a sandbox.
Run a medium-risk taskYou approve its plan, it writes only in scope, and you review the PR.
Run a high-risk taskThe agent only researches or drafts. People build and release it.
Set a team's default permissionsRead-only, then scoped writes in a sandbox. Named people approve risky actions.

TrapRaise autonomy only after repeated success on similar tasks. No model earns trust everywhere.

Review at team scale

Label agent-written PRsWhere policy asks or it helps reviewers. The label never lowers the bar.
Prove more by machineStrong types, focused tests, static analysis and codemods for repeated edits.
Use a review botAn independent check for risky code and missing tests. People still approve.
Measure agent quality across a teamRerun a versioned set of real tasks. Track defects, retries, cost and review time.

TrapScaling review doesn't mean skimming faster. Let agents produce only what reviewers can clear.

Repo, pipeline and incidents

Give agents the house rulesPut build, test and lint commands in AGENTS.md or CLAUDE.md.
Make a repo agent-readyClear module names, typed interfaces, fast tests and no dead examples to copy.
Name the stages of a delegation pipelineIntake, execution, review and release, tuned from rework and incident data.
Run a post-mortem on an agent's changeBlameless, like any incident. Ask why each control let it through.

TrapThe model is never the root cause. Fix the spec, permissions, tests or review that missed it.

Found this useful? Pass it on.
Pro · $10/mo

This sheet stays free. With Pro, you can:

  • Every answer on this sheet. Read the full answer to all 51 questions it links, not just the 7 free ones.
  • My sheet. The cards you star and the ones you miss in Quiz me, from every sheet, on one page to quiz and print.
  • PDFs. Download this sheet and My sheet, laid out for A4, with every question a link to its answer.
  • The rest of Pro. Every answer in the question library, and 1,000 AI credits a month.