2026年11月23日 星期一

先對齊,再放手|Matt Pocock 的八份文件

原文出處:Matt Pocock(YouTube)|Watch me ship a 21,000-line feature with mattpocock/skills

影片逐字稿研究 · 教學

先對齊,
再放手

Matt Pocock 交付一個 21,000 行的功能,靠的不是寫得更快,而是把「不知道」一份一份收進文件。八份文件、八次判斷——每一次,先讓你選,再看他怎麼選、為什麼。

影片 69 分鐘頻道 Matt Pocock逐字稿 2,013 行8 份文件 · 8 個判斷

這頁的主張:21,000 行是副產品。真正的工作是這八份文件——每一份收掉一種「不知道」,讓 agent 在實作時沒有東西需要自己猜。

“The more decisions you give it, the more decision space it has, the more likely it is to choose a bad one.” 45:45

怎麼用:① 先自己選一個答案 → ② 看 Matt 選什麼、為什麼 → ③ 需要驗證時展開「逐字稿原文」。和 Matt 不同不是錯,重點是理由。
DOC 01

glossary.md

收掉的不確定:這個東西叫什麼?

未面對

Matt 的 repo 有一份約 560 行的 glossary.md,定義整個系統的每個概念。它不是給人看的規格,是 agent 的上下文:diagram 是一群 diagram snapshots;snapshot 是 clip 拍攝當下的拷貝;active diagram 是正在畫的;preserved snapshot 是沒有 clip 使用也留著的。

當他把「縮圖裡的東西」放進這套詞彙,問題立刻變清楚——它不是 diagram,也不完全是 snapshot。命名的裂縫,就是資料模型要補的地方。

“The language is going to form the data model that everything else fits on top of.”

語言會形成資料模型,其他一切都在它上面長出來。

19:42 Matt Pocock

判斷 01縮圖裡放的那張圖,Matt 怎麼歸類?

不做這份的代價:名字沒定,表名、欄位、模組都得猜;下一個 session 的 agent 會用另一套詞,把同一件事重講一遍。

逐字稿原文(節錄)

10:56“a diagram is really a group of diagram snapshots, which is a copy of the diagram's drawing at the moment that a clip is filmed”

12:13“the thing we're putting into the thumbnail is not really a diagram, it's just a single snapshot”

21:36“an active diagram is a diagram, but a thumbnail diagram is not. So maybe the word diagram isn't right here.”

DOC 02

ADR

收掉的不確定:為什麼當初這樣決定?

未面對

glossary 描述「現在是什麼」,ADR 解釋「為什麼當初這樣決定」。影片裡 ADR 出現兩次關鍵作用:既有的 ADR 003(diagrams as first-class entities with per-clip snapshots)讓 Matt 知道圍籬為何存在;新的 ADR 060 則記錄「它叫 diagram,但不是 diagram」。

他對 ADR 的堅持不是形式——這是給未來 session 的投資。

“Do not remove a fence until you know why it was put up in the first place.”

不知道圍籬當初為何而立,就不准拆。— Chesterton's Fence,16:53 引述

16:53 Matt Pocock

判斷 02grilling 途中,agent 沒問你就自己寫了一份 ADR。你會怎麼處理?

不做這份的代價:六個月後只剩 code;你、你的同事、下一個 agent 都只能猜。

逐字稿原文(節錄)

16:35“the glossary kind of describes the application as it is now... the ADRs are here to explain why we made those decisions”

21:13“can you also run me through the decision to create an ADR here? Why did you decide to go for a new ADR?”

22:12“I'm investing time into this so that future runs understand the context for every decision.”

DOC 03

prototype

收掉的不確定:用起來是什麼感覺?

未面對

grilling 還沒結束,agent 已在背景做了三個 UI 變體。Matt 的實測評語很直接:A 可用(左上角小預覽、臉可左右拖);B 比想像糟——臉太大、左側多一條 view bar;C 的分割視圖「是垃圾」:左邊拖、右邊看,眼睛來回。

選 A 之後才是真正的收穫:靈敏度調低、白邊 bug 的追查、ghost face(指標進畫面時手消失)、以及把臉的移動與畫圖收進同一條 undo。

“We really get to stamp how we think the product is going to look before we actually schedule an agent to build it.”

在真的派 agent 去蓋之前,我們有機會把「產品長什麼樣」先蓋章定案。

36:30 Matt Pocock

判斷 03三個原型擺在眼前,你會留下哪一個?

不做這份的代價:手感問題會延後到 21,000 行之後才爆;那時改的是架構,不是 CSS。

逐字稿原文(節錄)

34:02“B is really not as good as I thought it was going to be.”

34:06“the split view is garbage... I have to manually line it up with my finger and I can't see my finger.”

36:46“we really are going to reduce the decision space for the agent. We're going to say, no, it has to look exactly like this.”

DOC 04

spec

收掉的不確定:做到哪算完成?哪些不做?

未面對

to-spec 是使用者手動呼叫的 skill,必須放在輸入開頭。它把整場 grilling 變成一個 GitHub issue:約 47 條 user stories、逐條實作決策、明確的 out-of-scope、原型 branch 的引用。Matt 稱它 destination document——不是待辦清單,是終點的樣子。

範圍決策在 grill 裡就做完了:pitch 不整合、使用者圖片不做、全面 soft delete 不擴;要做的則是搜尋對等與空白畫布。

“The spec acts like a destination document... tickets are essentially about scoping each individual session.”

spec 是目的地文件;tickets 則是在界定每一個 session 的範圍。

44:02 Matt Pocock

判斷 04這次 spec 的 out-of-scope 該包含哪幾項?(可多選,勾完按下方按鈕)

不做這份的代價:沒有 out-of-scope,agent 會把「順手能做」的都做進來;你想拒絕時,已經在 review 21,000 行。

逐字稿原文(節錄)

27:17“let's not worry about pitches. They're kind of soft deprecated.”

27:11“no user images in the thumbnail diagram.”

31:44“yeah, let's not overscope this.”

46:04“a bunch of user stories here, around 47 of them... implementation decisions... including stuff that's out of scope.”

DOC 05

tickets

收掉的不確定:先做哪一塊?範圍多大?

未面對

spec 之後是 to-ticket:9 張票,每張標 blocked-by,彼此可平行。第一張不是功能,是 pre-factor——把 diagram playground 的編輯器抽成共用元件。

每一張票只交給一個 sub-agent,範圍就是那張票。

“Each sub-agent we're going to run is going to be handed a single ticket, and that's going to be the scope of its piece of work.”

每個要跑的 sub-agent 只會拿到一張票,那張票就是它這塊工作的範圍。

44:22 Matt Pocock

判斷 05九張票裡,哪一張必須先做?

不做這份的代價:一個 agent 扛整個 21,000 行;平行化失效,失敗也沒有乾淨的邊界。

逐字稿原文(節錄)

44:29“the first one is like a pre-factor, like extracting the shared diagram editor into a shared component. Really useful. That's going to be very handy later.”

46:26“these can be parallelized.”

DOC 06

stacked PRs + feature flag

收掉的不確定:合併風險怎麼拆?

未面對

21,000 行的 PR 不能 review。Matt 要求拆成 stacked diffs:前面每一張都是 two-way door(可合、可退),最後才是 one-way door。實際順序:文件(glossary+ADR)、抽出共用編輯器、reducer 測試、magic conditionals 收斂、功能主體藏在 flag 後、additive migration、開 flag。

功能上線前,新舊實作並行。

“A two-way door means you can merge it and then revert it anytime... a one-way door is a PR that is merged and then is very difficult to unmerge.”

雙向門:合併後隨時能退;單向門:合併後很難回頭。

49:28 Matt Pocock

判斷 06以下哪個是 Matt 的拆法順序?

不做這份的代價:一張巨型單向門,出事只能整包 revert,或硬著頭皮 forward-fix。

逐字稿原文(節錄)

48:53“I think I want you to break it into smaller chunks using stacked diffs.”

50:10“utilize feature flags to make the thumbnail diagram available and then pull it back later”

57:06“out of all of these PRs, the only one where I would consider reviewing mandatory is this one... an additive migration”

DOC 07

lint rules / coding standards

收掉的不確定:品味怎麼變成規則?

未面對

review 的真正產物不是 comment,是規則。這輪他留下 12 條意見,全部不阻擋合併;但每一條都在問:能不能變成 deterministic 的檢查?as 禁用(存量約 2,000 處,用 ratchet)、intersection 改 interface extends(oxlint 沒規則就寫 parser)、useSearchParams 換型別安全 helper、裸 fetch 換 typed client。

只有「註解太多」找不到 lint 規則——它進的是 coding standards,分資料夾、分階段禁。

“I'm not just interested in what the code does, I'm also interested in the system that produced this code.”

我在乎的不只是這段程式碼做了什麼,還有「產出這段程式碼的系統」長什麼樣。

52:50 Matt Pocock

判斷 07以下哪一條 review 發現「不該」變成 lint 規則?

不做這份的代價:品味留在 review 裡,下一個 session 的 agent 重新犯一次;你只是重複收同樣的 comment。

逐字稿原文(節錄)

55:08“find a lint rule... a deterministic rule that we're not necessarily going to impose on day one, but we're going to ratchet it up over time.”

1:01:04“too many comments... here no lint rule fits.”

1:04:43“they allow workarounds to proliferate and the comments kind of act as a fig leaf.”

DOC 08

retro issue list

收掉的不確定:系統哪裡在扯後腿?

未面對

retro skill 讀 30 多個 session 紀錄、用 gh 拉回 12 條 review comment,然後給出一個殘酷的根因:「你的 12 條意見,standards 一條都沒寫;現有文件教的還是相反的 pattern;main 上已經有數千個實例。」

輸出是排序過的改進清單——有些改專案,有些改 Matt 自己的 skills:原型程式碼被直接複製、沒有重新實作,這條就開在 skills repo。

“All 12 of my review comments have one root cause. Nothing in the CVM's written standards cover your points. The existing code in the docs model do the opposite.”

我的 12 條意見只有一個根因:寫下來的 standards 一條都沒涵蓋;現有文件示範的還是相反的做法。

59:49 Matt Pocock

判斷 08以下哪一條 retro 發現,該開在 Matt 的 skills repo,而不是專案 repo?

不做這份的代價:同一個坑每一輪重踩;skills 不會進化,你也永遠在收同一種 comment。

逐字稿原文(節錄)

59:19“sending agents through the 30 odd session transcripts and your 12 review comments... it's going to come back with a ranked list.”

1:02:02“prototype code was copied and not reimplemented.”

1:02:14“could you raise an issue on the Matt Pocock skills repo? By the way, this is often how my skills get improved.”

結算

你的判斷 vs Matt 的判斷

人最值錢的地方在兩端:前期對齊、尾段品味。中間交給 agent,不是因為中間不重要,而是因為兩端做足了,中間才敢不看。1:08:35

01

講 WHY,不講 WHAT

給原因,agent 才有創作空間;給規格,它只會照做,錯過更好的解。
5:36

02

語言即資料模型

先有名字,才有表;有表才有模組。詞彙進了 context,一句話勝過一段規格。
19:42

03

決策空間歸零,才敢 AFK

spec 定終點、tickets 定範圍、原型定手感——它沒有東西要猜,你才敢離開。
45:45

“Grilling and retro are really the two main points at which I interact with the system.” — 1:08:59

附錄

八份文件索引

#文件收掉的不確定影片位置
01glossary.md這個東西叫什麼?10:33
02ADR 003 / ADR 060為什麼當初這樣決定?16:17 · 21:13
03prototype branch用起來是什麼感覺?33:16
04spec(GitHub issue)做到哪算完成?哪些不做?43:00 · 46:04
05tickets(9 張)先後順序與每個 session 的範圍?43:53 · 46:23
06stacked PRs + feature flag合併風險怎麼拆?48:53 · 50:10
07lint rules / coding standards品味怎麼變成規則?52:50 · 56:08
08retro issue list系統哪裡在扯後腿?58:30 · 1:02:02

Skills 速查

Skill用途
grill-with-docs大型功能開工前的深度拷問:需求、領域語言、資料模型、邊界全部問清楚。
wayfindergrill 到一半發現比想像更大時,升級成跨多個 session 的長程構想管理。
prototype一次生成多個 UI 變體,選定一個後持續迭代。
to-spec把 grilling 對話寫成正式 spec(GitHub issue:user stories、決策、out-of-scope)。使用者手動呼叫,須放在輸入開頭。
to-ticket把 spec 拆成標注 blocked-by、可平行執行的 tickets。
implement-spec讀 spec+tickets+glossary+原型,平行 sub-agent 實作,產出單一 PR(AFK 約 45–60 分鐘)。
code-reviewagent 依 coding standards 自審 PR,回報硬違規與 scope creep 並自行修復。
retro掃全部 agent session 紀錄+人類 review comments,產出排序過的環境改進清單。
verify-cvm在瀏覽器裡實際驗證 CVM 的實作(影片中提到、用於 QA)。

術語表

術語定義
diagram一群 diagram snapshots 的集合(教學用的圖表實體)。
diagram snapshotclip 拍攝當下圖表的拷貝,不可變。
active diagram作者目前正在畫的圖。
preserved snapshot即使沒有 clip 使用,仍保留在圖表 timeline 裡的 snapshot。
thumbnail影片在 YouTube 上顯示的縮圖。
cutout去背後放在圖表上的作者大頭照。
thumbnail diagram縮圖專屬的圖。名字像 diagram,但靠 ADR 記錄它不是 diagram。
ADRArchitecture Decision Record:記錄「為什麼」的決策文件,與 glossary(記「是什麼」)互補。
soft delete以標記(如 archived=true)代替真刪除,資料可救回。
two-way / one-way door可隨時 merge/revert 的 PR vs 動到資料、外部服務而難以回頭的 PR。
stacked diffs把巨型 PR 拆成一串互相疊著的小 PR,逐張 review 與合併。
ratchet(棘輪)先立 lint 規則、現存違規漸進清零:只許變好、不許變壞。
smart / dumb zonecontext 較小時 agent 品質較佳;約 150k tokens 後品質下滑(概念出自 Dex Horthy)。
glossary全 repo 的領域詞彙表;進 agent context 後,讓簡短句子傳達豐富語意。

時間戳索引

時間發生了什麼
1:32摩擦起點:縮圖流程要切視圖、重截圖
3:00決策樹:diff 大小 → one-shot / grill / wayfinder
5:36講 WHY,不講 WHAT
10:33glossary.md:560 行的領域詞彙
12:13「不是 diagram,是單一 snapshot」
14:09主導權:是你在對話,不是它在拷問你
16:53Chesterton's Fence
18:18混流/不混流的糾結
22:39Scenario testing 驗證命名
30:07Soft delete 作為預設
33:16三個原型變體上桌
39:48260k tokens 的 sub-agent 已在 dumb zone
43:00to-spec:把對話變成 GitHub issue
45:45決策越多,選錯的機率越高
48:53拆 stacked diffs 的要求
52:50審「產生程式碼的系統」
58:30retro 開跑
59:49根因:standards 沒涵蓋、文件教相反
1:04:20註解審計:940 行可刪
1:08:35人最值錢的地方在兩端

來源與標記:本頁內容來自 YouTube 影片逐字稿(2,013 行);英文引文取自自動字幕,僅做最小整理(補標點、去口頭贅字)。時間戳可點回原片。PR 的內容、順序與票數依口述重建,屬近似;標題等 metadata 取自 YouTube oEmbed。尚未收錄:Smart / Dumb Zone 的機制細節、ghost face 與白邊 bug 的技術過程——它們在影片裡很精彩,但不是這頁的主軸。

沒有留言:

張貼留言