search
Unified semantic exploration skill combining qmd hybrid retrieval with cgg call graph generation. Use when the user says "search the codebase", "find ADRs about X", "what specs cover Y", "search architecture", or wants to semantically explore design artifacts and code together.
What this skill does
# Unified Semantic Search
Search ADRs, specs, and code simultaneously using qmd hybrid retrieval, then enrich results with cgg call graphs for deeper code exploration.
## Process
<!-- Governing: ADR-0033 (cgg call graph integration), ADR-0024 (qmd as hard dependency), SPEC-0034 REQ "Hybrid Retrieval Across All Collections", SPEC-0034 REQ "Call Graph Generation Uses cgg With Filtering" -->
0. **Handle no-args / --help**: If `$ARGUMENTS` is empty or contains `--help`, output the usage block below and stop:
```
Usage: /sdd:search <query> [--output markdown|json] [--unfiltered] [--module <name>]
Examples:
/sdd:search "JWT authentication"
/sdd:search "payment processing" --output json
/sdd:search "token validation" --unfiltered
/sdd:search "auth middleware" --module api
Searches ADRs, specs, and code with qmd hybrid retrieval, then generates
call graphs with cgg for the most relevant code matches.
```
1. **Parse arguments**: Extract from `$ARGUMENTS`:
- `<query>`: everything before any `--` flags (required; stop here if empty after flag extraction)
- `--output markdown|json`: output format (default: `markdown`)
- `--unfiltered`: when present, skip filter derivation and pass raw query keywords to cgg
- `--module <name>`: when present, scope all collections and cgg to that module
2. **Compute the repo slug and collection names**:
<!-- Governing: ADR-0024 (qmd as hard dependency), SPEC-0019 REQ "qmd-helpers Reference" -->
Compute the slug per `references/qmd-helpers.md` § "This-Repo Collection Identification":
```bash
SLUG=$(git rev-parse --show-toplevel | xargs basename | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9-]/-/g')
```
- **Standard mode** (no `--module`): target collections `{slug}-adrs`, `{slug}-specs`, `{slug}-code`
- **Workspace mode** (`--module <name>` provided): target collections `{slug}-{module}-adrs`, `{slug}-{module}-specs`, `{slug}-{module}-code`
3. **Validate qmd collections exist**:
Use `mcp__plugin_qmd_qmd__status` (or `qmd status --json` as CLI fallback per `references/qmd-helpers.md` § "MCP-vs-CLI Selection") to list available collections. Apply exact-prefix match from `references/qmd-helpers.md` § "This-Repo Collection Identification".
If none of the three target collections exist, stop with: "No qmd collections found for {repo}. Run `/sdd:index` first."
Note which collections are missing (e.g., only `-adrs` and `-specs` but not `-code`) — search only what exists.
4. **Run qmd hybrid retrieval**:
<!-- Governing: ADR-0024 (qmd as hard dependency), SPEC-0034 REQ "Hybrid Retrieval Across All Collections" -->
Issue three separate qmd queries — one per collection type — so that ADR, spec, and code results are already partitioned when building output sections. Use MCP tool `mcp__plugin_qmd_qmd__query` (preferred) or `qmd query --json` as CLI fallback.
**ADR query** (if `{slug}-adrs` or `{slug}-{module}-adrs` collection exists):
```
searches: [
{ type: "lex", query: "<query verbatim>" },
{ type: "vec", query: "Architecture decisions about <query>" }
],
intent: "/sdd:search — find ADRs relevant to: <query>",
collections: ["{slug}-adrs"], // or {slug}-{module}-adrs
limit: 8,
minScore: 0.3
```
**Spec query** (if `{slug}-specs` or `{slug}-{module}-specs` collection exists):
```
searches: [
{ type: "lex", query: "<query verbatim>" },
{ type: "vec", query: "Specifications and requirements for <query>" }
],
intent: "/sdd:search — find specs relevant to: <query>",
collections: ["{slug}-specs"], // or {slug}-{module}-specs
limit: 8,
minScore: 0.3
```
**Code query** (if `{slug}-code` or `{slug}-{module}-code` collection exists):
```
searches: [
{ type: "lex", query: "<query verbatim>" },
{ type: "vec", query: "Source code implementing <query>" }
],
intent: "/sdd:search — find code relevant to: <query>",
collections: ["{slug}-code"], // or {slug}-{module}-code
limit: 8,
minScore: 0.3
```
Filter each result set: keep only items with `score >= 0.3`. Collect the three partitioned result sets.
**No-matches path**: If all three queries return zero results above `minScore`, output the following and stop — do NOT proceed to cgg:
```
No relevant ADRs, specs, or code found for '{query}'. Try a broader search term.
```
5. **Derive cgg filter** (unless `--unfiltered` was passed):
<!-- Governing: ADR-0033 (cgg call graph integration), SPEC-0034 REQ "Call Graph Generation Uses cgg With Filtering" -->
From the code query results, extract filter tokens per `references/cgg-integration.md` § "Filter Derivation Strategy — From qmd code matches":
1. Take each matched file path stem (e.g., `auth/jwt.go` → `jwt`, `auth`)
2. Take each qmd-matched symbol or heading keyword surfaced in the result snippets
3. Compose a regex alternation: `token1|token2|token3`
If the code query returned no results (collection absent or zero matches), fall back to keyword-based derivation per `references/cgg-integration.md` § "Filter Derivation Strategy — From requirement keywords":
- Lowercase and split the query on spaces/punctuation
- Strip common stop words (`the`, `a`, `an`, `for`, `with`, `of`, `in`, `and`, `or`, `to`)
- Compose alternation from remaining terms
If `--unfiltered` was passed, skip this step entirely. Warn the user:
```
Generating unfiltered call graph — output may be large. Use /cgg directly for advanced scoping.
```
6. **Generate call graph with cgg**:
<!-- Governing: ADR-0033 (cgg call graph integration), SPEC-0034 REQ "Call Graph Generation Uses cgg With Filtering", SPEC-0034 REQ "Error Messages and Logs Must Be Clear" -->
Follow `references/cgg-integration.md` § "Availability Check" first:
```bash
which cgg >/dev/null 2>&1
```
If cgg is not found, record the unavailability notice and skip to step 7 (graceful degradation).
Determine the target path:
- Standard mode: repo root (`git rev-parse --show-toplevel`)
- Workspace mode (`--module <name>`): resolve module source dir per `references/shared-patterns.md` § "Artifact Path Resolution"
Invoke cgg per `references/cgg-integration.md` § "cgg Invocation Pattern":
```bash
# With filter:
timeout 30 cgg <target-path> --filter "<filter-regex>" --format mermaid 2>/tmp/cgg-stderr-$$.txt
# Without filter (--unfiltered):
timeout 30 cgg <target-path> --format mermaid 2>/tmp/cgg-stderr-$$.txt
CGG_EXIT=$?
CGG_STDERR=$(cat /tmp/cgg-stderr-$$.txt)
rm -f /tmp/cgg-stderr-$$.txt
```
Handle exit codes per `references/cgg-integration.md` § "Exit code handling":
- Exit 0: normalize the Mermaid output per `references/cgg-integration.md` § "Mermaid Output Normalization"
- Exit 1: record "Call graph generation failed: {stderr}" and skip to step 7
- Exit 124: record timeout message per `references/cgg-integration.md` § "Timeout Handling" and skip to step 7
- Other exit: treat as exit 1
Apply node cap: if the Mermaid output has more than 20 nodes (lines matching `^\s+\w+\[`), trim to top 20 by connectivity and add the trimming comment per `references/cgg-integration.md` § "Node cap".
Normalize output per `references/cgg-integration.md` § "Mermaid Output Normalization":
- Sort nodes alphabetically
- Rewrite `graph LR` or `graph RL` to `graph TD`
- Strip memory-address node ID prefixes
- Append legend footer `%% Showing entry points + main flow; internal helpers omitted`
- Validate all `-->` edges reference declared nodes; remove dangling edges
Handle unsupported-language warnings per `references/cgg-integration.md` § "Unsupported Language Handling".
7. **Produce output**:
<!-- Governing: SPEC-0034 REQ "Markdown Output Format", SPEC-0034 REQ "JSON Output Format" -->
**Markdown output** (default, or `--output markdown`):
```markdown
## SRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.