AI-Assisted Coding · Midcourse projectPart 3

Study explanation · Part 03 · 11 min

The workflow loop, per feature

Branch and baseline first. Draft stories with AI and correct its assumptions. Write the mini-ADR before coding. Then build each feature as a small loop: backend, tests, frontend, verify, Break Test. Finish with the contract, a checkpoint and one focused refactor.

Listen to this lesson

Hear the lesson read aloud, with each sentence highlighted as you go.

Narrated by an AI voice.

Baseline before anything else

Run the app and the existing test suite before you change a line, and save the result. The baseline is your proof that anything failing later was caused by your change, not inherited. If something already fails, record it honestly; the brief asks for the baseline, not for a perfect starting point.

Key ideaWithout a baseline you cannot tell a regression from a pre-existing problem, and neither can your reviewer.

Stories with AI, corrected by you

Draft the user stories with AI support, then review them. AI drafts tend to assume things your repository does not do: a different field type, a status name that does not exist, filtering in the browser when the brief wants a backend change. Find those assumptions, correct them against the real code, and mark at least one per feature in your stories file. Then write the mini-ADR before coding, and keep the design small.

The small loop for each feature

Each feature goes through the same loop, one layer at a time. You verify a layer before you start the next, so when something breaks you know which layer to look at.

The per-feature small loop · Midcourse brief p. 3
  1. 1BackendModel, storage, route. Smallest change.
  2. 2TestsTargeted pytest, then the full suite.
  3. 3FrontendModal, cards, filter bar or panel.
  4. 4VerifyRun the app; watch the browser and Network.
  5. 5Break TestProve one important test bites.

Then repeat the loop for Feature 2, starting from a verified Feature 1.

One prompt, one phase

The loop only works if your prompts respect it. A prompt that asks for the backend, the tests and the UI of both features at once invites one giant patch you cannot review. Ask for one phase, name the files, state what must not change, and ask the assistant to stop. This is the Module 1 prompt-as-specification habit applied to a real codebase.

A phase-scoped prompt (study-guide illustration)Implement only the Feature 1 backend: an optional due_date on the task model and an overdue filter on the existing GET /tasks. Files: the model, storage and route modules. Do not change the frontend or tests in this phase. Keep unfiltered GET /tasks behavior identical. No new dependencies. Before editing, list the files and functions you will touch. After editing, run the existing tests and stop.

Checkpoint, then refactor

After both features, run the full behavior contract and the full pytest suite. Commit a working checkpoint. Only then do a focused refactor, and re-run the contract afterward. This is Module 3’s safe-refactor order: contract first, checkpoint second, a selected refactor third, verification after every accepted change.

Read with careThe brief says “any focused refactor”, so a refactor is expected but small. Pick one function or one block. A whole-file rewrite is the opposite of focused.

Key takeaways

  • Branch, then baseline, before any change.
  • Draft stories with AI, then correct its assumptions against the real repository.
  • Write the mini-ADR before coding; keep the design small.
  • Per feature: backend → tests → frontend → verify → Break Test, one layer at a time.
  • Contract and full suite, checkpoint, then one focused refactor and a re-run.

From the midcourse project brief (4 pages), with links back to the Module 1-3 habits it reuses.

Your study checkpoint

Ready to continue?

Mark the lesson complete once you have read it and tried its idea on something real.

Next · Part 4