Upfront Questioning Narrows Search Space

James Phoenix
James Phoenix

When specifications are vague, ask Claude Code to ask you lots of questions before implementing. This narrows the solution space before any code is written.


The Pattern

Tell Claude Code explicitly:

Before implementing, ask me questions to clarify requirements.

The agent then interviews you about edge cases, preferences, and constraints. Only after gathering answers does it propose or implement a solution.


Why This Works

1. Vague Specs Create Exponential Search Spaces

Vague requirement: "Add a settings page"

Possible interpretations:
- Modal vs full page vs sidebar
- Single form vs tabbed sections
- Auto-save vs explicit save button
- Inline validation vs submit validation
- Dark mode support or not
- Mobile responsive or desktop-only
- ...exponentially more combinations

Each unclarified dimension multiplies possibilities. Questions collapse the space before implementation begins.

2. UI Has Larger Search Spaces Than Backend

Backend work often has clearer constraints:

  • API contracts define inputs/outputs
  • Database schemas constrain data shapes
  • Business logic has deterministic rules

UI work is more open-ended:

  • Layout choices are subjective
  • Interaction patterns vary widely
  • Visual hierarchy has many valid solutions
  • User preferences are implicit

Upfront questioning is especially valuable for UI work where the search space is naturally more expansive.

3. Similar to Deep Research Pattern

Deep research tools work by:

  1. Gathering information about the problem
  2. Synthesizing context
  3. Generating output

Upfront questioning applies the same principle:

Udemy Bestseller

Learn Prompt Engineering

My O'Reilly book adapted for hands-on learning. Build production-ready prompts with practical exercises.

4.5/5 rating
306,000+ learners
View Course
  1. Gather requirements through questions
  2. Synthesize understanding
  3. Generate implementation

The interview phase is the research phase.


How to Apply

Simple Version

Add to your prompt:

Ask me 5-10 clarifying questions before implementing.

Structured Version

Before implementing, interview me about:
- User goals and workflows
- Edge cases and error states
- Design preferences and constraints
- Integration requirements
- Non-functional requirements (performance, accessibility)

Only proceed after I've answered.

CLAUDE.md Integration

Add to project instructions:

## Implementation Pattern

When requirements are vague, ask clarifying questions before coding.
Focus questions on:
- User intent behind the feature
- Edge cases that need handling
- Design/UX preferences
- Success criteria

When to Use

Scenario Use Upfront Questioning?
Vague feature request Yes
UI/UX work Yes
New domain you’re unfamiliar with Yes
Clear, well-specified task No
Bug fix with reproduction steps No
Refactoring with defined scope No

Example Exchange

User: Add a notifications system to the app.

Claude Code (with pattern):

Before implementing, I have some questions:

  1. What types of notifications? (system alerts, user actions, reminders)
  2. In-app only, or email/push as well?
  3. Should users be able to configure notification preferences?
  4. Real-time (WebSocket) or polling?
  5. How long should notifications persist?
  6. Any grouping/batching of similar notifications?
  7. What’s the read/unread UX?

User: Just in-app, real-time, user actions only, persist for 7 days, no grouping needed, simple dot indicator for unread.

Claude Code: Now implementing with those constraints…

The search space collapsed from hundreds of combinations to one clear path.


Key Principle

The cost of asking questions is linear. The cost of exploring wrong solutions is exponential. Front-load the questions.


Related

Topics
Ai AgentsClaudeContext EngineeringRequirement EngineeringUi Design

More Insights

Cover Image for Thought Leaders

Thought Leaders

People to follow for compound engineering, context engineering, and AI agent development.

James Phoenix
James Phoenix
Cover Image for Systems Thinking & Observability

Systems Thinking & Observability

Software should be treated as a measurable dynamical system, not as a collection of features.

James Phoenix
James Phoenix