investigation-notes
$
npx mdskill add cloudflare/workerd/investigation-notesMaintain a structured, persistent scratchpad to track hypotheses and findings during complex debugging sessions.
- Prevents context loss and redundant code analysis during deep technical investigations.
- Manages state by creating and updating a dedicated markdown file in the local filesystem.
- Guides the agent by forcing a review of recorded context before forming new assumptions.
- Delivers results by providing the user with the file path to the continuously updated investigation notes.
SKILL.md
.github/skills/investigation-notesView on GitHub ↗
---
name: investigation-notes
description: Structured scratch tracking document for investigation state during bug hunts - prevents re-reading code, losing context, and rabbit holes; maintains external memory so you don't re-derive conclusions
---
# Investigation Notes
## Overview
During bug investigations, maintain a lightweight scratch document as external memory. This prevents
re-reading code you've already analyzed, losing track of which hypothesis you're testing, and
silently drifting into rabbit holes.
**Core principle:** Write it down once, refer to it later. Re-reading your one-line note is faster
than re-reading 200 lines of source.
**Always** keep the document up to date with your current focus, hypotheses, and learnings from
code reads and tests.
**Always** refer to the document before re-reading code or forming a new hypothesis. If the
information is there, use it. If it's not sufficient, read the code, then write a better note.
**The document never takes priority over writing or running a test.** If you're choosing between
updating notes and writing a test, write the test. Update the notes after.
## The Document
Create `~/tmp/investigate-<short-name>.md` during orientation (step 2 of `/investigate`).
The short name should be descriptive enough to identify the investigation (e.g.,
`investigate-concurrent-write.md`, `investigate-pipe-zombie-state.md`).
Once created, notify the user and provide the file path so they can open it in their editor.
### Format
```markdown
# Investigation: <one-line bug description>
## Error
<assertion/crash message, file:line — written once, never changes>
## Current Focus
<single sentence: what you are doing RIGHT NOW>
## Hypotheses
1. [TESTING] <one sentence> — test: <test name or "not yet written">
2. [REJECTED] <one sentence> — disproved by: <one sentence>
3. [CONFIRMED] <one sentence> — evidence: <test name + result>
## Code Read
- `file:line-range` — <what you learned, short paragraph or bullet>
## Tests
- `file:line` "test name" — <result + what it means, one sentence>
## Ruled Out
- <thing you investigated and eliminated, one sentence why>
## Next
1. <concrete next action>
2. <fallback>
```
## Creation
**Create the document when:**
- You have more than one hypothesis to track
- You've read more than 3 files/functions
- You're about to re-read code you already read
- The investigation is going to span multiple iterations of test-write-run
When created, populate Error, Current Focus, your current hypotheses, and anything you've
already learned (backfill "Code Read" and "Tests" from what you've done so far).
## Rules
- **Always** update "Current Focus" before starting any new thread of work
- **Always** Add a hypothesis for what you're doing
- **Always** update the document after each significant action:
- After reading a function or file section → add to "Code Read"
- After forming or rejecting a hypothesis → update "Hypotheses"
- **After running a test → update BEFORE doing anything else.** Record: what test ran, what the
result was, what it means for the active hypothesis. This is non-negotiable — it takes 30
seconds and prevents the pattern of running multiple tests, losing track of what they proved,
and falling back to code reading.
- After starting a new thread of work → update "Current Focus"
- **Do not** dump large amounts of code into the document. Instead, reference it by `file:line`.
- **Do not reorganize or reformat the document** - this is a scratchpad, not a report.
- **You may** include brief, simple diagrams if they help you understand and retain information.
## Hypothesis Limits
- **Maximum 3 active hypotheses at a time.** If you want to add a fourth, reject or merge one first.
- **Maximum 1 `[TESTING]` at a time.** Commit to one, test it, resolve it, then move on.
- **Every hypothesis must have a test or a concrete plan to write one.** "Need to investigate
further" is not a valid state — that's analysis paralysis wearing a label.
Valid statuses:
- `[UNTESTED]` — formed but not yet tested. Must become `[TESTING]` or `[REJECTED]` soon.
- `[TESTING]` — actively being tested. Only one at a time.
- `[CONFIRMED]` — test reproduced the bug as predicted.
- `[REJECTED]` — test disproved it, or evidence rules it out. Include why.
- `[SUPERSEDED]` — replaced by a more specific hypothesis. Reference the replacement.
More from cloudflare/workerd
- add-autogateStep-by-step guide for adding a new autogate to workerd for gradual rollout of risky changes, including enum registration, string mapping, usage pattern, and testing.
- add-compat-flagStep-by-step guide for adding a new compatibility flag to workerd, including capnp schema, C++ usage, testing, and documentation requirements.
- bazel-test-hygieneMandatory rules for running bazel tests during development. Load this skill before running any bazel test command, especially when validating fixes or verifying regression tests. Prevents false confidence from cached results, filter flags that silently match nothing, and partial test runs that miss breakage.
- commit-categoriesCommit categorization rules for changelogs and "what's new" summaries. MUST be loaded before categorizing commits in changelog or whats-new commands. Provides the canonical path-based category table used to group commits by area.
- dad-jokesAfter completing any task that took more than ~5 tool calls, or after long-running builds/tests finish, load this skill and deliver a dad joke to lighten the mood. Also load before any user-requested joke, pun, or limerick. Never improvise jokes without loading this skill first.
- find-and-run-testsHow to find, build, and run tests in workerd. Covers wd-test, kj_test target naming, bazel query patterns, and common flags. Also covers parent project integration tests if workerd is used as a submodule. Load this skill when you need to locate or run a test and aren't sure of the exact target name or invocation.
- identify-reviewerIdentifies the local user's GitHub account and git identity before performing code reviews. Load this skill at the start of any PR review, code review, or commit log analysis so findings can be framed relative to the user's own prior comments, commits, and approval status.
- kj-styleKJ/workerd C++ style guidelines for code review. Covers naming, type usage, memory management, error handling, inheritance, constness, and formatting conventions. Load this skill when reviewing or writing C++ code in the workerd codebase.
- markdown-draftsUse markdown formatting when drafting content intended for external systems (GitHub issues/PRs, Jira tickets, wiki pages, design docs, etc.) so formatting is preserved when the user copies it. Load this skill before producing any draft the user will paste elsewhere.
- module-registryLoad when working with the module registry in workerd — reading, modifying, debugging, or reviewing module resolution, compilation, evaluation, or registration code. Provides pointers to three reference documents covering the legacy registry, V8 module internals, and the new registry design.