Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,23 @@ Use the **`/speckit.plan`** command to provide your tech stack and architecture
/speckit.plan The application uses Vite with minimal number of libraries. Use vanilla HTML, CSS, and JavaScript as much as possible. Images are not uploaded anywhere and metadata is stored in a local SQLite database.
```

### 5. Break down into tasks
### 5. Preview changes with what-if analysis (Optional)

Use **`/speckit.whatif`** to preview the impact of requirement changes on complexity, effort, and task breakdown without modifying any files.

```bash
/speckit.whatif Change the database from SQLite to PostgreSQL
```

### 6. Break down into tasks

Use **`/speckit.tasks`** to create an actionable task list from your implementation plan.

```bash
/speckit.tasks
```

### 6. Execute implementation
### 7. Execute implementation

Use **`/speckit.implement`** to execute all tasks and build your feature according to the plan.

Expand Down
2 changes: 2 additions & 0 deletions src/specify_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ def _get_skills_dir(project_path: Path, selected_ai: str) -> Path:
"tasks": "Break down implementation plans into actionable task lists.",
"implement": "Execute all tasks from the task breakdown to build the feature.",
"analyze": "Perform cross-artifact consistency analysis across spec.md, plan.md, and tasks.md.",
"whatif": "Preview the downstream impact of requirement changes (complexity, effort, tasks) without modifying files.",
"clarify": "Structured clarification workflow for underspecified requirements.",
"constitution": "Create or update project governing principles and development guidelines.",
"checklist": "Generate custom quality checklists for validating requirements completeness and clarity.",
Expand Down Expand Up @@ -1436,6 +1437,7 @@ def _display_cmd(name: str) -> str:
enhancement_intro,
"",
f"○ [cyan]{_display_cmd('clarify')}[/] [bright_black](optional)[/bright_black] - Ask structured questions to de-risk ambiguous areas before planning (run before [cyan]{_display_cmd('plan')}[/] if used)",
f"○ [cyan]{_display_cmd('whatif')}[/] [bright_black](optional)[/bright_black] - Preview the footprint of requirement changes (complexity, effort, tasks) before applying them",
f"○ [cyan]{_display_cmd('analyze')}[/] [bright_black](optional)[/bright_black] - Cross-artifact consistency & alignment report (after [cyan]{_display_cmd('tasks')}[/], before [cyan]{_display_cmd('implement')}[/])",
f"○ [cyan]{_display_cmd('checklist')}[/] [bright_black](optional)[/bright_black] - Generate quality checklists to validate requirements completeness, clarity, and consistency (after [cyan]{_display_cmd('plan')}[/])"
]
Expand Down
1 change: 1 addition & 0 deletions src/specify_cli/integrations/claude/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"implement": "Optional implementation guidance or task filter",
"analyze": "Optional focus areas for analysis",
"clarify": "Optional areas to clarify in the spec",
"whatif": "A hypothetical scenario (e.g., 'Add OAuth', 'Drop feature X')",
"constitution": "Principles or values for the project constitution",
"checklist": "Domain or focus area for the checklist",
"taskstoissues": "Optional filter or label for GitHub issues",
Expand Down
127 changes: 127 additions & 0 deletions templates/commands/whatif.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---
description: Preview the downstream impact (complexity, effort, tasks, risks) of requirement changes before committing to them.
scripts:
sh: scripts/bash/check-prerequisites.sh --json --include-tasks
ps: scripts/powershell/check-prerequisites.ps1 -Json -IncludeTasks
---

## User Input

```text
$ARGUMENTS
```

You **MUST** use this input as the "What-if Scenario" to analyze. If empty, prompt the user for a scenario.

## Goal

Provide a detailed, read-only simulation of how the proposed requirement change would impact the project's specification, implementation plan, and task breakdown. Help the team make data-driven decisions about whether to proceed with the change.

## Operating Constraints

**STRICTLY READ-ONLY**: Do **not** modify any files. This is a pure in-memory simulation.

## Execution Steps

### 1. Initialize Simulation Context

Run `{SCRIPT}` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS.
Load core artifacts from FEATURE_DIR:
- **spec.md**: Current requirements and priorities.
- **plan.md**: Current architecture and technical choices.
- **tasks.md**: Current task list and effort markers.
- **constitution**: Project principles (from `/memory/constitution.md`).

### 2. Formulate Simulated State

In your context, model the project as it would look *after* the proposed change:
- **Requirements**: Which are added, removed, or modified?
- **Architecture**: What technical changes are required (new libraries, DB schema changes, API updates)?
- **Tasks**: What is the delta in the task list?

### 3. Calculate Impact Metrics

Derive the following deltas based on your assessment:

#### A. Complexity Score (1-100)
- **Current Score**: Based on requirement count, dependency depth, and technical risk.
- **Simulated Score**: Based on the project state after the change.
- **Delta**: (Simulated - Current).

#### B. Effort Delta (Hours)
- Estimate the total person-hours required to implement the change.
- Breakdown: Research, Development, Testing, Refactoring.

#### C. Task Count Delta
- Number of tasks to be added, removed, or significantly altered.

### 4. Risk Assessment

Identify potential pitfalls:
- **Breaking Changes**: Impact on existing APIs or data.
- **Architecture Drift**: Does the change move the project away from its original goal?
- **Constitution Conflicts**: Does the change violate any project principles?
- **Integration Debt**: New dependencies or maintenance overhead.

### 5. Generate Simulation Report

Output a structured Markdown report (no file writes) with the following structure:

# "What-if" Analysis: [Scenario Summary]

## Executive Summary

| Metric | Current | Simulated | Delta |
|--------|---------|-----------|-------|
| Complexity Score | [Score] | [Score] | [+/- Delta] |
| Total Tasks | [Count] | [Count] | [+/- Delta] |
| Estimated Effort | [Hours] | [Hours] | [+/- Hours] |

**Risk Level**: [LOW | MEDIUM | HIGH | CRITICAL]

---

## 🏗️ Impacted Artifacts

### 📋 Specification (spec.md)
- **Changes**: [Briefly list requirement alterations]
- **Impact**: [High-level impact on user value]

### 📐 Implementation Plan (plan.md)
- **Changes**: [Briefly list architectural updates]
- **Impact**: [Technological implications]

### ✅ Task Breakdown (tasks.md)
- **[ADDED]**: [T-NEW-1] Description...
- **[REMOVED]**: [T-OLD-4] Description...
- **[CHANGED]**: [T-MOD-12] Description...

---

## 🚦 Risk Assessment

| Potential Risk | Severity | Mitigation Suggestion |
|----------------|----------|-----------------------|
| [Risk Title] | [Severity] | [Strategy] |

---

## 📊 Side-by-Side Preview (Simulated)

Show a diff-like preview for the most significant file change (typically spec.md or plan.md).

```markdown
<<<< CURRENT
[Original Content Snippet]
==== SIMULATED
[New Content Snippet]
>>>>
```

## 🏁 Recommendation

Provide a clear "Go / No-Go" recommendation based on the data. Suggest follow-up commands (e.g., "/speckit.specify" to apply these changes) if the user decides to proceed.

## Context

{ARGS}