Capability 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
Steps 1-5 are independent — run them simultaneously with parallel tool calls.
Agents: Glob ".claude/agents/*.md" (project) and "plugins/*/agents/*.md" (plugin); parse source, name (filename without .md), description (frontmatter).
Skills: Glob ".claude/skills/*/SKILL.md" and "plugins/*/skills/*/SKILL.md"; parse source, name (parent directory), description.
Commands: Glob ".claude/commands/*.md" and "plugins/*/commands/*.md"; parse source, name, description.
Quality commands from CLAUDE.md — .claude/CLAUDE.md first, then CLAUDE.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.
- LSP capabilities: pre-check
lsp.enabled (default true; if false, report every feature Disabled). Probe documentSymbol, hover, goToDefinition, findReferences, goToImplementation against one representative source file for the detected stack, each bounded by lsp.timeout (default 5000 ms); infer diagnostics Available when documentSymbol succeeds. Procedure and result rules: references/lsp-capability-probes.md.
Output Format
### Agents Available
| Agent | Source | Description |
|-------|--------|-------------|
### Skills Available
| Skill | Source | Description |
|-------|--------|-------------|
### Quality Commands
| Command | Purpose | Source |
|---------|---------|--------|
### Tech Stack
- {language} ({indicator file})
### Verification Capabilities
| Capability | Command | Source |
|-----------|---------|--------|
### LSP Capabilities
| Feature | Status | Use Case |
|---------|--------|----------|
| documentSymbol | {Available/Unavailable} | Symbol navigation in files |
| hover | {Available/Unavailable} | Type info and documentation during CODE phase |
| goToDefinition | {Available/Unavailable} | Trace code paths during EXPLORE phase |
| findReferences | {Available/Unavailable} | Impact analysis during EXPLORE, caller verification during REVIEW |
| goToImplementation | {Available/Unavailable} | Interface resolution |
| diagnostics | {Available/Unavailable} | Quality signal during VERIFY phase (errors→P1, warnings→P2) |
Graceful Degradation
No agents → built-in review checklist. No CLAUDE.md commands → detect from tech stack. No tech stack → ask the user for commands. 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.
1---2name: capability-discovery3description: Discover available agents, skills, quality commands (lint, test, typecheck), tech stack, verification capabilities, and LSP code intelligence features via parallel environment scanning. Use when starting implementation, creating PRs, reviewing PRs, or addressing feedback. This skill MUST be consulted because assuming tools exist causes runtime failures, and assuming they do not causes missing capabilities.4---56# Capability Discovery78## Contract910Iron 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`.1112## Detection Order1314Steps 1-5 are independent — run them simultaneously with parallel tool calls.15161. **Agents**: `Glob ".claude/agents/*.md"` (project) and `"plugins/*/agents/*.md"` (plugin); parse source, name (filename without `.md`), description (frontmatter).172. **Skills**: `Glob ".claude/skills/*/SKILL.md"` and `"plugins/*/skills/*/SKILL.md"`; parse source, name (parent directory), description.183. **Commands**: `Glob ".claude/commands/*.md"` and `"plugins/*/commands/*.md"`; parse source, name, description.194. **Quality commands from CLAUDE.md** — `.claude/CLAUDE.md` first, then `CLAUDE.md`:2021 ```bash22 grep -E "(npm|pnpm|yarn|bun|ruff|pytest|go |cargo |make )" "$CLAUDE_MD"23 ```24255. **Tech stack** by indicator file: `package.json` → node, `tsconfig.json` → typescript, `pyproject.toml` → python, `Gemfile` → ruby, `go.mod` → go, `Cargo.toml` → rust, `Makefile` → makefile.2627**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.28296. **Verification capabilities**: `ls verify.sh scripts/verify* playwright.config.* cypress.config.* 2>/dev/null`.307. **LSP capabilities**: pre-check `lsp.enabled` (default `true`; if `false`, report every feature `Disabled`). Probe `documentSymbol`, `hover`, `goToDefinition`, `findReferences`, `goToImplementation` against one representative source file for the detected stack, each bounded by `lsp.timeout` (default 5000 ms); infer `diagnostics` Available when `documentSymbol` succeeds. Procedure and result rules: `references/lsp-capability-probes.md`.3132## Output Format3334```markdown35### Agents Available36| Agent | Source | Description |37|-------|--------|-------------|3839### Skills Available40| Skill | Source | Description |41|-------|--------|-------------|4243### Quality Commands44| Command | Purpose | Source |45|---------|---------|--------|4647### Tech Stack48- {language} ({indicator file})4950### Verification Capabilities51| Capability | Command | Source |52|-----------|---------|--------|5354### LSP Capabilities55| Feature | Status | Use Case |56|---------|--------|----------|57| documentSymbol | {Available/Unavailable} | Symbol navigation in files |58| hover | {Available/Unavailable} | Type info and documentation during CODE phase |59| goToDefinition | {Available/Unavailable} | Trace code paths during EXPLORE phase |60| findReferences | {Available/Unavailable} | Impact analysis during EXPLORE, caller verification during REVIEW |61| goToImplementation | {Available/Unavailable} | Interface resolution |62| diagnostics | {Available/Unavailable} | Quality signal during VERIFY phase (errors→P1, warnings→P2) |63```6465## Graceful Degradation6667No agents → built-in review checklist. No CLAUDE.md commands → detect from tech stack. No tech stack → ask the user for commands. No LSP server → CLI-only analysis (grep/glob for references, CLI tools for diagnostics); not an error.6869## Caching7071This 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.