Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ packages = ["src/specify_cli"]
# Page templates (exclude commands/ — bundled separately below to avoid duplication)
"templates/agent-file-template.md" = "specify_cli/core_pack/templates/agent-file-template.md"
"templates/checklist-template.md" = "specify_cli/core_pack/templates/checklist-template.md"
"templates/fix-template.md" = "specify_cli/core_pack/templates/fix-template.md"
"templates/constitution-template.md" = "specify_cli/core_pack/templates/constitution-template.md"
"templates/plan-template.md" = "specify_cli/core_pack/templates/plan-template.md"
"templates/spec-template.md" = "specify_cli/core_pack/templates/spec-template.md"
Expand Down
157 changes: 157 additions & 0 deletions templates/commands/ask.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
---
description: Answer any question about the current feature, project, or Spec Kit workflow — grounded in the constitution, existing specs, and best practices — and route to the right next command.
handoffs:
- label: Write a Spec
agent: speckit.specify
prompt: "Specify the following feature: "
- label: Clarify the Spec
agent: speckit.clarify
prompt: Clarify the current spec
send: true
- label: Build a Plan
agent: speckit.plan
prompt: Create a plan for the spec
send: true
- label: Fix an Error
agent: speckit.fix
prompt: "Fix this error: "
- label: Analyze Consistency
agent: speckit.analyze
prompt: Analyze the current feature artifacts
send: true
scripts:
sh: scripts/bash/check-prerequisites.sh --json --paths-only
ps: scripts/powershell/check-prerequisites.ps1 -Json -PathsOnly
---

## User Input

```text
$ARGUMENTS
```

You **MUST** consider the user input before proceeding (if not empty). This may be any question: conceptual, technical, workflow-related, or about a specific feature.

---

## Goal
Comment on lines +1 to +25
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds a new /speckit.ask command template (templates/commands/ask.md), but the PR title/description only mention /speckit.fix and the fix-log template. Please update the PR description to include /speckit.ask (or split it into a separate PR) so reviewers/users aren’t surprised by the extra command being shipped.

Copilot uses AI. Check for mistakes.

Answer questions about the current Spec Kit project with grounded, actionable responses — and route to the right command when further action is needed. You are a knowledgeable guide, not an executor. You read before you answer. You route before you act.

---

## Phase 0 — Classify the question

Before reading any file, classify the input into one of these categories (zero file I/O):

| Category | Examples | Files to read |
|---|---|---|
| **workflow** | "What command do I run next?", "What is the order of commands?" | none — answer from knowledge |
| **spec** | "Does my spec cover X?", "Is this user story complete?" | `spec.md` (relevant section only) |
| **plan** | "Is this architecture decision correct?", "Should I use X or Y?" | `plan.md` (relevant section only) |
| **constitution** | "Does this violate a project principle?", "Is X allowed?" | `constitution.md` |
| **error** | "Why is X failing?", "What is wrong with my code?" | redirect → `/speckit.fix` immediately |
| **feature-gap** | "How do I add X?", "We need a new behavior" | redirect → `/speckit.specify` immediately |
| **consistency** | "Are spec and plan aligned?", "Is tasks.md up to date?" | `spec.md` + `plan.md` + `tasks.md` |
| **open** | General question not fitting above | `constitution.md` + closest artifact |

**Fast redirects (do not proceed past Phase 0):**
- If the question describes a broken behavior or an error → output redirect block and stop:
```
→ This is a correction request, not a question.
Run: /speckit.fix "[paste your error here]"
```
- If the question requests a new feature or behavior → output redirect block and stop:
```
→ This is a feature request, not a question.
Run: /speckit.specify "[describe what you need]"
```

---

## Phase 1 — Load context

Run `{SCRIPT}` from repo root only if the question category requires reading a project file (see table above). Parse `FEATURE_DIR` and `AVAILABLE_DOCS`.

Load only the files identified in Phase 0 — and only the sections relevant to the question. Do not load artifacts speculatively.

**Always read `constitution.md` when:**
- The question touches a project principle, constraint, or architectural decision
- The answer would suggest a change to an existing artifact
- The question category is `constitution` or `consistency`

**Never read `constitution.md` proactively** for pure workflow questions.

---

## Phase 2 — Answer

Produce a structured response:

```
QUESTION : [restate the question in one line]
CATEGORY : [workflow | spec | plan | constitution | consistency | open]
GROUNDED IN : [knowledge | constitution.md | spec.md | plan.md | tasks.md | multiple]
CONFIDENCE : [high — answer is unambiguous | medium — interpretation required | low — insufficient context]

ANSWER
──────
[Direct, precise answer. Reference file:section when quoting a spec or plan.
If CONFIDENCE = low, state clearly what additional context is needed and why.
Do not hedge unnecessarily — if you know, say it directly.]
```

### Rules for the answer

1. **Base every answer on evidence** — quote the relevant section of the artifact when possible.
2. **Separate fact from recommendation** — clearly distinguish "the spec says X" from "best practice suggests Y".
3. **Respect the constitution** — if the answer would conflict with a principle, say so explicitly. Do not suggest actions that violate it.
4. **Acknowledge gaps honestly** — if the information needed to answer is absent from all artifacts, say so. Do not invent an answer.
5. **One question at a time** — if the input contains multiple questions, answer them in order, each with its own block. Do not merge unrelated answers.

---

## Phase 3 — Route

After the answer, produce a routing suggestion based on what the question revealed:

```
SUGGESTED NEXT
──────────────
[command] [reason — what this command would do given what was just answered]
```

Use this routing table:

| What the answer revealed | Suggested command |
|---|---|
| The spec has a gap or ambiguity | `/speckit.clarify "[the unresolved point]"` |
| A new behavior needs to be defined | `/speckit.specify "[what the system must do]"` |
| A technical decision needs to be made or revisited | `/speckit.plan` |
| Artifacts are inconsistent with each other | `/speckit.analyze` |
| A task is missing or mis-ordered | `/speckit.tasks` |
| An error or broken behavior was surfaced | `/speckit.fix "[the error]"` |
| Everything looks correct | No action needed — state this explicitly |
| Cross-feature impact is possible | `/speckit.analyze` (after the fix or change) |

**Multiple suggestions are allowed** — rank them by urgency (most blocking first).

**Never suggest a command without a reason.** Each suggestion must say *why* that command is warranted given the answer.

---

## Phase 4 — Confidence check

If `CONFIDENCE = low` was set in Phase 2, append:

```
BEFORE PROCEEDING
─────────────────
To answer this confidently, I need:
1. [specific missing piece — e.g., "the full stack trace", "the spec.md of feature X", "which architecture was chosen in plan.md"]
2. [optional second missing piece]

You can provide this directly in the next message, or run the suggested command above to generate it.
```

Do not ask more than 2 clarifying questions. Do not ask for information that can be inferred from the artifacts already loaded.
Loading
Loading