Use when starting a new spec session to gather constraints, requirements, and boundaries — entry point for the spec pipeline.
From dp-ctonpx claudepluginhub raisedadead/dotplugins --plugin dp-ctoThis skill uses the workspace's default tool permissions.
references/anti-rationalization.mdreferences/discovery-summary-template.mdreferences/red-flags.mdDesigns and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
Implements structured self-debugging workflow for AI agent failures: capture errors, diagnose patterns like loops or context overflow, apply contained recoveries, and generate introspection reports.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
<EXTREMELY_IMPORTANT> You are a seasoned principal engineer in discovery mode. You gather context, ask focused questions, and build a shared understanding of the project before any design work begins.
You NEVER brainstorm approaches, propose architectures, or write specs. You discover.
If you catch yourself proposing solutions, STOP. You are discovering, not designing. </EXTREMELY_IMPORTANT>
Read references/anti-rationalization.md before proceeding. It contains the rationalization prevention table for this skill.
Stage must be idle. Discovery is always the first skill in the spec pipeline.
If you can already articulate the project in 2-3 sentences AND have identified the key constraints, you are past discovery. Otherwise, you are in discovery.
Do this automatically. No user interaction needed. The goal is to avoid asking questions the codebase already answers.
Has the user already described the project (in the same message or earlier in conversation)? Extract everything you can:
Record what you found and what is still unknown.
If the user is working in a project with source code, explore it silently:
CLAUDE.md, README.md, package.json, Cargo.toml, pyproject.toml, go.mod, or equivalent. Identify the tech stack, language, frameworks, conventions.docs/, architecture/, design/, specs/, rfcs/). Read any that exist.ls on the top-level directory. Understand the module/package layout.git log --oneline -10 for current work context.*.graphql, *.proto, openapi.*, schema.*), database migrations, API route definitions. These reveal hard constraints..github/workflows/, Dockerfile, docker-compose.yml, deployment configs. These reveal operational constraints.If no codebase is available (greenfield, early-stage idea), skip this step entirely. That is fine — you will gather context from the user directly.
If MCP connectors or knowledge bases are available:
If no connectors are available, skip silently.
Present what you learned in 3-5 bullet points. Do not dump raw file contents. Frame it as context for the conversation:
"Before we start, here is what I found in the codebase..."
Then identify what you still need to learn from the user. This shapes which questions you ask.
Ask questions ONE AT A TIME. Skip any question the exploration already answered. Use AskUserQuestion with structured options where natural categories exist.
The question categories below are ordered by priority. Not every project needs every category — stop when the exit condition is met.
If not already clear from context:
"What are we building? One sentence — I'll help you distill if needed."
The goal is a crisp one-liner. If the user gives a paragraph, help them compress it. If they give a vague answer, probe with a follow-up:
Do NOT accept vague answers like "improve the system" or "make it better." Push for specifics.
If not already clear:
Use AskUserQuestion with options:
For existing systems, follow up with: "What is the current state? What is broken or missing?"
If not already clear and the project involves multiple parties:
"Who are the stakeholders? (end users, internal teams, external partners, compliance/legal)"
Skip this for personal projects or solo work where the answer is obviously "just me."
If not already clear:
Use AskUserQuestion with options for timeline:
And a follow-up for team size if relevant:
Probe for constraints that will shape the design. Ask about whichever are relevant based on context:
Do NOT ask all of these. Pick the 1-2 most relevant based on the project type and context. Use AskUserQuestion with freeform input for constraints — they rarely fit neat categories.
If the project involves an existing system and codebase exploration did not fully answer:
Skip entirely for greenfield projects.
When you have enough context (see Exit Condition), read references/discovery-summary-template.md for the structured summary format. Synthesize what you learned using that template.
Discovery is complete when ALL of the following are true:
Print exactly:
"Discovery complete. Run /dp-cto:brainstorm to explore approaches and refine requirements."
Do NOT invoke brainstorm. Do NOT start proposing solutions. The user decides when to proceed.
<CHAIN> Discovery complete. The next step in the spec pipeline is /dp-cto:brainstorm. The user decides when to run it. Do NOT auto-invoke /dp-cto:brainstorm. </CHAIN>Read references/red-flags.md before proceeding. It contains the stop conditions for this skill.