Skip to content
Development
Command

/devkit.github.create-pr

Creates a GitHub pull request with branch creation, commits, and detailed description. Use when you need to submit changes for review.

From plugin
developer-kit
36935 skills44 agents35 commands2 MCP
> /plugin marketplace add giuseppe-trisciuoglio/developer-kit
> /plugin install developer-kit@developer-kit

Command definition

devkit.github.create-pr.md
description: Creates a GitHub pull request with branch creation, commits, and detailed description. Use when you need to submit changes for review.
allowed-tools: Bash(git *), Bash(gh *)
argument-hint: "[pr-title] [target-branch] [language]"

Create GitHub Pull Request

Overview

Creates a GitHub pull request with branch creation, commits, and detailed description. Use when you need to submit changes for review.

Usage

/devkit.github.create-pr $ARGUMENTS

Arguments

| Argument | Description | |--------------|------------------------------------------| | `$ARGUMENTS` | Combined arguments passed to the command |

Current Context

  • **Current Branch**: !`git branch --show-current`
  • **Git Status**: !`git status --porcelain`
  • **Remote Repository**: !`git config --get remote.origin.url`
  • **Modified Files**: !`git diff --name-only`

Execution Instructions

**Agent Selection**: To execute this GitHub task, use the following approach:

  • Primary: Use `general-purpose` agent with GitHub CLI expertise and code analysis capabilities

Configuration

**Arguments received**: `$ARGUMENTS`

**$1**: PR title (optional - will be generated if not provided) **$2**: Target branch (optional - defaults to `main` or `master`) **$3**: Language for PR description (optional - defaults to `en`)

**Supported languages**: `en`, `it`, `es`, `fr`, `de`

Phase 1: Pre-Flight Validation

1.1 Check Working Directory

Verify git repository and working directory status:

# Verify git repository
if ! git rev-parse --git-dir > /dev/null 2>&1; then
    echo "Error: Not a git repository"
    exit 1
fi

# Check for uncommitted changes
if [ -z "$(git status --porcelain)" ]; then
    echo "Error: No changes to commit"
    exit 1
fi

# Verify remote repository exists
if ! git config --get remote.origin.url > /dev/null 2>&1; then
    echo "Error: No remote repository configured"
    exit 1
fi

# Check GitHub CLI authentication
if ! gh auth status > /dev/null 2>&1; then
    echo "Error: GitHub CLI not authenticated. Run: gh auth login"
    exit 1
fi

1.2 Determine Target Branch

# Detect default branch
TARGET_BRANCH="${2:-$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5)}"
if [ -z "$TARGET_BRANCH" ]; then
    TARGET_BRANCH="main"
fi

echo "Target branch: $TARGET_BRANCH"

Phase 2: Change Analysis

2.1 Analyze Modified Files

# Get list of modified files
MODIFIED_FILES=$(git diff --name-only)
STAGED_FILES=$(git diff --cached --name-only)
UNTRACKED_FILES=$(git ls-files --others --exclude-standard)

echo "Modified files:"
echo "$MODIFIED_FILES"
echo ""
echo "Staged files:"
echo "$STAGED_FILES"
echo ""
echo "Untracked files:"
echo "$UNTRACKED_FILES"

2.2 Categorize Changes

Analyze changes by type:

  • **Feature additions**: New files, new functionality
  • **Bug fixes**: Corrections to existing code
  • **Refactoring**: Code improvements without behavior changes
  • **Documentation**: README, comments, docs
  • **Configuration**: Build files, properties, YAML configs
  • **Tests**: Test files and test data

Phase 3: Branch Creation

3.1 Generate Branch Name

# Generate branch name from PR title or changes
if [ -n "$1" ]; then
    BRANCH_NAME=$(echo "$1" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//')
else
    # Generate from changed files
    MAIN_CHANGE=$(echo "$MODIFIED_FILES" | head -1 | xargs dirname | sed 's/\//-/g')
    BRANCH_NAME="feature/${MAIN_CHANGE}-$(date +%s)"
fi

# Ensure unique branch name
COUNTER=1
ORIGINAL_BRANCH=$BRANCH_NAME
while git show-ref --verify --quiet refs/heads/$BRANCH_NAME; do
    BRANCH_NAME="${ORIGINAL_BRANCH}-${COUNTER}"
    ((COUNTER++))
done

echo "Branch name: $BRANCH_NAME"

3.2 Create and Switch Branch

# Create new branch
git checkout -b "$BRANCH_NAME"

echo "Created and switched to branch: $BRANCH_NAME"

Phase 4: Commit Strategy

4.1 Analyze Commit Splitting

Determine if changes should be split into multiple commits:

**Single commit when**:

  • Single file modified
  • Related changes in same component
  • Small focused change

**Multiple commits when**:

  • Changes span multiple features
  • Mix of feature and tests
  • Configuration and code changes
  • Documentation and implementation

4.2 Create Commits

# Stage all changes
git add -A

# Get diff statistics
TOTAL_ADDITIONS=$(git diff --cached --numstat | awk '{s+=$1} END {print s}')
TOTAL_DELETIONS=$(git diff --cached --numstat | awk '{s+=$2} END {print s}')
FILES_CHANGED=$(git diff --cached --name-only | wc -l)

echo "Changes: +$TOTAL_ADDITIONS -$TOTAL_DELETIONS across $FILES_CHANGED files"

4.3 Generate Commit Messages

Follow Conventional Commits specification:

<type>(<scope>): <description>

<body>

<footer>

**Types**:

  • `feat`: New feature
  • `fix`: Bug fix
  • `docs`: Documentation changes
  • `style`: Code style/formatting
  • `refactor`: Code refactoring
  • `test`: Test additions/modifications
  • `chore`: Build, dependencies, tooling
  • `perf`: Performance improvements
  • `ci`: CI/CD changes
  • `security`: Security improvements

**Example commits**:

# Feature commit
git commit -m "feat(user-service): add email verification functionality

- Implement email verification service
- Add verification token generation
- Create email template
- Add integration tests

Closes #123"

# Bug fix commit
git commit -m "fix(auth): resolve JWT token expiration issue

JWT tokens were expiring prematurely due to timezone
miscalculation. Updated to use UTC consistently.

Fixes #456"

# Refactoring commit
git commit -m "refactor(repository): simplify user query methods

- Remove duplicate code
- Extract common query logic
- Improve method naming
- Add Javadoc comments"

Phase 5: Push and PR Creation

5.1 Push Branch

# Push to remote
git push -u origin "$BRANCH_NAME"

echo "Pushed branch to remote: $BRANCH_
Read more
@giuseppe-trisciuoglio
Ships withdeveloper-kit

Modular plugin marketplace for Claude Code and agentic CLIs, with validated, spec-driven skills, agents, commands, and workflows for Java, TypeScript, Python, PHP, AWS, and AI.

369116 skills44 agents2 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
369
Star history of giuseppe-trisciuoglio/developer-kit on GitHub, a chart by star-history.com

Other commands on developer-kit.

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command