agentleFS
tableautableau/tableau-mcp/.claude/skills/create-pr-from-commits/SKILL.md

create-pr-from-commits

Skill347 starsChanged 6 months agoApache-2.0View on GitHub

Use when user asks to create a pull request - automates PR creation by analyzing commits, filling PR template, and submitting with gh pr create

  • Commits and pushes

The file

Show its rules and text

We split this skill into the rules it gives an agent

24 rules. About 0 are common, 17 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈17

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Don't use when:

    line 20
  2. Very specific:

    If the user provides just the number (e.g., "22802840"), prepend @W-.

    line 62
  3. Very specific:

    If they provide "W-12345678", prepend @.

    line 63
  4. Distinctive:

    Run these commands in parallel with Bash tool:

    line 69
  5. Very specific:

    Read the PR template at .github/pull_request_template.md to identify required sections.

    line 87
  6. Distinctive:

    Look for "why" in commit messages

    line 106
  7. Distinctive:

    Check multiple commits - may have multiple types

    line 112
  8. Very specific:

    Look for test file changes in diff (*.test.ts, *.spec.js)

    line 115
  9. Distinctive:

    Check commit messages mentioning "test"

    line 116
  10. Distinctive:

    Check commit bodies for "BREAKING" or "breaking change"

    line 121
  11. Distinctive:

    Create PR with GUS ID in title using HEREDOC format:

    line 125
  12. Distinctive:

    If no template exists, create minimal but complete PR:

    line 180
  13. Very specific:

    Use gh pr create --base <branch> to specify.

    line 202
  14. Very specific:

    If gh pr create fails with "pull request already exists":

    line 206
  15. Distinctive:

    Don't say: "I'll create the PR now" without prompting for GUS ID first.

    line 216
  16. Distinctive:

    Don't ask: "What should I put in the description?"

    line 220
  17. Distinctive:

    Don't write: "Various bug fixes and improvements"

    line 226
  18. Distinctive:

    Don't leave sections empty with "TODO".

    line 232
  19. Distinctive:

    If information is missing, infer from code changes or use reasonable defaults:

    line 234
  20. Distinctive:

    No tests? Say "Manual testing performed"

    line 235
  21. Distinctive:

    No breaking changes? Check the box as "No"

    line 236
  22. Distinctive:

    Always verify branch is pushed before creating PR:

    line 240
  23. Very specific:

    Use single quotes in <<'EOF' to prevent variable expansion in PR body.

    line 248
  24. Distinctive:

    All template sections filled

    line 290

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Create PR from Commits

Overview

Automate pull request creation by extracting information from git commits and filling the repository's PR template. This eliminates manual repetition while ensuring PRs contain complete, accurate information.

When to Use

Use when:

  • User asks to "create a PR"
  • User says "make a pull request"
  • User requests "submit this for review"
  • You've created 2+ PRs in the session (proactively offer this workflow)

Don't use when:

  • User wants to manually draft the PR description
  • PR requires special context not in commits
  • Repository has no PR template

Core Workflow

digraph pr_workflow {
    "User requests PR" [shape=doublecircle];
    "Gather git context" [shape=box];
    "Find PR template" [shape=box];
    "Analyze commits" [shape=box];
    "Fill template" [shape=box];
    "Create PR with gh pr create" [shape=box];
    "Return PR URL" [shape=doublecircle];

    "User requests PR" -> "Gather git context";
    "Gather git context" -> "Find PR template";
    "Find PR template" -> "Analyze commits";
    "Analyze commits" -> "Fill template";
    "Fill template" -> "Create PR with gh pr create";
    "Create PR with gh pr create" -> "Return PR URL";
}

Implementation

Step 1: Prompt for GUS ID (Internal Contributors Only)

For internal Tableau contributors, ask for the GUS work item ID:

What is the GUS work item ID for this PR? (Format: W-12345678)
If you're an external contributor, press Enter to skip.

GUS ID format:

  • Starts with @W-
  • Followed by 8 digits
  • Example: @W-22802840

If the user provides just the number (e.g., "22802840"), prepend @W-. If they provide "W-12345678", prepend @.

If no GUS ID provided: Continue without it - external contributors don't need GUS IDs.

Step 2: Gather Git Context (parallel)

Run these commands in parallel with Bash tool:

# Get all commits since main
git log main..HEAD --format="%h %s%n%b"

# Get full diff
git diff main...HEAD

# Get changed files
git diff main...HEAD --stat

# Check branch tracking
git branch -vv

Step 3: Read PR Template

Read the PR template at .github/pull_request_template.md to identify required sections.

Step 4: Analyze Commits

Extract information for PR title and template sections:

PR Title:

  • Format: @W-12345678: Short description (internal contributors with GUS ID)
  • Format: Short description (external contributors without GUS ID)
  • Derive short description from main commit subject (50 chars max after GUS ID)
  • Example with GUS: @W-22802840: Remove sensitive data from error logs
  • Example without GUS: Remove sensitive data from error logs

Description/Summary:

  • Combine commit subjects into bullet points
  • Group related commits (e.g., "fix lint issues" with main feature)
  • Lead with most important change

Motivation/Context:

  • Look for "why" in commit messages
  • Extract issue numbers (e.g., W-12345, #123, GUS-456)
  • Infer purpose from code changes if not explicit

Type of Change:

  • Scan for keywords: "fix" (bug fix), "add" (feature), "breaking" (breaking change), "docs" (documentation)
  • Check multiple commits - may have multiple types

Testing:

  • Look for test file changes in diff (*.test.ts, *.spec.js)
  • Check commit messages mentioning "test"
  • Note if all tests pass (check last commit message)

Breaking Changes:

  • Scan for: renamed env vars, removed APIs, changed defaults
  • Check commit bodies for "BREAKING" or "breaking change"

Step 5: Fill Template

Create PR with GUS ID in title using HEREDOC format:

gh pr create --title "@W-12345678: Short description from commits" --body "$(cat <<'EOF'
## Description
- Bullet point 1 from commit
- Bullet point 2 from commit

## Motivation and Context
[Extracted from commit bodies or inferred from changes]

## Type of Change
- [x] Bug fix
- [ ] New feature
...

## How Has This Been Tested?
[List test files changed or mention manual testing]

## Related Issues
Closes #123, W-45678

## Checklist
- [x] Tests added
- [x] Tests pass
- [ ] Documentation updated
EOF
)"

Template mapping patterns:

Template SectionInformation Source
Description/SummaryCommit subjects (bullets)
MotivationCommit bodies + issue refs
Type of ChangeKeywords in commits + diff analysis
TestingTest file changes + commit messages
Breaking ChangesBREAKING in commits + env var changes
Checklist itemsVerify against actual changes

Step 6: Create PR

# Push if needed
[[ $(git branch -vv | grep 'gone\]') ]] && git push -u origin HEAD

# Create PR with GUS ID in title
gh pr create --title "@W-12345678: Description" --body "..."

Edge Cases

No PR Template Found

If no template exists, create minimal but complete PR:

gh pr create --title "..." --body "$(cat <<'EOF'
## Summary
- [commit-based bullets]

## Changes
- [files changed summary]

## Testing
[test coverage or manual testing note]
EOF
)"

Multiple Base Branch Options

Check project conventions:

  • Most repos: main
  • Some use: master, develop, trunk

Use gh pr create --base <branch> to specify.

PR Already Exists

If gh pr create fails with "pull request already exists":

  • Return the existing PR URL
  • Offer to update the PR description with gh pr edit <number>

Common Mistakes

❌ Skipping GUS ID Prompt for Internal Contributors

ALWAYS ask for GUS ID (but allow skipping for external contributors).

Don't say: "I'll create the PR now" without prompting for GUS ID first.

❌ Asking User for Information Already in Commits

Don't ask: "What should I put in the description?"

The commits contain this information. Extract it (except for GUS ID).

❌ Generic or Vague Descriptions

Don't write: "Various bug fixes and improvements"

Extract specifics: "Fix memory leak in auth flow, improve error logging for failed requests"

❌ Skipping Template Sections

Don't leave sections empty with "TODO".

If information is missing, infer from code changes or use reasonable defaults:

  • No tests? Say "Manual testing performed"
  • No breaking changes? Check the box as "No"

❌ Creating PR Before Checking Push Status

Always verify branch is pushed before creating PR:

git branch -vv  # Check tracking

❌ Not Handling HEREDOC Properly

Use single quotes in <<'EOF' to prevent variable expansion in PR body.

Quick Reference

Full workflow:

# 1. Ask user for GUS ID (allow skip for external contributors)
# "What is the GUS work item ID? (Format: W-12345678, or press Enter to skip)"

# 2. Gather context (parallel)
git log main..HEAD --format="%h %s%n%b" &
git diff main...HEAD --stat &
wait

# 3. Find and read template
cat .github/pull_request_template.md

# 4. Create PR with GUS ID in title
gh pr create --title "@W-12345678: Short description" --body "$(cat <<'EOF'
[filled template here]
EOF
)"

Title format examples:

  • ✅ @W-22802840: Remove sensitive data from error logs (internal)
  • ✅ @W-12345678: Add user management feature (internal)
  • ✅ Remove sensitive data from error logs (external contributor)
  • ❌ W-22802840: Fix bug (missing @ symbol for internal contributor)

Real-World Impact

Before this skill:

  • 2-3 minutes per PR (manual git commands, template reading, copy-paste)
  • Inconsistent PR descriptions
  • Easy to skip template sections
  • Repeated work for multiple PRs

After this skill:

  • ~30 seconds per PR (automated extraction)
  • Consistent, complete PR descriptions
  • All template sections filled
  • Scalable to many PRs

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.