cleanup
Post-merge workflow resolution. Verifies PR merge status, backfills synthesis metadata, force-resolves review statuses, transitions to completed, and cleans up worktrees/branches. Use when the user says 'cleanup', 'resolve workflow', 'mark as done', or runs /cleanup. Do NOT use before PRs are merged.
What this skill does
# Cleanup Skill
## VCS Provider
This skill uses VCS operations through Exarchos MCP actions (`list_prs`, `get_pr_comments`, etc.).
These actions automatically detect and route to the correct VCS provider (GitHub, GitLab, Azure DevOps).
No `gh`/`glab`/`az` commands needed — the MCP server handles provider dispatch.
## Overview
Resolve merged workflows to `completed` state in a single operation. Replaces the manual multi-step process of navigating HSM guards after PR stacks merge.
## Batch Pruning for Stale Workflows
For bulk cleanup of accumulated stale or abandoned workflows (as opposed to resolving a single merged workflow), use `@skills/prune-workflows/SKILL.md`. That skill invokes `exarchos_orchestrate prune_stale_workflows` in dry-run mode, displays candidates, and applies after user confirmation. Safeguards automatically skip workflows with open PRs or recent commits.
**Rule of thumb:** cleanup is per-workflow (one merged feature → `completed`); prune is bulk (N inactive workflows → `cancelled`). They are complementary, not alternatives.
## Triggers
Activate this skill when:
- User runs `/exarchos:cleanup` command
- User says "cleanup", "resolve workflow", "mark as done"
- PR stack has merged and workflow needs resolution
- User wants to close out a completed feature
## Prerequisites
- Active workflow in any non-terminal phase
- All PRs merged on GitHub
## Process
### 1. Identify Target Workflow
Read workflow state to get current phase and metadata:
```typescript
mcp__plugin_exarchos_exarchos__exarchos_workflow({ action: "get", featureId: "<id>" })
```
If featureId not provided, use pipeline view to list active workflows:
```typescript
mcp__plugin_exarchos_exarchos__exarchos_view({ action: "pipeline" })
```
### 2. Verify Merge Status
For each PR associated with the workflow, verify it is merged.
**Primary method** — VCS MCP action:
```typescript
exarchos_orchestrate({ action: "list_prs", state: "merged" })
```
For individual PR details, use `exarchos_orchestrate({ action: "get_pr_comments", prId: "<number>" })` or the VCS provider's native API.
Collect from merged PRs:
- `prUrl`: The PR URL (or array of URLs for stacked PRs)
- `mergedBranches`: The head branch names that were merged
**Safety check:** If ANY PR is not merged, abort with clear error message.
For detailed verification guidance, see `references/merge-verification.md`.
### 2.5. Post-Merge Regression Check (Advisory)
After verifying merge status, run the post-merge regression check:
```typescript
exarchos_orchestrate({
action: "check_post_merge",
featureId: "<id>",
prUrl: "<url>",
mergeSha: "<sha>"
})
```
This check is **advisory** — findings are reported but do not block cleanup. If findings are detected, log them for the user's awareness before proceeding.
### 3. Invoke Cleanup Action
Call the MCP cleanup action with collected data:
```typescript
mcp__plugin_exarchos_exarchos__exarchos_workflow({
action: "cleanup",
featureId: "<id>",
mergeVerified: true,
prUrl: "<url-or-array>",
mergedBranches: ["branch1", "branch2"]
})
```
This single call:
- Backfills `synthesis.prUrl` and `synthesis.mergedBranches`
- Force-resolves all blocking review statuses to `approved`
- Transitions to `completed` via universal cleanup path
- Emits `workflow.cleanup` event to event store
### 4. Worktree Cleanup
Remove all worktrees associated with the workflow:
```bash
# Read worktrees from state (already captured in step 1)
git worktree remove .worktrees/<name>
git worktree prune
```
Handle gracefully if worktrees are already removed.
### 5. Branch Sync
Remove merged local branches:
```bash
git fetch --prune
git branch -d <merged-branch-1> <merged-branch-2> ...
```
### 6. Report Completion
Output summary:
```markdown
## Cleanup Complete
**Feature:** <featureId>
**Transition:** <previousPhase> → completed
**PRs merged:** <count>
**Worktrees removed:** <count>
**Branches synced:** ✓
```
## Dry Run
Use `dryRun: true` to preview what cleanup would do without modifying state:
```typescript
mcp__plugin_exarchos_exarchos__exarchos_workflow({
action: "cleanup",
featureId: "<id>",
mergeVerified: true,
dryRun: true
})
```
## Error Handling
| Error | Cause | Resolution |
|-------|-------|------------|
| STATE_NOT_FOUND | Invalid featureId | Check pipeline view for active workflows |
| ALREADY_COMPLETED | Workflow already done | No action needed |
| INVALID_TRANSITION | Workflow is cancelled | Cannot cleanup cancelled workflows |
| GUARD_FAILED | mergeVerified is false | Verify PRs are merged before cleanup |
## Anti-Patterns
| Don't | Do Instead |
|-------|------------|
| Use cleanup as escape hatch during implementation | Only use after PRs are merged |
| Skip merge verification | Always verify via GitHub API |
| Manually navigate HSM guards post-merge | Use /exarchos:cleanup |
| Leave worktrees after cleanup | Include worktree removal in process |
## Exarchos Integration
The cleanup action auto-emits events — do NOT manually emit:
- `workflow.cleanup` — emitted by the MCP cleanup action for the phase change to completed
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.