why
Find out why code is the way it is from its history, reviews, tickets, docs, and other records, and say how sure each answer is. Use when the user asks why something is built, written, or behaves a certain way, why a choice was made, or where a number or limit came from.
- License 许可
- MIT
- 所属仓库
- dwin/skills
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- why
- description
- Find out why code is the way it is from its history, reviews, tickets, docs, and other records, and say how sure each answer is. Use when the user asks why something is built, written, or behaves a certain way, why a choice was made, or where a number or limit came from.
02 资源文件 5
- 参考文档agents/openai.yaml213 B
- 参考文档references/epistemics.md3.9 KB
- 参考文档references/investigator-brief.md3.5 KB
- 参考文档references/sources.md8.7 KB
- 参考文档references/synthesis.md4.2 KB
03 SKILL.md 正文
Why
Code shows what it does, not why it exists. The reason lives in commits, reviews, tickets, design docs, chat, and runtime data, and every one of those records is incomplete and sometimes contradicts another. Find the evidence, and give each claim with how sure the evidence makes it.
Work as a careful investigator: keep what the record says apart from what you infer. references/epistemics.md defines the confidence tiers and the wording for each. Read it before you write the answer.
1. Pin the target and the question
The target is a piece of code, a pattern, a feature, or a named decision. The question asks for a rationale, a trade-off, the edge case behind the code, an outside constraint, whether the code is dead, or a sweep of its history.
When the target is vague, take your best reading from the conversation: open files, recent edits, what was just discussed. State it in one line so the user can redirect, and continue.
When the question carries a guess ("I assume it's for performance?"), the guess is one candidate to check against the evidence, the same as any other.
2. Build the code anchor
Gather the seed that every later step uses:
- the files, line ranges, and key symbols;
- what the code does now, read from the code itself;
- the commits that touch it:
git log --follow --oneline -- <file>,git blame -L <start>,<end> <file>, andgit log -S '<exact text>'for when a line or a constant appeared; - the pull request numbers in those commits, and each pull request's body and
review discussion:
gh pr view <number> --json title,body,author,mergedAt,labels,closingIssuesReferences,comments,reviews; - the comments reviewers left on individual lines, which that command leaves
out:
gh api --paginate repos/{owner}/{repo}/pulls/<number>/comments; - the ticket IDs named in commits and pull requests.
3. Search every source you can reach
Sort the sources this session can reach into seven categories:
- source control: history, reviews, comments, and tests, always reachable
through
gitandgh; - issue tracker;
- long-form docs: design docs, specs, ADRs, and postmortems;
- team chat;
- infrastructure observability: metrics, monitors, logs, traces, and incidents;
- error tracking;
- product analytics or data warehouse.
Place each connected tool, CLI, and MCP server by its name, instructions, and tools. Note any that could fit two categories. references/sources.md says what each category is best at and how to search it.
Search every category that has a source. The goal is a complete coverage map, and an empty search is a finding. A category is skipped only with a written reason that goes into the answer: no source for it is reachable here, which is a gap and not a choice, or it provably cannot bear on the target, such as error tracking for a build-time script. When the target is defensive code, such as a null check, a retry, a timeout, a rate limit, a feature flag, or a memory guard, add the incident searches from the sources reference to every category.
When your host can start agents, run one investigator per category in
parallel, each owning one source and briefed with
references/investigator-brief.md, the code
anchor, and the user's question. swarm says how your host starts them and
which model suits research. Investigators only read. Without agents, work
through the categories yourself, one at a time, under the same brief.
A trivial target, whose single pull request already states the whole answer, may be answered from the anchor. Do that only after confirming the other searches would add nothing, and say so in the answer.
4. Synthesize
Weigh the findings by references/synthesis.md: merge overlapping citations, surface contradictions, place every claim in a tier, spot-check the citations you are unsure of, and name the gaps. When the findings are long, hand them to one fresh agent along with the synthesis and epistemics references. Present its answer with the confidence wording intact.
5. Answer
Use the structure in the synthesis reference. Sources Consulted keeps one line per category, including those that found nothing and those skipped, with the reason.
When the question comes before a change to this code, end with the constraints the change must respect:
- Preserve. What the evidence says the code must keep doing.
- Change. What the evidence says no longer applies.
- Avoid. Approaches the record shows were tried and rejected.
- Risk. What could break, and how sure you are.
Failure modes
- Recency bias. The latest commit is rarely the whole story. The current shape is many decisions in layers, so trace back.
- Code as its own evidence. "The code clamps to 100, so the author wanted 100" is circular. Code is the mechanism, not the motive.
- Rationalizing. Messy history stays messy in the answer. A missing record is a gap, not proof that nobody cared.
- A tidy story. When two sources disagree, show both.
04 同仓库更多 Skills
visual-explainer
Render interactive visual explanations, architecture simulators, option tradeoff matrices, permission or blast-radius maps, and phased rollout cards on the host's native visual surface. Use when answering a question that compares three or more options across multiple dimensions, traces a multi-gate request or state flow, maps permissions or blast radius, lays out a multi-phase architecture plan, or when the user asks to visualize or sends `viz`.
writing-for-agents
Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.
wizard
Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.
whats-next
Match a task to the skill, flow, or playbook that fits it. Use when the user asks what to do next or which workflow applies, when a task fits no other skill, and for these kinds of work, which have playbooks here - proving a property of concurrent or stateful code with a model checker or verifier, matching a UI pixel for pixel, and diagnosing a live process or a captured profile, trace, or heap snapshot.
wayfinder
Plan a huge chunk of work — more than one agent session can hold — as a shared map of decision tickets on your issue tracker, and resolve them one at a time until the way to the destination is clear.
wait-what
Stop. That last message did not land — re-pitch it.