---
prompt-id: "18"
name: Phase 3 — REFINE (surgical corrections to Phase 2 code)
status: live
mcp: optional
model: Sonnet 4.6
environment: Claude Code (file modification) or Claude Desktop
inputs:
  - Phase 2 generated code
  - Drift list in format "[element]: [property] is [current] → should be [value]"
outputs:
  - Corrected code files — only the listed changes applied
chains: [10]
prereqs: ["17"]
documented-in: Ch16 — The Three-Phase Workflow
---

# Prompt 18 — Phase 3 REFINE

The third and final prompt in the Path B production workflow. Applies surgical corrections to the Phase 2 output. The discipline: change ONLY what is on the list. No refactor, no improvement, no "fix while I'm here." Each correction is in the explicit format `[element]: [property] is [current] → should be [value]`.

## When to use

After Phase 2 (Prompt 17) when visual comparison with the Figma source surfaces drift. Run REFINE per drift list, not as an open-ended polish pass.

## Output shape

The updated code file(s) with the listed corrections applied — and only those. A NOTES section may flag other issues observed but not changed.

## Chain memberships

- Chain 10 — Three-Phase Path B Workflow (step 3 of 3)

## The nuclear refinement (escape hatch)

If Claude keeps reinterpreting instead of applying exact values: paste the computed CSS from your browser's DevTools directly into the prompt and write *"Use these EXACT values, do not reinterpret."* This forces mechanical application rather than creative interpretation. Reserved for cases where standard REFINE rounds aren't taking.

## Prompt body

```
PHASE 3 — REFINE: Surgical corrections only

Apply these corrections to the code. Modify ONLY what is listed.
Do not refactor, rename, or "improve" anything not on the list.

Format: [Element]: [property] is [current] → should be [value]

Corrections:
- [element]: [property] is [current] → should be [value]
- [element]: [property] is [current] → should be [value]
- [element]: [property] is [current] → should be [value]

Rules:
1. Make ONLY the changes listed.
2. Do not refactor or improve other code.
3. Do not "fix" other issues you notice — add them to a separate
   NOTE section if they are important, but do not change them.
4. Keep all existing structure intact.
5. Return the corrected code, not a diff.

Output the updated file(s).

META-FOOTER (chain runner)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SAVE INSTRUCTION
  Overwrite the affected file(s) in output/components/.
  Keep the original file in output/components/_archive/<date>/
  if you want a rollback.

VERIFY
  Re-do the visual comparison with the Figma source. Any remaining
  drift items go into a second REFINE round, not a Phase 2 re-run.

CHAIN-STATE LOG
  Append to output/chain-state.md:
    ## Prompt 18 — Phase 3 REFINE
    Date: <today>
    Drift items applied: <count>
    Drift items remaining: <count or 0>
    Notes flagged for next sprint: <count>

HANDOFF
  "Phase 3 corrections applied. Drift remaining: <count>.
   If drift = 0: Chain 10 complete. Code is shippable.
   If drift > 0: run another Phase 3 round with the remaining items.
   After token-level changes: optionally run Chain 8 (Figma write-back)
   to sync Figma to the corrected code."
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
