ams-git-commit-helper
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-11-07
- Stars
- ★ 0
- Forks
- 1
03 SKILL.md 正文
Git Commit Helper
Overview
Commits are communication with future maintainers — including yourself in six months. A good
commit answers three questions at a glance: what changed, why it changed, and what to know before
touching it. This skill covers the craft: atomic changesets, conventional message format, bodies
that explain reasoning, and history hygiene (rebasing, squashing, fixups) that keeps git log
readable instead of archaeological.
Well-kept history turns git blame from a blame tool into a documentation tool.
When to use
- Writing commit messages for everyday work.
- Splitting a messy working tree into logical commits.
- Cleaning up a branch before opening a PR (rebase, squash, reorder).
- Writing PR descriptions that reviewers can act on.
- Establishing commit conventions for a team (conventional commits, changelogs).
Core concepts
- Atomic commits. One commit = one logical change: it builds, it passes tests, and reverting it removes exactly one thing. "Fix login bug and refactor utils and update docs" is three commits wearing a trench coat.
- Conventional Commits.
type(scope): subject— e.g.feat(auth): add TOTP two-factor setup. Types (feat,fix,docs,refactor,test,chore,perf,ci) make history greppable and changelogs generatable. Adopt it repo-wide or not at all — half-adopted conventions are noise. - Imperative subject. "Add retry logic" not "Added retry logic" — the subject completes "this commit will…". Keep it under ~50–72 chars; the body carries the detail.
- Body explains why. The diff shows what; the message explains why this approach, what alternatives were rejected, and any non-obvious consequences. Link the issue/ticket.
- History hygiene. Rebase private branches onto main before PR; squash fixup commits; drop "wip" and "fix typo" noise. Never rewrite public/shared history — the convenience isn't worth the chaos for collaborators.
- PR description = commit message at scale. What, why, how to test, screenshots for UI, breaking changes flagged loudly. Reviewers triage from the description; make it earn the click.
Practical workflow
- Stage deliberately. Use
git add -pto stage hunks, not files — split unrelated changes into separate commits even when they're in the same file. - Write the message:
feat(checkout): make order placement idempotent Double-taps on "Place order" created duplicate charges (INC-2214). Adds an idempotency key generated client-side and stored server-side for 24h; duplicate submissions return the original order. Considered disabling the button only, but network retries would still duplicate — key-based dedup covers both paths. - Self-review the diff (
git show, or the PR diff view) before pushing: stray files, debug code, and accidental secrets get caught here. - Clean the branch.
git rebase -i main: squash fixups, reword weak messages, drop noise. Aim for a branch where each commit could be reviewed and reverted independently. - Push and open the PR with a description covering: what/why, test plan, risk areas, and anything reviewers should look at first.
- After merge, delete the branch. Stale branches are where "which one is current?" confusion breeds.
Everyday commands:
git add -p # stage hunks interactively
git commit -v # show diff in editor while writing message
git rebase -i main # tidy private branch history
git commit --fixup=<sha> # mark a fix for autosquash later
git rebase -i --autosquash main
git log --oneline -15 # sanity-check the story your branch tells
Common pitfalls
- "wip" commits on shared branches. Fine locally; never in a PR. Squash before review.
- Mixing refactors with behavior changes. Reviewers can't tell what's safe. Refactor commit first (no behavior change), behavior commit second.
- Empty or misleading messages. "fix stuff", "updates", or a message describing what the code used to do. If the message doesn't help future-you, rewrite it.
- Committing secrets or junk.
.env, credentials,node_modules, IDE files —.gitignoreearly, and usegit-secrets-style hooks to catch accidents before push. - Rewriting public history. Force-pushing shared branches or amending merged commits breaks collaborators' clones. Rebase is for private branches only.
- Mega-commits. A 3,000-line "implement feature X" commit is unreviewable and unrevertable. If you can't split it, at least split the message into a real summary + body.
- No link to the why. A fix with no issue reference and no rationale becomes a mystery the next time someone touches that code. Two extra lines now save an hour later.
04 同仓库更多 Skills
web-scrape
Turn web pages into LLM-ready markdown via the Firecrawl API (renders JS, anti-bot handling). Use when browser_open/fetch fails on JS-heavy pages, or when you need clean markdown/structured extraction from a site. Requires FIRECRAWL_API_KEY.
design-taste-frontend
tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One Page Love, Awwwards Sites of the Day). Deals researched directions (idea, composition, type, palette, photographs, section blueprints) from a library, enforces a strict no-slop house style with a real-browser inspector, and runs a look-and-fix loop on screenshots. Use this whenever you build, design, redesign, restyle, polish or review a landing page, marketing site, portfolio, product page, one-pager, hero or any public-facing web page, in any stack (HTML/CSS, React, Next.js, Vue, Svelte, Astro, Tailwind) — also when the user says a page looks generic, templated, "AI-made", sloppy, or asks to make it look designed, premium, award-level or less like every other site. Not for dashboards or app screens.
test-driven-development
Use when implementing any feature or bugfix, before writing implementation code
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
requesting-code-review
Use when completing tasks, implementing major features, or before merging to verify work meets requirements
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).