recover-branch-context
Get up to speed on the current branch's intent by analyzing commits, changes, and optionally a Linear ticket. Use when starting work on an existing branch.
What this skill does
# Recover Branch Context You are tasked with understanding the intent and current state of an existing branch so you can resume or continue work effectively. The code state is your primary source of truth - it may have drifted from any associated Linear ticket. ## Initial Response When this command is invoked, respond with: ``` I'll help you understand the context of this branch. Let me analyze the commits and changes. Do you have a Linear ticket ID or URL for this work? (optional - I can proceed without it) ``` Then wait briefly for the user's response. If they provide a ticket, fetch it. If they say no or don't respond quickly, proceed with the analysis. ## Process Steps ### Step 1: Determine the Base Branch 1. **Check common base branch names**: ```bash git branch -a | grep -E "(main|master|dev|develop)" | head -5 ``` 2. **Find the merge base**: ```bash # Try dev first (common in this repo), then main/master git merge-base HEAD dev 2>/dev/null || git merge-base HEAD main 2>/dev/null || git merge-base HEAD master ``` 3. **Get current branch name**: ```bash git branch --show-current ``` ### Step 2: Gather Commit History Since Divergence 1. **Get all commits since diverging from base**: ```bash git log --oneline $(git merge-base HEAD dev)..HEAD ``` 2. **Get detailed commit messages** for understanding intent: ```bash git log --format="%h %s%n%b" $(git merge-base HEAD dev)..HEAD ``` 3. **Get files changed across all commits**: ```bash git diff --name-status $(git merge-base HEAD dev)..HEAD ``` ### Step 3: Gather Uncommitted Changes 1. **Get staged changes**: ```bash git diff --name-status --cached ``` 2. **Get unstaged changes**: ```bash git diff --name-status ``` 3. **Get untracked files**: ```bash git ls-files --others --exclude-standard ``` 4. **Full working tree status**: ```bash git status --short ``` ### Step 4: Fetch Linear Ticket (If Provided) If the user provides a Linear ticket: 1. Use the `mcp__linear__get_issue` tool to fetch the ticket details 2. Note: The ticket represents the **original requirements** but the code may have evolved ### Step 5: Analyze and Group Changes by Intent **CRITICAL**: Do not just list files. Group them by logical feature area or intent. 1. **Read key changed files** to understand what they do 2. **Identify patterns** in the changes: - New feature additions - Bug fixes - Refactoring - Configuration changes - Test additions 3. **Group files by their purpose**, not by directory ### Step 6: Output Summary Present findings in this structure: ```markdown # Branch Context: [branch-name] **Base branch**: [dev/main] **Commits since divergence**: [count] **Linear ticket**: [ID if provided, or "None provided"] ## Intent Summary [1-3 sentences describing the overall goal of this branch based on commits and changes] ## Feature Areas ### [Feature/Intent Area 1] **Purpose**: [What this group of changes accomplishes] **Status**: [Complete/In Progress/Not Started] **Committed changes**: - `path/to/file.ext:lines` - [brief description] - `path/to/another.ext` - [brief description] **Uncommitted changes**: - `path/to/wip.ext` - [brief description] ### [Feature/Intent Area 2] ... ## Uncommitted Work **Staged** (ready to commit): - [files] **Modified** (not staged): - [files] **Untracked** (new files): - [files] ## Code vs Ticket Drift [If a Linear ticket was provided, note any discrepancies between what the ticket describes and what the code actually implements. The code is the source of truth.] ## Suggested Next Steps [Based on the analysis, what appears to be remaining work or natural next actions] ``` ## Important Guidelines 1. **Code is the source of truth**: The branch's commits and changes represent what's actually being built, which may differ from the original ticket description. 2. **Group by intent, not structure**: Don't just list files by directory. Understand what each change accomplishes and group related changes together. 3. **Include file:line references**: When describing changes, point to specific locations in files so the user can quickly navigate. 4. **Identify work-in-progress**: Distinguish between completed (committed) work and in-progress (uncommitted) work. 5. **Note drift from ticket**: If a Linear ticket was provided, explicitly call out where the implementation has evolved beyond or differs from the ticket description. 6. **Be concise but complete**: The summary should give someone enough context to immediately start working, without overwhelming them with every detail. ## Example Output ```markdown # Branch Context: feat/comment-threads **Base branch**: main **Commits since divergence**: 3 **Linear ticket**: TASK-142 ## Intent Summary This branch adds threaded comments to tasks, allowing users to start discussion threads on individual tasks and reply to existing comments. The implementation includes a new database table, API routes for CRUD operations, and a collapsible thread UI in the task detail view. ## Feature Areas ### Comments Data Layer **Purpose**: Database schema and API routes for storing and retrieving comment threads **Status**: Complete **Committed changes**: - `src/db/schema/comments.ts` - New comments table with parent_id for threading - `src/db/migrations/0012_add_comments.sql` - Migration file - `src/api/routes/comments.ts` - CRUD endpoints for comments ### Thread UI Components **Purpose**: Components for displaying and composing threaded comments on tasks **Status**: In Progress **Committed changes**: - `src/components/tasks/CommentThread.tsx` - Recursive thread display component **Uncommitted changes**: - `src/components/tasks/CommentComposer.tsx` - Reply/new comment input box - `src/hooks/useCommentThread.ts` - Data fetching hook for thread state ## Code vs Ticket Drift The ticket scoped comments as flat (non-threaded), but the implementation adds full threading support with nested replies via a parent_id column. ## Suggested Next Steps 1. Complete the CommentComposer component and wire it into CommentThread 2. Add optimistic updates to useCommentThread for snappy UX 3. Add tests for the comment API routes ```
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.