Skip to content
Back to skills

Clean Branch

ASecurity

Clean up merged branches, close issues, and extract compound learning insights

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
toolsbashgitdocumentation

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill clean-branch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Clean Branch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Clean Branch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-clean-branch/badge)](https://www.skillsdirectory.com/skills/david-li0406-clean-branch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: clean-branch
description: Clean up merged branches, close issues, and extract compound learning insights
model: claude-sonnet-4-5
context: fork
agent: general-purpose
allowed-tools:
  - Bash(*)
  - Read
  - Edit
  - Write
  - Task
extended-thinking: true
---

# Branch Cleanup & PR Retrospective

You've just merged a PR to dev. Now complete the post-merge cleanup workflow.

## Workflow

### Phase 1: Identify Current State

First, determine what branch you're on and find the associated merged PR and issue:

```bash
# Get current branch name
git branch --show-current

# Find merged PR for this branch
gh pr list --state merged --head $(git branch --show-current) --limit 1

# Get full PR details to find issue number
gh pr view <PR_NUMBER> --json number,title,body
```

### Phase 2: Branch Cleanup

Perform standard cleanup operations:

```bash
# Switch to dev and pull latest
git checkout dev
git pull origin dev

# Delete local feature branch
git branch -d <BRANCH_NAME>

# Delete remote feature branch
git push origin --delete <BRANCH_NAME>
```

### Phase 3: Close Associated Issue

Close the GitHub issue with a summary of what was completed:

```bash
# View issue to understand what was done
gh issue view <ISSUE_NUMBER>

# Close issue with comment summarizing the work
gh issue close <ISSUE_NUMBER> --comment "Completed in PR #<PR_NUMBER>.

<Brief 1-2 sentence summary of what was implemented/fixed>

Changes merged to dev."
```

## Important Notes

- **PR Analysis**: Compound engineering analysis happens automatically via the Stop hook
- **No manual telemetry**: The telemetry system will detect this command and analyze the PR for learning opportunities
- **Summary format**: Keep issue close comments concise but informative

## What Happens Automatically

After you complete the cleanup, the telemetry system will:

1. Analyze the merged PR for patterns (review iterations, fix commits, common themes)
2. Identify compound engineering opportunities (automation, systematization, delegation)
3. Save insights to `meta/telemetry.json` in the `compound_learnings[]` array
4. Log suggestions for preventing similar issues in future PRs

This analysis looks for:
- **Delegation opportunities**: When specialized agents could have helped
- **Automation candidates**: Recurring manual processes
- **Systematization targets**: Knowledge for documentation
- **Prevention patterns**: Issues needing earlier intervention

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…