Create a PRD GitHub issue (labeled PRD) from user input and optionally add it to a GitHub Project
/plugin marketplace add el-feo/ai-context/plugin install ghpm@jebs-dev-tools<product idea or feature description>Optional environment variables:
GHPM_PROJECT - GitHub Project name to associate issue with. If not set, the command will query available projects for the repository owner and prompt for selection.
</arguments>
<usage_examples>
Detailed input (skips clarification):
/ghpm:create-prd Build a user authentication system with email/password and OAuth support for enterprise customers who need SSO to reduce IT friction during onboarding
→ Detailed input (30+ words, has who/what/why) → Proceeds directly to PRD generation
Vague input (triggers clarification):
/ghpm:create-prd Add a dashboard
→ Vague input (4 words, missing who/why/scope) → Presents clarifying questions:
After user responds → Generates PRD with enriched context
Complex feature (typically detailed enough):
/ghpm:create-prd Add real-time collaboration features to the document editor, similar to Google Docs, so remote teams can co-edit documents without version conflicts
→ Detailed input → Proceeds directly to PRD generation
With project association (auto-prompt):
/ghpm:create-prd Implement dark mode across the application for users with visual sensitivities to reduce eye strain
→ If GHPM_PROJECT not set, prompts: "Which GitHub Project should this PRD be added to?" with available projects
With project pre-set (skip prompt):
export GHPM_PROJECT="MyOrg/Q1 Roadmap"
/ghpm:create-prd Implement dark mode across the application for users with visual sensitivities to reduce eye strain
→ Skips project selection prompt and uses pre-set project
</usage_examples>
<operating_rules>
AskUserQuestion tool to gather context before generating the PRD. See <vagueness_detection> for criteria.<prd_structure>
Use this exact outline:
# PRD: <Concise Name>
## Summary
## Problem / Opportunity
## Goals (Success Metrics)
## Non-Goals / Out of Scope
## Users & Use Cases
## Requirements
- Functional Requirements
- Non-Functional Requirements
## UX / UI Notes (if relevant)
## Data / Integrations (if relevant)
## Risks / Edge Cases
## Assumptions
## Open Questions
## Acceptance Criteria (high level)
## Rollout / Release Notes (brief)
## Implementation Notes (non-binding)
(Keep this section minimal; do not over-prescribe.)
</prd_structure>
<input_validation>
Before proceeding, verify:
# 1. Verify gh CLI authentication
gh auth status || { echo "ERROR: Not authenticated. Run 'gh auth login'"; exit 1; }
# 2. Verify in git repository
git rev-parse --git-dir > /dev/null 2>&1 || { echo "ERROR: Not in a git repository"; exit 1; }
# 3. Verify GitHub remote exists
gh repo view --json nameWithOwner -q .nameWithOwner || { echo "ERROR: No GitHub remote found"; exit 1; }
If $ARGUMENTS is empty or missing, report an error:
ERROR: Product idea or feature description required
Usage: /ghpm:create-prd <description>
</input_validation>
<vagueness_detection>
Before generating the PRD, evaluate whether user input is sufficiently detailed. Input is considered vague if ANY of the following criteria are met:
| Criterion | Threshold | Example (Vague) | Example (Detailed) |
|---|---|---|---|
| Too short | < 20 words | "I want a dashboard" | "Build an analytics dashboard for sales managers to track quarterly revenue, pipeline metrics, and team performance with drill-down by region" |
| Missing 'who' | No target user/audience mentioned | "Add authentication" | "Add OAuth2 authentication for enterprise customers who need SSO" |
| Missing 'what' | No specific functionality described | "Improve performance" | "Optimize database queries in the user search endpoint to reduce p95 latency below 200ms" |
| Missing 'why' | No problem/goal articulated | "Add export feature" | "Add CSV export for compliance reports so auditors can analyze data offline" |
| Ambiguous scope | Could mean vastly different things | "Make it mobile-friendly" | "Create responsive layouts for the checkout flow that work on screens 320px to 768px wide" |
If 2+ criteria are triggered: Proceed to clarification step If 0-1 criteria triggered: Skip clarification, proceed directly to PRD generation
</vagueness_detection>
<clarification_questions>
When vague input is detected, use the AskUserQuestion tool to gather context. Select 2-4 questions based on what's missing from the input.
Q1: Target Users (use when 'who' is missing)
{
"question": "Who is the primary user of this feature?",
"header": "Users",
"multiSelect": false,
"options": [
{"label": "End users/customers", "description": "People using the product directly"},
{"label": "Internal team members", "description": "Employees within the organization"},
{"label": "Administrators", "description": "Users who configure or manage the system"},
{"label": "Developers/API consumers", "description": "Technical users integrating with the system"}
]
}
Q2: Problem Being Solved (use when 'why' is missing)
{
"question": "What problem does this solve for users?",
"header": "Problem",
"multiSelect": false,
"options": [
{"label": "Efficiency/speed", "description": "Reduce time or effort to complete tasks"},
{"label": "Missing capability", "description": "Enable something users currently cannot do"},
{"label": "User experience", "description": "Improve usability, accessibility, or satisfaction"},
{"label": "Compliance/security", "description": "Meet regulatory or security requirements"}
]
}
Q3: Core Capabilities (use when 'what' is vague)
{
"question": "Which capabilities are most important?",
"header": "Features",
"multiSelect": true,
"options": [
{"label": "View/display data", "description": "Read-only access to information"},
{"label": "Create/edit content", "description": "CRUD operations on data"},
{"label": "Automation/workflows", "description": "Automated processes or triggers"},
{"label": "Reporting/analytics", "description": "Insights, charts, or exports"}
]
}
Q4: Technical Constraints (use when scope is ambiguous)
{
"question": "Are there specific technical constraints?",
"header": "Constraints",
"multiSelect": true,
"options": [
{"label": "Must integrate with existing system", "description": "Needs to work with current infrastructure"},
{"label": "Performance-critical", "description": "High throughput or low latency required"},
{"label": "Mobile support required", "description": "Must work on mobile devices"},
{"label": "No constraints", "description": "Greenfield implementation"}
]
}
Q5: Scope/Priority (use when input could mean many things)
{
"question": "What's the scope for the initial version?",
"header": "Scope",
"multiSelect": false,
"options": [
{"label": "MVP/proof of concept", "description": "Minimal viable version to validate the idea"},
{"label": "Feature complete for core use case", "description": "Fully functional for primary scenario"},
{"label": "Production-ready with edge cases", "description": "Robust handling of all scenarios"},
{"label": "Enterprise-grade", "description": "Scalability, security, and compliance built-in"}
]
}
Based on vagueness detection results, select appropriate questions:
| Missing Element | Questions to Ask |
|---|---|
| Who (users) | Q1 (Target Users) |
| Why (problem) | Q2 (Problem Being Solved) |
| What (features) | Q3 (Core Capabilities) |
| Scope unclear | Q4 (Technical Constraints), Q5 (Scope/Priority) |
| Multiple missing | Combine up to 4 questions maximum |
After receiving user responses, append them to the original input before generating the PRD:
Original input: "I want a dashboard"
Enriched context from clarification:
- Target users: Internal team members
- Problem: Efficiency/speed - reduce time to complete tasks
- Capabilities: Reporting/analytics, View/display data
- Scope: Feature complete for core use case
Generate PRD using both original input AND enriched context.
</clarification_questions>
<workflow> ## Step 1: Validate EnvironmentRun input validation checks from previous section.
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
OWNER=$(gh repo view --json owner -q .owner.login)
If GHPM_PROJECT environment variable is already set, skip to Step 4.
Otherwise, query available projects for the repository owner and prompt the user to select one:
# Get list of projects for the repo owner
PROJECTS=$(gh project list --owner "$OWNER" --format json --limit 20)
If projects exist: Use AskUserQuestion to let the user select a project.
Build the question dynamically based on available projects:
{
"question": "Which GitHub Project should this PRD be added to?",
"header": "Project",
"multiSelect": false,
"options": [
{"label": "<Project Title 1>", "description": "Project #<number>"},
{"label": "<Project Title 2>", "description": "Project #<number>"},
...
{"label": "None", "description": "Do not add to any project"}
]
}
GHPM_PROJECT to the selected project titleGHPM_PROJECT unsetIf no projects exist: Skip project selection and inform the user:
No GitHub Projects found for owner '$OWNER'. Skipping project association.
To create a project, visit: https://github.com/<owner>?tab=projects
Evaluate user input against the vagueness criteria in <vagueness_detection>.
If input is sufficiently detailed (0-1 criteria triggered):
If input is vague (2+ criteria triggered):
<clarification_questions> (max 4)AskUserQuestion tool to present questions:Use the AskUserQuestion tool with the selected question templates.
Wait for user responses before proceeding.
Example clarification flow:
Input: "I want a dashboard"
Vagueness analysis:
→ 4 criteria triggered → Ask Q1 (Users), Q2 (Problem), Q5 (Scope)
Based on user input ($ARGUMENTS) and any enriched context from clarification, generate comprehensive PRD following the structure template.
# Use heredoc to safely handle multiline content
gh issue create \
--repo "$REPO" \
--title "PRD: <Concise Name>" \
--label "PRD" \
--body "$(cat <<'EOF'
<Generated PRD Content>
EOF
)"
if [ -n "$GHPM_PROJECT" ]; then
ISSUE_NUMBER=$(gh issue list --repo "$REPO" -l PRD --limit 1 --json number -q '.[0].number')
gh issue edit "$ISSUE_NUMBER" --add-project "$GHPM_PROJECT" 2>/dev/null || {
echo "WARNING: Failed to add issue to project '$GHPM_PROJECT'"
gh issue comment "$ISSUE_NUMBER" --body "Note: Could not automatically add to project '$GHPM_PROJECT'. Please add manually if needed."
}
fi
</workflow>
<error_handling> If gh CLI not authenticated:
gh auth statusgh auth loginIf not in git repository:
git statusIf no GitHub remote:
git remote -vgit remote add origin <url>If label "PRD" doesn't exist:
gh label create PRD --description "Product Requirements Document" --color 0E8A16--label "PRD" from issue creation and continueIf issue creation fails:
gh api rate_limitgh repo view --json viewerPermission -q .viewerPermissionIf project association fails:
GHPM_PROJECT format is correctgh project list<success_criteria> Command completes successfully when:
GHPM_PROJECT set, issue is added to project (or warning issued)Verification:
# View the created PRD
gh issue view <issue_number>
# List all PRD issues
gh issue list -l PRD --json number,title,url
</success_criteria>
<output> After completion, report:/ghpm:create-epics prd=#<number> to break this PRD into Epics"Example Output:
PRD Created Successfully
PRD Issue: #42 - https://github.com/owner/repo/issues/42
Repository: owner/repo
Project Association: Added to project 'Q1 Roadmap'
Next Step: Run `/ghpm:create-epics prd=#42` to break this PRD into Epics
</output>
<related_commands> GHPM Workflow:
/ghpm:create-prd - Create PRD from user input/ghpm:create-epics [prd=#N] - Break PRD into Epics/ghpm:create-tasks epic=#N - Break Epics into Tasks/ghpm:tdd-task [task=#N] - Implement Tasks with TDDRelated:
/gh-create-epic - Create standalone Epic (not part of GHPM workflow)
</related_commands>Now proceed:
GHPM_PROJECT not set: Query projects for owner and prompt user to select one.gh issue create.GHPM_PROJECT is set.