why
БесплатноБез исполняемых скриптовНе проверенUse for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and…
от fmflurry★ 173 звезды на GitHubОб этом скилле
Why
Investigate the motivation and intent behind code.
Companion to the how skill. how answers what the code does and how it works. why answers what forces led to its shape.
Spawn investigators with subagent_type: why-investigator (Claude Code: Agent tool; OpenCode: task tool). Models come from that agent definition; never pass model. Subagents cannot spawn subagents, so run this skill from the primary agent. If a why-synthesizer agent is installed, spawn it to merge the reports. If it is not installed, synthesize in this session.
Operating Posture
Operate as a careful, cautious, and precise investigator. Be honest about what you know vs what you're inferring. Read references/epistemics.md for the full confidence framework and phrasing guide. The synthesizer must follow it.
Step 1. Understand the Target and the Question
Parse what the user is asking. The target is usually a chunk of code, a pattern, a feature, or a named design decision. The question is usually a design rationale, a tradeoff, a motivating edge case, an external constraint, dead code, or a broad history sweep.
If the target is vague ("why do we do it this way?" with no clear referent), make your best guess from conversation context (open files, recent edits, selection, what was just discussed). State your interpretation briefly so the user can redirect if you're off, then proceed.
Step 2. Establish the Code Anchor
Before spawning investigators, anchor the investigation in concrete code. You need:
- The relevant file path(s) and line range(s)
- The key symbols (function names, class names, constants)
- An initial commit list. The last few commits touching the target.
- PR numbers from merge commits (pattern
(#1234)in the subject line)
Build this inline. If you cannot run shell commands (e.g. OpenCode conductor has bash denied), spawn one why-investigator for source control first to build the code anchor, then fan out.
# Blame target lines for last-touch commits
git blame -L <start>,<end> <file>
# Full file history, with patches, through renames
git log --follow -p -- <file>
# Last N commits touching the file, PR numbers visible
git log --oneline -20 -- <file>
# Extract PR numbers from a commit message
git log -1 --format=%B <commit>
Pull PR bodies and discussion via gh for any substantive commits:
gh pr view <number> --json title,body,author,createdAt,mergedAt,labels,closingIssuesReferences,comments,reviews
Capture this as seed context (file paths, symbols, commits, PR numbers, linked ticket IDs). Pass it to the investigators.
Step 3. Spawn Parallel Investigators (default posture)
Default to the full parallel investigation.
Discovery
Before spawning investigators, list the MCP tools available in this session.
Map each available MCP to one evidence category:
- Source control history
Source control is always available through git and gh. For any other MCP, classify using the MCP name, server instructions, tool names, and resource descriptors. If an MCP could fit more than one category, choose the one matching its primary evidence. Record ambiguous cases in the coverage map. Any other MCP found in the session that holds historical evidence (tickets, docs, telemetry) may still be investigated as its own category.
Aim for a complete coverage map, not a minimal one. Document the null, don't skip the search.
Launch all matching investigators in a single message so they run concurrently. Don't ask one agent to cover multiple MCPs.
Spawn each with subagent_type: why-investigator. Investigators MUST NOT write anything.
Each investigator gets:
- The base prompt from
references/investigator-prompt.md - The category playbook
references/sources/<source>.mdfor the selected MCP, adapted from the examples inreferences/source-playbook.md - The cross-cutting
references/sources/incident-postmortem.mdif the target code looks defensive (null checks, retry logic, timeout handling, rate limiting, feature flags, egress guards, OOM handlers) - The code anchor from Step 2 (file paths, symbols, commit hashes, PR numbers, ticket IDs)
- The user's original question
Investigator roster. One per available evidence category
Spawn one investigator per category that has a matching MCP. Each owns exactly one tool or MCP.
Each entry names the category and the kind of "why" it uniquely surfaces. Use it to know what to expect back, how to name a gap when a category returns empty, and (only in the rare provably-irrelevant case) to justify a skip.
- Source control investigator. Git history,
ghfor PRs, code comments, tests. Always spawn. The only guaranteed source. Best at surfacing implementation-time rationale captured during review.
When to skip an investigator
Only skip with an explicit, written justification that goes in the final "Sources Consulted" section. Two valid reasons:
- **No MCP is available for
Установить why в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл why?
Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control plus any other connected historical-evidence MCP) in parallel, then returns a cited read on decisions and tradeoffs. Use how for runtime behavior.
Как установить скилл why?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл why запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic