Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Github Pr.Create Child

БесплатноБез исполняемых скриптовНе проверен

Write instructions to build a child PR from a branch or PR

gpsaggeseот gpsaggese★ 158 звёзд на GitHub

Об этом скилле

Goal

  • Given a <SRC> Git branch, write instructions to build a child PR on a new <DST> branch

Workflow

Resolve the Input

  • An argument in the form PR<PLAN_NUM> (e.g., PR2) selects a PR of the split plan <SPLIT_PREFIX>.md (see ## Select the Content of the Child PR)
    • The plan is written by .claude/skills/github_pr.split_branch/SKILL.md
  • Resolve the other argument following .claude/skills/github_pr.rules.md ## Resolve the PR Argument
    • A PR is not needed
    • <SRC> is <BRANCH_NAME>
  • Get the code following .claude/skills/github_pr.rules.md ## Get the Local Code of the PR

Select the Content of the Child PR

  • <INPUT_REF> is <SRC>, as in .claude/skills/skill.rules.md ### Name the Output File
    • <PREFIX> is github_pr.create_child.<INPUT_REF>
    • <SPLIT_PREFIX> is github_pr.split_branch.<INPUT_REF>
    • All the files are in the current dir
  • If <SPLIT_PREFIX>.md exists
    • Use the PR PR<PLAN_NUM>
    • Without PR<PLAN_NUM>, use the first PR of the plan that is not under ## Merged/Done, and tell the user which one
  • If <SPLIT_PREFIX>.md does not exist, ask the user which files go in the child PR
    • If the user passed PR<PLAN_NUM>, say that the plan is missing
  • Set <FILES_TXT>, the list of the files of the child PR
    • If <SPLIT_PREFIX>.pr<PLAN_NUM>.files.txt exists, use it and do not rewrite it
    • Otherwise, create <PREFIX>.files.txt with one file per line
    • For a renamed file, <FILES_TXT> must list both the old and the new path; if one is missing, tell the user
  • Set <PYTEST_SH>, the script with the tests that check the behavior of the PR
    • If <SPLIT_PREFIX>.pr<PLAN_NUM>.pytest.sh exists, use it and do not rewrite it
    • Otherwise, create <PREFIX>.pytest.sh and make it executable

Find the Next Branch Name

  • Find which branch name is next available:
    > i git_branch_next_name
    Found highest number '3' in all branches, next is '4'
    branch_next_name='HelpersTask1273_Get_Mac_tests_to_pass_4'
    

Create the Files

  • Create <PREFIX>.title.txt with the title of the PR on one line
    • Use plain text, without backticks or $, since the shell reads the title
  • Create <PREFIX>.commit_msg.txt with the title, an empty line, and the description of what the PR does
    • Start from the description of the PR in <SPLIT_PREFIX>.md, if any
  • Create <PREFIX>.merge.txt with the instructions to build the child PR
    • Follow the phases in ## Example
    • Replace <FILES_TXT> and <PYTEST_SH> with the actual file names
    • Add a comment for each phase, and make sure each command is correct
  • In <PREFIX>.merge.txt and <PREFIX>.pytest.sh, state how they were generated, with this comment at the top of each file (after the shebang, if any):
    # Generated by `.claude/skills/github_pr.create_child/SKILL.md`
    

Example

  • Example of <PREFIX>.merge.txt for PR2, where <FILES_TXT> and <PYTEST_SH> come from the split plan
    # Set the variables.
    > export SRC_BRANCH=HelpersTask1273_Get_Mac_tests_to_pass
    > export DST_BRANCH=HelpersTask1273_Get_Mac_tests_to_pass_4
    > export PREFIX=github_pr.create_child.$SRC_BRANCH
    > export PR2=github_pr.split_branch.$SRC_BRANCH.pr2
    > export FILES=$(cat $PR2.files.txt)
    
    # Create the branch from `origin/master`, without a draft PR.
    > i git_branch_create --branch-name $DST_BRANCH --no-create-pr
    
    # Copy the files from the source branch and stage them.
    # `$SRC_BRANCH` must include `origin/master`, or the copy reverts newer changes.
    > git_sync_between_branches.sh --src_branch $SRC_BRANCH --dst_branch $DST_BRANCH --files "$FILES"
    
    # Check that only the expected changes are staged.
    > git diff --cached --stat
    
    # Commit.
    > git commit -F $PREFIX.commit_msg.txt
    
    # Run the tests, in the container and outside.
    > export CSFY_DOCKER_ENGINE="docker"; i docker_cmd --stage=local -v 1.6.0 --cmd "./$PR2.pytest.sh 2>&1 | tee build1.txt"
    > export CSFY_DOCKER_ENGINE="docker"; ./$PR2.pytest.sh 2>&1 | tee build2.txt
    > export CSFY_DOCKER_ENGINE="apple"; ./$PR2.pytest.sh 2>&1 | tee build3.txt
    
    # Push, create the PR, and watch the CI.
    > git push
    > i gh_create_pr --no-draft --title "$(cat $PREFIX.title.txt)" --body "$(cat $PREFIX.commit_msg.txt)"
    > i gh_watch
    
  • If the files come from another Git client instead of a branch, replace the copy phase with this one
    # Copy only the listed files from another Git client.
    > export SRC_DIR=/Users/saggese/src/csfy1/helpers_root
    > export DST_DIR=/Users/saggese/src/notes1/helpers_root
    > diff_to_vimdiff.py --dir1 $SRC_DIR --dir2 $DST_DIR
    > copy_across_clients.py --dir1 $SRC_DIR --dir2 $DST_DIR --from_file $SRC_DIR/$PR2.files.txt
    > cp $SRC_DIR/$PREFIX.* $SRC_DIR/$PR2.pytest.sh $DST_DIR/
    > cd $DST_DIR
    > git add $FILES
    

Verification

  • The output files are in the current dir and start with github_pr.create_child.<INPUT_REF>
Полный SKILL.md на GitHub

Установить Github Pr.Create Child в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Github Pr.Create Child?

Write instructions to build a child PR from a branch or PR

Как установить скилл Github Pr.Create Child?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Github Pr.Create Child запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Github Pr.Create Child с