Commit 7c9585df9c5e

Vincent Demeester <vincent@sbr.pm>
2025-12-04 23:10:49
feat: Add GitHub skill for PR and workflow management
- Enable PR status checking, review, and creation workflows via gh CLI - Provide intelligent check restart with gh-restart-failed integration - Support PR template auto-detection and filling for consistency Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 4d1b3bd
dots/.config/claude/skills/GitHub/tools/README.md
@@ -0,0 +1,348 @@
+# GitHub Skill Tools
+
+Custom tools for enhanced GitHub workflow automation.
+
+## Purpose
+
+While `gh` CLI handles most GitHub operations, these tools provide enhanced functionality for:
+- Complex PR status formatting and filtering
+- Intelligent check restart logic
+- Automated PR template filling
+- Advanced workflow automation
+
+## Available Tools
+
+### Planned Tools
+
+**CheckPRStatus.sh**
+- Enhanced PR check status with color-coded output
+- Automatic log fetching for failures
+- Smart filtering (required checks, failed only, pending)
+- Export to JSON/Markdown
+- Notification integration
+
+**RestartFailedChecks.sh**
+- Detect flaky vs. code failures from logs
+- Automatic retry for flaky tests (with configurable limits)
+- Skip restart if same failure occurred multiple times
+- Statistics tracking (success rate, retry count)
+- Slack/email notifications
+
+**CreatePR.sh**
+- Auto-detect and parse PR templates
+- Intelligently fill template sections based on commits
+- Auto-check completed checklist items
+- Detect PR type from branch name or commits
+- Suggest reviewers based on file changes (git blame)
+- Validate PR against project guidelines
+
+**PRSummary.py**
+- Generate comprehensive PR summaries
+- Analyze code changes and generate description
+- Extract key changes and impact
+- Suggest labels and reviewers
+- Integration with AI for smart summaries (complex logic warrants Python)
+
+## Tool Development Guidelines
+
+### Technology Stack
+
+- **Bash/Shell**: Primary choice for most tools (simple, portable, direct `gh` integration)
+- **Python with uv**: For complex logic requiring data structures or libraries
+- **nix-shell**: For shell scripts needing specific dependencies
+
+### Structure
+
+**Shell Script Example:**
+
+```bash
+#!/usr/bin/env nix-shell
+#! nix-shell -i bash -p gh jq
+
+# CheckPRStatus.sh - Enhanced PR check status viewer
+
+set -euo pipefail
+
+# Parse arguments
+PR_NUMBER="${1:-}"
+FILTER="${2:-all}"  # all, failed, pending, required
+
+if [ -z "$PR_NUMBER" ]; then
+  echo "Usage: $0 <pr-number> [filter]"
+  exit 1
+fi
+
+# Get PR checks
+CHECKS=$(gh pr view "$PR_NUMBER" --json statusCheckRollup --jq '.statusCheckRollup')
+
+# Filter and format
+case "$FILTER" in
+  failed)
+    echo "$CHECKS" | jq -r '.[] | select(.conclusion == "failure") | "✗ \(.name)"'
+    ;;
+  pending)
+    echo "$CHECKS" | jq -r '.[] | select(.status != "COMPLETED") | "⏳ \(.name)"'
+    ;;
+  required)
+    echo "$CHECKS" | jq -r '.[] | select(.isRequired == true) | "\(.conclusion // .status) \(.name)"'
+    ;;
+  *)
+    echo "$CHECKS" | jq -r '.[] | "\(.conclusion // .status) \(.name)"'
+    ;;
+esac
+```
+
+**Python Script Example (for complex logic):**
+
+```python
+#!/usr/bin/env -S uv run --quiet --script
+# /// script
+# dependencies = ["click", "requests"]
+# ///
+
+"""
+PRSummary.py - Generate intelligent PR summaries
+"""
+
+import click
+import json
+import subprocess
+
+@click.command()
+@click.option('--pr', required=True, help='PR number')
+@click.option('--format', default='markdown', help='Output format')
+def summarize_pr(pr: int, format: str):
+    """Generate comprehensive PR summary"""
+
+    # Get PR data via gh
+    result = subprocess.run(
+        ['gh', 'pr', 'view', str(pr), '--json', 'title,body,commits,files'],
+        capture_output=True,
+        text=True
+    )
+
+    data = json.loads(result.stdout)
+
+    # Analyze commits
+    commits = data['commits']
+    files_changed = len(data['files'])
+
+    # Generate summary
+    summary = f"""
+# PR #{pr}: {data['title']}
+
+## Changes
+- {files_changed} files changed
+- {len(commits)} commits
+
+## Commit Summary
+"""
+
+    for commit in commits:
+        summary += f"- {commit['messageHeadline']}\n"
+
+    click.echo(summary)
+
+if __name__ == '__main__':
+    summarize_pr()
+```
+
+### Best Practices
+
+1. **Prefer shell scripts**: Start with bash, only use Python if truly needed
+2. **Use nix-shell shebang**: For scripts with dependencies (jq, curl, etc.)
+3. **Use uv for Python**: Inline dependency management with `# /// script`
+4. **Fail fast**: Exit early with clear error messages (`set -euo pipefail`)
+5. **Validate inputs**: Check for required options and valid values
+6. **Provide feedback**: Show progress for long-running operations
+7. **Handle errors gracefully**: Don't crash, provide actionable error messages
+8. **Make it scriptable**: Support JSON output for automation
+9. **Add help text**: Include usage message when called incorrectly
+10. **Follow conventions**: Use standard flags like `-v`, `--json`, `--dry-run`
+
+### Dependencies
+
+**Shell Scripts:**
+```bash
+#!/usr/bin/env nix-shell
+#! nix-shell -i bash -p gh jq curl fzf
+
+# Script has access to: gh, jq, curl, fzf
+```
+
+**Python Scripts:**
+```python
+#!/usr/bin/env -S uv run --quiet --script
+# /// script
+# dependencies = [
+#   "click>=8.0",
+#   "requests>=2.28",
+# ]
+# ///
+```
+
+### Example: CheckPRStatus.sh
+
+```bash
+#!/usr/bin/env nix-shell
+#! nix-shell -i bash -p gh jq
+
+# CheckPRStatus.sh - Enhanced PR check status viewer
+# Usage: ./CheckPRStatus.sh <pr-number> [--filter failed|pending|required]
+
+set -euo pipefail
+
+# Colors
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+# Parse arguments
+PR_NUMBER="${1:-}"
+FILTER_TYPE="${2:-all}"
+
+show_usage() {
+  cat << EOF
+Usage: $0 <pr-number> [--filter <type>]
+
+Arguments:
+  pr-number      PR number to check
+
+Options:
+  --filter TYPE  Filter checks (all|failed|pending|required)
+  --show-logs    Show failure logs
+  --json         Output as JSON
+
+Examples:
+  $0 123                    # Show all checks
+  $0 123 --filter failed    # Show only failed checks
+  $0 123 --show-logs        # Show failures with logs
+EOF
+}
+
+if [ -z "$PR_NUMBER" ]; then
+  show_usage
+  exit 1
+fi
+
+# Get PR checks
+CHECKS_JSON=$(gh pr view "$PR_NUMBER" --json statusCheckRollup --jq '.statusCheckRollup')
+
+# Count statuses
+TOTAL=$(echo "$CHECKS_JSON" | jq 'length')
+PASSED=$(echo "$CHECKS_JSON" | jq '[.[] | select(.conclusion == "success")] | length')
+FAILED=$(echo "$CHECKS_JSON" | jq '[.[] | select(.conclusion == "failure")] | length')
+PENDING=$(echo "$CHECKS_JSON" | jq '[.[] | select(.status != "COMPLETED")] | length')
+
+# Show summary
+echo -e "\nPR #$PR_NUMBER Check Status"
+echo "=============================="
+echo -e "Total: $TOTAL | ${GREEN}Passed: $PASSED${NC} | ${RED}Failed: $FAILED${NC} | ${YELLOW}Pending: $PENDING${NC}\n"
+
+# Filter and display
+case "${FILTER_TYPE}" in
+  --filter)
+    case "${3:-all}" in
+      failed)
+        echo -e "${RED}Failed Checks:${NC}"
+        echo "$CHECKS_JSON" | jq -r '.[] | select(.conclusion == "failure") | "  ✗ \(.name)\n    → \(.detailsUrl)"'
+        ;;
+      pending)
+        echo -e "${YELLOW}Pending Checks:${NC}"
+        echo "$CHECKS_JSON" | jq -r '.[] | select(.status != "COMPLETED") | "  ⏳ \(.name)"'
+        ;;
+      required)
+        echo -e "Required Checks:"
+        echo "$CHECKS_JSON" | jq -r '.[] | select(.isRequired == true) | "  \(if .conclusion == "success" then "✓" elif .conclusion == "failure" then "✗" else "⏳" end) \(.name)"'
+        ;;
+      all|*)
+        echo "$CHECKS_JSON" | jq -r '.[] | "\(if .conclusion == "success" then "✓" elif .conclusion == "failure" then "✗" else "⏳" end) \(.name)"'
+        ;;
+    esac
+    ;;
+  --show-logs)
+    echo -e "${RED}Failed Checks with Logs:${NC}\n"
+
+    # Get failed run IDs
+    BRANCH=$(gh pr view "$PR_NUMBER" --json headRefName --jq '.headRefName')
+    FAILED_RUNS=$(gh run list --branch="$BRANCH" --status=failure --json databaseId --jq '.[].databaseId' | head -3)
+
+    for run_id in $FAILED_RUNS; do
+      echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+      gh run view "$run_id" --log-failed | head -50
+      echo ""
+    done
+    ;;
+  --json)
+    echo "$CHECKS_JSON" | jq '.'
+    ;;
+  *)
+    # Default: show all
+    echo "$CHECKS_JSON" | jq -r '.[] | "\(if .conclusion == "success" then "✓" elif .conclusion == "failure" then "✗" else "⏳" end) \(.name)"'
+    ;;
+esac
+```
+
+### Testing Tools
+
+```bash
+# Make executable
+chmod +x tools/CheckPRStatus.sh
+
+# Test (nix-shell will automatically provide dependencies)
+./tools/CheckPRStatus.sh 123
+
+# Test with filter
+./tools/CheckPRStatus.sh 123 --filter failed
+
+# Test with logs
+./tools/CheckPRStatus.sh 123 --show-logs
+```
+
+## Integration with Workflows
+
+Tools are referenced in workflow files:
+
+```markdown
+## Custom Tool: Enhanced Status Check
+
+For complex formatting:
+
+\`\`\`bash
+./tools/CheckPRStatus.sh 123 --filter failed --show-logs
+\`\`\`
+```
+
+## Development Workflow
+
+1. **Plan the tool**: Define what it should do
+2. **Check if gh can do it**: Don't duplicate existing functionality
+3. **Choose language**: Shell for simple, Python for complex
+4. **Add dependencies**: Use nix-shell or uv shebang
+5. **Prototype**: Write minimal version
+6. **Test**: Test with real PRs/repos
+7. **Make executable**: `chmod +x tools/ToolName.sh`
+8. **Document**: Add usage examples to workflow files
+9. **Integrate**: Reference in appropriate workflows
+
+## Future Tools
+
+- **PRMetrics.sh**: Analyze PR size, complexity, review time
+- **AutoLabel.sh**: Automatically suggest labels based on file changes
+- **ReviewReminder.sh**: Notify reviewers of pending PRs
+- **MergeQueue.sh**: Manage PR merge order with dependencies
+- **ChangelogGenerator.sh**: Generate changelog from merged PRs
+
+## Contributing
+
+When adding a new tool:
+
+1. Create script in `tools/` (prefer `.sh`, use `.py` only if needed)
+2. Add appropriate shebang (nix-shell or uv)
+3. Add usage/help message
+4. Make executable: `chmod +x`
+5. Document in this README
+6. Reference in relevant workflow files
+7. Add usage examples
+8. Test with real GitHub data
dots/.config/claude/skills/GitHub/workflows/CheckStatus.md
@@ -0,0 +1,259 @@
+# CheckStatus Workflow
+
+Check the status of GitHub PR checks, identify failures, and provide actionable information.
+
+## When to Use
+
+- "check pr status"
+- "show pr checks"
+- "ci status"
+- "check failures"
+- "are the checks passing?"
+
+## Quick Commands
+
+### Check Current PR
+```bash
+# Auto-detect current branch's PR and show checks
+gh pr checks
+
+# Watch checks in real-time
+gh pr checks --watch
+
+# Show checks for specific PR
+gh pr checks 123
+```
+
+### Detailed Status
+```bash
+# Get full status including URLs and conclusions
+gh pr view 123 --json statusCheckRollup --jq '.statusCheckRollup'
+
+# List all workflow runs for current branch
+gh run list --branch=$(git branch --show-current)
+
+# Show failed runs only
+gh run list --branch=$(git branch --show-current) --status=failure
+```
+
+## Workflow Steps
+
+### 1. Identify the PR
+
+**If PR number is provided:**
+```bash
+gh pr view <number>
+```
+
+**If no PR number (auto-detect):**
+```bash
+# Get PR for current branch
+gh pr status --json currentBranch,state,number --jq '.currentBranch.number'
+```
+
+### 2. Get Check Status
+
+```bash
+# Simple check list
+gh pr checks <number>
+
+# Detailed JSON output
+gh pr view <number> --json statusCheckRollup,state,mergeable
+```
+
+### 3. Analyze Results
+
+Parse the output to identify:
+- ✓ **Passing checks**: All green
+- ✗ **Failed checks**: What failed and why
+- ⏳ **Pending checks**: Still running
+- ⊘ **Skipped checks**: Not required
+
+### 4. Show Failure Details
+
+For each failed check:
+```bash
+# Get the workflow run ID
+gh run list --workflow="Check Name" --branch=branch-name --limit=1 --json databaseId --jq '.[0].databaseId'
+
+# View the run with logs
+gh run view <run-id> --log-failed
+
+# Or view in browser
+gh run view <run-id> --web
+```
+
+### 5. Present Summary
+
+**Format:**
+```
+PR #123: feature-branch → main
+
+Status: ❌ Checks failing (2/5)
+
+✓ tests (2m 34s)
+✓ lint (1m 12s)
+✓ build (3m 45s)
+✗ e2e-tests (4m 23s) - FAILED
+✗ security-scan (2m 01s) - FAILED
+
+Failed Checks:
+
+1. e2e-tests
+   Run: https://github.com/owner/repo/actions/runs/123456
+   Error: Test suite "auth" failed with 2 failures
+
+   Next steps:
+   - View logs: gh run view 123456 --log-failed
+   - Rerun: gh run rerun 123456 --failed
+
+2. security-scan
+   Run: https://github.com/owner/repo/actions/runs/123457
+   Error: Found 1 high severity vulnerability
+
+   Next steps:
+   - View details: gh run view 123457 --log
+   - Fix and push changes
+```
+
+## Advanced Usage
+
+### Check Multiple PRs
+
+```bash
+# List all open PRs with check status
+gh pr list --json number,title,statusCheckRollup --jq '.[] | "\(.number): \(.title) - \(.statusCheckRollup | length) checks"'
+```
+
+### Monitor Checks
+
+```bash
+# Watch checks until completion
+gh pr checks --watch --interval 30
+```
+
+### Filter by Status
+
+```bash
+# Show only failed checks
+gh pr view <number> --json statusCheckRollup --jq '.statusCheckRollup[] | select(.conclusion == "failure")'
+
+# Show only required checks
+gh pr view <number> --json statusCheckRollup --jq '.statusCheckRollup[] | select(.isRequired == true)'
+```
+
+## Custom Tool: Enhanced Status Check
+
+For more complex formatting and filtering, use the custom tool:
+
+```bash
+# In tools/ directory
+./CheckPRStatus.ts --pr 123 --show-logs --filter failed
+```
+
+**Tool capabilities:**
+- Color-coded output
+- Automatic log fetching for failures
+- Smart filtering (required, failed, pending)
+- Export to JSON/Markdown
+- Integration with notifications
+
+## Common Scenarios
+
+### Scenario 1: Quick Status Check
+```bash
+# Just want to know if checks passed
+gh pr checks && echo "✓ All checks passed" || echo "✗ Some checks failed"
+```
+
+### Scenario 2: Debug Specific Failure
+```bash
+# Get PR number
+PR=$(gh pr status --json currentBranch --jq '.currentBranch.number')
+
+# Find failed runs
+gh run list --branch=$(git branch --show-current) --status=failure --limit=1 --json databaseId --jq '.[0].databaseId'
+
+# View failure logs
+gh run view <run-id> --log-failed
+```
+
+### Scenario 3: Wait for Checks to Complete
+```bash
+# Watch until all complete
+gh pr checks --watch
+
+# Or poll in script
+while true; do
+  STATUS=$(gh pr view <number> --json statusCheckRollup --jq '.statusCheckRollup | map(select(.status != "COMPLETED")) | length')
+  if [ "$STATUS" -eq 0 ]; then
+    echo "All checks completed"
+    break
+  fi
+  echo "Waiting for $STATUS checks..."
+  sleep 30
+done
+```
+
+## Error Handling
+
+**No PR found:**
+```
+Error: Current branch has no associated PR
+→ Create one: gh pr create
+```
+
+**PR is draft:**
+```
+PR #123 is a draft
+Checks may not run until marked as ready for review
+→ Mark ready: gh pr ready 123
+```
+
+**No checks configured:**
+```
+No status checks found for this PR
+→ Check if GitHub Actions are configured
+→ Verify branch protection rules
+```
+
+## Integration with Other Workflows
+
+- **RestartChecks**: If checks failed, offer to restart
+- **ReviewPR**: Show check status as part of review
+- **CreatePR**: Check status immediately after creation
+
+## Best Practices
+
+1. **Check before requesting review**: Ensure checks pass before asking for review
+2. **Monitor long-running checks**: Use `--watch` for jobs over 5 minutes
+3. **Investigate failures immediately**: Don't wait for multiple failures
+4. **Use JSON output for automation**: Parse with `jq` for scripts
+5. **Keep check names descriptive**: Makes debugging easier
+
+## Output Formats
+
+### Simple (default)
+```
+gh pr checks 123
+```
+
+### JSON (for scripts)
+```bash
+gh pr view 123 --json statusCheckRollup
+```
+
+### Custom (with jq)
+```bash
+gh pr view 123 --json statusCheckRollup --jq '
+  .statusCheckRollup |
+  group_by(.conclusion) |
+  map({conclusion: .[0].conclusion, count: length})
+'
+```
+
+## Resources
+
+- [gh pr checks documentation](https://cli.github.com/manual/gh_pr_checks)
+- [gh run list documentation](https://cli.github.com/manual/gh_run_list)
+- [GitHub Checks API](https://docs.github.com/en/rest/checks)
dots/.config/claude/skills/GitHub/workflows/CreatePR.md
@@ -0,0 +1,451 @@
+# CreatePR Workflow
+
+Create a GitHub pull request with proper formatting, labels, and metadata.
+
+## When to Use
+
+- "create pr"
+- "open pull request"
+- "new pr"
+- "create pull request"
+
+## Quick Commands
+
+```bash
+# Interactive PR creation
+gh pr create
+
+# With title and body
+gh pr create --title "feat: Add user authentication" --body "Description here"
+
+# From template
+gh pr create --template feature.md
+
+# Set base branch
+gh pr create --base main
+
+# Add reviewers, assignees, labels
+gh pr create --reviewer @user1,@user2 --assignee @me --label enhancement
+
+# Create as draft
+gh pr create --draft
+
+# Fill from commit messages
+gh pr create --fill
+```
+
+## Workflow Steps
+
+### 1. Verify Current State
+
+```bash
+# Check current branch
+git branch --show-current
+
+# Ensure changes are committed
+git status
+
+# Check if PR already exists
+gh pr status
+```
+
+### 2. Check for PR Template
+
+**Look for templates in common locations:**
+
+```bash
+# Check for pull request templates
+TEMPLATE=""
+
+# Check common locations
+if [ -f .github/pull_request_template.md ]; then
+  TEMPLATE=".github/pull_request_template.md"
+elif [ -f .github/PULL_REQUEST_TEMPLATE.md ]; then
+  TEMPLATE=".github/PULL_REQUEST_TEMPLATE.md"
+elif [ -f docs/pull_request_template.md ]; then
+  TEMPLATE="docs/pull_request_template.md"
+elif [ -f PULL_REQUEST_TEMPLATE.md ]; then
+  TEMPLATE="PULL_REQUEST_TEMPLATE.md"
+elif [ -d .github/PULL_REQUEST_TEMPLATE ]; then
+  # Multiple templates, list them
+  ls .github/PULL_REQUEST_TEMPLATE/
+fi
+
+if [ -n "$TEMPLATE" ]; then
+  echo "Found PR template: $TEMPLATE"
+  cat "$TEMPLATE"
+fi
+```
+
+**Common template locations:**
+- `.github/pull_request_template.md` (default)
+- `.github/PULL_REQUEST_TEMPLATE.md` (uppercase)
+- `.github/PULL_REQUEST_TEMPLATE/feature.md` (multiple templates)
+- `docs/pull_request_template.md`
+- `PULL_REQUEST_TEMPLATE.md` (root)
+
+### 3. Generate PR Content Following Template
+
+**If template exists, follow its structure:**
+
+Example template:
+```markdown
+## Description
+<!-- Describe your changes -->
+
+## Type of Change
+- [ ] Bug fix
+- [ ] New feature
+- [ ] Breaking change
+- [ ] Documentation update
+
+## Checklist
+- [ ] Tests added/updated
+- [ ] Documentation updated
+- [ ] All checks passing
+```
+
+**Fill in based on commits:**
+
+```bash
+# Read template
+TEMPLATE_CONTENT=$(cat .github/pull_request_template.md)
+
+# Generate filled content
+cat > /tmp/pr_body.md <<EOF
+## Description
+$(git log main..HEAD --format=%B | head -5)
+
+## Type of Change
+- [x] New feature
+- [ ] Bug fix
+- [ ] Breaking change
+- [ ] Documentation update
+
+## Checklist
+- [x] Tests added/updated
+- [x] Documentation updated
+- [ ] All checks passing
+
+## Related Issues
+Closes #42
+EOF
+```
+
+**If no template, use default format:**
+
+```markdown
+## Summary
+Brief overview of changes
+
+## Changes
+- Change 1
+- Change 2
+- Change 3
+
+## Testing
+- [ ] Unit tests added/updated
+- [ ] Manual testing completed
+- [ ] All checks passing
+
+## Related Issues
+Closes #123
+Relates to #456
+```
+
+### 4. Extract Title and Body
+
+**Title format** (conventional commits):
+```
+<type>: <short description>
+
+Types: feat, fix, docs, chore, refactor, test, perf, ci
+```
+
+**Generate from commits:**
+```bash
+# Get commit messages since diverging from main
+git log main..HEAD --oneline
+
+# Generate title from first commit
+TITLE=$(git log main..HEAD --format=%s | head -1)
+
+# Or use conventional commit format
+TITLE="feat: Add user authentication"
+```
+
+### 5. Create PR with Template Content
+
+**Using template file directly:**
+```bash
+# gh pr create will automatically use template if it exists
+gh pr create --fill
+```
+
+**Using custom template:**
+```bash
+# Specify template
+gh pr create --template feature.md
+```
+
+**Manual creation with template content:**
+```bash
+# Read and fill template
+BODY=$(cat .github/pull_request_template.md)
+
+# Replace placeholders or fill sections
+BODY=$(echo "$BODY" | sed 's/<!-- Describe your changes -->/Implements JWT authentication/')
+
+gh pr create \
+  --title "feat: Add user authentication" \
+  --body "$BODY" \
+  --base main
+```
+
+### 6. Verify and Monitor
+
+```bash
+# View created PR
+gh pr view
+
+# Check status
+gh pr checks --watch
+
+# Get PR URL
+gh pr view --json url --jq '.url'
+```
+
+## Template Detection and Usage
+
+### Automatic Detection
+
+The `gh pr create` command automatically detects and uses templates:
+
+```bash
+# Will use template if found
+gh pr create
+
+# Will prompt for which template if multiple exist
+gh pr create
+```
+
+### Manual Template Selection
+
+```bash
+# List available templates
+ls .github/PULL_REQUEST_TEMPLATE/
+
+# Use specific template
+gh pr create --template bug_fix.md
+gh pr create --template feature.md
+gh pr create --template hotfix.md
+```
+
+### Parse and Fill Template
+
+For intelligent template filling:
+
+```bash
+#!/bin/bash
+# parse_template.sh
+
+TEMPLATE=".github/pull_request_template.md"
+
+if [ ! -f "$TEMPLATE" ]; then
+  echo "No template found"
+  exit 1
+fi
+
+# Read template
+CONTENT=$(cat "$TEMPLATE")
+
+# Extract sections and fill
+# Example: Fill "Type of Change" based on branch name
+BRANCH=$(git branch --show-current)
+
+if [[ $BRANCH == feat/* ]]; then
+  CONTENT=$(echo "$CONTENT" | sed 's/\[ \] New feature/[x] New feature/')
+elif [[ $BRANCH == fix/* ]]; then
+  CONTENT=$(echo "$CONTENT" | sed 's/\[ \] Bug fix/[x] Bug fix/')
+fi
+
+# Auto-check completed items
+# If tests exist, mark checkbox
+if git diff main..HEAD --name-only | grep -q "test"; then
+  CONTENT=$(echo "$CONTENT" | sed '0,/\[ \] Tests added/s/\[ \] Tests added/[x] Tests added/')
+fi
+
+echo "$CONTENT"
+```
+
+## Advanced Usage
+
+### Create Custom Template
+
+Create `.github/pull_request_template.md`:
+```markdown
+## Description
+<!-- Describe your changes -->
+
+## Type of Change
+- [ ] Bug fix (non-breaking change which fixes an issue)
+- [ ] New feature (non-breaking change which adds functionality)
+- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
+- [ ] Documentation update
+- [ ] Code refactoring
+- [ ] Performance improvement
+- [ ] Test addition/update
+
+## Motivation and Context
+<!-- Why is this change required? What problem does it solve? -->
+<!-- If it fixes an open issue, please link to the issue here -->
+
+## How Has This Been Tested?
+<!-- Describe the tests you ran to verify your changes -->
+- [ ] Unit tests
+- [ ] Integration tests
+- [ ] Manual testing
+
+## Screenshots (if appropriate)
+<!-- Add screenshots to help explain your changes -->
+
+## Checklist
+- [ ] My code follows the code style of this project
+- [ ] I have updated the documentation accordingly
+- [ ] I have added tests to cover my changes
+- [ ] All new and existing tests passed
+- [ ] My changes generate no new warnings
+- [ ] I have checked my code and corrected any misspellings
+
+## Related Issues
+<!-- Link related issues: Closes #123, Relates to #456 -->
+```
+
+### Multiple Templates
+
+Create directory `.github/PULL_REQUEST_TEMPLATE/`:
+
+```bash
+.github/PULL_REQUEST_TEMPLATE/
+├── bug_fix.md
+├── feature.md
+├── hotfix.md
+└── documentation.md
+```
+
+Use specific template:
+```bash
+gh pr create --template bug_fix.md
+```
+
+### Auto-Fill PR
+
+```bash
+# Fill title from first commit, body from rest
+gh pr create --fill
+
+# Fill with verbose output
+gh pr create --fill-verbose
+```
+
+### Draft PR
+
+For work in progress:
+```bash
+# Create as draft
+gh pr create --draft
+
+# Mark ready later
+gh pr ready <number>
+```
+
+## Common Scenarios
+
+### Scenario 1: Quick PR (with template)
+
+```bash
+# gh automatically detects and uses template
+gh pr create --fill --web
+```
+
+### Scenario 2: Custom Template Filling
+
+```bash
+# Detect template
+TEMPLATE=".github/pull_request_template.md"
+
+# Fill template intelligently
+BODY=$(cat "$TEMPLATE")
+
+# Auto-check items based on changes
+if git diff main..HEAD --name-only | grep -q "_test\|spec"; then
+  BODY=$(echo "$BODY" | sed '0,/\[ \] Tests added/s/\[ \] Tests added/[x] Tests added/')
+fi
+
+if git diff main..HEAD --name-only | grep -q "README\|docs/"; then
+  BODY=$(echo "$BODY" | sed '0,/\[ \] Documentation updated/s/\[ \] Documentation updated/[x] Documentation updated/')
+fi
+
+gh pr create \
+  --title "feat: Add user authentication" \
+  --body "$BODY" \
+  --reviewer @team
+```
+
+### Scenario 3: Cross-Fork PR
+
+```bash
+# From your fork to upstream
+gh pr create \
+  --repo upstream/repo \
+  --base main \
+  --head yourname:feature-branch
+```
+
+## Custom Tool: Smart PR Creation
+
+For intelligent template filling and validation:
+
+```bash
+# In tools/ directory
+./CreatePR.ts --auto-fill --validate-checklist --detect-type
+```
+
+**Tool capabilities:**
+- Auto-detect PR template location
+- Intelligently fill template sections based on commits
+- Validate all checklist items are addressed
+- Auto-detect PR type from branch name or commits
+- Link related issues automatically
+- Suggest reviewers based on file changes
+- Validate PR against project guidelines
+
+## Best Practices
+
+1. **Use repository template**: Always use the repo's PR template if it exists
+2. **Fill template completely**: Don't leave sections empty or with placeholders
+3. **Check all boxes**: Actually verify checklist items before marking
+4. **Descriptive titles**: Follow conventional commit format
+5. **Comprehensive description**: Explain WHY, not just WHAT
+6. **Link issues**: Use "Closes #123" to auto-close
+7. **Add reviewers**: Don't leave empty, assign relevant people
+8. **Use labels**: Categorize for better tracking
+9. **Include tests**: Mention test coverage in description
+10. **Check before creating**: Ensure commits are ready
+11. **Use draft for WIP**: Don't request review for incomplete work
+
+## Template Best Practices
+
+1. **Keep templates concise**: Don't overwhelm contributors
+2. **Use clear sections**: Organize with headers
+3. **Provide examples**: Show what good looks like
+4. **Make checklists actionable**: Specific, verifiable items
+5. **Link to contributing guide**: Reference detailed guidelines
+6. **Support multiple types**: Create separate templates for bugs/features
+7. **Include issue links**: Remind to link related issues
+
+## Resources
+
+- [gh pr create documentation](https://cli.github.com/manual/gh_pr_create)
+- [Pull request templates](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository)
+- [Pull request best practices](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests)
dots/.config/claude/skills/GitHub/workflows/ManageIssues.md
@@ -0,0 +1,224 @@
+# ManageIssues Workflow
+
+Create, list, view, and manage GitHub issues.
+
+## When to Use
+
+- "create issue"
+- "list issues"
+- "view issue"
+- "close issue"
+- "update issue"
+
+## Quick Commands
+
+### List Issues
+
+```bash
+# List open issues
+gh issue list
+
+# List all issues (including closed)
+gh issue list --state all
+
+# Filter by label
+gh issue list --label bug
+
+# Filter by assignee
+gh issue list --assignee @me
+
+# Search issues
+gh issue list --search "authentication"
+```
+
+### View Issue
+
+```bash
+# View issue details
+gh issue view <number>
+
+# View in browser
+gh issue view <number> --web
+
+# View comments
+gh issue view <number> --comments
+```
+
+### Create Issue
+
+```bash
+# Interactive
+gh issue create
+
+# With title and body
+gh issue create --title "Bug: Login fails" --body "Description here"
+
+# With labels and assignee
+gh issue create --title "Bug" --label bug --assignee @me
+
+# From template
+gh issue create --template bug_report.md
+```
+
+### Update Issue
+
+```bash
+# Close issue
+gh issue close <number>
+
+# Reopen issue
+gh issue reopen <number>
+
+# Edit issue
+gh issue edit <number> --title "New title" --body "New body"
+
+# Add labels
+gh issue edit <number> --add-label bug,priority:high
+
+# Assign
+gh issue edit <number> --add-assignee @user
+```
+
+## Workflow Steps
+
+### 1. Create Issue from Problem
+
+When you encounter a bug or have a feature request:
+
+```bash
+gh issue create --title "feat: Add dark mode support" --body "$(cat <<'EOF'
+## Feature Request
+
+Add dark mode support to the application.
+
+## Motivation
+Users working in low-light environments would benefit from a dark theme.
+
+## Proposed Solution
+- Add theme toggle in settings
+- Support system preference detection
+- Persist user preference
+
+## Alternatives Considered
+- Browser extension (not ideal for all users)
+- Manual CSS overrides (poor UX)
+
+## Additional Context
+Similar to #123 but for the entire UI.
+EOF
+)"
+```
+
+### 2. Track and Organize
+
+```bash
+# Add to project
+gh issue edit <number> --add-project "Q1 2025"
+
+# Set milestone
+gh issue edit <number> --milestone "v2.0"
+
+# Add labels
+gh issue edit <number> --add-label enhancement,ui,needs-design
+```
+
+### 3. Link to PRs
+
+```bash
+# In PR description, use:
+Closes #<issue-number>
+Fixes #<issue-number>
+Resolves #<issue-number>
+```
+
+## Common Scenarios
+
+### Scenario 1: Bug Report
+
+```bash
+gh issue create \
+  --title "bug: Login redirect fails on mobile" \
+  --label bug,mobile \
+  --body "$(cat <<'EOF'
+## Bug Description
+Login redirect doesn't work on mobile Safari
+
+## Steps to Reproduce
+1. Open site on iPhone Safari
+2. Click login button
+3. Enter credentials
+4. Observe redirect fails
+
+## Expected Behavior
+Should redirect to dashboard
+
+## Actual Behavior
+Stays on login page, shows error in console
+
+## Environment
+- OS: iOS 17.2
+- Browser: Safari
+- Device: iPhone 14
+
+## Additional Context
+Works fine on desktop Chrome
+EOF
+)"
+```
+
+### Scenario 2: Feature Request
+
+```bash
+gh issue create \
+  --title "feat: Add export to CSV functionality" \
+  --label enhancement,data-export \
+  --body "## Feature Request
+
+Allow users to export data to CSV format.
+
+## Use Case
+Users need to analyze data in Excel/Google Sheets
+
+## Acceptance Criteria
+- [ ] Export button in data table
+- [ ] Includes all visible columns
+- [ ] Respects current filters
+- [ ] Handles large datasets (>10k rows)
+
+## Priority
+Medium - requested by 5 customers"
+```
+
+### Scenario 3: Find and Fix
+
+```bash
+# Find bugs assigned to me
+gh issue list --assignee @me --label bug
+
+# Pick one to work on
+gh issue view 42
+
+# Create branch
+git checkout -b fix/issue-42-login-redirect
+
+# Make changes, commit, create PR
+gh pr create --fill
+
+# PR body includes "Closes #42"
+```
+
+## Best Practices
+
+1. **Use templates**: Create issue templates for consistency
+2. **Clear titles**: Describe the issue, not the solution
+3. **Provide context**: Include steps to reproduce for bugs
+4. **Label appropriately**: Use labels for categorization
+5. **Assign ownership**: Assign issues to track responsibility
+6. **Link PRs**: Always link PRs that fix issues
+7. **Close when done**: Don't leave resolved issues open
+8. **Update status**: Comment on progress for long-running issues
+
+## Resources
+
+- [gh issue documentation](https://cli.github.com/manual/gh_issue)
+- [GitHub issues guide](https://docs.github.com/en/issues)
dots/.config/claude/skills/GitHub/workflows/RestartChecks.md
@@ -0,0 +1,355 @@
+# RestartChecks Workflow
+
+Intelligently restart failed GitHub workflow checks for a pull request.
+
+## When to Use
+
+- "restart checks"
+- "rerun failed checks"
+- "retry ci"
+- "restart failed jobs"
+- "rerun workflow"
+
+## Quick Commands
+
+### Restart Failed Jobs
+
+```bash
+# Rerun only failed jobs from last run
+gh run rerun <run-id> --failed
+
+# Rerun entire workflow
+gh run rerun <run-id>
+
+# Rerun specific job
+gh run rerun <run-id> --job <job-id>
+```
+
+### Find Failed Runs
+
+```bash
+# List failed runs for current branch
+gh run list --branch=$(git branch --show-current) --status=failure
+
+# Get latest failed run ID
+gh run list --branch=$(git branch --show-current) --status=failure --limit=1 --json databaseId --jq '.[0].databaseId'
+```
+
+## Workflow Steps
+
+### 1. Identify Target PR/Branch
+
+**If PR number provided:**
+```bash
+# Get branch from PR
+BRANCH=$(gh pr view <number> --json headRefName --jq '.headRefName')
+```
+
+**If no PR (use current branch):**
+```bash
+BRANCH=$(git branch --show-current)
+```
+
+### 2. Find Failed Runs
+
+```bash
+# Get all failed runs for the branch
+gh run list --branch="$BRANCH" --status=failure --json databaseId,name,conclusion,createdAt
+
+# Group by workflow name to get latest failed run for each
+gh run list --branch="$BRANCH" --status=failure --json databaseId,name,workflowName --jq '
+  group_by(.workflowName) |
+  map({workflow: .[0].workflowName, runId: .[0].databaseId})
+'
+```
+
+### 3. Present Options
+
+Show the user which checks failed:
+
+```
+Failed checks on branch: feature-branch
+
+1. CI Tests (run: 123456)
+   - Failed 2 minutes ago
+   - 3 jobs failed
+
+2. Security Scan (run: 123457)
+   - Failed 5 minutes ago
+   - 1 job failed
+
+3. Build (run: 123458)
+   - Failed 1 minute ago
+   - 2 jobs failed
+
+Restart options:
+a) All failed checks
+b) Specific check (choose number)
+c) Cancel
+```
+
+### 4. Execute Restart
+
+**Restart all failed:**
+```bash
+for run_id in $(gh run list --branch="$BRANCH" --status=failure --json databaseId --jq '.[].databaseId'); do
+  gh run rerun "$run_id" --failed
+  echo "Restarted run: $run_id"
+done
+```
+
+**Restart specific:**
+```bash
+gh run rerun <run-id> --failed
+```
+
+### 5. Monitor Progress
+
+```bash
+# Watch the restarted checks
+gh run watch <run-id>
+
+# Or show PR checks
+gh pr checks --watch
+```
+
+### 6. Confirm Completion
+
+```
+✓ Restarted 3 failed workflow runs
+
+Monitoring:
+- CI Tests: https://github.com/owner/repo/actions/runs/123459
+- Security Scan: https://github.com/owner/repo/actions/runs/123460
+- Build: https://github.com/owner/repo/actions/runs/123461
+
+Watch progress: gh pr checks --watch
+```
+
+## Advanced Usage
+
+### Restart with Different Parameters
+
+Some workflows accept inputs for reruns:
+
+```bash
+# Rerun with specific inputs
+gh workflow run <workflow-name> --ref <branch> -f param=value
+```
+
+### Smart Restart (Skip Non-Flaky Failures)
+
+If failures are due to code issues (not flaky tests), ask user first:
+
+```bash
+# Analyze failure logs
+gh run view <run-id> --log-failed
+
+# If failure looks like code issue, suggest fixing first
+echo "Failure appears to be code-related. Fix the issue before restarting?"
+```
+
+### Restart in Batch
+
+For multiple PRs or branches:
+
+```bash
+# Get all PRs with failed checks
+gh pr list --json number,headRefName,statusCheckRollup --jq '
+  .[] |
+  select(.statusCheckRollup | any(.conclusion == "failure")) |
+  .number
+'
+
+# Restart each
+for pr in $(gh pr list ...); do
+  BRANCH=$(gh pr view "$pr" --json headRefName --jq '.headRefName')
+  # Restart failed runs...
+done
+```
+
+## Common Scenarios
+
+### Scenario 1: Quick Restart Current PR
+
+```bash
+# Get current PR
+PR=$(gh pr status --json currentBranch --jq '.currentBranch.number')
+
+# Find and restart failed runs
+FAILED_RUNS=$(gh run list --branch=$(git branch --show-current) --status=failure --json databaseId --jq '.[].databaseId')
+
+# Restart each
+for run in $FAILED_RUNS; do
+  gh run rerun "$run" --failed
+done
+
+# Watch
+gh pr checks --watch
+```
+
+### Scenario 2: Restart Specific Failed Job
+
+```bash
+# View run to see which jobs failed
+gh run view <run-id>
+
+# Get failed job IDs
+gh run view <run-id> --json jobs --jq '.jobs[] | select(.conclusion == "failure") | .databaseId'
+
+# Restart specific job
+gh run rerun <run-id> --job <job-id>
+```
+
+### Scenario 3: Automatic Retry on Flaky Tests
+
+```bash
+# Check if failure is flaky (appears in logs)
+if gh run view <run-id> --log-failed | grep -q "flaky\|timeout\|network"; then
+  echo "Detected flaky failure, restarting automatically..."
+  gh run rerun <run-id> --failed
+else
+  echo "Failure appears to be code-related. Review before restarting."
+fi
+```
+
+## Available Tool: gh-restart-failed
+
+**Interactive tool for restarting failed checks across multiple PRs:**
+
+```bash
+# List and restart failed checks interactively
+gh-restart-failed
+
+# Use specific repository
+gh-restart-failed owner/repo
+
+# Ignore specific workflows (Label Checker ignored by default)
+gh-restart-failed -i "build" -i "test"
+
+# Filter by PR labels
+gh-restart-failed -l "bug" -l "enhancement"
+```
+
+**Features:**
+- Interactive fzf interface with multi-select
+- Preview failed checks before restarting
+- Handles multiple PRs at once
+- Filters out old runs (>1 month)
+- Color-coded output with status
+
+**Location**: `~/src/home/tools/gh-restart-failed/`
+
+## Custom Tool: Intelligent Restart (Planned)
+
+For more sophisticated restart logic:
+
+```bash
+# In tools/ directory
+./RestartFailedChecks.sh --pr 123 --auto-flaky --max-retries 2
+```
+
+**Planned capabilities:**
+- Detect flaky vs. code failures
+- Automatic retry for flaky tests (with limits)
+- Skip restart if same failure occurred multiple times
+- Notify on Slack/email when checks complete
+- Statistics tracking (success rate, retry count)
+
+## Error Handling
+
+**No failed runs found:**
+```
+No failed checks found for this branch
+→ All checks passing or none configured
+```
+
+**Workflow run not found:**
+```
+Error: Run ID not found
+→ May have been deleted or expired
+→ Check: gh run list --branch <branch>
+```
+
+**Permission denied:**
+```
+Error: Permission denied to rerun workflow
+→ Requires write access to repository
+→ Check: gh auth status
+```
+
+**Workflow already running:**
+```
+Cannot restart: workflow is already running
+→ Wait for completion or cancel first
+→ Cancel: gh run cancel <run-id>
+```
+
+## Best Practices
+
+1. **Check logs before restarting**: Don't blindly restart failures
+2. **Limit automatic retries**: Avoid infinite retry loops (max 2-3)
+3. **Restart failed jobs only**: Use `--failed` to save CI resources
+4. **Monitor after restart**: Ensure the retry succeeds
+5. **Fix code issues first**: Don't restart if failure is code-related
+6. **Track retry history**: Know when tests are consistently flaky
+
+## Integration with Other Workflows
+
+- **CheckStatus**: Identify failures before restarting
+- **ReviewPR**: Restart as part of PR review process
+- **ManageIssues**: Create issue for persistent failures
+
+## Restart Strategies
+
+### Conservative (Recommended)
+```bash
+# 1. Check what failed
+gh run view <run-id> --log-failed
+
+# 2. Confirm with user
+echo "Restart failed jobs? (y/n)"
+
+# 3. Restart only failed
+gh run rerun <run-id> --failed
+```
+
+### Aggressive (For Flaky Tests)
+```bash
+# Auto-restart up to 3 times
+RETRIES=0
+MAX_RETRIES=3
+
+while [ $RETRIES -lt $MAX_RETRIES ]; do
+  gh run rerun <run-id> --failed
+
+  # Wait for completion
+  gh run watch <run-id>
+
+  # Check if passed
+  if gh run view <run-id> --json conclusion --jq '.conclusion' | grep -q "success"; then
+    break
+  fi
+
+  RETRIES=$((RETRIES + 1))
+done
+```
+
+### Selective (By Workflow)
+```bash
+# Only restart specific workflows (e.g., tests but not linting)
+RESTARTABLE_WORKFLOWS=("CI Tests" "E2E Tests")
+
+for workflow in "${RESTARTABLE_WORKFLOWS[@]}"; do
+  RUN_ID=$(gh run list --workflow="$workflow" --branch="$BRANCH" --status=failure --limit=1 --json databaseId --jq '.[0].databaseId')
+  if [ -n "$RUN_ID" ]; then
+    gh run rerun "$RUN_ID" --failed
+  fi
+done
+```
+
+## Resources
+
+- [gh run rerun documentation](https://cli.github.com/manual/gh_run_rerun)
+- [gh run watch documentation](https://cli.github.com/manual/gh_run_watch)
+- [GitHub Actions re-running workflows](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs)
dots/.config/claude/skills/GitHub/workflows/ReviewPR.md
@@ -0,0 +1,431 @@
+# ReviewPR Workflow
+
+Review a GitHub pull request with comprehensive checks, diff analysis, and approval/feedback workflow.
+
+## When to Use
+
+- "review pr"
+- "review pull request"
+- "check pr changes"
+- "approve pr"
+- "request changes on pr"
+
+## Quick Commands
+
+### View PR
+
+```bash
+# View PR summary
+gh pr view <number>
+
+# View in browser
+gh pr view <number> --web
+
+# View specific fields
+gh pr view <number> --json title,body,state,author,reviews
+```
+
+### Review PR
+
+```bash
+# Approve
+gh pr review <number> --approve
+
+# Request changes
+gh pr review <number> --request-changes --body "Feedback here"
+
+# Comment only
+gh pr review <number> --comment --body "Looks good, minor suggestions"
+```
+
+### Checkout and Test
+
+```bash
+# Checkout PR branch locally
+gh pr checkout <number>
+
+# Run tests
+npm test  # or your test command
+
+# Return to previous branch
+git checkout -
+```
+
+## Workflow Steps
+
+### 1. Get PR Information
+
+```bash
+# Fetch comprehensive PR data
+gh pr view <number> --json \
+  number,title,body,state,author,headRefName,baseRefName,\
+  mergeable,statusCheckRollup,reviews,commits
+
+# Store for analysis
+```
+
+**Present summary:**
+```
+PR #123: Add user authentication
+Author: @username
+Branch: feature/auth → main
+Status: OPEN
+Mergeable: TRUE
+
+Commits: 5
+Files changed: 12
+Reviews: 1 approval, 0 changes requested
+```
+
+### 2. Check CI/CD Status
+
+```bash
+# Get check status
+gh pr checks <number>
+
+# Detailed status
+gh pr view <number> --json statusCheckRollup --jq '
+  .statusCheckRollup |
+  group_by(.conclusion) |
+  map({status: .[0].conclusion, count: length})
+'
+```
+
+**Present status:**
+```
+Checks: ✓ 8/8 passing
+- ✓ tests (3m 24s)
+- ✓ lint (1m 12s)
+- ✓ build (2m 45s)
+- ✓ security scan (2m 01s)
+```
+
+### 3. Review Changes
+
+```bash
+# View diff
+gh pr diff <number>
+
+# View diff stats
+gh pr diff <number> --name-status
+
+# Save diff for analysis
+gh pr diff <number> > /tmp/pr_${number}.diff
+```
+
+**Analyze changes:**
+- Identify file types (code, tests, docs, config)
+- Look for security concerns
+- Check test coverage
+- Review code quality
+
+### 4. Check for Common Issues
+
+**Security concerns:**
+```bash
+# Look for potential security issues in diff
+gh pr diff <number> | grep -E "(password|secret|api_key|token|private_key)"
+```
+
+**Test coverage:**
+```bash
+# Check if tests were added
+gh pr diff <number> --name-status | grep -c "_test\|spec\|test_"
+```
+
+**Large changes:**
+```bash
+# Count lines changed
+gh pr diff <number> --stat | tail -1
+```
+
+### 5. Request Feedback or Approve
+
+**If issues found:**
+```bash
+gh pr review <number> --request-changes --body "$(cat <<'EOF'
+Thanks for the PR! I have a few suggestions:
+
+1. **Security**: Line 45 has a hardcoded API key
+   - Move to environment variable or config
+
+2. **Testing**: Missing tests for the new auth middleware
+   - Add tests in `tests/auth.test.ts`
+
+3. **Documentation**: Update README with auth setup instructions
+
+Let me know if you have questions!
+EOF
+)"
+```
+
+**If approved:**
+```bash
+gh pr review <number> --approve --body "$(cat <<'EOF'
+LGTM!
+
+Changes look good:
+✓ Tests added and passing
+✓ Security best practices followed
+✓ Code is well-documented
+
+Approved to merge.
+EOF
+)"
+```
+
+### 6. Suggest Next Steps
+
+Based on review outcome:
+
+**If approved and checks passing:**
+```
+✓ PR approved
+✓ All checks passing
+✓ No merge conflicts
+
+Ready to merge:
+gh pr merge <number> --squash  # or --merge, --rebase
+```
+
+**If changes requested:**
+```
+Requested changes on PR #123
+
+Waiting for author to address feedback.
+Track updates: gh pr view <number>
+```
+
+**If checks failing:**
+```
+Cannot approve: checks are failing
+
+Fix issues first:
+gh pr checks <number>
+```
+
+## Advanced Usage
+
+### Review Checklist
+
+Create a review checklist template:
+
+```bash
+cat > review_checklist.md <<'EOF'
+## Code Review Checklist
+
+### Functionality
+- [ ] Changes match the PR description
+- [ ] No obvious bugs or logical errors
+- [ ] Edge cases are handled
+
+### Code Quality
+- [ ] Code follows project style guidelines
+- [ ] No code duplication
+- [ ] Functions are small and focused
+- [ ] Variable names are clear
+
+### Testing
+- [ ] Tests added for new functionality
+- [ ] Tests cover edge cases
+- [ ] All tests passing
+
+### Security
+- [ ] No hardcoded secrets or credentials
+- [ ] Input validation present
+- [ ] No obvious security vulnerabilities
+
+### Documentation
+- [ ] Code is commented where necessary
+- [ ] README updated if needed
+- [ ] API docs updated if applicable
+
+### Performance
+- [ ] No obvious performance issues
+- [ ] Database queries are optimized
+- [ ] No memory leaks
+EOF
+```
+
+### Inline Comments
+
+Add specific line comments:
+
+```bash
+# Comment on specific lines (requires GitHub API)
+gh api repos/:owner/:repo/pulls/<number>/reviews \
+  -f event=COMMENT \
+  -f body="Review comments" \
+  -F comments[][path]="file.ts" \
+  -F comments[][line]=42 \
+  -F comments[][body]="Consider extracting this to a function"
+```
+
+### Batch Review
+
+Review multiple PRs:
+
+```bash
+# Get all open PRs
+gh pr list --json number,title,author
+
+# Review each
+for pr in $(gh pr list --json number --jq '.[].number'); do
+  echo "Reviewing PR #$pr"
+  gh pr view "$pr"
+  # ... review process
+done
+```
+
+## Common Scenarios
+
+### Scenario 1: Quick Approval
+
+```bash
+# View PR
+gh pr view 123
+
+# Check status
+gh pr checks 123
+
+# If all good, approve
+gh pr checks 123 && \
+  gh pr review 123 --approve --body "LGTM! Approving." && \
+  gh pr merge 123 --squash
+```
+
+### Scenario 2: Detailed Review
+
+```bash
+# Checkout and test locally
+gh pr checkout 123
+npm test
+npm run lint
+
+# If passing, approve
+if [ $? -eq 0 ]; then
+  gh pr review 123 --approve --body "Tested locally. All passing."
+else
+  gh pr review 123 --request-changes --body "Tests failing locally. Please investigate."
+fi
+
+# Return to main
+git checkout main
+```
+
+### Scenario 3: Collaborative Review
+
+```bash
+# Check existing reviews
+gh pr view 123 --json reviews
+
+# Add your review
+gh pr review 123 --comment --body "Adding review comments. Will approve after @otherreviewer weighs in."
+
+# Later, after discussion
+gh pr review 123 --approve
+```
+
+## Custom Tool: Enhanced Review
+
+For complex review workflows:
+
+```bash
+# In tools/ directory
+./ReviewPR.ts --pr 123 --checklist --auto-test --report
+```
+
+**Tool capabilities:**
+- Automatic checklist generation
+- Clone and test PR in isolated environment
+- Generate review report with metrics
+- Compare against style guide automatically
+- Integration with code quality tools (SonarQube, etc.)
+
+## Review Templates
+
+### Approval Template
+
+```bash
+gh pr review <number> --approve --body "$(cat <<'EOF'
+✓ Code review complete
+
+**What I reviewed:**
+- Code changes and logic
+- Test coverage
+- Security considerations
+- Documentation
+
+**Summary:**
+All looks good! Changes are well-implemented and tested.
+
+Approved to merge.
+EOF
+)"
+```
+
+### Request Changes Template
+
+```bash
+gh pr review <number> --request-changes --body "$(cat <<'EOF'
+Thanks for the PR! I have some feedback:
+
+## Required Changes
+
+1. **Issue 1**
+   - Description
+   - Suggested fix
+
+2. **Issue 2**
+   - Description
+   - Suggested fix
+
+## Optional Suggestions
+
+- Suggestion 1
+- Suggestion 2
+
+Let me know if you have questions!
+EOF
+)"
+```
+
+### Comment Template
+
+```bash
+gh pr review <number> --comment --body "$(cat <<'EOF'
+A few suggestions (non-blocking):
+
+💡 **Performance**: Consider caching the result of `expensiveFunction()`
+💡 **Testing**: Might be worth adding a test for the error case
+💡 **Documentation**: Could add a code comment explaining why we use this approach
+
+Feel free to address in this PR or a follow-up.
+EOF
+)"
+```
+
+## Best Practices
+
+1. **Review promptly**: Don't let PRs sit unreviewed
+2. **Be constructive**: Frame feedback positively
+3. **Explain reasoning**: Don't just say "change this"
+4. **Test locally when needed**: For complex changes, test yourself
+5. **Check the context**: Read linked issues/discussions
+6. **Review tests first**: Ensure tests validate the changes
+7. **Look for security issues**: Always consider security implications
+8. **Don't nitpick**: Focus on important issues
+9. **Approve fast, merge slow**: Approve quickly but merge after all reviewers approve
+10. **Follow up**: Check if your feedback was addressed
+
+## Integration with Other Workflows
+
+- **CheckStatus**: Check CI before reviewing
+- **CreatePR**: Review immediately after creating your own PRs
+- **ManageIssues**: Link issues in review comments
+
+## Resources
+
+- [gh pr review documentation](https://cli.github.com/manual/gh_pr_review)
+- [GitHub PR review guide](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests)
+- [Code review best practices](https://google.github.io/eng-practices/review/)
dots/.config/claude/skills/GitHub/SKILL.md
@@ -0,0 +1,218 @@
+---
+name: GitHub
+description: GitHub repository and pull request management. USE WHEN working with GitHub PRs, checking CI/CD status, reviewing pull requests, managing issues, or using gh CLI commands.
+---
+
+# GitHub
+
+Expert guidance for GitHub workflows, pull request management, and repository operations using the gh CLI and custom tools.
+
+## Purpose
+
+This skill helps you efficiently manage GitHub repositories, pull requests, and CI/CD workflows using the gh command-line tool and custom automation.
+
+### Context Detection
+
+**This skill activates when:**
+- User asks about GitHub pull requests or PR status
+- User mentions gh CLI commands or GitHub workflows
+- User wants to check CI/CD status, GitHub Actions, or PR checks
+- User asks about reviewing PRs, managing issues, or GitHub operations
+- Current directory is a git repository with GitHub remote
+
+## Workflow Routing
+
+**When executing a workflow, output this notification directly:**
+
+```
+Running the **WorkflowName** workflow from the **GitHub** skill...
+```
+
+| Workflow | Trigger | File |
+|----------|---------|------|
+| **CheckStatus** | "check pr status", "pr checks", "ci status", "check failures" | `workflows/CheckStatus.md` |
+| **ReviewPR** | "review pr", "review pull request", "check pr changes" | `workflows/ReviewPR.md` |
+| **CreatePR** | "create pr", "open pull request", "new pr" | `workflows/CreatePR.md` |
+| **ManageIssues** | "create issue", "list issues", "close issue" | `workflows/ManageIssues.md` |
+| **RestartChecks** | "restart checks", "rerun failed", "retry ci" | `workflows/RestartChecks.md` |
+
+## Quick Reference
+
+### Essential gh Commands
+
+```bash
+# PR operations
+gh pr list                          # List PRs
+gh pr status                        # Show status of relevant PRs
+gh pr view [number]                 # View PR details
+gh pr checks [number]               # Show check status
+gh pr create                        # Create new PR
+gh pr review [number]               # Review a PR
+gh pr merge [number]                # Merge a PR
+
+# Issue operations
+gh issue list                       # List issues
+gh issue view [number]              # View issue details
+gh issue create                     # Create new issue
+gh issue close [number]             # Close an issue
+
+# Repository operations
+gh repo view                        # View repository
+gh repo clone <repo>                # Clone repository
+gh run list                         # List workflow runs
+gh run view [id]                    # View run details
+gh run rerun [id]                   # Rerun a workflow
+```
+
+### Check Status Quick View
+
+```bash
+# Check PR status with failures
+gh pr checks --watch
+
+# View specific PR checks
+gh pr checks 123
+
+# List failed workflow runs
+gh run list --workflow=CI --status=failure
+
+# View workflow run logs
+gh run view <run-id> --log
+```
+
+## Common Workflows
+
+### Check PR Status
+See all checks for a PR, identify failures, and get actionable information:
+```bash
+gh pr checks 123
+gh pr view 123 --json statusCheckRollup
+```
+
+### Review a PR
+Get PR details, view diff, and leave review comments:
+```bash
+gh pr view 123
+gh pr diff 123
+gh pr review 123 --approve
+gh pr review 123 --request-changes --body "Feedback here"
+```
+
+### Restart Failed Checks
+Rerun failed CI checks for a PR:
+```bash
+# Get failed run IDs
+gh run list --branch=pr-branch --status=failure
+
+# Rerun specific run
+gh run rerun <run-id>
+
+# Rerun failed jobs only
+gh run rerun <run-id> --failed
+```
+
+## Tools
+
+### Available: gh-restart-failed
+
+**Location**: `~/src/home/tools/gh-restart-failed/`
+
+Interactive tool to list and restart failed GitHub workflow checks on pull requests.
+
+**Features:**
+- Lists all PRs with failed checks
+- Interactive selection with fzf (multi-select supported)
+- Preview failed checks before restarting
+- Ignore specific workflows by pattern
+- Filter PRs by label
+- Color-coded output
+
+**Usage:**
+```bash
+# Use current repository
+gh-restart-failed
+
+# Use specific repository
+gh-restart-failed owner/repo
+
+# Ignore specific workflows
+gh-restart-failed -i "Label Checker" -i "build"
+
+# Filter by PR labels
+gh-restart-failed -l "bug" -l "enhancement"
+
+# Show help
+gh-restart-failed --help
+```
+
+**Dependencies**: gh, fzf, jq (automatically provided by Nix package)
+
+**How it works:**
+1. Fetches all open PRs with their check status
+2. Filters PRs with failed checks (FAILURE, TIMED_OUT, STARTUP_FAILURE, ACTION_REQUIRED)
+3. Shows interactive fzf picker with preview of failed checks
+4. Restarts only failed jobs for selected PRs
+5. Handles edge cases (old runs, already restarted, etc.)
+
+### Custom Tools (to be implemented)
+
+Custom tools in `tools/` directory for additional behaviors:
+
+- **CheckPRStatus.sh** - Enhanced PR check status with filtering and formatting
+- **PRSummary.py** - Generate comprehensive PR summaries
+
+(See `tools/README.md` for development guidelines)
+
+## Integration with Git Skill
+
+This skill works alongside the Git skill:
+- **Git skill**: Local repository operations (commits, branches, rebasing)
+- **GitHub skill**: Remote GitHub operations (PRs, issues, checks)
+
+When both apply, prefer:
+- Git skill for: commits, branches, local workflows
+- GitHub skill for: PRs, CI/CD, issues, reviews
+
+## Best Practices
+
+1. **Use gh CLI for standard operations**: It's faster and more reliable than web UI
+2. **Check PR status before merge**: Always verify checks pass
+3. **Review locally when possible**: Use `gh pr checkout` to test changes
+4. **Automate repetitive tasks**: Use custom tools for complex workflows
+5. **Monitor CI/CD actively**: Don't wait for email notifications
+
+## Examples
+
+**Example 1: Check PR status**
+```
+User: "Check the status of PR #123"
+→ Invokes CheckStatus workflow
+→ Shows all checks with pass/fail status
+→ Highlights any failures with logs
+→ Provides actionable next steps
+```
+
+**Example 2: Review and merge PR**
+```
+User: "Review PR #456 and merge if tests pass"
+→ Invokes ReviewPR workflow
+→ Shows PR details and diff
+→ Checks all CI status
+→ Approves and merges if all green
+```
+
+**Example 3: Restart failed checks**
+```
+User: "Restart the failed checks on my PR"
+→ Invokes RestartChecks workflow
+→ Identifies current PR branch
+→ Finds failed workflow runs
+→ Reruns only failed jobs
+```
+
+## Resources
+
+- [GitHub CLI Manual](https://cli.github.com/manual/)
+- [gh pr documentation](https://cli.github.com/manual/gh_pr)
+- [gh run documentation](https://cli.github.com/manual/gh_run)
+- [GitHub Actions documentation](https://docs.github.com/en/actions)