Jira Feature Documentation Generator
This skill provides detailed step-by-step implementation guidance for the /jira:generate-feature-doc command, which generates comprehensive feature documentation by recursively analyzing a Jira feature and all its related issues and GitHub pull requests.
IMPORTANT FOR AI: This is a procedural skill - when invoked, you should directly execute the implementation steps defined in this document. Do NOT look for or execute external scripts. Follow the step-by-step instructions below, starting with Step 1.
When to Use This Skill
This skill is automatically invoked by the /jira:generate-feature-doc command and should not be called directly by users.
Prerequisites
- MCP Jira server configured and running (required - see
plugins/jira/README.md for setup)
- GitHub CLI (
gh) installed and authenticated (for analyzing PRs)
- User has read access to Jira issues (including private issues via MCP authentication)
- User has read access to linked GitHub repositories
- Working directory has
.work/jira/feature-doc/ for output (will be created if needed)
Implementation Steps
Step 1: Initialize and Fetch Main Feature Issue
Objective: Set up environment and fetch main feature issue.
Actions:
Save initial directory: INITIAL_DIR=$(pwd) (save at start, before any cd commands)
Check prerequisites: Verify jq and gh CLI are installed and authenticated
- If missing, display error with installation instructions
Create output directory: WORK_DIR=$INITIAL_DIR/.work/jira/feature-doc/<feature-key> (use mkdir -p)
Fetch main feature via getJiraIssue with the feature key. If MCP is unavailable, display error pointing to plugins/jira/README.md.
Parse response: Extract key, summary, description, issuetype, status
- If fetch fails, display error and exit
Display progress: Show feature summary and type
Step 2: Analyze Each GitHub PR
Important: This step expects PR data as input from the jira:extract-prs skill (invoked by the command file). The input is structured JSON containing all discovered PRs with their metadata.
Input Format:
{
"pull_requests": [
{
"url": "https://github.com/org/repo/pull/123",
"state": "MERGED",
"title": "PR title",
"isDraft": false,
"sources": ["remote_link", "description"],
"found_in_issues": ["ISSUE-123"]
}
]
}
Objective: Fetch and analyze PR details to extract implementation information.
Important: This command is for documenting completed features. Only analyze PRs that have been MERGED. Skip OPEN, DRAFT, WIP, or CLOSED (but not merged) PRs.
Actions:
Filter for MERGED PRs: Only analyze PRs with state == "MERGED" AND isDraft == false
- Skip OPEN PRs (work in progress)
- Skip PRs with
isDraft == true (not ready for review)
- Skip CLOSED PRs (not merged)
For each MERGED PR, fetch detailed data:
- Parse PR URL to extract org/repo/number
- Fetch metadata:
gh pr view {number} --repo {org}/{repo} --json title,body,mergedAt,author,commits,files
- Fetch diff:
gh pr diff {number} --repo {org}/{repo}
- Fetch comments:
gh pr view {number} --repo {org}/{repo} --json comments
Extract key information:
- From body: Purpose, approach, breaking changes
- From commits: Implementation steps, testing
- From diff: New APIs, architectural changes, config updates
- From comments: Design decisions, rationale, considerations
Handle errors: If PR inaccessible (403, 404), log warning and continue
Save data: Store metadata, diff, and comments to ${WORK_DIR}/pr-{org}-{repo}-{number}.*
Step 3: Synthesize Documentation Structure
Objective: Organize information into structured outline.
Available sections (calling command specifies which to generate):
- Overview: Jira link, status, counts, dates, authors (from main issue + PR metadata)
- Background and Goals: Description from main issue (clean Jira formatting)
- Architecture and Design: High-level changes, components, design decisions (from PRs)
- Implementation Details: Core changes, API changes, configuration (from PR diffs, code snippets)
- Usage Guide: Prerequisites, basic/advanced usage (from README updates, PR descriptions)
- Testing: Test coverage, strategies, key test PRs
- Related Resources: Can include external links, issue tables, PR tables, dependency graphs
Step 4: Generate Documentation Content
Objective: Fill in the outline with actual content based on command requirements.
Section generation guidelines:
- Overview: Extract from main issue + PR metadata (Jira link, status, counts, dates, authors)
- Background: Clean Jira formatting from main issue description
- Architecture: Synthesize from PR descriptions and comments (high-level overview, components, decisions with PR links)
- Implementation: Group by core changes, API changes, configuration (include code snippets, link to PRs, list key files)
- Usage: Extract from README updates and PR descriptions (prerequisites, YAML/CLI examples)
- Testing: Summarize by category (unit, E2E, CI), list key test PRs
- Related Resources: Format depends on command requirements (external links, tables, graphs)
Note: Only generate sections specified by the calling command. Check the command file for exact requirements.
Step 5: Output
Objective: Save documentation and display summary.
Actions:
Write documentation: Save to ${WORK_DIR}/feature-doc.md with footer:
---
*Generated by `/jira:generate-feature-doc` on <timestamp>*
*Source: <feature-key> and <count> related issues*
Save metadata: Store analysis log with timestamps, counts, output files, errors/warnings
Display summary:
- Success message with file location
- Statistics: issues analyzed, PRs analyzed, commits, files changed, doc lines
- Warnings if any (inaccessible PRs, missing descriptions)
- Additional files for debugging
Error Handling
Issue Not Found (404, 403, network error):
- Display error with verification steps (issue key format, permissions, MCP config)
- Display the error message, clean up any temporary state, and exit without creating files
No PRs Found:
- Display warning (feature not implemented, PRs not linked, or small feature)
- Generate documentation from main issue only
GitHub Rate Limit:
- Display error with progress and reset time
- Offer options: wait, generate from partial data, or cancel
Large Feature (>50 PRs):
- Display warning with estimated time and API calls
- Offer options: continue or cancel
Malformed Issue Data:
- Log warning about missing/invalid fields
- Continue with remaining issues (don't fail entire process)
Performance Optimization
Parallel PR Analysis:
- For >10 PRs, use parallel processing (
xargs -P 5)
- Limit to ~5 concurrent requests to avoid rate limits
Smart Diff Analysis:
- Use
--stat to identify key files
- Skip vendor/, generated files, test fixtures
- Fetch full diff only for critical files
Best Practices for AI Implementation
Progress feedback: Show progress after each major step (discovery, PR analysis, etc.)
Error resilience: Don't fail the entire process if one PR is inaccessible
Smart synthesis: Don't just concatenate PR descriptions - synthesize into coherent narrative
Context awareness: Understand the codebase domain (e.g., Kubernetes, OpenShift) to better interpret changes
Structured output: Use consistent markdown formatting with proper headers, code blocks, tables
Link preservation: Always provide clickable links to Jira issues and GitHub PRs
Timestamp tracking: Note when PRs were merged to understand timeline
Author attribution: Credit authors of PRs and issues where relevant
Code examples: Include actual code snippets from PRs to illustrate changes
Visual hierarchy: Use tables, lists, and headers to make documentation scannable
Example Workflow
User runs: /jira:generate-feature-doc OCPSTRAT-1612
1. Initialize
- Fetch main feature issue (OCPSTRAT-1612)
- Create working directory (.work/jira/feature-doc/OCPSTRAT-1612/)
- Verify prerequisites (jq, gh CLI)
2. Extract PRs (via extract-prs skill)
- Discover descendants using `parent = KEY` BFS → 3 issues total
- Extract PRs from remote links (primary) + text (backup) → 7 PRs
- Fetch PR state from GitHub → 5 MERGED, 1 OPEN, 1 CLOSED
3. Analyze MERGED PRs
- Filter for MERGED PRs → 5 PRs to analyze
- For each: fetch metadata + diff + comments
- Extract implementation details, design decisions
4. Generate Documentation
- Synthesize sections: Overview, Architecture, Implementation, Usage, Testing
- Create tables for issues and PRs
- Write to feature-doc.md
5. Display Results
✅ Documentation generated successfully!
📄 File: .work/jira/feature-doc/OCPSTRAT-1612/feature-doc.md
📊 3 issues, 5 MERGED PRs, ~380 lines generated
1---2name: jira-doc-generator3description: Detailed implementation guide for recursively analyzing Jira features and generating comprehensive documentation4---56# Jira Feature Documentation Generator78This skill provides detailed step-by-step implementation guidance for the `/jira:generate-feature-doc` command, which generates comprehensive feature documentation by recursively analyzing a Jira feature and all its related issues and GitHub pull requests.910**IMPORTANT FOR AI**: This is a **procedural skill** - when invoked, you should directly execute the implementation steps defined in this document. Do NOT look for or execute external scripts. Follow the step-by-step instructions below, starting with Step 1.1112## When to Use This Skill1314This skill is automatically invoked by the `/jira:generate-feature-doc` command and should not be called directly by users.1516## Prerequisites1718- **MCP Jira server configured and running** (required - see `plugins/jira/README.md` for setup)19- GitHub CLI (`gh`) installed and authenticated (for analyzing PRs)20- User has read access to Jira issues (including private issues via MCP authentication)21- User has read access to linked GitHub repositories22- Working directory has `.work/jira/feature-doc/` for output (will be created if needed)2324## Implementation Steps2526### Step 1: Initialize and Fetch Main Feature Issue2728**Objective**: Set up environment and fetch main feature issue.2930**Actions**:31321. **Save initial directory**: `INITIAL_DIR=$(pwd)` (save at start, before any cd commands)33342. **Check prerequisites**: Verify `jq` and `gh` CLI are installed and authenticated35 - If missing, display error with installation instructions36373. **Create output directory**: `WORK_DIR=$INITIAL_DIR/.work/jira/feature-doc/<feature-key>` (use `mkdir -p`)38394. **Fetch main feature** via `getJiraIssue` with the feature key. If MCP is unavailable, display error pointing to `plugins/jira/README.md`.40415. **Parse response**: Extract `key`, `summary`, `description`, `issuetype`, `status`42 - If fetch fails, display error and exit43446. **Display progress**: Show feature summary and type4546### Step 2: Analyze Each GitHub PR4748**Important**: This step expects PR data as input from the `jira:extract-prs` skill (invoked by the command file). The input is structured JSON containing all discovered PRs with their metadata.4950**Input Format**:51```json52{53 "pull_requests": [54 {55 "url": "https://github.com/org/repo/pull/123",56 "state": "MERGED",57 "title": "PR title",58 "isDraft": false,59 "sources": ["remote_link", "description"],60 "found_in_issues": ["ISSUE-123"]61 }62 ]63}64```6566**Objective**: Fetch and analyze PR details to extract implementation information.6768**Important**: This command is for documenting **completed features**. Only analyze PRs that have been **MERGED**. Skip OPEN, DRAFT, WIP, or CLOSED (but not merged) PRs.6970**Actions**:71721. **Filter for MERGED PRs**: Only analyze PRs with `state == "MERGED"` AND `isDraft == false`73 - Skip OPEN PRs (work in progress)74 - Skip PRs with `isDraft == true` (not ready for review)75 - Skip CLOSED PRs (not merged)76772. **For each MERGED PR, fetch detailed data**:78 - Parse PR URL to extract org/repo/number79 - Fetch metadata: `gh pr view {number} --repo {org}/{repo} --json title,body,mergedAt,author,commits,files`80 - Fetch diff: `gh pr diff {number} --repo {org}/{repo}`81 - Fetch comments: `gh pr view {number} --repo {org}/{repo} --json comments`82833. **Extract key information**:84 - **From body**: Purpose, approach, breaking changes85 - **From commits**: Implementation steps, testing86 - **From diff**: New APIs, architectural changes, config updates87 - **From comments**: Design decisions, rationale, considerations88894. **Handle errors**: If PR inaccessible (403, 404), log warning and continue90915. **Save data**: Store metadata, diff, and comments to `${WORK_DIR}/pr-{org}-{repo}-{number}.*`9293### Step 3: Synthesize Documentation Structure9495**Objective**: Organize information into structured outline.9697**Available sections** (calling command specifies which to generate):98991. **Overview**: Jira link, status, counts, dates, authors (from main issue + PR metadata)1002. **Background and Goals**: Description from main issue (clean Jira formatting)1013. **Architecture and Design**: High-level changes, components, design decisions (from PRs)1024. **Implementation Details**: Core changes, API changes, configuration (from PR diffs, code snippets)1035. **Usage Guide**: Prerequisites, basic/advanced usage (from README updates, PR descriptions)1046. **Testing**: Test coverage, strategies, key test PRs1057. **Related Resources**: Can include external links, issue tables, PR tables, dependency graphs106107### Step 4: Generate Documentation Content108109**Objective**: Fill in the outline with actual content based on command requirements.110111**Section generation guidelines**:1121131. **Overview**: Extract from main issue + PR metadata (Jira link, status, counts, dates, authors)1142. **Background**: Clean Jira formatting from main issue description1153. **Architecture**: Synthesize from PR descriptions and comments (high-level overview, components, decisions with PR links)1164. **Implementation**: Group by core changes, API changes, configuration (include code snippets, link to PRs, list key files)1175. **Usage**: Extract from README updates and PR descriptions (prerequisites, YAML/CLI examples)1186. **Testing**: Summarize by category (unit, E2E, CI), list key test PRs1197. **Related Resources**: Format depends on command requirements (external links, tables, graphs)120121**Note**: Only generate sections specified by the calling command. Check the command file for exact requirements.122123### Step 5: Output124125**Objective**: Save documentation and display summary.126127**Actions**:1281291. **Write documentation**: Save to `${WORK_DIR}/feature-doc.md` with footer:130 ```markdown131 ---132 *Generated by `/jira:generate-feature-doc` on <timestamp>*133 *Source: <feature-key> and <count> related issues*134 ```1351362. **Save metadata**: Store analysis log with timestamps, counts, output files, errors/warnings1371383. **Display summary**:139 - Success message with file location140 - Statistics: issues analyzed, PRs analyzed, commits, files changed, doc lines141 - Warnings if any (inaccessible PRs, missing descriptions)142 - Additional files for debugging143144## Error Handling145146**Issue Not Found** (404, 403, network error):147- Display error with verification steps (issue key format, permissions, MCP config)148- Display the error message, clean up any temporary state, and exit without creating files149150**No PRs Found**:151- Display warning (feature not implemented, PRs not linked, or small feature)152- Generate documentation from main issue only153154**GitHub Rate Limit**:155- Display error with progress and reset time156- Offer options: wait, generate from partial data, or cancel157158**Large Feature** (>50 PRs):159- Display warning with estimated time and API calls160- Offer options: continue or cancel161162**Malformed Issue Data**:163- Log warning about missing/invalid fields164- Continue with remaining issues (don't fail entire process)165166## Performance Optimization167168**Parallel PR Analysis**:169- For >10 PRs, use parallel processing (`xargs -P 5`)170- Limit to ~5 concurrent requests to avoid rate limits171172**Smart Diff Analysis**:173- Use `--stat` to identify key files174- Skip vendor/, generated files, test fixtures175- Fetch full diff only for critical files176177## Best Practices for AI Implementation1781791. **Progress feedback**: Show progress after each major step (discovery, PR analysis, etc.)1801812. **Error resilience**: Don't fail the entire process if one PR is inaccessible1821833. **Smart synthesis**: Don't just concatenate PR descriptions - synthesize into coherent narrative1841854. **Context awareness**: Understand the codebase domain (e.g., Kubernetes, OpenShift) to better interpret changes1861875. **Structured output**: Use consistent markdown formatting with proper headers, code blocks, tables1881896. **Link preservation**: Always provide clickable links to Jira issues and GitHub PRs1901917. **Timestamp tracking**: Note when PRs were merged to understand timeline1921938. **Author attribution**: Credit authors of PRs and issues where relevant1941959. **Code examples**: Include actual code snippets from PRs to illustrate changes19619710. **Visual hierarchy**: Use tables, lists, and headers to make documentation scannable198199## Example Workflow200201```202User runs: /jira:generate-feature-doc OCPSTRAT-16122032041. Initialize205 - Fetch main feature issue (OCPSTRAT-1612)206 - Create working directory (.work/jira/feature-doc/OCPSTRAT-1612/)207 - Verify prerequisites (jq, gh CLI)2082092. Extract PRs (via extract-prs skill)210 - Discover descendants using `parent = KEY` BFS → 3 issues total211 - Extract PRs from remote links (primary) + text (backup) → 7 PRs212 - Fetch PR state from GitHub → 5 MERGED, 1 OPEN, 1 CLOSED2132143. Analyze MERGED PRs215 - Filter for MERGED PRs → 5 PRs to analyze216 - For each: fetch metadata + diff + comments217 - Extract implementation details, design decisions2182194. Generate Documentation220 - Synthesize sections: Overview, Architecture, Implementation, Usage, Testing221 - Create tables for issues and PRs222 - Write to feature-doc.md2232245. Display Results225 ✅ Documentation generated successfully!226 📄 File: .work/jira/feature-doc/OCPSTRAT-1612/feature-doc.md227 📊 3 issues, 5 MERGED PRs, ~380 lines generated228```