Pull Request Management & Creation Skill
This skill guides AI agents and contributors on how to create, format, and manage Pull Requests (PRs) in the GitHub Backup Automation System repository.
1. Core Pull Request Rules
[!IMPORTANT]
LOCAL BRANCH-FIRST MANDATE:
- All work MUST be done on a dedicated local branch (
<github-username>/<parent-branch>/<feature>). Never develop directly on main.
[!IMPORTANT]
STRICT SINGLE OPEN PR RULE (CONSOLIDATION MANDATE):
- To prevent branch fragmentation, merge conflicts, and stale rebase overhead, there must be at most ONE active open Pull Request at any time.
- Check First: Before creating a branch or opening a PR, agents MUST run
gh pr list --state open.
- Consolidate if an open PR exists: If an open PR already exists targeting
main, DO NOT create a new PR or branch. Switch to the active PR's branch (git checkout <branch>), pull latest, apply all new changes and commits to that branch, push, and optionally update the existing PR's title/labels/body (gh pr edit <N>).
- New PR Only When Fleet Is Clean: Only create a new branch and open a new PR when
gh pr list --state open returns zero open PRs.
[!IMPORTANT]
EXPLICIT USER REQUEST REQUIRED:
- AI agents MUST NEVER create Pull Requests automatically or as a default background action.
- Agents are only authorized to push branches and open Pull Requests when specifically and explicitly instructed by the user (e.g. "create a PR to main").
[!CAUTION]
TARGET BRANCH IS ALWAYS main ONLY:
- All Pull Requests in this repository MUST target
main.
- Never open Pull Requests against
dev, feature branches, or temporary staging branches. main is the sole integration branch.
2. Pre-PR Validation Checklist
Before opening any Pull Request, the agent/developer MUST ensure:
- Local Commits Clean: All intended changes are committed with Conventional Commit messages (
git status is clean).
- Pre-Commit Gate Passed: The full pre-commit pipeline has executed and passed without errors:
make pre-commit
- Branch Pushed to Remote: The local branch is pushed to origin:
git push -u origin <branch-name>
3. Pull Request Creation Runbook
Using GitHub CLI (gh)
When requested by the user to create a PR:
- Extract authentication token if needed:
export GH_TOKEN=$(grep GITHUB_TOKEN_PERSONAL .env | cut -d'"' -f2)
- Push the local branch to the remote repository:
git push -u origin <branch-name>
- Create the PR targeting
main with auto-assignment and conventional labels:gh pr create \
--base main \
--head <branch-name> \
--title "<type>(<scope>): <concise title>" \
--assignee "@me" \
--label "type/<type>,area/<subsystem>,status/ready-for-review" \
--body "$(cat << 'EOF'
## 🎯 Pull Request Overview
* <Concise executive summary of changes>
### 🏗️ Subsystem Impact & Boundaries
| Subsystem | Impacted? | Description of Changes |
| :--- | :---: | :--- |
| **Go Backend (Fiber API & WebSockets)** | [x] | <details> |
| **Python Observatory (FastAPI & Agent)** | [ ] | N/A |
| **Next.js Frontend (Turbopack)** | [ ] | N/A |
| **Backup Worker CLI (SQLite)** | [ ] | N/A |
### 🧪 Testing & Verification
* [x] `make pre-commit` executed and passed all validations
* [x] Unit, integration, and AI agent test suites passed (`make test`)
* [x] Static type checking passed (Pyright & TypeScript)
* [x] Production builds succeeded (Go binaries & Next.js Turbopack)
### 🛡️ Security & Documentation
* [x] Verified zero credentials/secrets committed
* [x] Relevant agent skills (`.agents/skills/`) and docs updated
* [x] Release notes added to `CHANGELOG.md`
EOF
)"
4. Post-Creation Confirmation
Once the PR is opened:
- Output the generated PR URL (e.g.
https://github.com/MishraShardendu22/github-backup-automation-system/pull/123).
- Summarize the base branch (
main), head branch, assignees, labels, and included commit range.
- See
.agents/skills/github-pr-issue-automation/SKILL.md for full visual formatting guidelines.
1---2name: pull-request-management3description: Rules and runbooks for creating and managing GitHub Pull Requests when explicitly requested by the user. Enforces that all PRs must target 'main' only and are never created automatically.4---56# Pull Request Management & Creation Skill78This skill guides AI agents and contributors on how to create, format, and manage Pull Requests (PRs) in the **GitHub Backup Automation System** repository.910---1112## 1. Core Pull Request Rules1314> [!IMPORTANT]15> **LOCAL BRANCH-FIRST MANDATE**:16> * All work MUST be done on a dedicated local branch (`<github-username>/<parent-branch>/<feature>`). Never develop directly on `main`.1718> [!IMPORTANT]19> **STRICT SINGLE OPEN PR RULE (CONSOLIDATION MANDATE)**:20> * To prevent branch fragmentation, merge conflicts, and stale rebase overhead, there must be at most **ONE active open Pull Request** at any time.21> * **Check First**: Before creating a branch or opening a PR, agents MUST run `gh pr list --state open`.22> * **Consolidate if an open PR exists**: If an open PR already exists targeting `main`, DO NOT create a new PR or branch. Switch to the active PR's branch (`git checkout <branch>`), pull latest, apply all new changes and commits to that branch, push, and optionally update the existing PR's title/labels/body (`gh pr edit <N>`).23> * **New PR Only When Fleet Is Clean**: Only create a new branch and open a new PR when `gh pr list --state open` returns zero open PRs.2425> [!IMPORTANT]26> **EXPLICIT USER REQUEST REQUIRED**:27> * AI agents MUST **NEVER** create Pull Requests automatically or as a default background action.28> * Agents are only authorized to push branches and open Pull Requests when **specifically and explicitly instructed by the user** (e.g. *"create a PR to main"*).2930> [!CAUTION]31> **TARGET BRANCH IS ALWAYS `main` ONLY**:32> * All Pull Requests in this repository MUST target **`main`**.33> * Never open Pull Requests against `dev`, feature branches, or temporary staging branches. `main` is the sole integration branch.3435---3637## 2. Pre-PR Validation Checklist3839Before opening any Pull Request, the agent/developer MUST ensure:40411. **Local Commits Clean**: All intended changes are committed with Conventional Commit messages (`git status` is clean).422. **Pre-Commit Gate Passed**: The full pre-commit pipeline has executed and passed without errors:43 ```bash44 make pre-commit45 ```463. **Branch Pushed to Remote**: The local branch is pushed to origin:47 ```bash48 git push -u origin <branch-name>49 ```5051---5253## 3. Pull Request Creation Runbook5455### Using GitHub CLI (`gh`)5657When requested by the user to create a PR:58591. Extract authentication token if needed:60 ```bash61 export GH_TOKEN=$(grep GITHUB_TOKEN_PERSONAL .env | cut -d'"' -f2)62 ```632. Push the local branch to the remote repository:64 ```bash65 git push -u origin <branch-name>66 ```673. Create the PR targeting `main` with auto-assignment and conventional labels:68 ```bash69 gh pr create \70 --base main \71 --head <branch-name> \72 --title "<type>(<scope>): <concise title>" \73 --assignee "@me" \74 --label "type/<type>,area/<subsystem>,status/ready-for-review" \75 --body "$(cat << 'EOF'76 ## 🎯 Pull Request Overview77 * <Concise executive summary of changes>7879 ### 🏗️ Subsystem Impact & Boundaries80 | Subsystem | Impacted? | Description of Changes |81 | :--- | :---: | :--- |82 | **Go Backend (Fiber API & WebSockets)** | [x] | <details> |83 | **Python Observatory (FastAPI & Agent)** | [ ] | N/A |84 | **Next.js Frontend (Turbopack)** | [ ] | N/A |85 | **Backup Worker CLI (SQLite)** | [ ] | N/A |8687 ### 🧪 Testing & Verification88 * [x] `make pre-commit` executed and passed all validations89 * [x] Unit, integration, and AI agent test suites passed (`make test`)90 * [x] Static type checking passed (Pyright & TypeScript)91 * [x] Production builds succeeded (Go binaries & Next.js Turbopack)9293 ### 🛡️ Security & Documentation94 * [x] Verified zero credentials/secrets committed95 * [x] Relevant agent skills (`.agents/skills/`) and docs updated96 * [x] Release notes added to `CHANGELOG.md`97 EOF98 )"99 ```100101---102103## 4. Post-Creation Confirmation104105Once the PR is opened:106* Output the generated PR URL (e.g. `https://github.com/MishraShardendu22/github-backup-automation-system/pull/123`).107* Summarize the base branch (`main`), head branch, assignees, labels, and included commit range.108* See [`.agents/skills/github-pr-issue-automation/SKILL.md`](.agents/skills/github-pr-issue-automation/SKILL.md) for full visual formatting guidelines.109