Gathering Branch Context
Quickly gather all context for a branch to start working from a known point. Combines Linear issue details, GitHub PR information, and Buildkite build status.
Load skills: linear, reading-pull-requests, buildkite-pipelines
Workflow
1. Determine the Branch
Use the current branch or ask the user:
git branch --show-current
2. Fetch Linear Issue Details
Parse the branch name for a Linear issue ID (e.g., ABC-123 or abc-123):
# Common patterns: feature/ABC-123-description, abc-123/description, ABC-123-description
# Use -i for case-insensitive matching, then uppercase for linear CLI
git branch --show-current | grep -oiE '[a-z]+-[0-9]+' | head -1 | tr '[:lower:]' '[:upper:]'
If an issue ID was found, load the linear skill and use it to view the issue.
3. Find and Read Pull Request
Load the reading-pull-requests skill and use it to find and read any PR for the branch.
The reading-pull-requests skill covers finding PRs by branch name, reading PR details (including body, reviews, and review decision), and viewing PR checks.
4. Get Build Status
Load the buildkite-pipelines skill and use it to get the latest build for the branch.
If the build has failures, use the buildkite-pipelines skill's "Debug a failed build" workflow to list failed jobs and optionally fetch their logs.
Output Summary
Present a consolidated summary:
- Linear Issue: Title, status, description, acceptance criteria
- Pull Request: Title, description/body, status, review decision, open comments
- Build Status: State (passed/failed/running), failed job count, link
Example
For branch feature/ENG-456-add-user-auth:
## Branch Context: feature/ENG-456-add-user-auth
### Linear Issue: ENG-456
- **Title**: Add user authentication
- **Status**: In Progress
- **Description**: Implement JWT-based auth...
### Pull Request: #1234
- **Title**: Add user authentication
- **Status**: Open
- **Reviews**: Approved (2/2)
- **Comments**: 3 unresolved
- **Description**: Implements JWT-based authentication...
### Build: #5678
- **Status**: Failed
- **Failed Jobs**: 2 (rspec, eslint)
- **URL**: https://buildkite.com/...
