create-pr

作者: warpdotdev

在 warp 儲存庫中為當前分支建立拉取請求。當使用者提及開啟 PR、建立拉取請求、提交變更以供審查或準備合併程式碼時使用。

npx skills add https://github.com/warpdotdev/common-skills --skill create-pr

create-pr

Overview

This guide covers best practices for creating pull requests in the warp repository, including merging master, running presubmit checks, linking Linear tasks, ensuring appropriate test coverage, and structuring your PR for effective review.

Related Skills

  • fix-errors - Fix presubmit failures (formatting, linting, tests) before opening PR
  • warp-integration-test - Add or update integration coverage for user-visible flows, regressions, and P0 use cases
  • add-feature-flag - Gate changes behind feature flags

Pre-PR Checklist

1. Merge master into your feature branch

Always merge master into your feature branch before starting the review process.

git fetch origin
git merge origin/master

Resolve any merge conflicts locally before opening the PR.

2. Run presubmit checks for code changes

If the PR includes code changes, run the relevant presubmit checks before opening or updating it:

./script/presubmit

./script/presubmit runs:

  • cargo fmt - Code formatting
  • cargo clippy - Linting with all warnings as errors
  • All tests (unit, doc, and integration) If the PR is documentation-only (for example, skills, markdown, or other non-code content), you do not need to run cargo fmt or cargo clippy just to open or update the PR.

If presubmit fails for a code-changing PR, use the fix-errors skill to resolve issues.

You must run cargo fmt and cargo clippy before:

  • Opening a new PR that includes code changes
  • Pushing new commits that include code changes to an existing PR branch
  • Any reviewed branch update that changes code

3. Review your changes

Before creating a PR, review what changes you're about to submit:

# View commits in your branch (comparing against base branch)
git --no-pager log <base-branch>..HEAD --oneline

# View file statistics for changes
git --no-pager diff <base-branch>...HEAD --stat

# View full diff
git --no-pager diff <base-branch>...HEAD

This helps you:

  • Verify all intended changes are included
  • Catch unintended changes before review
  • Write an accurate PR description
  • Ensure you're comparing against the correct base branch
  • Tests: Include tests when required—bug fixes (regression test), algorithmic code (unit tests), UI components (layout test), P0 use cases (integration test). See Testing Requirements below.

4. Link to Linear task

When possible, PRs should be associated with a Linear task. Use the Linear MCP tool (if available) to find corresponding issues.

Branch naming convention: Remote branches should be prefixed with your name (e.g., zheng/feature, alice/fix-bug).

How to link PRs to Linear: Include the issue ID in the PR title (e.g., [WARP-1234] Add new feature). Do this before creating the PR for automatic linking.

5. Open the PR

Use the PR template at .github/pull_request_template.md when opening PRs.

Add changelog entries when appropriate using the format at the bottom of the PR template. Some examples:

  • Feature: "Global search in files across your current directories. Use CMD-F/CTRL-SHIFT-F to open."
  • Improvement: "Added horizontal autoscrolling when jumping to line/column."
  • Bug fix: "Fixed session viewer input being cleared when agent runs commands.

CLI workflow:

  • Check if PR exists for current branch:

    gh pr view --json number,url
    

    Exit code 0 if PR exists, 1 if not.

  • Create a new PR:

    # With title and body
    gh pr create --title "Title" --body "Description" --draft
    
    # Auto-fill from commits
    gh pr create --fill --draft
    
    # Use PR template file
    gh pr create --body-file .github/pull_request_template.md --title "Title" --draft
    

    Key flags: --draft / -d, --fill / -f, --body-file / -F, --web / -w

  • Update an existing PR:

    gh pr edit --title "New title" --body "New body"
    gh pr edit --add-reviewer username --add-label bug
    
  • Mark PR ready for review:

    gh pr ready
    

6. Include co-author attribution

When committing changes, include attribution as a trailer at the end of the commit message only — never in the PR description — and never add a second Warp/Oz co-author trailer if the commit already has one:

Co-Authored-By: Warp Agent <agent@warp.dev>

Testing Requirements

Bug fixes require regression tests

All bug fixes should be accompanied by a regression test. This helps prevent re-breaking something that was already broken once.

The test should:

  • Reproduce the original bug (would fail before the fix)
  • Pass after the fix is applied
  • Be clearly named to indicate what bug it's preventing

Algorithmic code requires unit tests

Code with non-trivial logic should have unit tests to validate functionality:

Examples of what needs unit tests:

  • Custom data structures (e.g., SumTree)
  • Search-related APIs that should return expected results for a given query
  • Core layout code in the UI framework
  • Any algorithmic or computational logic

Not required for:

  • Sufficiently-simple functions
  • Trivial getters/setters

Follow the repository's local testing conventions for guidance on writing unit tests.

UI components need layout validation tests

All UI components (implementations of View) should have a simple unit test to validate that they can be laid out without a panic.

This provides high-level coverage over rendering "safety" (though not "correctness"):

#[test]
fn test_component_can_layout() {
    use warpui::App;
    use warp::test_util::{terminal::initialize_app_for_terminal_view, add_window_with_terminal};
    
    App::test((), |mut app| async move {
        initialize_app_for_terminal_view(&mut app);
        let term = add_window_with_terminal(&mut app, None);
        
        // Render the component - should not panic
        term.update(&mut app, |view, ctx| {
            // Create and layout your component
        });
    })
}

Ask before skipping integration coverage

If the PR changes a user-visible flow, fixes an end-to-end regression, or otherwise looks like it would benefit from integration coverage, use the ask_user_question tool before creating or updating the PR to ask whether the user wants an integration test added as part of the work.

Prefer a direct choice such as:

  • Yes, add an integration test before creating the PR
  • No, continue without an integration test

If the user chooses to add one, use the warp-integration-test skill.

P0 use cases require integration tests

All "P0 use cases" require an integration test that covers the behavior/flow in question.

A "P0 use case" is defined as: Any behavior of the application that, if broken, warrants an out-of-band release.

Integration tests should:

  • Exercise the full user-facing flow
  • Validate end-to-end functionality
  • Be placed in the integration/ directory

Use the warp-integration-test skill for implementation details, test registration steps, and validation workflow.

PR Description Guidelines

Your PR summary under the "Description" section should include:

  1. What - What changes are being made
  2. Why - Why these changes are necessary (link to Linear task if applicable)
  3. How - Brief explanation of the approach taken

After Opening the PR

  1. Monitor CI checks - Ensure all automated checks pass
  2. Respond to review comments - Address feedback promptly
  3. Keep the PR up to date - Merge master if conflicts arise
  4. Re-run relevant validation - After making changes based on review feedback. For code changes, re-run cargo fmt/cargo clippy (and other relevant checks); for documentation-only changes, this is not required.

Best Practices

  • Keep PRs focused - One logical change per PR when possible
  • Write clear commit messages - Explain what and why, not just what
  • Self-review first - Review your own diff before requesting review
  • Update tests - Ensure test coverage reflects your changes
  • Document breaking changes - Call out any API changes or breaking modifications
  • Use feature flags - Gate risky changes behind feature flags when appropriate (see the add-feature-flag skill)

來自 warpdotdev 的更多技能

council
warpdotdev
運行一個模型多樣化的子代理委員會,從多個角度調查同一問題,比較發現,並產出最終建議。每當用戶要求委員會、第二意見、多個代理/模型評估一個問題、平行調查、紅隊/藍隊比較,或協助在競爭的技術方法之間做決定時,使用此技能。
researchcommunicationproject-management
spec-driven-implementation
warpdotdev
在實作前先撰寫 PRODUCT.md,必要時撰寫 TECH.md,並隨著實作演進持續更新這兩份規格,以推動規格優先的工作流程,適用於開始開發重大功能、規劃由代理驅動的實作,或使用者希望將產品與技術規格納入版本控制時。
developmentdocumentproject-management
review-pr
warpdotdev
審查拉取請求的差異,並將結構化反饋寫入 review.json,以供工作流程發布。適用於從本地工件(如 pr_diff.txt 和 pr_description.txt)審查已檢出的拉取請求,並產生機器可讀的審查輸出,而非直接發布到 GitHub。
code-reviewdevelopment
implement-specs
warpdotdev
根據已核准的 PRODUCT.md 與 TECH.md 實作功能,在開發過程中保持規格與程式碼同步於同一個 PR 中。請於產品與技術規格核准後、下一步為建置功能時使用。
developmentcode-reviewapi
cross-critique
warpdotdev
針對有爭議的問題進行第二輪討論,將每個子代理的獨立提案傳遞給其他作者,並要求提供結構化的優缺點分析,然後進行綜合。當你面對多個獨立提案或意見(例如架構權衡、程式碼審查分歧、設計選擇、相互競爭的根本原因理論)時,使用此技能可獲得比單純綜合更精確的分析。此技能與 council 和 research 技能自然搭配;……
resolve-merge-conflicts
warpdotdev
Resolve Git merge conflicts by extracting only unresolved paths, conflict hunks, and compact diffs instead of loading whole files into context. Use when a merge, rebase, cherry-pick, or stash pop stops on conflicts, when `git status` shows unmerged paths, or when files contain conflict markers.
developmentcode-review
brandalf
warpdotdev
引導Warp或Oz品牌資產的創作、修訂與審查。適用於製作啟動頁面、文件、HTML/CSS元件、UI模型、提示詞、社群素材、文案、簡報,或任何其他應呈現明確Warp或Oz風格與語調的品牌交付物。
designcreativemarketing
saga
warpdotdev
執行自主的、規格驅動的開發「saga」,適用於中大型功能,使用協調器代理與一群工作者子代理。當使用者呼叫 /saga、要求以最少人工干預自主端到端建置一個大型功能、希望在平行化實作前將全面規格拆解為里程碑與任務並附上嚴謹驗證標準,或希望協調器在保留其...的同時將實作委派給工作者代理時,請使用此技能。
developmentproject-managementtesting