smart-git-automation
Smart change detection, auto branch naming, and streamlined commit/PR workflow
- License 许可
- MIT
- 最近更新
- 2026-08-07
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- smart-git-automation
- risk
- critical
- source
- community
- license
- MIT
- version
- 1.0.0
- date_added
- 2026-06-05
- description
- Smart change detection, auto branch naming, and streamlined commit/PR workflow
- source_repo
- mskadu/opencode-agent-skills
- source_type
- community
- license_source
- https://github.com/mskadu/opencode-agent-skills/blob/main/LICENSE
02 资源文件 1
- 参考文档README.md1.5 KB
03 SKILL.md 正文
What I do
- Intelligently detect and group related changes
- Auto-generate descriptive branch names from changes
- Streamlined workflow: scan → branch → commit → push → PR with fewer prompts
When to Use
Use this when you want a faster, smarter git workflow that groups changes logically and reduces manual confirmation overhead.
Workflow Steps
1. Smart Detection & Grouping
Run in parallel:
git status- check what's changedgit diff --stat- see file modification summarygit diff --name-only- list changed files onlygit diff --staged --stat- see what's already staged
Analyze changes to group them logically:
- Files in the same module/directory → likely related
- Files that were modified together in recent edits → likely related
- New files that complement each other → likely related
Present grouped changes in a clear format, e.g.:
📁 Group 1: UI Components
- src/components/Button.tsx (modified)
- src/components/Button.test.tsx (modified)
📁 Group 2: API Layer
- src/api/client.ts (new)
- src/api/types.ts (modified)
2. Auto Branch Name Generation
Generate branch name from dominant change pattern:
- Use format:
<type>/<short-description> - Types:
feature,fix,refactor,docs,test,chore - Derive description from most significant changed file/feature
- Convert to kebab-case, max 50 chars
- Examples:
feature/add-user-auth(from auth-related files)fix/login-validation(from validation changes)refactor/api-cleanup(from API refactoring)
Show the proposed branch name and ask for one-word confirmation (or type alternative).
3. Streamlined Branch & Commit
- If not on main/master: check if current branch matches proposed name
- If yes: stay on it
- If no: ask to switch or create new
- Create branch only after validating the branch name, then use
git checkout -b "$branch_name" - Stage explicit pathspecs only:
git add -- path/to/file ...- If file paths are generated, keep them NUL-delimited (
git diff -z --name-only) and pass them as pathspec arguments. - Never concatenate untrusted filenames into a shell command and never run the placeholder text literally.
- If file paths are generated, keep them NUL-delimited (
- Auto-generate commit message from changes:
- First line:
<type>: <short description>(max 72 chars) - Body: grouped file changes with brief descriptions
- First line:
- Commit with generated message, show preview first
- Ask for one-word confirmation to proceed
4. Push & Optional PR
- After commit, ask: "Push to remote? (yes/no/abort)"
- If yes:
git push -u origin <branch-name> - Then ask: "Create PR? (yes/no)"
- If yes:
- Check remote:
git remote -v - If fork: use fork's remote (e.g.,
mskadu/repo-name) - Auto-generate PR description from commit messages
- Use
gh pr createwith:- Title from branch name
- Body: summary of changes + file breakdown + follow-up notes
- Check remote:
Key Rules
- Group related files automatically, but allow user to adjust
- Generate branch names from actual changes, don't ask user to name them
- Reduce confirmations: ask for one-word answers or single confirmation points
- Never commit secrets, credentials, or large binaries
- Check if GitHub repo exists before PR creation
- Skip PR step if user says "no" at any point
- If branch already exists with changes, offer to amend or add new commit
Limitations
- Do not bypass repository-specific maintainer rules, branch policies, or required review gates.
- Confirm destructive or publishing actions explicitly; this skill should streamline routine Git flow, not remove accountability.
04 同仓库更多 Skills
vercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
stop-slop
Remove AI writing patterns from prose. Use when drafting, editing, or reviewing text to eliminate predictable AI tells and produce more human-like writing.
ogilvy-copywriting
Apply David Ogilvy's advertising principles when writing or reviewing copy, headlines, product descriptions, landing pages, ads, emails, or any persuasive text. Use when the goal is copy that sells, not copy that wins awards. Covers positioning, headlines, promises, brand voice, long-form copy, and visual logic. Source: How to Create Advertising That Sells (1972) + Ogilvy on Advertising.
frontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
web-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.