본문으로 건너뛰기
cccskills
무료GitHub에 공개

pr

Prepare outstanding commits on a feature branch for a pull request to upstream

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md3.6 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Prepare a pull request from the current feature branch. This skill collects all commits on the current branch that are ahead of upstream/main, generates a PR title and description summarizing the changes, and creates the PR against upstream.

Arguments

The skill accepts optional arguments:

  • No arguments: auto-generate title and description from commits
  • A short description: used as the PR title (e.g., /pr Add support for TLS client certs)

Example: /pr or /pr Fix saturation search convergence

Steps

  1. Verify prerequisites:

    • Must NOT be on main branch (should be on a feature branch)
    • The upstream remote must exist
    • The origin remote must exist
    BRANCH=$(git branch --show-current)
    if [ "$BRANCH" = "main" ]; then
      echo "Error: Must be on a feature branch, not main"
      exit 1
    fi
    git remote get-url upstream >/dev/null 2>&1 || { echo "Error: 'upstream' remote not found"; exit 1; }
    git remote get-url origin >/dev/null 2>&1 || { echo "Error: 'origin' remote not found"; exit 1; }
    
  2. Run cargo fmt and amend the last commit if formatting changes are needed:

    cargo fmt
    if [ -n "$(git status --porcelain)" ]; then
      git add -u
      git commit --amend --no-edit
    fi
    

    After this step, the working directory must be clean. If there are still uncommitted changes (non-formatting), stop and tell the user to commit or stash them first.

  3. Sync with upstream:

    git fetch upstream
    git fetch origin
    
  4. Identify commits for the PR:

    • Find the merge base between the current branch and upstream/main
    • List all commits from the merge base to HEAD
    • Show the full diff against upstream/main
    MERGE_BASE=$(git merge-base upstream/main HEAD)
    git log --oneline ${MERGE_BASE}..HEAD
    git diff ${MERGE_BASE}..HEAD --stat
    

    If there are no commits ahead of upstream/main, stop and tell the user there is nothing to submit.

  5. Generate PR title and description:

    • If the user provided a title argument, use that as the PR title
    • Otherwise, analyze the commits and diff to generate a concise PR title (under 70 characters)
    • Generate the PR body with:
      • A ## Summary section with 1-3 bullet points describing the changes
      • A ## Changes section listing the commits
      • A ## Test plan section with a checklist of testing suggestions

    Present the title and body to the user for review before creating the PR.

  6. Push the feature branch to origin:

    BRANCH=$(git branch --show-current)
    git push -u origin ${BRANCH}
    
  7. Create the PR against upstream:

    BRANCH=$(git branch --show-current)
    
    gh pr create \
      --repo "$(git remote get-url upstream | sed 's/.*github.com[:/]\(.*\)\.git/\1/' | sed 's/.*github.com[:/]\(.*\)/\1/')" \
      --head "$(git remote get-url origin | sed 's/.*github.com[:/]\(.*\)\.git/\1/' | sed 's/.*github.com[:/]\(.*\)/\1/' | cut -d/ -f1):${BRANCH}" \
      --base main \
      --title "${PR_TITLE}" \
      --body "${PR_BODY}"
    
  8. Report the PR URL to the user.

Troubleshooting

  • No upstream remote: Add it with git remote add upstream <repo-url>
  • No origin remote: This is your fork. Add with git remote add origin <fork-url>
  • gh CLI not installed: brew install gh or see https://cli.github.com/
  • Not authenticated with gh: gh auth login
  • PR already exists: If a PR already exists for this branch, report the existing PR URL instead

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

When making code changes or reviewing existing code, check if architecture diagram matches implementation, and keep the diagram in sync.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

iopsystems/rpc-perf332026년 6월 22일 업데이트

iopsystems의 스킬 모두 보기

이 스킬의 문제 신고