Design exploration and task decomposition protocol. Used by orchestrator (interactive) and planner agent (auto).
/plugin marketplace add mnthe/hardworker-marketplace/plugin install ultrawork@hardworker-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill defines how to analyze context, make design decisions, and decompose work into tasks.
Two modes:
{SESSION_DIR}/
├── session.json # Goal and metadata (JSON)
├── context.json # Summary/links from explorers (JSON)
└── exploration/ # Detailed findings (Markdown)
├── exp-1.md
└── ...
session.json - understand the goalcontext.json - get summary, key files, patterns, links to detailsexploration/*.md - read detailed markdown as needed# Read session
cat {SESSION_DIR}/session.json
# Read context summary (lightweight)
cat {SESSION_DIR}/context.json
# List available explorations
ls {SESSION_DIR}/exploration/
# Read detailed exploration as needed
cat {SESSION_DIR}/exploration/exp-1.md
Analyze the goal against context to find:
| Category | Examples | Priority |
|---|---|---|
| Ambiguous Requirements | "auth" → OAuth? Email? Both? | High |
| Architecture Choices | DB type, framework, patterns | High |
| Library Selection | Which packages to use | Medium |
| Scope Boundaries | What's in/out of scope | Medium |
| Priority/Order | Which features first | Low |
{
"topic": "Authentication method",
"options": [
{"label": "OAuth only", "description": "Google/GitHub login"},
{"label": "Email/Password", "description": "Traditional credentials"},
{"label": "Both", "description": "OAuth + credentials"}
],
"recommendation": "Both",
"rationale": "Flexibility for users without social accounts"
}
Core Principle: Turn ambiguous ideas into clear, validated designs through dialogue.
For each decision point:
1. Present brief context (what you found)
2. Ask ONE question with options
3. Wait for response
4. Record decision
5. Move to next question
| Rule | Description |
|---|---|
| One at a time | Never batch multiple questions in one message |
| Multiple choice | Prefer options over open-ended when possible |
| Recommend | Add "(Recommended)" to your suggested option |
| Max 4 options | Keep choices manageable |
| Lead with why | Briefly explain why you're asking |
# Before asking, provide brief context
"""
Based on exploration, the project uses Next.js App Router
and has no existing auth implementation.
"""
AskUserQuestion(questions=[{
"question": "Which authentication method should we implement?",
"header": "Auth", # Short label (max 12 chars)
"options": [
{"label": "OAuth + Email (Recommended)", "description": "Most flexible, supports both"},
{"label": "OAuth only", "description": "Simpler, relies on social providers"},
{"label": "Email only", "description": "Traditional, no third-party deps"}
],
"multiSelect": False
}])
Ask in this order (skip if already clear):
Before settling on a design, ALWAYS propose 2-3 approaches:
## Approach Options
### Option A: NextAuth.js (Recommended)
- **Pros**: Next.js standard, built-in OAuth, active community
- **Cons**: Limited customization, learning curve
- **Best for**: Quick implementation, standard auth flows
### Option B: Passport.js
- **Pros**: Flexible strategy pattern, many providers
- **Cons**: Complex setup, separate Next.js integration needed
- **Best for**: Complex custom requirements
### Option C: Custom Implementation
- **Pros**: Full control, minimal dependencies
- **Cons**: Security risks, development time
- **Best for**: Very specialized requirements
**Recommendation**: Option A - Project is Next.js based, standard auth flow is sufficient
Then ask:
AskUserQuestion(questions=[{
"question": "Which approach should we use?",
"header": "Approach",
"options": [
{"label": "Option A (Recommended)", "description": "NextAuth.js - fast, standard"},
{"label": "Option B", "description": "Passport.js - flexible customization"},
{"label": "Option C", "description": "Custom - full control"}
],
"multiSelect": False
}])
Stop and ask if you notice:
| Signal | Example | Action |
|---|---|---|
| Vague scope | "Add login feature" | Ask about OAuth/email/both |
| Multiple approaches | REST vs GraphQL | Ask preference |
| Missing constraints | No perf requirements | Ask about scale |
| Ambiguous terms | "quickly", "simple" | Clarify meaning |
After decisions are made, present design in small sections:
Section 1: Overview (200-300 words)
→ Ask: "Does the overview look correct?"
Section 2: Architecture (200-300 words)
→ Ask: "Is the architecture appropriate?"
Section 3: Scope (200-300 words)
→ Ask: "Is the scope correct?"
After each section:
AskUserQuestion(questions=[{
"question": "Does this section look correct?",
"header": "Review",
"options": [
{"label": "Yes, continue", "description": "Move to next section"},
{"label": "Needs changes", "description": "I have feedback"}
],
"multiSelect": False
}])
If "Needs changes" → get feedback, adjust, re-present that section.
Make decisions automatically (no user interaction available):
For each decision:
1. Analyze context for signals
2. Choose based on:
- Existing patterns in codebase
- Dependencies already present
- Common best practices
3. Record choice with rationale
4. Mark asked_user: false
Auto Decision Heuristics:
Write design.md to session directory using Write tool.
Be thorough and detailed - this document guides all implementation work.
# Design: {Goal}
## Overview
[High-level description of what will be built]
## Approach Selection
### Considered Options
| Option | Pros | Cons | Fit |
|--------|------|------|-----|
| Option A (Selected) | ... | ... | Best for our case |
| Option B | ... | ... | ... |
| Option C | ... | ... | ... |
### Selected: Option A
**Rationale**: [Why this approach was chosen]
## Decisions
### {Decision Topic 1}
- **Choice**: [Selected option]
- **Rationale**: [Why this was chosen]
- **Alternatives Considered**: [Other options]
- **Asked User**: Yes/No
## Architecture
### Components
#### 1. {Component Name}
- **Files**: `path/to/file.ts`
- **Dependencies**: package-name
- **Description**: What this component does
### Data Flow
[Diagram or description of data flow]
## Error Handling
### Error Categories
| Category | Example | Handling Strategy |
|----------|---------|-------------------|
| Validation | Invalid input | Return 400 with details |
| Auth | Invalid token | Return 401, redirect to login |
| Not Found | Resource missing | Return 404 |
| Server | DB connection fail | Return 500, log, alert |
### Error Response Format
```json
{
"error": {
"code": "VALIDATION_ERROR",
"message": "User-friendly message",
"details": [...]
}
}
| Level | Coverage | Tools |
|---|---|---|
| Unit | Business logic, utils | Jest/Vitest |
| Integration | API endpoints, DB | Supertest |
| E2E | Critical user flows | Playwright/Cypress |
__tests__/fixtures/docs/api/| Risk | Impact | Mitigation |
|---|---|---|
| [Risk 1] | High/Med/Low | [How to mitigate] |
| [Risk 2] | High/Med/Low | [How to mitigate] |
---
## Phase 5: Decompose Tasks
### Task Granularity Rules
- One task = one discrete deliverable
- Max ~30 minutes of focused work
- Can be completed by single worker
- Has testable success criteria
### Task Template
```json
{
"id": "1",
"subject": "Clear, actionable title",
"description": "Specific deliverable with context",
"complexity": "standard|complex",
"blockedBy": [],
"criteria": [
"Testable condition 1",
"Testable condition 2"
]
}
| Complexity | Model | When |
|---|---|---|
standard | sonnet | CRUD, simple features, tests, straightforward changes |
complex | opus | Architecture, security, algorithms, 5+ files |
Independent tasks → blockedBy: [] (parallel)
Sequential dependency → blockedBy: ["1"] (after task 1)
Multi-dependency → blockedBy: ["1","2"] (after both)
Verify task → blockedBy: [all] (after everything)
SCRIPTS="${CLAUDE_PLUGIN_ROOT}/scripts"
# Create each task
$SCRIPTS/task-create.sh --session {SESSION_ID} \
--id "1" \
--subject "Setup NextAuth.js provider" \
--description "Configure NextAuth with Google OAuth" \
--complexity standard \
--criteria "Auth routes respond|OAuth flow works"
# Always include verify task
$SCRIPTS/task-create.sh --session {SESSION_ID} \
--id "verify" \
--subject "[VERIFY] Integration verification" \
--description "Verify all auth flows work end-to-end" \
--blocked-by "1,2,3" \
--complexity complex \
--criteria "All tests pass|Manual login works"
Return planning summary:
# Planning Complete
## Design Decisions
| Topic | Choice | User Asked |
|-------|--------|------------|
| Auth method | OAuth + Credentials | Yes |
| Session storage | JWT | No (auto) |
## Task Graph
| ID | Subject | Blocked By | Complexity |
|----|---------|------------|------------|
| 1 | Setup NextAuth | - | standard |
| 2 | User model | 1 | standard |
| 3 | Login UI | 1 | standard |
| verify | Verification | 1,2,3 | complex |
## Parallel Waves
1. **Wave 1**: [1] - start immediately
2. **Wave 2**: [2, 3] - after wave 1
3. **Wave 3**: [verify] - after all
## Files Created
- {SESSION_DIR}/design.md
- {SESSION_DIR}/tasks/1.json
- {SESSION_DIR}/tasks/2.json
- {SESSION_DIR}/tasks/3.json
- {SESSION_DIR}/tasks/verify.json
Before finalizing, verify:
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.