“代码生成越快,严密工程化判断力越稀缺”
面对 AI 催生的 "Vibe Coding" 狂热,Total TypeScript 创始人 Matt Pocock 坚定举起工程主义大旗:盲目依赖 AI 快速生成代码必然产生灾难性的“大泥球 (Big Ball of Mud)”债务。我们必须用严格的类型系统、TDD 测试导轨、反向审问 ("Grill Me") 与垂直切片,驾驭大模型成为可靠的生产力系统。
“工程化,而非氛围编程” ("Engineering, Not Vibe Coding")
1. "Vibe coding" relies on AI without engineering discipline.
2. Unchecked AI code creates a "Big Ball of Mud" that becomes unmaintainable within weeks.
3. Faster code generation makes architecture, boundary design, and testing MORE valuable, not less.
4. Real engineers define rigorous constraints before AI writes a single line.
“审问我”技术 (The "Grill Me" Technique: 需求反向质询闭环)
"Do not generate the solution yet. Interrogate me relentlessly. Ask me 4 tough architectural questions about edge cases, state lifecycles, error states, and storage constraints before planning implementation."
垂直切片与严格测试驱动 (Vertical Slices & TDD in Agentic Era)
1. Do not ask AI to build broad horizontal layers (e.g. "build the whole database schema").
2. Cut thin "Vertical Slices" spanning Database → Service → API → UI for a single user journey.
3. Write failing unit and integration tests first.
4. Tests provide tight mathematical feedback loops that keep AI agents on track without drift.
“白班规划 vs 夜班执行”工作心智模型 (Day Shift vs. Night Shift)
- • 定义系统边界与业务领域模型 (DDD)
- • 制定严格的类型契约与接口规范
- • 编写精准的验收标准与失败测试用例
- • 裁决架构权衡与技术栈选型
- • 实现样板代码与 CRUD 业务逻辑
- • 持续运行测试套件,直到全部红灯变绿灯
- • 消除重复代码并重构实现细节
- • 编写边缘边界测试用例覆盖
类型系统作为 AI 的安全护栏 (TypeScript as Guardrails)
user.address.postalCode,运行时静默返回 undefined;而在严格 TypeScript 环境下,编译器会在 10 毫秒内抛出类型错误。AI Agent 接收到此报错后,无需人类介入,即可自动重构修正代码。
知识民主化与直觉心智模型 (Total TypeScript Educational Revolution)
1. Traditional technical education uses obscure academic terminology to gatekeep knowledge.
2. Total TypeScript replaces lectures with 5-second interactive feedback puzzles.
3. Clear mental models allow beginner developers to gain expert intuition rapidly.
定制化智能体技能体系 (Agent Skills as Executable Standards)
- 强制禁止使用
any或不安全的类型断言as unknown as T - 强制要求每个导出的公共函数显式声明返回值类型
- 强制要求使用 Zod 校验外部 I/O 边界
执行前的共享设计共识机制 (Establishing Shared Understanding)
AI 无法读懂开发者脑海中的隐性假设。在敲定任何代码之前,必须强制 AI 产出一份单页轻量设计草案 (One-page RFC):包括数据流向图、核心函数签名、以及它拒绝采用的备选方案及其原因。
防御性类型设计与零运行时开销契约 (Defensive Types & Branded Types)
type OrderId = string & { readonly __brand: unique symbol };
function cancelOrder(userId: UserId, orderId: OrderId) { /* ... */ }
const uId = "usr_102" as UserId;
const oId = "ord_884" as OrderId;
// 编译期直接拦截!防止传反参数导致的越权:
// cancelOrder(oId, uId); // Error: Type 'OrderId' is not assignable to type 'UserId'
从打字员到编排架构师的终极跃迁 (The Shift from Typist to Orchestrator)
1. Remembering syntax and typing boilerplate no longer creates competitive advantage.
2. Future senior engineers win on Taste, Systems Thinking, and Agent Orchestration.
3. Humans define the problem and evaluate aesthetic quality.
4. Machines perform execution and verification.