一键导入
whyspec-search
Use when looking for why something was built a certain way or finding past decisions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when looking for why something was built a certain way or finding past decisions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | whyspec-search |
| description | Use when looking for why something was built a certain way or finding past decisions. |
| argument-hint | <query> [--domain <domain>] |
Search reasoning — find past decisions, contexts, and intent across all changes.
Input: A search query string. Optionally include --domain <domain> to filter by domain.
Search is not just a lookup tool — it's the team knowledge check before new work:
Run the search
whyspec search --json "<query>"
If ARGUMENTS includes --domain:
whyspec search --json "<query>" --domain "<domain>"
Parse the JSON response — an array of scored results, each containing:
id: Context ID (e.g., ctx_a1b2c3d4) or file identifiertitle: Context or intent titlechange_name: Name of the changedomain: Auto-detected or specified domainscore: Relevance score (title=100, reasoning=30, files=20, general=10)matched_sections: Which sections matched (title, reasoning, files, etc.)path: File path for retrievalsnippet: Most relevant text excerptDisplay results with scores AND reasoning snippets
## Search: "authentication"Found 3 results:
[score: 130] JWT Auth with RS256 (add-auth) Domain: authentication | Matched: title, reasoning
"Chose RS256 over HS256 — allows key rotation without redeploying. Session stored in httpOnly cookie, not localStorage (XSS protection). Token expiry: 15min access, 7d refresh — balances security vs UX."
This decision affects your current work if you're touching auth tokens or session management.
[score: 30] Database Migration Plan (migrate-db) Domain: database | Matched: reasoning
"Considered token storage in DB but rejected — added 3ms latency per request. Chose Redis for session cache instead (src/lib/redis.ts)."
[score: 20] API Rate Limiting (add-rate-limits) Domain: api | Matched: files
"src/middleware/auth.ts — modified to extract JWT sub claim for per-user rate limiting after authentication."
View full story: /whyspec-show add-auth
Narrow by domain: /whyspec-search "authentication" --domain auth
Why good: Shows the actual reasoning from past decisions. A developer
searching for "authentication" immediately sees WHY RS256 was chosen,
WHY httpOnly cookies, and WHERE token decisions connect to rate limiting.
The annotation "This decision affects..." connects past to present.
Found 3 results:
Why bad: Just titles with no reasoning snippets. The developer has to open each one to find the relevant decision. Defeats the purpose of search.
## Search: "why is the session timeout 15 minutes"No results found for "why is the session timeout 15 minutes".
Suggestions:
/whyspec-search "session" --domain authNo results found. Why bad: Dead end. No help. User is stuck.
Connect results to the current context
If the search was triggered during planning or debugging, connect the findings:
/whyspec-plan: "Past decision in add-auth chose RS256 — your new feature should be compatible with this."/whyspec-debug: "Similar bug was investigated in debug-token-expiry — root cause was clock skew between services."/whyspec-show <name> or narrower search.| Tool | When to use | When NOT to use |
|---|---|---|
| Bash | Run whyspec search --json "<query>" — the primary search mechanism | Don't search manually with grep |
| Read | Follow up on results — read full context files when the snippet isn't enough | Don't read every result; focus on high-scoring ones |
| Grep | Supplement: search code for implementations referenced in search results | Don't use grep as a replacement for whyspec search |
No AskUserQuestion — this is a display-only skill. Show results and offer follow-up commands.
Use when planning a code change, capturing decisions before coding, or setting up the Decision Bridge.
Use after coding to preserve reasoning — resolves the Decision Bridge with actual outcomes.
Use when encountering any bug, test failure, or unexpected behavior — before proposing fixes.
Use when starting implementation, continuing work, or executing tasks from a WhySpec plan.
Use when reviewing the full story of a change — intent, design, tasks, and Decision Bridge delta.