Skip to content

Add git plugin with enhanced workflows - #2

Merged
cblecker merged 2 commits into
mainfrom
add-git-plugin
Jan 23, 2026
Merged

Add git plugin with enhanced workflows#2
cblecker merged 2 commits into
mainfrom
add-git-plugin

Conversation

@cblecker

@cblecker cblecker commented Jan 23, 2026

Copy link
Copy Markdown
Owner

Summary

This PR adds a new git plugin that enhances Claude Code's built-in git capabilities with smart defaults, safety guardrails, and automatic convention detection.

Changes

  • Three user-invocable skills: /git:branch, /git:commit, /git:pr

    • Smart branch creation with conventional commits detection
    • Mainline protection preventing accidental commits to main/master
    • Fork detection and PR template discovery
  • PreToolUse hooks for safety reminders on git operations

    • Bash git/gh commands hook with safety warnings
    • GitHub MCP tools hook for fork setup reminders
  • Four reference files with shared detection utilities

    • Mainline branch detection (remote HEAD → local fallback)
    • Fork detection (origin vs upstream)
    • Conventional commits detection (config + history analysis)
    • Git safety rules (force push warnings, etc.)
  • Progressive disclosure design

    • Lean skill files (1,500-2,000 words)
    • Detailed reference files for complex logic
    • Symlinked references to avoid duplication
  • Consolidated markdownlint configuration

    • Combined .markdownlint.json and .markdownlint-cli2.jsonc
    • Added ignores for symlinked directories

Testing

The plugin was tested by using it to commit its own implementation:

  • /git:branch - Created add-git-plugin branch from main
  • /git:commit - Staged files and created commit with proper message
  • /git:pr - This PR was created using the plugin itself

Manual testing checklist:

  • Skills trigger on expected phrases
  • Hooks provide reminders before git operations
  • Reference files are accessible via symlinks
  • Plugin validates with claude plugin validate ./git
  • Markdown lints with npx markdownlint-cli2 "git/**/*.md"

Related Issues

N/A - Initial implementation following the design plan.


🤖 Generated with Claude Code using the git plugin

Summary by CodeRabbit

  • New Features
    • Added Git plugin to streamline git workflows with intelligent branch naming based on conventional commits.
    • Integrated safety features to prevent dangerous git operations and mainline branch protection reminders.
    • Implemented fork detection and support for pull request creation with template discovery.
    • Added comprehensive pre-operation validation checks for git operations.

✏️ Tip: You can customize this high-level summary in your review settings.

cblecker and others added 2 commits January 22, 2026 21:04
Implements a new git plugin that enhances Claude Code's built-in git
capabilities with smart defaults, safety guardrails, and automatic
convention detection.

Features:
- Three user-invocable skills: /git:branch, /git:commit, /git:pr
- PreToolUse hooks for safety reminders on git operations
- Auto-detection of conventional commits, fork setups, and mainline branches
- Reference files with shared detection utilities
- Progressive disclosure with lean skills and detailed references

Also consolidates markdownlint configuration into single
.markdownlint-cli2.jsonc file with combined rules and ignores.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changed prompt-based hooks to focus on what they can actually verify
(tool input parameters) rather than trying to check external conditions
(git remotes, file system) they don't have access to.

Changes:
- create_pull_request hook: Check 'head' parameter format for fork detection
- push_files hook: Check 'branch' parameter for mainline detection
- Both hooks now return empty systemMessage when parameters look correct

This eliminates confusing "hook error" messages and makes hooks more
targeted and helpful.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@cblecker

Copy link
Copy Markdown
Owner Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jan 23, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jan 23, 2026

Copy link
Copy Markdown

Walkthrough

This PR introduces a comprehensive Git plugin to the marketplace, including a plugin manifest, documentation for Git workflows, safety hooks configuration, and three core skills for branch creation, committing, and pull request creation with supporting reference documentation.

Changes

Cohort / File(s) Summary
Plugin Registration
.claude-plugin/marketplace.json
Registers new Git plugin with name "git", source "./git", and strict mode enabled
Markdown Linting Configuration
.markdownlint-cli2.jsonc, .markdownlint.json
Introduces new .markdownlint-cli2.jsonc with consolidated linting rules and disables several MD checks; removes legacy .markdownlint.json configuration
Git Plugin Core
git/.claude-plugin/plugin.json, git/README.md
Adds plugin manifest (v0.1.0) with metadata and keywords; provides comprehensive documentation covering features (smart branching, conventional commits, fork handling, PR templates) and usage guide
Git Safety & Hooks
git/hooks/hooks.json
Defines PreToolUse hooks with three matchers (Bash, GitHub PR creation, push operations) to provide real-time safety reminders and validations for dangerous Git operations
Git Reference Documentation
git/reference/conventional-commits.md, git/reference/fork-detection.md, git/reference/git-safety.md, git/reference/mainline-detection.md
Adds detailed reference guides for conventional commit detection, fork workflow identification, safety best practices, and mainline branch detection strategies
Git Skills: Branch
git/skills/branch/SKILL.md, git/skills/branch/reference
Documents branch creation skill with smart naming (CC-based prefixes), base-branch awareness, conventional commit detection, and comprehensive error handling
Git Skills: Commit
git/skills/commit/SKILL.md, git/skills/commit/reference
Documents commit skill with pre-flight checks, staged file handling, conventional commit support, sensitive file warnings, and mainline branch protection
Git Skills: PR
git/skills/pr/SKILL.md, git/skills/pr/reference
Documents PR creation skill with fork detection, base branch determination, PR template discovery, and GitHub MCP integration

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25–30 minutes

Possibly related PRs

Poem

🐰 A git plugin hops into the warren,
With skills to branch, commit, and pardon,
Safety hooks guard each dangerous leap,
While references guide the warren deep,
Smart workflows now keep us from despair! 🌿

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary change: adding a new git plugin with enhanced workflows including smart branch creation, safety features, and fork detection.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@git/hooks/hooks.json`:
- Around line 14-37: The hook uses a non-existent matcher
"mcp__plugin_github_github__push_files"; update hooks.json so the matcher either
targets a real GitHub MCP tool (one of the documented names:
mcp__plugin_github_github__create_pull_request,
mcp__plugin_github_github__update_pull_request,
mcp__plugin_github_github__pull_request_read, or
mcp__plugin_github_github__list_pull_requests) if you intended this behavior, or
remove the entire "mcp__plugin_github_github__push_files" hook block if
file-pushing via MCP is not supported, and keep the existing prompt/timeout
behavior only under a valid matcher.

In `@git/README.md`:
- Around line 9-13: Update wording that overstates enforcement: replace the
phrase "Prevents accidental commits directly to main/master branches" (and the
same wording appearing at the later occurrence around lines 75-77) with
non-blocking language such as "Warns before commits to main/master branches" or
"Reminds before committing to main/master branches"; also adjust the feature
heading "Mainline protection" to something like "Mainline reminders/protection
(warning only)" so the README consistently reflects that hooks are non-blocking
warnings.

In `@git/reference/conventional-commits.md`:
- Line 99: Update the table entry that shows the CI example by fixing the
platform capitalization: change the example commit text `ci(github): add
deployment workflow` to use `GitHub` (e.g. `ci(GitHub): add deployment
workflow`) so the platform name is properly capitalized; ensure any other
occurrences of the lowercase `github` in that same row are similarly corrected.

In `@git/reference/mainline-detection.md`:
- Around line 7-8: The document contains conflicting priority orders
(Remote→Local→CLAUDE vs CLAUDE→Remote→Local); pick a single canonical order
(e.g., CLAUDE→Remote→Local if CLAUDE should be highest) and update every
occurrence to match, including the section under the "Use this priority order:"
heading and the other instance referenced around the 51st line; ensure the
header text and any explanatory lines or lists that mention the priority reflect
the chosen order consistently and update any cross-references or examples that
assume the previous order.
♻️ Duplicate comments (2)
git/skills/pr/reference (1)

1-1: Same reference implementation pattern as branch/reference.

This file has the same implementation pattern as git/skills/branch/reference. Please see the review comment on that file regarding verification of whether these should be actual symlinks or text files.

git/skills/commit/reference (1)

1-1: Same reference implementation pattern.

This file follows the same pattern as git/skills/branch/reference and git/skills/pr/reference. Please see the review comment on git/skills/branch/reference for verification of the implementation approach.

🧹 Nitpick comments (2)
git/skills/commit/SKILL.md (2)

24-115: Add explicit user confirmation before running CLAUDE.md commands.
Those commands are repo-sourced and may be long-running or unexpected; make the confirmation step explicit.

✏️ Suggested wording
-1. Execute each command specified
-2. Verify all pass successfully
-3. If any fail, report to user and ask how to proceed
-4. Do NOT commit if verification fails without user approval
+1. Confirm with the user before running each command (especially long‑running or repo‑sourced)
+2. Execute each command specified
+3. Verify all pass successfully
+4. If any fail, report to user and ask how to proceed
+5. Do NOT commit if verification fails without user approval

186-208: Avoid hard‑coding a co‑author identity in the example.
Make it a placeholder or conditional to keep the guidance portable across repos.

✏️ Suggested update
-Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
+Co-Authored-By: <assistant-name> <assistant-email>

Comment thread git/hooks/hooks.json
Comment thread git/README.md
Comment thread git/reference/conventional-commits.md
Comment thread git/reference/mainline-detection.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant