Lesson 1 of 6
AI-Assisted Workflows
Plan before you prompt, then ship in small reviewable steps — agents for multi-step work, autocomplete for local edits, a human on every merge.
① Watch
Speed
📖 Read this walkthrough — every command, and why
AI-Assisted Workflows — you own the spec and the verify; the AI drafts in between
Mental model: the AI-assisted loop only works when you keep two things the model
does not own — the SPEC that defines what "correct" means, and the VERIFICATION
that proves the code meets it. The AI drafts the code in the middle. It accelerates
the typing, not the thinking and not the accountability.
The loop: spec -> AI draft -> run -> review -> integrate -> refine
You own the ends (spec, verify + integrate); the AI owns only the draft.
1 · Write a clear spec
A good spec is precise enough to test against. Ours:
isPalindrome(s): return true if the string reads the same forwards and
backwards, IGNORING case and any non-alphanumeric characters.
That single sentence pins down the signature, the inputs, and — crucially —
the two normalization rules that make the result checkable.
2 · Let the AI draft it
From that spec the model produced this real function (verbatim):
function isPalindrome(s) {
const cleaned = s.toLowerCase().replace(/[^a-z0-9]/g, '');
const reversed = cleaned.split('').reverse().join('');
return cleaned === reversed;
}
What each part does:
s.toLowerCase() honors "ignore case"
.replace(/[^a-z0-9]/g, '') strips every non-alphanumeric char
.split('').reverse().join('') reverses the cleaned string
cleaned === reversed the palindrome test itself
3 · Run it — the part the AI cannot do for you
A draft that looks right is not the same as a draft that works. We executed
the generated code against the test cases the spec implies:
isPalindrome("A man, a plan, a canal: Panama") = true (want true) PASS
isPalindrome("race a car") = false (want false) PASS
isPalindrome("") = true (want true) PASS
isPalindrome("Ab_a") = true (want true) PASS
Result: 4/4 passed. Only now is the draft trustworthy — because it was run,
not because it read well.
4 · Review + integrate
You are the reviewer who runs every change. Read the diff, confirm it matches
the spec (including the edges — empty string, mixed case, punctuation), and
only then integrate it. Keep it under source control with small diffs so each
AI-drafted change is easy to review and easy to revert.
5 · Decompose + iterate
Break work into small, clearly specified units — one function, one behavior,
one spec at a time. Then run the loop per unit:
spec -> draft -> run -> refine -> spec (next unit)
Small units keep the spec sharp and the verification cheap. A vague, giant
request forces the model to guess; a small, specified one is verifiable.
Notes:
- You own the spec AND the verify. The AI drafts; you define "correct" and you
prove it. That is what makes the loop trustworthy instead of just fast.
- Small, specified units beat one big prompt — each unit's spec is testable and
its diff is reviewable.
- "Looks right" is not "works". Always run the code before you integrate it.
- AI accelerates typing, not thinking or accountability — you stay the final gate.
Verify: run the drafted isPalindrome against its 4 cases and confirm 4/4 PASS
before integrating; if any fail, refine the spec or the draft and rerun.
Gotcha: never ship an unverified draft — a green read-through is not a green run.