capability-discovery
Discover available agents, skills, quality commands (lint, test, typecheck), tech stack, verification capabilities, and LSP code intelligence features via parallel environment scanning. Use when start
SKILL.mdplugins/flow/skills/capability-discovery/SKILL.md
GitHubCapability Discovery
Contract
Iron law: discover before assuming — never hardcode tool availability; scan the environment first. Invoked once per command run, before any quality or verification phase: /flow:start Phase 1, /flow:pr pre-flight, /flow:address before verification, /flow:resolve step 1c, /flow:setup Phase 1, /flow:design and /flow:brainstorm EXPLORE, and the test-runner agent. Returns the six-section markdown report below (Agents Available, Skills Available, Quality Commands, Tech Stack, Verification Capabilities, LSP Capabilities). The calling command stores the output for later phases and does not re-invoke it within the same run. Permitted skips: the markdown-only early exit (no tech-stack file and no quality commands in CLAUDE.md) and LSP probing when lsp.enabled is false.
Detection Order
The plugin's own agents, skills and commands are under the flow plugin root, which in a project is outside the repository (a plugins/ path exists only in the marketplace repository). Print it first; references/plugin-root-resolution.md describes the search:
printf 'FLOW_ROOT=%s\n' "$(__fr="${CLAUDE_PLUGIN_ROOT:-}";[ -x "$__fr/bin/cascade-resolve.sh" ]||__fr=$({ printf '%s\n' plugins/flow;ls -d "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/plugins/cache/synapti-marketplace/flow/*/ 2>/dev/null|sort -Vr;printf '%s\n' "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/plugins/marketplaces/synapti-marketplace/plugins/flow"; }|while read -r __p;do [ -x "${__p%/}/bin/cascade-resolve.sh" ]&&{ printf '%s\n' "${__p%/}";break;};done);printf '%s\n' "$__fr")"
An empty FLOW_ROOT= means no install was found: report the plugin rows as unavailable rather than as none.
Steps 1-5 are independent — run them simultaneously with parallel tool calls.
Agents:
Glob ".claude/agents/*.md"(project) and"<FLOW_ROOT>/agents/*.md"(plugin); parse source, name (filename without.md), description (frontmatter).Skills:
Glob ".claude/skills/*/SKILL.md"and"<FLOW_ROOT>/skills/*/SKILL.md"; parse source, name (parent directory), description.Commands:
Glob ".claude/commands/*.md"and"<FLOW_ROOT>/commands/*.md"; parse source, name, description.Quality commands from CLAUDE.md —
.claude/CLAUDE.mdfirst, thenCLAUDE.md:grep -E "(npm|pnpm|yarn|bun|ruff|pytest|go |cargo |make )" "$CLAUDE_MD"Tech stack by indicator file:
package.json→ node,tsconfig.json→ typescript,pyproject.toml→ python,Gemfile→ ruby,go.mod→ go,Cargo.toml→ rust,Makefile→ makefile.
Early exit — markdown-only: no tech-stack file AND no quality commands in CLAUDE.md → report Quality Commands "No code-related quality commands applicable", Tech Stack "Markdown-only project", skip Step 6.
Verification capabilities:
ls verify.sh scripts/verify* playwright.config.* cypress.config.* 2>/dev/null.Also probe the four dependency-license tools (
license-checker,pip-licenses,cargo-license,go-licenses) thatagents/security-reviewer.mdStep 4 uses, andjscpd, the clone detectorbin/flow-clone-scan.shdrives. Commands and output lines:references/runtime-verification-probes.md§ Tool probes.An absent tool is reported
not-installedwith its install command, never passed over: a reviewer who never learns a tool was missing reads a thinner judgment as a complete one.jscpdhas no fallback, so absent it means the verbatim duplication layer reportsSTATE=unavailable. Report it; never install it.LSP capabilities: pre-check
lsp.enabled(defaulttrue; iffalse, report every featureDisabled). ProbedocumentSymbol,hover,goToDefinition,findReferences,goToImplementationagainst one representative source file for the detected stack, each bounded bylsp.timeout(default 5000 ms); inferdiagnosticsAvailable whendocumentSymbolsucceeds. Procedure and result rules:references/lsp-capability-probes.md.
Output Format
Six sections, Agents Available, Skills Available, Quality Commands, Tech Stack, Verification Capabilities and LSP Capabilities, in the template in references/capability-discovery-output.md.
Graceful Degradation
[ask: decision] No agents → built-in review checklist. No CLAUDE.md commands → detect from tech stack. No tech stack → ask the user for commands (metadata.source flow:decision). No LSP server → CLI-only analysis (grep/glob for references, CLI tools for diagnostics); not an error.
Caching
This skill runs in a forked context. The calling command must store the output for use in later phases — do not re-invoke within the same command execution.