Suhail
@suhail
---
name: cleanbranch
description: Create a new branch with only the essential feature changes. Use for /cleanbranch, $cleanbranch, or requests to extract a minimal feature branch.
---
# Clean branch
Create the smallest complete PR for the intended feature, with clear code and minimal comments.
- Infer the feature from the conversation and review existing changes, including committed,
uncommitted, and untracked work.
- Create a fresh branch from the user's chosen base, the current PR's base, or the repository's
default branch. Use a descriptive branch name unless one is provided. Prefer a separate worktree
to preserve the original branch and working files.
- Carry over only what the feature needs to work end to end, including necessary integration
and tests. Leave out unrelated refactors, formatting changes, experiments, and speculative work.
- Favor clear names, simple control flow, and existing patterns. Avoid unnecessary abstractions.
Comment only on non-obvious intent or constraints; remove comments that repeat the code.
- Re-verify that the feature works end to end, maintains comparable performance and quality,
and satisfies the original requirements and intended scope.
- Review the full diff against the base and run relevant tests and repository-required checks.
Fix failures introduced by the extraction and report any validation limitations.
- Report the branch, base, worktree path, what was kept or omitted, and validation results.
Commit, push, or open a PR only when requested or already authorized.