PluginBench
Skill
Pass
Audit score 90

grounding-before-coding

riekelt/principal-engineer

Map real code and data before writing—ground every claim in evidence before any change.

What is grounding-before-coding?

Grounding before coding is a discipline for starting any non-trivial change, bug investigation, or work in unfamiliar code. Use it to read implementations rather than names, quote evidence with file:line references, verify actual behavior against assumptions, and map invariants before touching code—ensuring changes are built on facts, not beliefs.

  • Read implementations to verify what code actually does, not what its name suggests
  • Quote evidence with file:line references and exact query results for every load-bearing claim
  • Discover actual conventions in the codebase rather than guessing them
  • Trust code and git history over documents or ticket status
  • Reproduce bugs before fixing them
  • Find all callers and shared code paths before editing to catch sibling issues

How to install grounding-before-coding

npx skills add https://github.com/riekelt/principal-engineer --skill grounding-before-coding
Prerequisites
  • The principal-engineering skill must be installed first
Claude Code
Cursor
Windsurf
Cline

How to use grounding-before-coding

  1. 1.Read the actual implementations of methods and functions, not just their names or documentation
  2. 2.Gather evidence: run queries, check git history, and collect file:line references for every key claim
  3. 3.Verify conventions used in the codebase (naming, dependency wiring, error handling, testing patterns)
  4. 4.Check git log and code history to confirm the current state matches what documents claim
  5. 5.For bugs, reproduce the failure before making any changes
  6. 6.Map all callers and code paths that touch the area you plan to change
  7. 7.Document the invariants, touchpoints, and current behavior that your change must not break

Use cases

Good for
  • Starting a non-trivial code change in an unfamiliar codebase
  • Investigating intermittent errors or bugs after a deploy
  • Pure investigation tasks like 'figure out why the export is empty'
  • Reviewing a prior session's code summary before building on it
  • Identifying the root cause of a bug across multiple code paths before patching
Who it's for
  • Engineers working in unfamiliar codebases
  • Developers investigating bugs or production issues
  • Principal engineers and code reviewers
  • Teams under time pressure who need to avoid assumption-based mistakes

grounding-before-coding FAQ

When should I use grounding before coding?

Use it before writing any spec, fix, or first line of code for non-trivial changes, when investigating bugs, working in unfamiliar code, or doing pure investigation. Use it whenever a change or conclusion is about to be built from belief instead of from the actual code tree.

What does 'quote your evidence' mean?

Every load-bearing claim in your plan must be backed by a file:line reference, an exact query result, or command output. If you cannot back a claim with evidence, say so explicitly instead of assuming it.

How deep should I ground?

Map what the change touches plus one ring around it, at the depth the risk demands. This is not reading everything—it is reading enough to understand the invariants and all paths into the code you will touch.

Should I re-ground things already established in this session?

No. Ground once per session, then cite the evidence you already gathered. Re-grounding wastes time and risks missing updates.

What if the code cannot answer an intent question?

Ask the code owner or check the history. An unanswerable question becomes a named assumption, never a silent one. Document it explicitly so the team knows what you are building on.

Full instructions (SKILL.md)

Source of truth, from riekelt/principal-engineer.


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.