riekelt/principal-engineer已通过检查
SKILL DETAIL
grounding-before-coding
riekelt/principal-engineer/grounding-before-coding
此技能适用于开始任何非平凡更改、调查错误或处理不熟悉代码之前——在编写第一行代码之前。也适用于纯调查,无需计划更改,例如“深入研究这个”、“弄清楚为什么”、“有时导出为空”、部署后的间歇性错误。它编码了“先接地”的纪律:映射真实代码和数据,引用证据,绝不猜测约定。每当更改或结论即将基于信念而非代码树构建时,即使时间紧迫,也应使用此技能。 该纪律包括:阅读实现而非名称;引用证据(文件:行号、查询结果或命令输出);绝不猜测约定;信任代码而非状态;在修复前重现问题;在调用者汇聚处修复;映射更改不得破坏的不变量。接地不是阅读所有内容,而是映射更改触及的范围及其周围一环,深度由风险决定。它不能替代提问,当代码无法回答意图问题时,应询问历史或所有者。它不重新接地本会话已建立的内容。常见错误包括从框架文档推断项目代码行为、仅接地快乐路径、信任先前会话的摘要而非代码,以及因任务“看起来像”先前任务而跳过接地。
安装量 · 321查看来源
Installation
npx skills add https://github.com/riekelt/principal-engineer --skill grounding-before-coding
技能文件
SKILL.md
最近同步 · 2026年10月21日
SKILL.md›
---
name: grounding-before-coding
description: "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."
---
# 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.