Grounding Before Coding

作者 riekelte67b7af9ac74無授權條款5 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫3 週前更新

Use when starting any non-trivial change, investigating a bug, or working in unfamiliar code - before the first line is written. Also use for pure investigation with no change planned yet - "dig into this", "figure out why", "sometimes the export is empty", intermittent errors after a deploy. Encodes the ground-first discipline: map the real code and data, quote evidence, never guess conventions. Use whenever a change or a conclusion is about to be built from belief instead of from the tree, even under time pressure.

AI 產生的概覽

建立先扎根再寫程式的紀律:動手前先摸清真實程式碼與資料、引用證據、絕不猜測慣例。

功能
這項技能提供一套在改動程式碼前先做調查的紀律:閱讀實作而非名稱,引用 file:line 證據,在儲存庫中核實慣例,並在修正前先重現缺陷。它引導梳理改動涉及的接觸點與不可破壞的不變條件,並主張在呼叫端匯聚處修正缺陷,而不是只修補報告中的那條路徑。它也列出扎根的界線以及常見錯誤,例如依據框架文件推測專案程式碼行為,或輕信先前工作階段的程式碼摘要。
適用情境
適用於開始任何非例行改動、調查缺陷或在陌生程式碼中工作、尚未寫下第一行程式碼之時。也適用於尚無改動計畫的純調查,例如追查偶發或無法解釋的行為。當改動或結論可能建立在臆測而非程式碼樹之上時,都應使用。
執行需求
除代理外無需指令碼或工具;它引用了一個名為 principal-engineering 的前置技能。

Grounding before coding

REQUIRED BACKGROUND: the principal-engineering skill.

Overview

Before writing a spec, a fix, or a first line: map the real code and data. Quote file:line and run the query behind every number you rely on.

The discipline

  1. Read the implementations, not the names. A method called validate that does not validate is the default assumption. Verify what a thing does before building on what it is called.
  2. Quote your evidence. Every load-bearing claim in your plan gets a file:line, an exact query result, or a command output. When you cannot back a claim, say so out loud instead of assuming it.
  3. Never guess conventions. How this repo names things, wires dependencies, handles errors, or runs tests is discoverable in minutes.
  4. Trust code, not status. A document's or ticket's self-reported state is not evidence of execution state; adjudicate with the code and the history (git log -S <symbol>, grep the tree) before building on it.
  5. Reproduce before fixing. For bugs: see the failure happen before changing anything.
  6. Fix where the callers converge. A bug report names one symptom on one path; before editing, find every route into the code you are about to touch. When the defect lives in something shared, the guard belongs in the shared place: it is the smaller diff AND the fix that covers the sibling paths the ticket never mentioned. Patching only the reported path repairs the report, not the bug.
  7. Map the invariants a change must not break. The output of grounding is a map: the touchpoints, the current behavior (quoted), and those invariants. Tests named after old bugs, guards with explanatory comments, and constants encoding hard-won thresholds mark earlier incidents.

Limits of grounding

  • Not reading everything: map what the change touches plus one ring around it, at the depth the risk demands.
  • Not a substitute for asking: when the code cannot answer an intent question (why is this threshold 7?), the history or the owner can. An unanswerable question becomes a named assumption, never a silent one.
  • Not re-grounding what this session already established: ground once, cite it after.

Common mistakes

  • Theorizing from the framework's documentation about what the project's code does. The project forked, wrapped, or misused the framework; the tree tells you which.
  • Grounding the happy path only. The invariants live in the error paths and the edge-case guards.
  • Trusting a prior session's summary of the code over the code. Open the files the summary names before building on it.
  • Skipping grounding because the task "looks like" a previous one. The signal that pattern-matches a known case may have a different cause; check that the evidence supports this case.

來源與署名

來源:riekelt/principal-engineer位於plugins/principal-engineer/skills/grounding-before-coding提交e67b7af

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架