agentleFS
MorningStar0709MorningStar0709/trae-agent-enhancements/skills/finishing-a-development-branch/SKILL.md

finishing-a-development-branch

Skill18 starsChanged 7 months agoMITView on GitHub

Use when implementation is done, validation has passed, and you need to decide how to wrap up the current branch, including Chinese requests such as “接下来合并还是提 PR”“这条分支怎么收尾”“保留还是丢弃当前工作”. Do not use while implementation or verification is still in progress, or when the user only wants a normal commit.

  • Commits and pushes

123 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use diagnosing-superpowers, testing-anti-patterns and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • obraSkill

    diagnosing-superpowers

    Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

    Also in 6 projects that use this

  • MicrosoftSkill

    testing-anti-patterns

    Use when writing or changing tests, adding mocks, or tempted to add test-only methods to production code - prevents testing mock behavior, production pollution with test-only methods, and mocking without understanding dependencies

    Also in 5 projects that use this

  • shibit-netSkill

    chinese-code-review

    中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。

    Also in 3 projects that use this

  • shibit-netSkill

    chinese-commit-conventions

    中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。

    Also in 3 projects that use this

  • kntismSkill

    defense-in-depth

    Use when invalid data causes failures deep in execution, requiring validation at multiple system layers - validates at every layer data passes through to make bugs structurally impossible

    Also in 3 projects that use this

  • MicrosoftSkill

    root-cause-tracing

    Use when errors occur deep in execution and you need to trace back to find the original trigger - systematically traces bugs backward through call stack, adding instrumentation when needed, to identify source of invalid data or incorrect behavior

    Also in 5 projects that use this

  • +1 more from shibit-net
  • +1 more from microsoft

The file

Show its rules and text

We split this skill into the rules it gives an agent

26 rules. 0 are common, 21 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 114 edited versions we read keep these.

  • 21

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill for development wrap-up: confirm that results are genuinely usable first, provide structured options, and then execute …

    line 10
  2. Distinctive:

    Base branch unclear: Ask the user first.

    line 41
  3. Distinctive:

    Remote capabilities unclear: Check first or explain uncertainty.

    line 42
  4. Distinctive:

    If there is no fresh validation evidence, stop and run validation first.

    line 48
  5. Very specific:

    If such knowledge exists, invoke self-improvement to capture it before proceeding with wrap-up.

    line 63
  6. Distinctive:

    If the base branch is unclear, ask the user first.

    line 74
  7. Distinctive:

    Keep the current branch and workspace as-is.

    line 81
  8. Distinctive:

    After merging, re-run minimal necessary validations.

    line 95
  9. Very specific:

    Remote is GitHub (github.com): Use standard GitHub flow:

    line 104
  10. Very specific:

    If gh is unavailable when using GitHub:

    line 112
  11. Distinctive:

    Default to keeping the current worktree/branch.

    line 116
  12. Distinctive:

    Only execute the deletion after explicit user confirmation.

    line 127
  13. Distinctive:

    If the current work is in a git worktree:

    line 131
  14. Distinctive:

    Option 1: After a successful merge, optionally clean up the worktree.

    line 132
  15. Distinctive:

    Option 2: Keep the worktree by default.

    line 133
  16. Distinctive:

    Option 3: Keep the worktree.

    line 134
  17. Distinctive:

    Option 4: Delete the worktree after confirmation.

    line 135
  18. Very specific:

    Before providing any wrap-up options, confirm validation evidence using verification-before-completion standards.

    line 139
  19. Distinctive:

    Use PowerShell-compatible git / gh commands on a Windows host.

    line 140
  20. Distinctive:

    When deleting a branch, worktree, or discarding changes, explicit confirmation is mandatory.

    line 141
  21. Very specific:

    If the current environment lacks gh or remote permissions, do not pretend a PR was created successfully.

    line 142
  22. Distinctive:

    Git not installed or no repository: Run git --version first to confirm Git is available, then git rev-parse --is-inside-work-tree to …

    line 147
  23. Distinctive:

    Validation failed: Stop wrap-up, return to implementation or fixing.

    line 148
  24. Distinctive:

    When completing the wrap-up, state at least:

    line 155
  25. Distinctive:

    Use this fixed skeleton by default:

    line 162
  26. Distinctive:

    If wrap-up is not truly completed due to validation failure, remote failure, or lack of user confirmation, do not use "completed".

    line 184

“Common” is measured: kept by at least 6 in 10 of the 114 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Finishing a Development Branch

Overview

Use this skill for development wrap-up: confirm that results are genuinely usable first, provide structured options, and then execute merge, push, keep, or discard based on the user's choice.

Core Principle: Validate first, give options next, execute wrap-up last.

Use This Skill

  • Feature implementation is complete.
  • Key validations have passed.
  • You need to decide whether to merge locally, create a PR, keep as-is, or discard.
  • The current work may be in a worktree or an isolated branch.

Do Not Use

  • Code is not finished or validations haven't run.
  • The user only wants a normal commit, not branch-level wrap-up.
  • You are still debugging or implementing a feature.

Input Contract

Required Inputs:

  • Implementation is complete and validation results exist.
  • The current branch state is identifiable.

Optional but highly recommended inputs:

  • Base branch name.
  • Whether currently in a worktree.
  • Whether the user wants to push, create PR, keep, or discard.
  • Whether gh is available in the current environment.

Missing input handling:

  • Validation evidence is stale or missing: Return to validation first; do not enter wrap-up.
  • Base branch unclear: Ask the user first.
  • Remote capabilities unclear: Check first or explain uncertainty; do not pretend a PR can be created.

Execution Protocol

1. Confirm Validation State First

If there is no fresh validation evidence, stop and run validation first. Do not directly ask "what's next?".

Confirm at least:

  • Key tests have been re-run.
  • Build or lint (if relevant) has passed.
  • Current branch state is clear.

1.5. Knowledge Promotion Gate <!-- anchor: knowledge-promotion-gate -->

During wrap-up of medium or larger tasks, check if any persistent workarounds, rule discoveries, or recurring errors occurred during this branch. Examples:

  • A non-obvious environment workaround was discovered during implementation.
  • A project convention was clarified through user correction.
  • A recurring error pattern was encountered.

If such knowledge exists, invoke self-improvement to capture it before proceeding with wrap-up.

Also, if memories are near the 20-entry limit or containing outdated entries, run a quick memory maintenance pass using self-improvement's resources/memory-maintenance.md before adding new entries.

2. Identify Base Branch and Current Branch

PowerShell example:

$currentBranch = git branch --show-current
$baseBranch = "main"

If the base branch is unclear, ask the user first. Do not assume arbitrarily.

3. Provide Structured Options

Recommend providing only these 4 options:

  1. Merge locally back to the base branch.
  2. Push and create a Pull Request.
  3. Keep the current branch and workspace as-is.
  4. Discard current work.

In Trae, prioritize using the current environment's structured questioning tool to let the user choose, rather than asking an open-ended question.

4. Execute Based on Choice

Option 1: Merge Locally

Execute only after validation passes.

git checkout $baseBranch
git pull
git merge $currentBranch

After merging, re-run minimal necessary validations; if they pass, consider deleting the feature branch.

Option 2: Push and Create PR

First, detect the remote configuration:

git remote -v
  • No remote configured: Report that no remote is set up. Offer to configure one using chinese-git-workflow (for Gitee, GitLab, Coding) or standard git remote add origin <url> for GitHub. Do not proceed with push.
  • Remote is GitHub (github.com): Use standard GitHub flow:
    git push -u origin $currentBranch
    gh pr create --title "<title>" --body "<summary>"
  • Remote is Gitee, GitLab, Coding, CNB, or other: Push the branch, then guide the user to create a PR/MR through the platform's web UI. The gh CLI is GitHub-specific and will not work on other platforms. See chinese-git-workflow for platform-specific remote configuration.
  • Multiple push URLs configured (mirror sync): Push once — Git will push to all configured URLs automatically.

If gh is unavailable when using GitHub:

  • Explicitly state the PR was not created.
  • Provide the completed steps and the next manual actions required.

Default to keeping the current worktree/branch. Do not automatically clean up the local workspace right after creating a PR.

Option 3: Keep As-Is

Output the current branch name, path, and validation status, then stop.

Option 4: Discard Current Work

Requires secondary confirmation. The confirmation text must explicitly state what will be deleted:

  • Branch.
  • Worktree (if exists).
  • Unsaved local work.

Only execute the deletion after explicit user confirmation.

Relationship with Worktrees

If the current work is in a git worktree:

  • Option 1: After a successful merge, optionally clean up the worktree.
  • Option 2: Keep the worktree by default.
  • Option 3: Keep the worktree.
  • Option 4: Delete the worktree after confirmation.

Trae / Windows Conventions

  • Before providing any wrap-up options, confirm validation evidence using verification-before-completion standards.
  • Use PowerShell-compatible git / gh commands on a Windows host.
  • When deleting a branch, worktree, or discarding changes, explicit confirmation is mandatory.
  • If the current environment lacks gh or remote permissions, do not pretend a PR was created successfully.
  • For non-GitHub remotes (Gitee, GitLab, Coding, CNB), reference chinese-git-workflow for platform-specific PR/MR workflows.

Failure Handling

  • Git not installed or no repository: Run git --version first to confirm Git is available, then git rev-parse --is-inside-work-tree to confirm the current directory is a repository. If either fails, stop and offer to install Git, initialize one with git init, or proceed with file-level operations only.
  • Validation failed: Stop wrap-up, return to implementation or fixing.
  • Base branch unclear: Ask the user first.
  • Remote push failed: Report the actual error; do not say "PR created".
  • Deletion action is risky: Re-confirm the scope and consequences.

Output Contract

When completing the wrap-up, state at least:

  • Current branch and base branch.
  • Validations run.
  • Which wrap-up option the user chose.
  • Actual commands or actions executed.
  • Whether the branch/worktree was kept.

Use this fixed skeleton by default:

分支收尾已完成。

**Current Branch:** `<current-branch>`
**Base Branch:** `<base-branch>`
**Wrap-up Method:** `Merge Locally` | `Create PR` | `Keep As-Is` | `Discard Work`

**Validation Status:**
- [Tests / lint / build / manual checks]

**Actions Executed:**
- [Commands or operations performed]

**Branch / Worktree Status:**
- [Kept / Deleted / Unmodified]

**Risks or Next Steps:**
- [If none, write `- None`]

If wrap-up is not truly completed due to validation failure, remote failure, or lack of user confirmation, do not use "completed". Explicitly state the current stalled state and the next step.

Integration

  • using-git-worktrees: Adjacent — if the current work is in an isolated workspace.
  • verification-before-completion: Upstream — validate before stating "ready to merge / ready to commit".
  • git-commit: Upstream — if the branch has uncommitted work that needs final commits before wrap-up.
  • chinese-git-workflow: Adjacent — use when the remote is Gitee, GitLab, Coding, CNB, or requires platform-specific PR/MR configuration.
  • self-improvement: Internal — Knowledge Promotion Gate (section 1.5) invokes self-improvement during wrap-up.
  • memory-kernel: Downstream — after self-improvement completes, write promoted knowledge to MCP Memory.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.