moai-adk 0.4.7__py3-none-any.whl → 0.4.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of moai-adk might be problematic. Click here for more details.
- moai_adk/templates/.claude/agents/alfred/cc-manager.md +188 -954
- moai_adk/templates/.claude/agents/alfred/debug-helper.md +4 -5
- moai_adk/templates/.claude/agents/alfred/doc-syncer.md +2 -2
- moai_adk/templates/.claude/agents/alfred/git-manager.md +2 -2
- moai_adk/templates/.claude/agents/alfred/implementation-planner.md +3 -3
- moai_adk/templates/.claude/agents/alfred/project-manager.md +6 -6
- moai_adk/templates/.claude/agents/alfred/quality-gate.md +4 -6
- moai_adk/templates/.claude/agents/alfred/skill-factory.md +36 -36
- moai_adk/templates/.claude/agents/alfred/spec-builder.md +2 -2
- moai_adk/templates/.claude/agents/alfred/tag-agent.md +2 -2
- moai_adk/templates/.claude/agents/alfred/tdd-implementer.md +3 -3
- moai_adk/templates/.claude/agents/alfred/trust-checker.md +5 -5
- moai_adk/templates/.claude/commands/alfred/0-project.md +98 -42
- moai_adk/templates/.claude/commands/alfred/1-plan.md +7 -7
- moai_adk/templates/.claude/commands/alfred/2-run.md +36 -36
- moai_adk/templates/.claude/commands/alfred/3-sync.md +10 -10
- moai_adk/templates/.claude/hooks/alfred/alfred_hooks.py +14 -1
- moai_adk/templates/.claude/hooks/alfred/core/__init__.py +115 -33
- moai_adk/templates/.claude/hooks/alfred/handlers/session.py +8 -9
- moai_adk/templates/.claude/hooks/alfred/handlers/tool.py +6 -6
- moai_adk/templates/.claude/hooks/alfred/handlers/user.py +5 -4
- moai_adk/templates/.claude/output-styles/alfred/agentic-coding.md +1 -1
- moai_adk/templates/.claude/output-styles/alfred/moai-adk-learning.md +1 -1
- moai_adk/templates/.claude/output-styles/alfred/study-with-alfred.md +1 -1
- moai_adk/templates/.claude/settings.json +42 -2
- moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/SKILL.md +480 -0
- moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/examples.md +257 -0
- moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/reference.md +120 -0
- moai_adk/templates/.claude/skills/moai-cc-agents/SKILL.md +249 -0
- moai_adk/templates/.claude/skills/moai-cc-agents/templates/agent-template.md +32 -0
- moai_adk/templates/.claude/skills/moai-cc-claude-md/SKILL.md +278 -0
- moai_adk/templates/.claude/skills/moai-cc-claude-md/templates/CLAUDE-template.md +26 -0
- moai_adk/templates/.claude/skills/moai-cc-commands/SKILL.md +287 -0
- moai_adk/templates/.claude/skills/moai-cc-commands/templates/command-template.md +21 -0
- moai_adk/templates/.claude/skills/moai-cc-hooks/SKILL.md +232 -0
- moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/pre-bash-check.sh +19 -0
- moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/preserve-permissions.sh +19 -0
- moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/validate-bash-command.py +24 -0
- moai_adk/templates/.claude/skills/moai-cc-mcp-plugins/SKILL.md +179 -0
- moai_adk/templates/.claude/skills/moai-cc-mcp-plugins/templates/settings-mcp-template.json +39 -0
- moai_adk/templates/.claude/skills/moai-cc-memory/SKILL.md +296 -0
- moai_adk/templates/.claude/skills/moai-cc-memory/templates/session-summary-template.md +18 -0
- moai_adk/templates/.claude/skills/moai-cc-settings/SKILL.md +243 -0
- moai_adk/templates/.claude/skills/moai-cc-settings/templates/settings-complete-template.json +30 -0
- moai_adk/templates/.claude/skills/moai-cc-skills/SKILL.md +271 -0
- moai_adk/templates/.claude/skills/moai-cc-skills/templates/SKILL-template.md +15 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/EXAMPLES.md +261 -35
- moai_adk/templates/.claude/skills/moai-skill-factory/INTERACTIVE-DISCOVERY.md +15 -15
- moai_adk/templates/.claude/skills/moai-skill-factory/PARALLEL-ANALYSIS-REPORT.md +429 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/PYTHON-VERSION-MATRIX.md +391 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/SKILL-FACTORY-WORKFLOW.md +431 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/SKILL.md +33 -33
- moai_adk/templates/.claude/skills/moai-skill-factory/STEP-BY-STEP-GUIDE.md +466 -0
- moai_adk/templates/.claude/skills/moai-skill-factory/reference.md +438 -42
- moai_adk/templates/.claude/skills/moai-spec-authoring/README.md +129 -0
- moai_adk/templates/.claude/skills/moai-spec-authoring/SKILL.md +1300 -0
- moai_adk/templates/.claude/skills/moai-spec-authoring/examples/validate-spec.sh +161 -0
- moai_adk/templates/CLAUDE.md +101 -93
- {moai_adk-0.4.7.dist-info → moai_adk-0.4.8.dist-info}/METADATA +537 -146
- {moai_adk-0.4.7.dist-info → moai_adk-0.4.8.dist-info}/RECORD +63 -73
- moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-alfred-debugger-pro/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-alfred-debugger-pro/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-alfred-debugger-pro/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-alfred-performance-optimizer/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-alfred-performance-optimizer/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-alfred-performance-optimizer/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-alfred-refactoring-coach/SKILL.md +0 -113
- moai_adk/templates/.claude/skills/moai-alfred-refactoring-coach/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-alfred-refactoring-coach/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-alfred-tui-survey/SKILL.md +0 -635
- moai_adk/templates/.claude/skills/moai-alfred-tui-survey/examples.md +0 -992
- moai_adk/templates/.claude/skills/moai-alfred-tui-survey/reference.md +0 -801
- moai_adk/templates/.claude/skills/moai-claude-code/SKILL.md +0 -121
- moai_adk/templates/.claude/skills/moai-claude-code/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-claude-code/reference.md +0 -28
- moai_adk/templates/.claude/skills/moai-claude-code/templates/agent-full.md +0 -332
- moai_adk/templates/.claude/skills/moai-claude-code/templates/command-full.md +0 -384
- moai_adk/templates/.claude/skills/moai-claude-code/templates/plugin-full.json +0 -363
- moai_adk/templates/.claude/skills/moai-claude-code/templates/settings-full.json +0 -595
- moai_adk/templates/.claude/skills/moai-claude-code/templates/skill-full.md +0 -496
- moai_adk/templates/.claude/skills/moai-lang-clojure/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-lang-clojure/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-clojure/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-lang-elixir/SKILL.md +0 -124
- moai_adk/templates/.claude/skills/moai-lang-elixir/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-elixir/reference.md +0 -31
- moai_adk/templates/.claude/skills/moai-lang-haskell/SKILL.md +0 -124
- moai_adk/templates/.claude/skills/moai-lang-haskell/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-haskell/reference.md +0 -31
- moai_adk/templates/.claude/skills/moai-lang-julia/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-lang-julia/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-julia/reference.md +0 -30
- moai_adk/templates/.claude/skills/moai-lang-lua/SKILL.md +0 -123
- moai_adk/templates/.claude/skills/moai-lang-lua/examples.md +0 -29
- moai_adk/templates/.claude/skills/moai-lang-lua/reference.md +0 -30
- {moai_adk-0.4.7.dist-info → moai_adk-0.4.8.dist-info}/WHEEL +0 -0
- {moai_adk-0.4.7.dist-info → moai_adk-0.4.8.dist-info}/entry_points.txt +0 -0
- {moai_adk-0.4.7.dist-info → moai_adk-0.4.8.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: moai-alfred-interactive-questions
|
|
3
|
+
version: 3.0.0
|
|
4
|
+
created: 2025-10-22
|
|
5
|
+
updated: 2025-10-23
|
|
6
|
+
status: active
|
|
7
|
+
description: Guide Alfred sub-agents to actively invoke AskUserQuestion for ambiguous decisions.
|
|
8
|
+
keywords: ['interactive', 'clarification', 'decision-making', 'AskUserQuestion']
|
|
9
|
+
allowed-tools:
|
|
10
|
+
- AskUserQuestion
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Alfred Interactive Questions - Skill Guide
|
|
14
|
+
|
|
15
|
+
## Skill Metadata
|
|
16
|
+
|
|
17
|
+
| Field | Value |
|
|
18
|
+
| ----- | ----- |
|
|
19
|
+
| **Skill Name** | moai-alfred-interactive-questions |
|
|
20
|
+
| **Version** | 3.0.0 (2025-10-23) |
|
|
21
|
+
| **Core Tool** | `AskUserQuestion` (Claude Code built-in) |
|
|
22
|
+
| **Auto-load** | When Alfred detects ambiguity in requests |
|
|
23
|
+
| **Tier** | Alfred (Workflow Orchestration) |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## What It Does
|
|
28
|
+
|
|
29
|
+
**Purpose**: Empower Alfred sub-agents to **actively ask clarifying questions** whenever user intent is ambiguous, rather than guessing.
|
|
30
|
+
|
|
31
|
+
Leverages Claude Code's native `AskUserQuestion` tool to collect explicit, structured user input that transforms vague requests into precise specifications.
|
|
32
|
+
|
|
33
|
+
**Key capabilities**:
|
|
34
|
+
- ✅ Single-select & multi-select option types
|
|
35
|
+
- ✅ 1-4 questions per survey (avoid fatigue)
|
|
36
|
+
- ✅ 2-4 options per question (prevent choice overload)
|
|
37
|
+
- ✅ Automatic "Other" option for custom input
|
|
38
|
+
- ✅ Conditional branching based on answers
|
|
39
|
+
- ✅ Integration across all Alfred commands (Plan/Run/Sync)
|
|
40
|
+
- ✅ Reduces ambiguity → fewer iterations → faster execution
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## When to Ask (Trigger Patterns)
|
|
45
|
+
|
|
46
|
+
### ✅ ASK when user intent is ambiguous:
|
|
47
|
+
|
|
48
|
+
1. **Vague noun phrases**: "Add dashboard", "Refactor auth", "Improve performance"
|
|
49
|
+
2. **Missing scope**: No specification of WHERE, WHO, WHAT, HOW, WHEN
|
|
50
|
+
3. **Multiple valid paths**: ≥2 reasonable implementation approaches
|
|
51
|
+
4. **Trade-off decisions**: Speed vs quality, simple vs comprehensive, etc.
|
|
52
|
+
5. **Risky operations**: Destructive actions needing explicit consent
|
|
53
|
+
|
|
54
|
+
### ❌ DON'T ask when:
|
|
55
|
+
- User explicitly specified exact requirements
|
|
56
|
+
- Decision is automatic (no choices)
|
|
57
|
+
- Single obvious path exists
|
|
58
|
+
- Quick yes/no confirmation only (maybe, but keep it brief)
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Core Principle: Just Ask!
|
|
63
|
+
|
|
64
|
+
**Golden Rule**: When in doubt, **ask the user** instead of guessing.
|
|
65
|
+
|
|
66
|
+
**Why**:
|
|
67
|
+
- ✅ User sees exactly what you'll do → no surprises
|
|
68
|
+
- ✅ Single interaction vs 3-5 rounds of back-and-forth
|
|
69
|
+
- ✅ Fast → execute with certainty
|
|
70
|
+
- ✅ Reduces "vibe coding" frustration
|
|
71
|
+
|
|
72
|
+
**Pattern**:
|
|
73
|
+
```
|
|
74
|
+
Ambiguous request detected
|
|
75
|
+
↓
|
|
76
|
+
Call AskUserQuestion({questions: [...]})
|
|
77
|
+
↓
|
|
78
|
+
User selects from clear options
|
|
79
|
+
↓
|
|
80
|
+
Proceed with confirmed specifications
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## AskUserQuestion API Reference
|
|
86
|
+
|
|
87
|
+
### Minimal Invocation
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
const answer = await AskUserQuestion({
|
|
91
|
+
questions: [
|
|
92
|
+
{
|
|
93
|
+
question: "How should we implement this?",
|
|
94
|
+
header: "Approach", // max 12 chars
|
|
95
|
+
multiSelect: false,
|
|
96
|
+
options: [
|
|
97
|
+
{
|
|
98
|
+
label: "Option 1", // 1-5 words
|
|
99
|
+
description: "What it does and why you'd pick it."
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
label: "Option 2",
|
|
103
|
+
description: "Alternative with different trade-offs."
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Returns: { "Approach": "Option 1" }
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Key Constraints
|
|
114
|
+
|
|
115
|
+
| Constraint | Reason |
|
|
116
|
+
|-----------|--------|
|
|
117
|
+
| **1-4 questions max** | Avoid user fatigue |
|
|
118
|
+
| **2-4 options per Q** | Prevent choice overload |
|
|
119
|
+
| **Header ≤12 chars** | TUI layout fit |
|
|
120
|
+
| **Label 1-5 words** | Quick scanning |
|
|
121
|
+
| **Description required** | Enables informed choice |
|
|
122
|
+
| **Auto "Other" option** | Always available for custom input |
|
|
123
|
+
|
|
124
|
+
### Question Types
|
|
125
|
+
|
|
126
|
+
**Single-Select** (`multiSelect: false`):
|
|
127
|
+
- Mutually exclusive: "Choose ONE database"
|
|
128
|
+
- Returns: `{ "Header": "Selected Label" }`
|
|
129
|
+
|
|
130
|
+
**Multi-Select** (`multiSelect: true`):
|
|
131
|
+
- Independent options: "Which features to enable?" (check multiple)
|
|
132
|
+
- Returns: `{ "Header": ["Label1", "Label2"] }`
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Usage Patterns (Top 5)
|
|
137
|
+
|
|
138
|
+
### Pattern 1: Implementation Approach
|
|
139
|
+
|
|
140
|
+
**Trigger**: "Add feature X" or "Build Y" without specifics
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
await AskUserQuestion({
|
|
144
|
+
questions: [{
|
|
145
|
+
question: "How should we implement this feature?",
|
|
146
|
+
header: "Approach",
|
|
147
|
+
multiSelect: false,
|
|
148
|
+
options: [
|
|
149
|
+
{ label: "New standalone component", description: "Isolated, reusable." },
|
|
150
|
+
{ label: "Extend existing component", description: "Shared state, simpler." },
|
|
151
|
+
{ label: "Use environment flag", description: "Conditional visibility." }
|
|
152
|
+
]
|
|
153
|
+
}]
|
|
154
|
+
});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Pattern 2: Confirmation (Risky Operations)
|
|
158
|
+
|
|
159
|
+
**Trigger**: Destructive action (delete, migrate, reset)
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
await AskUserQuestion({
|
|
163
|
+
questions: [{
|
|
164
|
+
question: "This will permanently delete 50 records. Proceed?",
|
|
165
|
+
header: "Confirm",
|
|
166
|
+
multiSelect: false,
|
|
167
|
+
options: [
|
|
168
|
+
{ label: "Yes, proceed", description: "Irreversible. Continue." },
|
|
169
|
+
{ label: "No, cancel", description: "Abort operation." }
|
|
170
|
+
]
|
|
171
|
+
}]
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Pattern 3: Multi-Option Feature Selection
|
|
176
|
+
|
|
177
|
+
**Trigger**: "Which framework/library/approach?"
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
await AskUserQuestion({
|
|
181
|
+
questions: [{
|
|
182
|
+
question: "Which i18n library?",
|
|
183
|
+
header: "Library",
|
|
184
|
+
multiSelect: false,
|
|
185
|
+
options: [
|
|
186
|
+
{ label: "next-intl", description: "Next.js 15+ native, best DX." },
|
|
187
|
+
{ label: "react-i18next", description: "Popular, flexible, more setup." },
|
|
188
|
+
{ label: "Format.js", description: "ICU format, powerful, complex." }
|
|
189
|
+
]
|
|
190
|
+
}]
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Pattern 4: Multi-Select (Independent Features)
|
|
195
|
+
|
|
196
|
+
**Trigger**: "Which features to enable/include?"
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
await AskUserQuestion({
|
|
200
|
+
questions: [{
|
|
201
|
+
question: "Which testing frameworks?",
|
|
202
|
+
header: "Test Tools",
|
|
203
|
+
multiSelect: true, // Multiple selections allowed
|
|
204
|
+
options: [
|
|
205
|
+
{ label: "Unit tests (Vitest)", description: "Fast, modern." },
|
|
206
|
+
{ label: "E2E tests (Playwright)", description: "Browser automation." },
|
|
207
|
+
{ label: "Visual regression", description: "Screenshot comparison." }
|
|
208
|
+
]
|
|
209
|
+
}]
|
|
210
|
+
});
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Pattern 5: Sequential Questions (Conditional Flow)
|
|
214
|
+
|
|
215
|
+
**Trigger**: Dependent decisions (Q2 depends on Q1 answer)
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
// Question 1
|
|
219
|
+
const q1 = await AskUserQuestion({
|
|
220
|
+
questions: [{
|
|
221
|
+
question: "Enable authentication?",
|
|
222
|
+
header: "Auth",
|
|
223
|
+
options: [
|
|
224
|
+
{ label: "Yes", description: "User login required." },
|
|
225
|
+
{ label: "No", description: "Public access." }
|
|
226
|
+
]
|
|
227
|
+
}]
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Question 2 (only if Q1 = "Yes")
|
|
231
|
+
if (q1["Auth"] === "Yes") {
|
|
232
|
+
const q2 = await AskUserQuestion({
|
|
233
|
+
questions: [{
|
|
234
|
+
question: "Which auth provider?",
|
|
235
|
+
header: "Provider",
|
|
236
|
+
options: [
|
|
237
|
+
{ label: "JWT + email", description: "Traditional." },
|
|
238
|
+
{ label: "OAuth", description: "Third-party." }
|
|
239
|
+
]
|
|
240
|
+
}]
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Best Practices
|
|
248
|
+
|
|
249
|
+
### ✅ DO
|
|
250
|
+
|
|
251
|
+
- **Be specific**: "Which database type?" not "What should we use?"
|
|
252
|
+
- **Provide context**: Include file names, scope, or impact
|
|
253
|
+
- **Order logically**: General → Specific; safest option first
|
|
254
|
+
- **Flag risks**: Use "NOT RECOMMENDED" or "CAUTION:" prefixes
|
|
255
|
+
- **Explain trade-offs**: Mention time, resources, complexity
|
|
256
|
+
- **Single-select for exclusive**: "Choose ONE"
|
|
257
|
+
- **Multi-select for combinable**: "Check any that apply"
|
|
258
|
+
- **Include descriptions**: Every option needs rationale
|
|
259
|
+
- **Keep headers short**: "Approach" not "Implementation Strategy"
|
|
260
|
+
- **Batch related questions**: Ask 2-3 at once if they flow naturally
|
|
261
|
+
|
|
262
|
+
### ❌ DON'T
|
|
263
|
+
|
|
264
|
+
- **Overuse questions**: Only ask when ambiguous
|
|
265
|
+
- **Too many options**: 2-4 per question max
|
|
266
|
+
- **Vague labels**: "Option A", "Use tokens", "Option 2"
|
|
267
|
+
- **Skip descriptions**: User needs rationale
|
|
268
|
+
- **Hide trade-offs**: Always mention implications
|
|
269
|
+
- **Make destructive default**: Risky option = NOT pre-selected
|
|
270
|
+
- **Mix concerns**: One decision per question
|
|
271
|
+
- **Manually add "Other"**: It's auto-provided
|
|
272
|
+
- **Nest more than 2 levels deep**: Keep flow linear
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Integration with Alfred Sub-agents
|
|
277
|
+
|
|
278
|
+
### spec-builder (`/alfred:1-plan`)
|
|
279
|
+
|
|
280
|
+
**When to ask**:
|
|
281
|
+
- SPEC title is vague ("Add feature")
|
|
282
|
+
- Scope undefined (what exactly?)
|
|
283
|
+
- Domain prefix unclear (AUTH vs UI vs DATA?)
|
|
284
|
+
|
|
285
|
+
**Example**:
|
|
286
|
+
```typescript
|
|
287
|
+
if (titleIsAmbiguous(specTitle)) {
|
|
288
|
+
const answer = await AskUserQuestion({
|
|
289
|
+
questions: [{
|
|
290
|
+
question: "Can you clarify what this SPEC should cover?",
|
|
291
|
+
header: "Scope",
|
|
292
|
+
options: [...]
|
|
293
|
+
}]
|
|
294
|
+
});
|
|
295
|
+
specTitle = answer["Scope"];
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### code-builder (`/alfred:2-run`)
|
|
300
|
+
|
|
301
|
+
**When to ask**:
|
|
302
|
+
- Implementation approach unclear
|
|
303
|
+
- Multiple valid paths exist
|
|
304
|
+
- Error recovery needed (failing tests)
|
|
305
|
+
|
|
306
|
+
**Example**:
|
|
307
|
+
```typescript
|
|
308
|
+
if (multipleValidImplementationPaths) {
|
|
309
|
+
const answer = await AskUserQuestion({
|
|
310
|
+
questions: [{
|
|
311
|
+
question: "How should we implement this?",
|
|
312
|
+
header: "Approach",
|
|
313
|
+
options: [...]
|
|
314
|
+
}]
|
|
315
|
+
});
|
|
316
|
+
implementationStrategy = answer["Approach"];
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### doc-syncer (`/alfred:3-sync`)
|
|
321
|
+
|
|
322
|
+
**When to ask**:
|
|
323
|
+
- Sync scope unclear (full vs partial)
|
|
324
|
+
- PR Ready status uncertain
|
|
325
|
+
- Documentation coverage decision needed
|
|
326
|
+
|
|
327
|
+
**Example**:
|
|
328
|
+
```typescript
|
|
329
|
+
const syncMode = await AskUserQuestion({
|
|
330
|
+
questions: [{
|
|
331
|
+
question: "Which sync mode?",
|
|
332
|
+
header: "Mode",
|
|
333
|
+
options: [
|
|
334
|
+
{ label: "auto", description: "Smart detection." },
|
|
335
|
+
{ label: "force", description: "Regenerate all." }
|
|
336
|
+
]
|
|
337
|
+
}]
|
|
338
|
+
});
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Real-World Examples
|
|
344
|
+
|
|
345
|
+
### Example: Vague Feature Request
|
|
346
|
+
|
|
347
|
+
**User**: "Add a completion page for the competition."
|
|
348
|
+
|
|
349
|
+
**Alfred detects ambiguity**:
|
|
350
|
+
- Where should it live? (new route vs modify existing)
|
|
351
|
+
- Who can access it? (public vs authenticated)
|
|
352
|
+
- What should it display? (results vs simple message)
|
|
353
|
+
|
|
354
|
+
**AskUserQuestion invocation**:
|
|
355
|
+
```typescript
|
|
356
|
+
const answer = await AskUserQuestion({
|
|
357
|
+
questions: [
|
|
358
|
+
{
|
|
359
|
+
question: "How should the completion page be implemented?",
|
|
360
|
+
header: "Approach",
|
|
361
|
+
multiSelect: false,
|
|
362
|
+
options: [
|
|
363
|
+
{ label: "New public route", description: "New page visible to all visitors." },
|
|
364
|
+
{ label: "Modify existing page", description: "Add conditional logic to /end page." },
|
|
365
|
+
{ label: "Environment flag", description: "Set NEXT_PUBLIC_COMPETITION_CLOSED=true." }
|
|
366
|
+
]
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
question: "For logged-in participants?",
|
|
370
|
+
header: "Behavior",
|
|
371
|
+
multiSelect: false,
|
|
372
|
+
options: [
|
|
373
|
+
{ label: "Show full results", description: "Redirect to /end page with history." },
|
|
374
|
+
{ label: "Show simple message", description: "Display 'Competition concluded' only." }
|
|
375
|
+
]
|
|
376
|
+
}
|
|
377
|
+
]
|
|
378
|
+
});
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
**Result**: Alfred knows exactly what to build.
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## Anti-Patterns to Avoid
|
|
386
|
+
|
|
387
|
+
### ❌ Too Many Options
|
|
388
|
+
```typescript
|
|
389
|
+
// 8+ options = choice paralysis
|
|
390
|
+
options: [
|
|
391
|
+
{ label: "PostgreSQL" }, { label: "MySQL" }, { label: "MariaDB" },
|
|
392
|
+
{ label: "SQLite" }, { label: "MongoDB" }, { label: "CouchDB" },
|
|
393
|
+
{ label: "Cassandra" }, { label: "Redis" }
|
|
394
|
+
]
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### ✅ Group Options
|
|
398
|
+
```typescript
|
|
399
|
+
// First ask: which TYPE? Then: specific within type
|
|
400
|
+
questions: [{
|
|
401
|
+
question: "Database type?",
|
|
402
|
+
header: "DB Type",
|
|
403
|
+
options: [
|
|
404
|
+
{ label: "Relational (SQL)", description: "PostgreSQL, MySQL, etc." },
|
|
405
|
+
{ label: "Document (NoSQL)", description: "MongoDB, CouchDB, etc." },
|
|
406
|
+
{ label: "Key-Value", description: "Redis, Memcached, etc." }
|
|
407
|
+
]
|
|
408
|
+
}]
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## Error Handling
|
|
414
|
+
|
|
415
|
+
### User Cancels (ESC key)
|
|
416
|
+
```typescript
|
|
417
|
+
try {
|
|
418
|
+
const answer = await AskUserQuestion({...});
|
|
419
|
+
} catch (error) {
|
|
420
|
+
console.log("User cancelled survey");
|
|
421
|
+
// Fall back to default or abort
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### Validate Custom Input ("Other" option)
|
|
426
|
+
```typescript
|
|
427
|
+
const answer = await AskUserQuestion({...});
|
|
428
|
+
|
|
429
|
+
if (answer["Header"] === "Other" || !VALID_OPTIONS.includes(answer["Header"])) {
|
|
430
|
+
// Handle custom input validation
|
|
431
|
+
validateCustomInput(answer["Header"]);
|
|
432
|
+
}
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## Performance Tips
|
|
438
|
+
|
|
439
|
+
- **Batch questions**: Ask 2-3 related questions in one call
|
|
440
|
+
- **Minimize calls**: Don't ask sequentially unless truly dependent
|
|
441
|
+
- **Pre-generate options**: Analyze codebase once to generate all options
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
## References
|
|
446
|
+
|
|
447
|
+
**Official Claude Code Documentation**:
|
|
448
|
+
- AskUserQuestion tool (built-in Claude Code)
|
|
449
|
+
- Interactive Prompting (CLAUDE.md § Clarification & Interactive Prompting)
|
|
450
|
+
|
|
451
|
+
**Related Skills**:
|
|
452
|
+
- `moai-alfred-spec-metadata-validation` (SPEC clarity)
|
|
453
|
+
- `moai-alfred-ears-authoring` (requirement phrasing)
|
|
454
|
+
- `moai-foundation-specs` (SPEC structure)
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
## Summary
|
|
459
|
+
|
|
460
|
+
**When to use**:
|
|
461
|
+
- User intent is ambiguous
|
|
462
|
+
- Multiple valid approaches exist
|
|
463
|
+
- Architectural decisions with trade-offs
|
|
464
|
+
- Approvals needed before risky ops
|
|
465
|
+
|
|
466
|
+
**How**:
|
|
467
|
+
1. Detect ambiguity (vague request, multiple paths, etc.)
|
|
468
|
+
2. Call `AskUserQuestion({ questions: [...] })`
|
|
469
|
+
3. User selects from clear options
|
|
470
|
+
4. Proceed with confirmed specifications
|
|
471
|
+
|
|
472
|
+
**Benefits**:
|
|
473
|
+
- ✅ Certainty instead of guessing
|
|
474
|
+
- ✅ Single interaction vs 3-5 iterations
|
|
475
|
+
- ✅ Faster, happier users
|
|
476
|
+
- ✅ Less "vibe coding" frustration
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
**End of Skill** | Refactored 2025-10-23
|