From draft
Starts collaborative intake for new feature or bug tracks: verifies draft init, loads project context (product.md, tech-stack.md), checks overlaps, refines scope, generates spec.md and plan.md.
npx claudepluginhub mayurpise/draft --plugin draftThis skill uses the workspace's default tool permissions.
You are creating a new track (feature, bug fix, or refactor) for Context-Driven Development. This is a **collaborative process** — you are an active participant providing guidance, fact-checking, and expertise grounded in vetted sources.
Creates new development tracks (features, bugs, chores, refactors) via interactive spec gathering and phased implementation plans. For Conductor-initialized projects.
Creates new tracks (features, bugs, chores, refactors) with interactive spec gathering, classification, and phased implementation plans. Requires Conductor setup files.
Implements one task at a time from track plan using TDD workflow (red-green-refactor), commits each task, runs reviews at phase boundaries, updates plan.md. Use to start coding, implement next task, or run TDD.
Share bugs, ideas, or general feedback.
You are creating a new track (feature, bug fix, or refactor) for Context-Driven Development. This is a collaborative process — you are an active participant providing guidance, fact-checking, and expertise grounded in vetted sources.
Feature Description: $ARGUMENTS
Collaborative understanding, not speed.
ls draft/product.md draft/tech-stack.md draft/workflow.md draft/tracks.md 2>/dev/null
If missing, tell user: "Project not initialized. Run /draft:init first."
Check for --quick flag in $ARGUMENTS:
--quick from $ARGUMENTS now (before Step 1) and store the cleaned text as the working description for all subsequent steps. Proceed to Step 1, then go directly to Step 1.5: Quick Mode.Load full project context (these documents ARE the big picture — every track must be grounded in them):
draft/product.md — product vision, users, goals, constraints, guidelines (optional section)draft/tech-stack.md — languages, frameworks, patterns, code style, accepted patternsdraft/.ai-context.md (if exists) — system map, modules, data flows, invariants, security architecture. Falls back to draft/architecture.md for legacy projects.draft/workflow.md — TDD preference, commit conventions, review processdraft/guardrails.md (if exists) — hard guardrails, learned conventions, learned anti-patternsdraft/tracks.md — existing tracks to check for overlap or dependenciesdraft/tracks/*/metadata.json updated within the last 30 days, read the impact block (if present). Build a map module → [recent_track_ids]. After Step 4 (scope distillation), once the candidate modules for the new track are known, intersect them with this map. If overlap exists, surface it in the intake summary:
Overlap warning: track <id> recently touched modules <A>, <B>.
Review draft/tracks/<id>/metadata.json#impact before proceeding.
This is informational, not blocking — the user decides whether to proceed, depend on the prior track, or rebase scope.core/templates/intake-questions.md — structured questions for intakecore/knowledge-base.md — vetted sources for AI guidanceCreate a short, kebab-case ID from the description (use the stripped description if --quick was present):
add-user-authfix-login-bugCheck if draft/tracks/<track_id>/ already exists. If collision detected, append -<ISO-date> suffix (e.g., feature-auth-2026-02-21). Verify the suffixed path is also free before proceeding.
See core/shared/vcs-commands.md for command conventions.
git checkout -b <track_id>
--quick only)Skip if: --quick was not present in $ARGUMENTS.
Skip all intake conversation. Ask only two questions:
Then generate both files directly:
mkdir -p draft/tracks/<track_id>
draft/tracks/<track_id>/spec.md (minimal — no YAML frontmatter needed):
# Spec: [Title]
**Track ID:** <track_id>
**Type:** quick
## What
[description from question 1]
## Acceptance Criteria
- [ ] [from question 2, one per line]
## Non-Goals
- No scope expansion beyond what's described above
draft/tracks/<track_id>/plan.md (flat — single phase, no phases ceremony):
# Plan: [Title]
**Track ID:** <track_id>
## Phase 1: Complete
**Goal:** [one-line summary from spec]
**Verification:** [how to confirm ACs are met — run tests / manual check]
### Tasks
- [ ] **Task 1:** [derived from AC 1]
- [ ] **Task N:** Verify — [run tests or check from AC]
Then execute Step 8 (Create Metadata & Update Tracks) with these overrides for quick tracks:
"type": "quick" (not feature|bugfix|refactor)"phases": {"total": 1, "completed": 0} (plan has exactly 1 phase)Skip Steps 2–7.
After Step 8 completes, announce:
Quick track created: <track_id>
Files: spec.md (minimal), plan.md (flat)
Next: /draft:implement
Create the track directory and draft files immediately with skeleton structure:
draft/tracks/<track_id>/spec-draft.md:MANDATORY: Include YAML frontmatter with git metadata. Gather git info first:
git branch --show-current # LOCAL_BRANCH
git rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo "none" # REMOTE/BRANCH
git rev-parse HEAD # FULL_SHA
git rev-parse --short HEAD # SHORT_SHA
git log -1 --format=%ci HEAD # COMMIT_DATE
git log -1 --format=%s HEAD # COMMIT_MESSAGE
git status --porcelain | head -1 | wc -l # 0 = clean, >0 = dirty
---
project: "{PROJECT_NAME}"
module: "root"
track_id: "<track_id>"
generated_by: "draft:new-track"
generated_at: "{ISO_TIMESTAMP}"
git:
branch: "{LOCAL_BRANCH}"
remote: "{REMOTE/BRANCH}"
commit: "{FULL_SHA}"
commit_short: "{SHORT_SHA}"
commit_date: "{COMMIT_DATE}"
commit_message: "{COMMIT_MESSAGE}"
dirty: {true|false}
synced_to_commit: "{FULL_SHA}"
---
# Specification Draft: [Title]
| Field | Value |
|-------|-------|
| **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
| **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
| **Generated** | {ISO_TIMESTAMP} |
| **Synced To** | `{FULL_SHA}` |
**Track ID:** <track_id>
**Status:** [ ] Drafting
> This is a working draft. Content will evolve through conversation.
## Context References
- **Product:** `draft/product.md` — [pending]
- **Tech Stack:** `draft/tech-stack.md` — [pending]
- **Architecture:** `draft/.ai-context.md` — [pending]
## Problem Statement
[To be developed through intake conversation]
## Background & Why Now
[To be developed through intake conversation]
## Requirements
### Functional
[To be developed through intake conversation]
### Non-Functional
[To be developed through intake conversation]
## Acceptance Criteria
[To be developed through intake conversation]
## Non-Goals
[To be developed through intake conversation]
## Technical Approach
[To be developed through intake conversation]
## Success Metrics
<!-- Remove metrics that don't apply -->
| Category | Metric | Target | Measurement |
|----------|--------|--------|-------------|
| Performance | [e.g., API response time] | [e.g., <200ms p95] | [e.g., APM dashboard] |
| Quality | [e.g., Test coverage] | [e.g., >90%] | [e.g., CI coverage report] |
| Business | [e.g., User adoption rate] | [e.g., 50% in 30 days] | [e.g., Analytics] |
| UX | [e.g., Task completion rate] | [e.g., >95%] | [e.g., User testing] |
## Stakeholders & Approvals
<!-- Add roles relevant to your organization -->
| Role | Name | Approval Required | Status |
|------|------|-------------------|--------|
| Product Owner | [name] | Spec sign-off | [ ] |
| Tech Lead | [name] | Architecture review | [ ] |
| Security | [name] | Security review (if applicable) | [ ] |
| QA | [name] | Test plan review | [ ] |
### Approval Gates
- [ ] Spec approved by Product Owner
- [ ] Architecture reviewed by Tech Lead
- [ ] Security review completed (if touching auth, data, or external APIs)
- [ ] Test plan reviewed by QA
## Risk Assessment
<!-- Score: Probability (1-5) × Impact (1-5). Risks scoring ≥9 require mitigation plans. -->
| Risk | Probability | Impact | Score | Mitigation |
|------|-------------|--------|-------|------------|
| [e.g., Third-party API instability] | 3 | 4 | 12 | [e.g., Circuit breaker + fallback cache] |
| [e.g., Data migration failure] | 2 | 5 | 10 | [e.g., Dry-run migration + rollback script] |
| [e.g., Scope creep] | 3 | 3 | 9 | [e.g., Strict non-goals enforcement] |
## Deployment Strategy
<!-- Define rollout approach for production delivery. For bug fixes and minor refactors, this section may be removed or marked N/A. -->
### Rollout Phases
1. **Canary** (1-5% traffic) — Validate core flows, monitor error rates
2. **Limited GA** (25%) — Expand to subset, watch performance metrics
3. **Full GA** (100%) — Complete rollout
### Feature Flags
- Flag name: `[feature_flag_name]`
- Default: `off`
- Kill switch: [yes/no]
### Rollback Plan
- Trigger: [e.g., error rate >1%, latency >500ms p95]
- Process: [e.g., disable feature flag, revert deployment]
- Data rollback: [e.g., migration revert script, N/A]
### Monitoring
- Dashboard: [link or name]
- Alerts: [e.g., PagerDuty rule for error rate spike]
- Key metrics: [e.g., error rate, latency, throughput]
## Open Questions
[Tracked during conversation]
## Conversation Log
> Key decisions and reasoning captured during intake.
[Conversation summary will be added here]
draft/tracks/<track_id>/plan-draft.md:MANDATORY: Include YAML frontmatter with git metadata (same git info as spec-draft.md):
---
project: "{PROJECT_NAME}"
module: "root"
track_id: "<track_id>"
generated_by: "draft:new-track"
generated_at: "{ISO_TIMESTAMP}"
git:
branch: "{LOCAL_BRANCH}"
remote: "{REMOTE/BRANCH}"
commit: "{FULL_SHA}"
commit_short: "{SHORT_SHA}"
commit_date: "{COMMIT_DATE}"
commit_message: "{COMMIT_MESSAGE}"
dirty: {true|false}
synced_to_commit: "{FULL_SHA}"
---
# Plan Draft: [Title]
| Field | Value |
|-------|-------|
| **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
| **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
| **Generated** | {ISO_TIMESTAMP} |
| **Synced To** | `{FULL_SHA}` |
**Track ID:** <track_id>
**Spec:** ./spec.md
**Status:** [ ] Drafting
> This is a working draft. Phases will be defined after spec is finalized.
## Overview
[To be developed after spec finalization]
## Phases
[To be developed after spec finalization]
## Notes
[Tracked during conversation]
Announce: "Created draft files. Let's build out the specification through conversation."
Follow the structured intake from core/templates/intake-questions.md. You are an active collaborator, not just a questioner.
For each question:
Ground advice in vetted sources:
The goal is collaborative understanding, not speed.
Walk through problem questions from intake-questions.md:
After each answer:
Checkpoint: "Here's the problem as I understand it: [summary]. Does this capture it?"
Walk through solution questions:
After each answer:
Checkpoint: "The proposed approach is [summary]. I've identified these alternatives: [list]. Your reasoning for this choice is [X]. Correct?"
Walk through risk questions:
After each answer:
Checkpoint: "Key risks identified: [list]. Are there others you're aware of?"
Walk through success questions:
After each answer:
Checkpoint: "Acceptance criteria so far: [list]. Missing anything?"
If track type is refactor:
"Want to run a tech-debt analysis to prioritize what to address?
→ /draft:tech-debt scans 6 debt categories with prioritization
Run tech-debt analysis? [Y/n]"
If accepted: invoke /draft:tech-debt, use its prioritized output to scope the refactor spec.
If spec introduces technology not in tech-stack.md or changes service boundaries in .ai-context.md:
"This involves a significant design decision. Consider running:
→ /draft:adr to document the architectural decision"
For bugs, incidents, or Jira-sourced issues. Tighter scope, investigation-focused.
AI contribution: Pattern recognition for common bug types, severity assessment.
AI contribution: Suggest additional reproduction scenarios, edge cases to check.
AI contribution: Help narrow investigation scope, reference architecture.md for module boundaries.
AI contribution: Suggest investigation approach, reference debugging patterns.
Update spec-draft.md with bug-specific structure after gathering sufficient context.
Trigger: Track type is bug/RCA AND any of: Jira ticket ID found, description contains "incident", "outage", "SEV", "regression", "crash".
When triggered, execute the auto-triage pipeline before proceeding to Step 4:
If Jira ticket provided:
get_issue(), get_issue_description(), get_issue_comments()curl/wget to fetch any URLs mentioned (dashboards, error pages, API responses)ssh to access log locations on remote nodes (if paths like /home/log/, node IPs mentioned)"Bug track detected with [Jira context / error description]. Run a structured debug session before writing the spec?
→ /draft:debug will help reproduce and isolate the issue
Run debug session? [Y/n]"
If accepted:
/draft:debug with gathered triage contextIf debug session produced findings:
core/agents/rca.md.ai-context.mdCreate draft/tracks/<track_id>/rca.md using the template from core/templates/rca.md:
If Jira ticket linked, sync via core/shared/jira-sync.md:
rca.md to ticket"RCA complete. Findings:
Root cause: {summary}
Classification: {type}
Blast radius: {affected modules}
→ Want me to write regression tests for this? [Y/n]
→ Ready to proceed with the fix? [Y/n]"
Only proceed to spec/plan generation after developer approval.
If track description contains "incident", "outage", "SEV", or "postmortem":
ls draft/tracks/*/incident-*.md 2>/dev/null/draft:incident-response postmortem first to capture incident context."After completing intake sections:
If refining:
Before finalizing, offer a quick spec stress-test. This takes 2 minutes and often surfaces blind spots.
Based on the track type (feature / bug / refactor), present 3 pre-selected challenge techniques:
Feature tracks:
Bug tracks:
Refactor tracks:
Present to the user:
Quick stress-test before finalizing — pick one or skip:
1. [Technique name] — [one-line prompt]
2. [Technique name] — [one-line prompt]
3. [Technique name] — [one-line prompt]
Enter 1–3, or "skip":
When user confirms spec is ready:
spec-draft.md → spec.md:
spec-draft.md content.spec.md.spec.md exists and has non-empty content.spec-draft.md.spec.md status to [x] CompletePresent final spec.md for acknowledgment.
Based on finalized spec, build out plan-draft.md:
Create phased breakdown:
For each phase:
AI contribution:
Use fixed 3-phase structure:
Reference core/agents/rca.md for detailed process.
Based on track context, automatically include these tasks in the appropriate plan phase:
If track modifies production code: Add final task in last phase:
- [ ] Run /draft:deploy-checklist before deploying
If spec mentions new APIs, services, or components: Add documentation task:
- [ ] Update documentation (run /draft:documentation api|runbook)
If testing-strategy.md exists or TDD enabled: Add in Phase 1:
- [ ] Verify testing strategy covers this track (run /draft:testing-strategy if not done)
Present plan-draft.md for review.
When user confirms plan is ready:
[x] Completeplan.md, then delete plan-draft.mdPresent final plan.md for acknowledgment.
Before creating metadata, verify final files exist:
ls draft/tracks/<track_id>/spec.md draft/tracks/<track_id>/plan.md 2>/dev/null
If either missing:
draft/tracks/<track_id>/metadata.json:{
"id": "<track_id>",
"title": "[Title]",
"type": "feature|bugfix|refactor",
"status": "planning",
"created": "[ISO timestamp]",
"updated": "[ISO timestamp]",
"phases": {
"total": 3,
"completed": 0
},
"tasks": {
"total": "<count all `- [ ]` task lines in plan.md>",
"completed": 0
}
}
Count all - [ ] task lines in plan.md and set tasks.total in metadata.json accordingly instead of 0.
Note: ISO timestamps can use either Z or .000Z suffix (both valid ISO 8601). No format constraint enforced — both second precision (2026-02-08T12:00:00Z) and millisecond precision (2026-02-08T12:00:00.000Z) are acceptable.
Before updating tracks.md, verify metadata.json was written successfully:
cat draft/tracks/<track_id>/metadata.json | python3 -c "import sys,json; json.load(sys.stdin)" 2>/dev/null || echo "INVALID"
If invalid or missing:
draft/tracks.md:Add under Active:
## Active
### [track_id] - [Title]
- **Status:** [ ] Planning
- **Created:** [date]
- **Phases:** 0/3
- **Path:** `./tracks/<track_id>/`
Remove draft files if they still exist (defensive cleanup for failed renames):
rm -f draft/tracks/<track_id>/spec-draft.md
rm -f draft/tracks/<track_id>/plan-draft.md
The -f flag ensures idempotent cleanup whether files exist or not.
Verify tracks.md was updated successfully:
grep "<track_id>" draft/tracks.md
If not found:
Announce: "Track created: <track_id>
Created:
Updated:
Key decisions documented in spec.md Conversation Log.
Next: Review the spec and plan, then run /draft:implement to begin."
If Jira ticket is linked (from spec.md or metadata.json), sync via core/shared/jira-sync.md:
spec.md and plan.md to ticketBased on track type, suggest relevant follow-ups:
Bug tracks:
"Track ready for implementation. Also consider:
→ /draft:incident-response postmortem — If this bug caused an incident
→ git bisect — Find the exact commit that introduced this bug"
Feature tracks:
"Track ready for implementation.
Next: /draft:implement
Also: /draft:testing-strategy — Define test approach for this feature"
Refactor tracks:
"Track ready for implementation.
Next: /draft:implement
Also: /draft:adr — Document refactoring decisions"