PM (Program Manager) Skill
Defines a label-based polling and claiming system for a PM agent that plans features, writes specs, and creates issues from GitHub Discussions.
What this file does
Defines a label-based polling and claiming system for a PM agent that plans features, writes specs, and creates issues from GitHub Discussions.
When to use it
- Building an AI agent that triages feature requests from GitHub Discussions
- Automating the handoff between product planning and engineering tickets
- Implementing label-based work claiming with race condition handling
- Structuring agent output into standardized issue templates and planning comments
Assumes this stack
PM (Program Manager) Skill
The PM agent is responsible for planning features, creating specifications, and ensuring work is well-defined before implementation begins.
Trigger Criteria
The PM skill polls for:
- Discussions in the "Planning" category that have no
status:*label (unprocessed) - Issues tagged
type:questionthat need product decisions - Prioritizes by age (oldest unprocessed first)
Claiming
PM uses label-based claiming for Discussions (which have limited assignee support):
- Add
status:planninglabel to the Discussion - Immediately re-read the Discussion to verify claim
- Add
agent:pmlabel if sole claimer - If another PM has already added
status:planning, back off
Label-Based Claiming Vulnerability
WARNING: Label-based claiming has a TOCTOU race condition. Two PMs polling simultaneously can both add status:planning before either verifies, resulting in duplicate planning.
Mitigation:
- Single PM instance: Only run one PM agent at a time (recommended)
- Verification delay: After adding label, wait 1-2 seconds before re-reading
- Check for competing comments: If another
[PM]comment exists, back off
Backoff on conflict:
1. Remove status:planning label
2. Remove agent:pm label
3. Wait: base_delay * (2 ^ attempt) + random(0, jitter)
4. Try next unprocessed Discussion
Note: This vulnerability is acceptable for Phase 1 (manual orchestration with single PM instance). For high-volume automation, consider using a Discussion-level assignee if GitHub adds support, or a separate coordination mechanism.
Responsibilities
1. Feature Planning
When a new Discussion appears in Planning:
1. Add status:planning label to claim
2. Read the full Discussion thread
3. Identify the core problem or opportunity
4. Draft acceptance criteria
5. Identify dependencies and risks
6. Create a planning comment with structure:
- Problem Statement
- Proposed Solution
- Acceptance Criteria
- Dependencies
- Open Questions
7. If ready, create Issue(s) with appropriate labels
8. Close/answer the Discussion
2. Spec Refinement
When a Discussion needs more detail:
1. Read existing Discussion and any linked Issues
2. Identify gaps in specification
3. Ask clarifying questions via comments
4. Update spec based on responses
5. Create Issues when specification is complete
6. Close/answer the Discussion
3. Prioritization
PM helps maintain priority by:
1. Reviewing new Issues for appropriate priority labels
2. Flagging conflicts or unclear scope
3. Suggesting priority based on Discussion context
4. Polling Query
PM uses the GitHub GraphQL API to find unprocessed Discussions:
query {
repository(owner: "OWNER", name: "REPO") {
discussions(
categoryId: "PLANNING_CATEGORY_ID"
first: 10
orderBy: { field: CREATED_AT, direction: ASC }
) {
nodes {
id
number
title
labels(first: 10) {
nodes {
name
}
}
}
}
}
}
Filter results client-side: select Discussions where no label starts with status:.
Output Artifacts
Issue Template
When PM creates an Issue:
## Summary
[One paragraph description]
## Background
[Link to Discussion: #123]
## Acceptance Criteria
- [ ] Criterion 1
- [ ] Criterion 2
- [ ] Criterion 3
## Technical Notes
[Any implementation hints from Discussion]
## Dependencies
[List any blocking work]
---
*Created by [PM] from Discussion #123*
Planning Comment
When PM completes planning:
[PM] Planning complete for this Discussion.
**Created Issues:**
- #456: [Issue title]
- #457: [Issue title]
**Deferred Items:**
- [Item moved to backlog with reason]
**Open Questions:**
- [Questions that need human input]
Labels Used
Reads
| Label | Meaning |
|---|---|
(absence of status:*) | Discussion needs PM attention |
Writes
| Label | Meaning |
|---|---|
status:planning | PM is actively working on this Discussion |
status:ready | Issue ready for implementation |
status:needs-human | Cannot plan without human input |
priority:high | Urgent work |
priority:medium | Normal priority |
priority:low | Nice to have |
type:feature | New functionality |
type:bug | Defect fix |
type:chore | Maintenance work |
agent:pm | PM is working on this |
Constraints
- No Code Changes: PM does not modify code files
- No PR Creation: PM creates Issues, not PRs
- Verbose Explanations: Always explain the "why" behind decisions
- Link Everything: Always link Issues back to source Discussions
Subagent Usage
PM uses subagents for:
- Codebase Analysis: "What modules would this feature touch?"
- Dependency Check: "Are there existing Issues that relate to this?"
- Scope Estimation: "How complex is this based on similar past work?"
Example Workflow
1. PM polls GitHub, finds Discussion #42 in Planning category (no status label)
2. PM claims Discussion by adding status:planning and agent:pm
3. PM reads Discussion: "We need better error messages"
4. PM uses subagent to scan codebase for error handling patterns
5. PM drafts spec:
- Problem: Error messages are cryptic
- Solution: Add user-friendly messages with error codes
- Criteria: All user-facing errors have human-readable text
6. PM creates Issue #100: "Improve error message clarity"
- Labels: type:feature, priority:high, status:ready
7. PM comments on Discussion #42 linking to Issue #100
8. PM closes/answers Discussion #42
9. PM exits
Error Handling
If PM cannot complete planning:
- Add
status:needs-humanlabel to Discussion - Comment explaining what is unclear
- Exit without creating Issues
Budget
Budget is enforced externally via CLI flags:
claude -p "..." \
--max-turns 10 \
--max-budget-usd 2.00
If budget/turns exhausted mid-task:
- Agent terminates immediately
- Claim remains (
status:planninglabel still present) - Stale detection (30 min) clears the claim
- Next PM invocation picks up from GitHub state
There is no cross-session tracking. See orchestration.md.
What's inside
9 sections covering trigger criteria, claiming protocol, 4 responsibilities, output artifacts, 10 labels, constraints, subagent usage, example workflow, and error handling
Change this for your project
- Replace
"OWNER"and"REPO"in the GraphQL query with your repository owner and name - Replace
"PLANNING_CATEGORY_ID"in the GraphQL query with your planning category ID - Replace
#42,#100, and#456in the example workflow with actual discussion and issue numbers
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Worth borrowing
- Label-based claiming with a verification step and exponential backoff on conflict
- Stale detection (30 min) to clear claims from terminated agents
- Subagent delegation for codebase analysis, dependency checks, and scope estimation
Related Documents
MCP Integration Workflows and Orchestration Guide
Defines enterprise-grade integration patterns, orchestration strategies, and advanced workflows for MCP servers with code examples.
Valet V1 — Architecture & Implementation Plan
Defines a hosted background coding agent platform with isolated sandboxed dev environments, multiplayer sessions, and YAML-driven workflows.
Writing Effective Skills
Distills patterns from production agent skills across multiple frameworks into actionable design principles for writing skills that agents actually follow.
AutoDoc Demo: Step-by-Step Walkthrough
Walks through setting up AutoDoc in a target repository and triggering automated documentation generation from code changes.