/sdd:search [query] [--output markdown|json] [--unfiltered] [--module <name>]from sdd
Searches ADRs, specs, and code simultaneously using qmd hybrid retrieval, then enriches results with cgg call graphs for deeper code exploration.
Ships in sdd. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Harness portability. This skill runs on any agent harness that loads Agent Skills — Claude Code, Codex CLI, OpenCode, Crush. Tool names used below (
AskUserQuestion,Task,TeamCreate,SendMessage,TaskCreate,ToolSearch,mcp__*,${CLAUDE_PLUGIN_ROOT}) denote capabilities, not hard requirements: map each to your harness's equivalent or use the documented fallback per${CLAUDE_PLUGIN_ROOT}/references/harness-compat.md. References toCLAUDE.mdmean the project memory file (CLAUDE.md,AGENTS.md, orCRUSH.md) per harness-compat § "Project Memory File". A citation of the formshared-patterns.md § "Section"names one##heading in that file — load only that section (see its "How to Read This File" note), never the whole file. Invocation and arguments. Where your harness has no command layer (Crush, Codex CLI, OpenCode) this skill is reached from itsdescription, not a slash command: the/sdd:{name}form below is Claude Code namespacing.$ARGUMENTSmeans whatever arrived with the invocation: take the target and any--flagsfrom the request that triggered this skill, and when neither is present follow this skill's documented no-argument path instead of reporting missing arguments (harness-compat § "Invocation and Arguments").
Search ADRs, specs, and code simultaneously using qmd hybrid retrieval, then enrich results with cgg call graphs for deeper code exploration.
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.
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 moduleCompute the repo slug and collection names:
Compute the slug per ${CLAUDE_PLUGIN_ROOT}/references/qmd-helpers.md § "This-Repo Collection Identification":
SLUG=$(git rev-parse --show-toplevel | xargs basename | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9-]/-/g')
--module): target collections {slug}-adrs, {slug}-specs, {slug}-code--module <name> provided): target collections {slug}-{module}-adrs, {slug}-{module}-specs, {slug}-{module}-codeValidate qmd collections exist:
Use mcp__plugin_qmd_qmd__status (or qmd status --json as CLI fallback per ${CLAUDE_PLUGIN_ROOT}/references/qmd-helpers.md § "MCP-vs-CLI Selection") to list available collections. Apply exact-prefix match from ${CLAUDE_PLUGIN_ROOT}/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.
Run qmd hybrid retrieval:
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.
Derive cgg filter (unless --unfiltered was passed):
From the code query results, extract filter tokens per ${CLAUDE_PLUGIN_ROOT}/references/cgg-integration.md § "Filter Derivation Strategy — From qmd code matches":
auth/jwt.go → jwt, auth)token1|token2|token3If the code query returned no results (collection absent or zero matches), fall back to keyword-based derivation per ${CLAUDE_PLUGIN_ROOT}/references/cgg-integration.md § "Filter Derivation Strategy — From requirement keywords":
the, a, an, for, with, of, in, and, or, to)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.
Generate call graph with cgg:
Follow ${CLAUDE_PLUGIN_ROOT}/references/cgg-integration.md § "Availability Check" first:
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:
git rev-parse --show-toplevel)--module <name>): resolve module source dir per ${CLAUDE_PLUGIN_ROOT}/references/shared-patterns.md § "Artifact Path Resolution"Invoke cgg per ${CLAUDE_PLUGIN_ROOT}/references/cgg-integration.md § "cgg Invocation Pattern":
# 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 ${CLAUDE_PLUGIN_ROOT}/references/cgg-integration.md § "Exit code handling":
${CLAUDE_PLUGIN_ROOT}/references/cgg-integration.md § "Mermaid Output Normalization"${CLAUDE_PLUGIN_ROOT}/references/cgg-integration.md § "Timeout Handling" and skip to step 7Apply 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 ${CLAUDE_PLUGIN_ROOT}/references/cgg-integration.md § "Node cap".
Normalize output per ${CLAUDE_PLUGIN_ROOT}/references/cgg-integration.md § "Mermaid Output Normalization":
graph LR or graph RL to graph TD%% Showing entry points + main flow; internal helpers omitted--> edges reference declared nodes; remove dangling edgesHandle unsupported-language warnings per ${CLAUDE_PLUGIN_ROOT}/references/cgg-integration.md § "Unsupported Language Handling".
Produce output:
Markdown output (default, or --output markdown):
## Search Results: {query}
Found {A} ADRs, {S} specs, {C} code snippets for "{query}".
### 1. Matching ADRs
{For each ADR result, sorted by score descending:}
- **{ADR-ID}: {title}** (score: {score:.2f})
{1-2 sentence relevance note derived from the result snippet and context}
{If no ADR matches:}
No matching ADRs found.
### 2. Matching Specs
{For each spec result, sorted by score descending:}
- **{SPEC-ID}: {title}** (score: {score:.2f})
{1-2 sentence relevance note derived from the result snippet and context}
{If no spec matches:}
No matching specs found.
### 3. Relevant Code Snippets
{For each code result, sorted by score descending:}
- **{path}** (score: {score:.2f})
{1-2 sentence description of what this code does relative to the query}
{If no code matches:}
No relevant code found.
### 4. Call Graphs
{If cgg unavailable:}
Call graphs unavailable — install cgg with: cargo install cgg
or see https://github.com/NeuralNotwerk/cgg
{If cgg timed out:}
Call graph generation timed out (30s). The codebase may be very large.
Try: /cgg <module/path> --filter <keyword> to narrow the scope.
{If cgg failed:}
Call graph generation failed: {stderr}
{If --unfiltered:}
> Generating unfiltered call graph — output may be large. Use /cgg directly for advanced scoping.
{If cgg succeeded:}
<!-- Call graph: {filter used or "unfiltered"}, generated {date} -->
```mermaid
graph TD
...
%% Showing entry points + main flow; internal helpers omitted
{If no nodes matched the filter after trimming:} No call graph nodes matched the filter. Try broadening your search term or use --unfiltered.
| Collection | Matches |
|---|---|
| ADRs | {A} |
| Specs | {S} |
| Code | {C} |
| Call graph nodes | {N or "unavailable"} |
{If cgg succeeded:} Refine the call graph with: /cgg {target-path} --filter "{filter}"
{If no call graph:} Generate a focused call graph with: /cgg {target-path} --filter "{derived-filter-keywords}"
**JSON output** (`--output json`):
Emit a single JSON object:
```json
{
"query": "<query>",
"adr_matches": [
{
"id": "ADR-XXXX",
"title": "<title>",
"path": "<path>",
"score": 0.85,
"snippet": "<snippet text>"
}
],
"spec_matches": [
{
"id": "SPEC-XXXX",
"title": "<title>",
"path": "<path>",
"score": 0.75,
"snippet": "<snippet text>"
}
],
"code_snippets": [
{
"path": "<path>",
"score": 0.65,
"snippet": "<snippet text>"
}
],
"call_graphs": [
{
"filter": "<filter-regex or null>",
"mermaid": "<normalized mermaid block or null>",
"error": "<error message or null>"
}
]
}
For the call_graphs array:
mermaid contains the normalized Mermaid string, error is nullmermaid is null, error contains the user-facing messagefilter is null when --unfiltered was usedlimit: 8 and minScore: 0.3 for all qmd queries per SPEC-0034${CLAUDE_PLUGIN_ROOT}/references/cgg-integration.md § "Mermaid Output Normalization" before embedding--unfiltered is set, MUST skip filter derivation AND emit the large-graph warning before invoking cgg--module <name> is set, MUST scope all qmd collections to {slug}-{module}-{kind} AND scope cgg to the module source directoryNo relevant ADRs, specs, or code found for '{query}'. Try a broader search term. — and stop before invoking cgg## for the top-level heading and ### for sections within the reportmcp__plugin_qmd_qmd__query over the qmd CLI; fall back to CLI only when the MCP is not loaded (per ${CLAUDE_PLUGIN_ROOT}/references/qmd-helpers.md § "MCP-vs-CLI Selection")${CLAUDE_PLUGIN_ROOT}/references/cgg-integration.md verbatim — do not inline custom variantsWhat SKILL.md sets; muted values are Claude Code's defaults
22 skills in this plugin
/adrCreate a new Architecture Decision Record (ADR) using MADR format. Use when the user wants to document an architectural decision, says "create an ADR", "we need an ADR for", or discusses a decision that should be recorded./auditComprehensive audit of design artifact alignment across the project. Use when the user says "audit the architecture", "full drift report", or wants a thorough review of spec compliance and ADR adherence./checkQuick-check code against ADRs and specs for drift. Use when the user says "check for drift", "does this match the spec", or wants a fast alignment check on a specific file or directory.npx claudepluginhub joestump/claude-plugin-sdd --plugin sddOther plugins' skills for the same job