Refactor, Verified

Claude Code changes the repository. Cowork inspects the browser. Vercel previews stage every result. A practical walkthrough of the division of labor — plan mode gates, runtime boundary mapping, the four-command gate (lint, type-check, test, build), and why --dangerously-skip-permissions belongs in a worktree, never…

5:23 video6 min readWatch on YouTube

Refactor, Verified

Claude Code changes the repository. Cowork inspects the browser. Vercel previews stage every result. A practical walkthrough of the division of labor — plan mode gates, runtime boundary mapping, the four-command gate (lint, type-check, test, build), and why --dangerously-skip-permissions belongs in a worktree, never on main.

Chapters: 0:00 Intro 0:15 What Claude Code does 0:42 The boundary problem 0:57 Act II: The Map 1:21 Layer stack 2:19 Act III: The Gate 2:25 The four-command gate 2:38 local ≠ deployed 3:32 Cowork QA checklist 4:16 --dangerously-skip-permissions 4:32 Verdict 4:52 Your turn

Every claim in this video was fact-checked against the source chapter and primary sources before rendering.

youtube.com/@NikBearBrown

What this video covers

  • 0:00 — Intro
  • 0:15 — What Claude Code does
  • 0:42 — The boundary problem
  • 0:57 — Act II: The Map
  • 1:21 — Layer stack
  • 2:19 — Act III: The Gate
  • 2:25 — The four-command gate
  • 2:38 — local ≠ deployed
  • 3:32 — Cowork QA checklist
  • 4:16 — dangerously-skip-permissions
  • 4:32 — Verdict
  • 4:52 — Your turn

Transcript

A lightly formatted transcript of the video, with timestamps so you can jump to any section on YouTube.

Intro

[0:00] An Nyeong, this is Liam in for Bear. Today's ask, a live Versel site needs cleaning up. Who does it, Claude code or Cowork? That's the wrong question. The right question is which execution environment owns which half of the job. Get that split right and the refactor is boring in the best way.

What Claude Code does

[0:15] Act one, the split. Claude code lives where your repository lives. It reads the code base, edits files, runs commands, and holds project memory in Claude.md files that load every session. Cowork is the opposite shape, a remote agent in an isolated environment. It keeps working after you close the laptop, reaches your files and browser through the desktop app, and speaks to drive, SharePoint, and email through connectors. Outcome oriented, not repo-centric. One update to the old folk

The boundary problem

[0:43] Wisdom, the boundary is no longer code versus visual. Claude code has a browser now, a preview pane in the desktop app, and Claude in Chrome for real click-through verification. Visual QA stopped being Cowork's exclusive territory. Act two, before anyone edits

Act II: The Map

[0:58] Anything, the map. A Next.js app is full of boundaries that carry runtime meaning, and a cleanup that ignores them breaks things without an obvious diff. The opening move is plan mode. Claude reads files and runs exploration commands, but edits nothing until you approve the plan. Reconnaissance and execution get separated by a gate you control. No prompt gymnastics required. The audit

Layer stack

[1:21] Maps four layers, server versus client component boundaries, edge versus node runtimes, redirects, rewrites, and the proxy file, and every place the code reads an environment variable. Those are the load-bearing walls. Here's the silent failure. One casual use client on the wrong component, one node-only import in an edge path, one fetch moved out of its caching layer, and behavior changes while the diff looks like housekeeping. Style-only refactors are how production breaks politely. And a 2026 wrinkle, in Next 16 middleware was renamed proxy, and Next lint is gone entirely. An audit that greps for yesterday's file names misses today's routing truth. Check proxy.ts legacy middleware, the config rewrites, and versal.json. For big repos, scope is the safety feature. Per directory claw.md files, deny rules on generated code, and work trees so each session gets its own branch back checkout. The agent only loads the conventions for the part of the tree it touches.

Act III: The Gate

[2:19] Act three, the gate. Every refactor phase ends the same way, and none of it is optional.

The four-command gate

[2:25] Because next one is gone, the gate has to be explicit four commands run in order. Yes lint through the CLI, type script with no emit, the tests for the area you touched, and a full production build. A phase that hasn't passed all four hasn't happened. One more layer of

local ≠ deployed

[2:39] Honesty, local next is not versal. If the refactor touches request time behavior, pull the project's environment down with versal pull, and rehearse with versal dev. Environment drift is a bug you can subtract before it exists. Act four, versal already assumes the workflow you want. Push a branch, get a preview deployment with its own URL. The platform stages every change in a live setting before production is ever at risk. Lean into that, never skip from local edits to main. Add deployment checks so promotion has conditions, not vibes. If the refactor deserved an agent, it deserves a release gate stronger than merge when it looks okay. And the trap nobody budgets for, protected previews. If the preview URL sits behind authentication and you point an agent at it, the agent faithfully verifies your login wall. Give it a deliberate path in, a bypass built for automation, or the QA report is fiction.

Cowork QA checklist

[3:32] Act five, now Cowork earns its half. Hand it the production URL, the preview URL, and a bounded checklist of pages and flows. It clicks through both, collects the screenshots, and comes back with evidence while your terminal session doesn't even need to be open. When outside systems are involved, Cowork has a documented priority order. Connectors first, browser second, screen interaction last. Design references in Drive or SharePoint come through connectors, not through brittle clicking. That errand never belonged in your Git loop anyway. And the loop closes cleanly. When Cowork finds a regression, it doesn't fix code. It writes the finding and the fix routes back to Claude code as a scope task on the same branch. Code changes the repository, Cowork gathers the evidence. Nobody freelances.

dangerously-skip-permissions

[4:16] Last judgment call, dangerously skip permissions is exactly what it says. Reserve it for box disposable environments and even there pair it with work trees, throwaway branches, frequent commits, and a hard rule, never on main. The better the guardrails get, the less you should need the bypass. Let's recap

Verdict

[4:33] With Claude. Claude code changes the repository, plan mode first, scoped memory, one bounded phase at a time. The four command gate ends every phase because Next.js gone and vibes are not a check. Vercel preview stage the result behind real URLs and real checks. And the browser, Claude's own or Cowork's, is the only witness that counts for what users actually see. Your turn. Here's

Your turn

[4:53] The prompt word for word. You are in a Git tracked Next.js repo deployed on Vercel. Audit first, no edits, map the routing, server versus client boundaries, runtimes, proxy and rewrites, and vars and data fetching. Then propose a phased refactor plan where every phase ends with lint, type check, tests, and a production build. That audit first clause is the leash and the phase gate clause is the seat belt. Run it on your messiest repo and read the audit before you let it touch a file. Refactor verified, Liam in for bear.

More from Claude Code & Agentic Development

Nik Bear Brown Poet and Songwriter