finalizing-pr
Finalizes branch changes for merging by simplifying code, running checks, reviewing changes, and creating a PR if needed. Use when ready to merge changes into the target branch.
About this skill
This skill streamlines the critical final steps of the development lifecycle, ensuring that a feature or bug fix branch is meticulously prepared for integration into the main codebase. Designed for developers contributing to the Streamlit open-source framework, it automates a comprehensive pre-merge checklist, including code simplification, execution of quality checks (such as linting, testing, or style guides), and a final review of changes. A key feature is its ability to autonomously create a new pull request if one does not already exist, pushing the branch from development state to merge-ready without requiring manual intervention. It explicitly aims to reduce human oversight by documenting any ambiguities directly within the PR conversation, ensuring a smooth and efficient transition to the review phase.
Best use case
This skill is ideal for developers who have completed their work on a feature or bug fix branch and want to automate the process of preparing it for code review and merging. It ensures consistency in pre-merge quality, reduces manual overhead, and accelerates the release cycle by autonomously handling the final polish and PR creation.
Finalizes branch changes for merging by simplifying code, running checks, reviewing changes, and creating a PR if needed. Use when ready to merge changes into the target branch.
Upon successful execution, the target branch will be cleaned, simplified, and verified against defined quality checks. A new pull request will be created (if one didn't exist) or an existing one will be updated, with any noted ambiguities or questions documented in the PR conversation. The branch will be in a state ready for code review and subsequent merging into the target branch.
Practical example
Example input
Please finalize the current branch for merging into 'develop'.
Example output
The branch 'feature/new-user-auth' has been successfully prepared for merging. Code simplifications were applied, and all quality checks passed. Pull request #X has been created and is awaiting review. Any ambiguities or minor suggestions have been noted in the PR conversation tab.
When to use this skill
- When your feature branch is functionally complete and you're ready to initiate the code review process.
- To ensure your code adheres to project-specific quality standards (e.g., linting, testing, formatting) before creating a pull request.
- When you want to automatically generate a pull request for a new branch without manual setup.
- To consistently apply code simplification best practices across the codebase.
When not to use this skill
- When the branch is still actively under development and not ready for a final review.
- If you need to manually resolve complex merge conflicts that require human judgment.
- When you prefer to create the pull request manually to add highly customized descriptions or reviewers before any automated steps.
- If the required quality checks or code simplifications are not yet defined or stable.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/finalizing-pr/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How finalizing-pr Compares
| Feature / Agent | finalizing-pr | Standard Approach |
|---|---|---|
| Platform Support | Claude | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | easy | N/A |
Frequently Asked Questions
What does this skill do?
Finalizes branch changes for merging by simplifying code, running checks, reviewing changes, and creating a PR if needed. Use when ready to merge changes into the target branch.
Which AI agents support this skill?
This skill is designed for Claude.
How difficult is it to install?
The installation complexity is rated as easy. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# Finalizing PR Prepares the current branch for merge by running quality checks, simplifying code, and creating a PR if one doesn't exist. **Be fully autonomous** — Do NOT stop or pause to ask for confirmation. Go from current state to merge-ready PR without human intervention. Note any open questions or ambiguities in a PR conversation comment (under the Conversation tab) rather than blocking on them. ## Workflow Follow these steps in order. **Run all subagents in foreground** (not background) unless otherwise specified—wait for each to complete before proceeding. > **Note:** For small changes (documentation tweaks, test-only tweaks, one-liners, or other mini-changes), you can skip steps 1, 2, 3, 6, 7, and 8. ### 1. Build and install Run `make all` in a subagent to ensure the build and installation are up-to-date. Wait for completion before proceeding. ```bash make all ``` ### 2. Update internal docs Run the `/updating-internal-docs` skill in a background subagent to auto-fix internal documentation issues. Instruct it to apply all recommended fixes to internal docs issues related to the local changes. ### 3. Simplify changes Run the `simplifying-local-changes` subagent to clean up and simplify the code changes. Wait for completion before proceeding. ### 4. Run autofix Run autofix in a subagent to fix formatting and linting issues. Wait for completion before proceeding. ```bash make autofix ``` ### 5. Run checks (first pass) Run the /checking-changes skill in a subagent (uses `make check`) to validate the changes. Wait for completion, then fix any issues found before proceeding. Don't run other checks besides `make check` in this step. ### 6. Review changes Run the `reviewing-local-changes` subagent to review the changes. Wait for completion and read the review output. ### 7. Address review feedback Review the recommendations from step 6. For each recommendation: - If valid and improves code quality: implement the change - If not applicable or would over-engineer: skip with brief reasoning ### 8. Run checks (second pass) Run the /checking-changes skill in a subagent with `E2E_CHECK=true make check` to also run changed e2e tests. Wait for completion, then fix any issues found before proceeding. Snapshot mismatches can be ignored (they require manual updates). ### 9. Create or update PR > **Note:** If currently on `develop`, create a new branch first following the naming conventions in `wiki/pull-requests.md`. Check if a PR exists for the current branch: ```bash gh pr view --json number,title,url ``` **If no PR exists**, create one following the guidelines in `wiki/pull-requests.md` (please read!). Add appropriate labels and fill in the body based on `.github/pull_request_template.md` (skip the video/screenshot section). **Link related issues:** Add `- Closes #12345` to the PR description for any known GitHub issues this PR resolves. **Required labels:** | Category | Options | |----------|---------| | Impact | `impact:users` (affects user behavior) OR `impact:internal` (no user behavior change) | | Change type | `change:feature`, `change:bugfix`, `change:chore`, `change:refactor`, `change:docs`, `change:spec`, `change:other` | Note: PRs labeled `change:spec` (for spec/design documents only) are exempt from Impact label requirements. ```bash # Push branch to origin first (required for gh pr create in non-interactive mode) git push -u origin HEAD # Create the PR gh pr create --base develop --title "[type] Description" --body "$(cat <<'EOF' ## Describe your changes - Change 1 - Change 2 ## GitHub Issue Link (if applicable) - Closes #12345 ## Testing Plan - [x] Unit Tests (JS and/or Python) EOF )" --label "impact:users,change:feature" ``` **If PR exists**, check if description needs updating based on current changes. ### 10. Trigger AI review Apply the `ai-review` label to trigger the AI code review: ```bash gh pr edit --add-label "ai-review" ``` ### 11. Upload intermediate files If relevant intermediate files exist (specs, plans, implementation notes in `work-tmp/` or untracked in `specs/`), run the `/sharing-pr-agent-artifacts` skill to push them to the wiki and comment on the PR with links. ### 12. Fix CI issues and address PR review comments Run the `fixing-pr` subagent to automatically wait for CI, fix any failures, address PR review comments, validate changes, and push. Wait for completion before proceeding. ### 13. Post agent metrics Post the agent metrics to the PR body: ```bash uv run python scripts/log_agent_metrics.py --post ``` ### 14. Trigger final AI review Apply the `ai-review` label to trigger the final AI code review: ```bash gh pr edit --add-label "ai-review" ```
Related Skills
fixing-streamlit-ci
Analyze and fix failed GitHub Actions CI jobs for the current branch/PR. Use when CI checks fail, PR checks show failures, or you need to diagnose lint/type/test errors and verify fixes locally.
fixing-flaky-e2e-tests
Diagnose and fix flaky Playwright e2e tests. Use when tests fail intermittently, show timeout errors, have snapshot mismatches, or exhibit browser-specific failures.
discovering-make-commands
Lists available make commands for Streamlit development. Use for build, test, lint, or format tasks.
debugging-streamlit
Debug Streamlit frontend and backend changes using make debug with hot-reload. Use when testing code changes, investigating bugs, checking UI behavior, or needing screenshots of the running app.
creating-pull-requests
Creates a draft pull request on GitHub with proper labels, branch naming, and description formatting. Use when changes are ready to be submitted as a PR to the streamlit/streamlit repository.
checking-changes
Validates all code changes before committing by running format, lint, type, and unit test checks. Use after making backend (Python) or frontend (TypeScript) changes, before committing or finishing a work session.
assessing-external-test-risk
Assesses whether branch or PR changes are high-risk for externally hosted or embedded Streamlit usage and recommends whether external e2e coverage with `@pytest.mark.external_test` is needed. Use during code review, PR triage, or test planning when changes touch routing, auth, websocket/session behavior, embedding, assets, cross-origin behavior, SiS/Snowflake runtime, storage, or security headers.
addressing-pr-review-comments
Address all valid review comments on a PR for the current branch in the streamlit/streamlit repo. Covers both inline review comments and general PR (issue) comments. Use when a PR has reviewer feedback to address, including code changes, style fixes, and documentation updates.
ui-demo
Record polished UI demo videos using Playwright. Use when the user asks to create a demo, walkthrough, screen recording, or tutorial video of a web application. Produces WebM videos with visible cursor, natural pacing, and professional feel.
microsoft-docs
Query official Microsoft documentation to find concepts, tutorials, and code examples across Azure, .NET, Agent Framework, Aspire, VS Code, GitHub, and more. Uses Microsoft Learn MCP as the default, with Context7 and Aspire MCP for content that lives outside learn.microsoft.com.
jupyter-notebook
Use when the user asks to create, scaffold, or edit Jupyter notebooks (`.ipynb`) for experiments, explorations, or tutorials; prefer the bundled templates and run the helper script `new_notebook.py` to generate a clean starting notebook.
n8n-expression-syntax
Validate n8n expression syntax and fix common errors. Use when writing n8n expressions, using {{}} syntax, accessing $json/$node variables, troubleshooting expression errors, or working with webhook data in workflows.