.fyi
SkillsMCPPluginsSubagents

Browse by category

DevOps & CI/CD SkillsProductivity & Workflow SkillsOther SkillsProduct & Project Management SkillsDocumentation & Knowledge SkillsCode Review & Refactor SkillsBackend & APIs SkillsAgent Meta & Communication SkillsResearch SkillsSecurity SkillsUX UI & Design SkillsTesting & QA SkillsSee all →

Every Claude Code skill, MCP server, plugin and subagent in one directory. Searchable, comparable, and one command from installed. Live stats from GitHub, npm and PyPI.

We're on Product HuntYour agent's app storeCheck it out →
Agent SkillsMCP ServersPluginsSubagentsCoding Agents
CollectionsOfficial publishersGlossaryFAQBlogSearchSavedFeedback
PrivacyTermsllms.txtSitemap

made with ♥ · © 2026 aaaa.fyi

Independent project · real data from public registries

…/agent-skills/git-workflow-and-versioning
home/skills/addyosmani/agent-skills/git-workflow-and-versioning
addyosmani avatar

git-workflow-and-versioning

byaddyosmani· 31 skills

Installs

15k

Stars

80k

Forks

8.7k

Category

Code Review & Refactor

View on GitHub

TL;DR

Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams. Use when cutting a release, choosing a semantic version bump, tagging, or writing a changelog.

How to install git-workflow-and-versioning?

addyosmani/agent-skills/git-workflow-and-versioning
$npx -y skills add addyosmani/agent-skills --skill git-workflow-and-versioning

Installs into the current project.

›Prefer a prompt? Paste this to your agent

Use this skill

Run `npx skills use "https://github.com/addyosmani/agent-skills" --skill "addyosmani/agent-skills/git-workflow-and-versioning"` and follow the generated skill instructions now. Read its complete output, redirecting it to a temporary file first if necessary. Resolve relative paths from the supporting-files directory it provides.

Use the whole pack

Use the skills in "https://github.com/addyosmani/agent-skills" that are relevant to the current task. Run `npx skills add "https://github.com/addyosmani/agent-skills"` and select the relevant skills, then follow their instructions.

Files · 1

View on GitHub
SKILL.md
1# Git Workflow and Versioning
2 
3## Overview
4 
5Git is your safety net. Treat commits as save points, branches as sandboxes, and history as documentation. With AI agents generating code at high speed, disciplined version control is the mechanism that keeps changes manageable, reviewable, and reversible.
6 
7## When to Use
8 
9Always. Every code change flows through git.
10 
11## Core Principles
12 
13### Trunk-Based Development (Recommended)
14 
15Keep `main` always deployable. Work in short-lived feature branches that merge back within 1-3 days. Long-lived development branches are hidden costs — they diverge, create merge conflicts, and delay integration. DORA research consistently shows trunk-based development correlates with high-performing engineering teams.
16 
17```
18main ──●──●──●──●──●──●──●──●──●── (always deployable)
19 ╲ ╱ ╲ ╱
20 ●──●─╱ ●──╱ ← short-lived feature branches (1-3 days)
21```
22 
23This is the recommended default. Teams using gitflow or long-lived branches can adapt the principles (atomic commits, small changes, descriptive messages) to their branching model — the commit discipline matters more than the specific branching strategy.
24 
25- **Dev branches are costs.** Every day a branch lives, it accumulates merge risk.
26- **Release branches are acceptable.** When you need to stabilize a release while main moves forward.
27- **Feature flags > long branches.** Prefer deploying incomplete work behind flags rather than keeping it on a branch for weeks.
28 
29### 1. Commit Early, Commit Often
30 
31Each successful increment gets its own commit. Don't accumulate large uncommitted changes.
32 
33```
34Work pattern:
35 Implement slice → Test → Verify → Commit → Next slice
36 
37Not this:
38 Implement everything → Hope it works → Giant commit
39```
40 
41Commits are save points. If the next change breaks something, you can revert to the last known-good state instantly.
42 
43### 2. Atomic Commits
44 
45Each commit does one logical thing:
46 
47```
48# Good: Each commit is self-contained
49git log --oneline
50a1b2c3d Add task creation endpoint with validation
51d4e5f6g Add task creation form component
52h7i8j9k Connect form to API and add loading state
53m1n2o3p Add task creation tests (unit + integration)
54 
55# Bad: Everything mixed together
56git log --oneline
57x1y2z3a Add task feature, fix sidebar, update deps, refactor utils
58```
59 
60### 3. Descriptive Messages
61 
62Commit messages explain the *why*, not just the *what*:
63 
64```
65# Good: Explains intent
66feat: add email validation to registration endpoint
67 
68Prevents invalid email formats from reaching the database.
69Uses Zod schema validation at the route handler level,
70consistent with existing validation patterns in auth.ts.
71 
72# Bad: Describes what's obvious from the diff
73update auth.ts
74```
75 
76**Format:**
77```
78<type>: <short description>
79 
80<optional body explaining why, not what>
81```
82 
83**Types:**
84- `feat` — New feature
85- `fix` — Bug fix
86- `refactor` — Code change that neither fixes a bug nor adds a feature
87- `test` — Adding or updating tests
88- `docs` — Documentation only
89- `chore` — Tooling, dependencies, config
90 
91### 4. Keep Concerns Separate
92 
93Don't combine formatting changes with behavior changes. Don't combine refactors with features. Each type of change should be a separate commit — and ideally a separate PR:
94 
95```
96# Good: Separate concerns
97git commit -m "refactor: extract validation logic to shared utility"
98git commit -m "feat: add phone number validation to registration"
99 
100# Bad: Mixed concerns
101git commit -m "refactor validation and add phone number field"
102```
103 
104**Separate refactoring from feature work.** A refactoring change and a feature change are two different changes — submit them separately. This makes each change easier to review, revert, and understand in history. Small cleanups (renaming a variable) can be included in a feature commit at reviewer discretion.
105 
106### 5. Size Your Changes
107 
108Target ~100 lines per commit/PR. Changes over ~1000 lines should be split. See the splitting strategies in `code-review-and-quality` for how to break down large changes.
109 
110```
111~100 lines → Easy to review, easy to revert
112~300 lines → Acceptable for a single logical change
113~1000 lines → Split into smaller changes
114```
115 
116## Branching Strategy
117 
118### Feature Branches
119 
120```
121main (always deployable)
122 │
123 ├── feature/task-creation ← One feature per branch
124 ├── feature/user-settings ← Parallel work
125 └── fix/duplicate-tasks ← Bug fixes
126```
127 
128- Branch from `main` (or the team's default branch)
129- Keep branches short-lived (merge within 1-3 days) — long-lived branches are hidden costs
130- Delete branches after merge
131- Prefer feature flags over long-lived branches for incomplete features
132 
133### Branch Naming
134 
135```
136feature/<short-description> → feature/task-creation
137fix/<short-description> → fix/duplicate-tasks
138chore/<short-description> → chore/update-deps
139refactor/<short-description> → refactor/auth-module
140```
141 
142## Working with Worktrees
143 
144For parallel AI agent work, use git worktrees to run multiple branches simultaneously:
145 
146```bash
147# Create a worktree for a feature branch
148git worktree add ../project-feature-a feature/task-creation
149git worktree add ../project-feature-b feature/user-settings
150 
151# Each worktree is a separate directory with its own branch
152# Agents can work in parallel without interfering
153ls ../
154 project/ ← main branch
155 project-feature-a/ ← task-creation branch
156 project-feature-b/ ← user-settings branch
157 
158# When done, merge and clean up
159git worktree remove ../project-feature-a
160```
161 
162Benefits:
163- Multiple agents can work on different features simultaneously
164- No branch switching needed (each directory has its own branch)
165- If one experiment fails, delete the worktree — nothing is lost
166- Changes are isolated until explicitly merged
167 
168## The Save Point Pattern
169 
170```
171Agent starts work
172 │
173 ├── Makes a change
174 │ ├── Test passes? → Commit → Continue
175 │ └── Test fails? → Revert to last commit → Investigate
176 │
177 ├── Makes another change
178 │ ├── Test passes? → Commit → Continue
179 │ └── Test fails? → Revert to last commit → Investigate
180 │
181 └── Feature complete → All commits form a clean history
182```
183 
184This pattern means you never lose more than one increment of work. If an agent goes off the rails, `git reset --hard HEAD` takes you back to the last successful state.
185 
186## Change Summaries
187 
188After any modification, provide a structured summary. This makes review easier, documents scope discipline, and surfaces unintended changes:
189 
190```
191CHANGES MADE:
192- src/routes/tasks.ts: Added validation middleware to POST endpoint
193- src/lib/validation.ts: Added TaskCreateSchema using Zod
194 
195THINGS I DIDN'T TOUCH (intentionally):
196- src/routes/auth.ts: Has similar validation gap but out of scope
197- src/middleware/error.ts: Error format could be improved (separate task)
198 
199POTENTIAL CONCERNS:
200- The Zod schema is strict — rejects extra fields. Confirm this is desired.
201- Added zod as a dependency (72KB gzipped) — already in package.json
202```
203 
204This pattern catches wrong assumptions early and gives reviewers a clear map of the change. The "DIDN'T TOUCH" section is especially important — it shows you exercised scope discipline and didn't go on an unsolicited renovation.
205 
206## Pre-Commit Hygiene
207 
208Before every commit:
209 
210```bash
211# 1. Check what you're about to commit
212git diff --staged
213 
214# 2. Ensure no secrets
215git diff --staged | grep -i "password\|secret\|api_key\|token"
216 
217# 3. Run tests
218npm test
219 
220# 4. Run linting
221npm run lint
222 
223# 5. Run type checking
224npx tsc --noEmit
225```
226 
227Automate this with git hooks:
228 
229```json
230// package.json (using lint-staged + husky)
231{
232 "lint-staged": {
233 "*.{ts,tsx}": ["eslint --fix", "prettier --write"],
234 "*.{json,md}": ["prettier --write"]
235 }
236}
237```
238 
239## Handling Generated Files
240 
241- **Commit generated files** only if the project expects them (e.g., `package-lock.json`, Prisma migrations)
242- **Don't commit** build output (`dist/`, `.next/`), environment files (`.env`), or IDE config (`.vscode/settings.json` unless shared)
243- **Have a `.gitignore`** that covers: `node_modules/`, `dist/`, `.env`, `.env.local`, `*.pem`
244 
245## Using Git for Debugging
246 
247```bash
248# Find which commit introduced a bug
249git bisect start
250git bisect bad HEAD
251git bisect good <known-good-commit>
252# Git checkouts midpoints; run your test at each to narrow down
253 
254# View what changed recently
255git log --oneline -20
256git diff HEAD~5..HEAD -- src/
257 
258# Find who last changed a specific line
259git blame src/services/task.ts
260 
261# Search commit messages for a keyword
262git log --grep="validation" --oneline
263```
264 
265## Release & Versioning
266 
267Commits are how *you* track change; a **version** is how your *consumers* track it. The moment anything else depends on your code — another team, a published package, a deployed client — "latest on main" stops being a sufficient answer to "what am I running, and is it safe to upgrade?" A version number and a changelog are the contract that answers it.
268 
269### Semantic Versioning
270 
271For anything with consumers, version `MAJOR.MINOR.PATCH` and let the number carry meaning:
272 
273```
274 MAJOR breaking change — consumers must change their code to upgrade
275 MINOR new functionality, backward-compatible — safe to upgrade
276 PATCH bug fix, backward-compatible — safe to upgrade
277```
278 
279The number is a promise, so make the code match it. A "patch" that changes behavior consumers relied on is a major change wearing a disguise (Hyrum's Law — see the `api-and-interface-design` skill). When unsure whether a change is breaking, assume it is; a surprise major is far cheaper than a broken consumer.
280 
281### Tag the release, and let the tag be the source of truth
282 
283A release is an immutable point in history, not a moving branch. Tag it so it can always be reproduced:
284 
285```bash
286git tag -a v1.4.0 -m "Release 1.4.0"
287git push origin v1.4.0
288```
289 
290Derive the version from the tag rather than hand-editing it in scattered files, so the artifact, the tag, and the changelog can never disagree.
291 
292### Keep a changelog written for humans
293 
294A changelog is not `git log`. It's the curated, consumer-facing answer to "what changed and do I care?" — grouped by `Added / Changed / Fixed / Deprecated / Removed / Security`, newest on top, every entry phrased around user impact, not internal mechanics.
295 
296```markdown
297## [1.4.0] - 2025-06-12
298### Added
299- Bulk task import via CSV
300### Fixed
301- Timezone drift in recurring task due dates
302### Deprecated
303- `GET /v1/tasks/all` — use the paginated `GET /v1/tasks` (removal in 2.0)
304```
305 
306Write the entry in the same change that makes the change, while the impact is fresh — not reconstructed from commit archaeology at release time. Breaking changes get a migration note and a deprecation window (follow the `deprecation-and-migration` skill); shipping the actual release is the `shipping-and-launch` skill's job — this section is the versioning contract that feeds it.
307 
308## Common Rationalizations
309 
310| Rationalization | Reality |
311|---|---|
312| "I'll commit when the feature is done" | One giant commit is impossible to review, debug, or revert. Commit each slice. |
313| "The message doesn't matter" | Messages are documentation. Future you (and future agents) will need to understand what changed and why. |
314| "I'll squash it all later" | Squashing destroys the development narrative. Prefer clean incremental commits from the start. |
315| "Branches add overhead" | Short-lived branches are free and prevent conflicting work from colliding. Long-lived branches are the problem — merge within 1-3 days. |
316| "I'll split this change later" | Large changes are harder to review, riskier to deploy, and harder to revert. Split before submitting, not after. |
317| "I don't need a .gitignore" | Until `.env` with production secrets gets committed. Set it up immediately. |
318| "It's just a small fix, bump the patch" | Check what consumers can observe. A behavior change they relied on is a major, whatever the diff size. |
319| "The changelog is just the commit log" | Commits are for you; the changelog is for consumers, curated by impact. Generating one from raw commits buries what matters. |
320| "We'll write the changelog at release time" | By then the impact is reconstructed from memory and half of it is missing. Write the entry with the change. |
321 
322## Red Flags
323 
324- Large uncommitted changes accumulating
325- Commit messages like "fix", "update", "misc"
326- Formatting changes mixed with behavior changes
327- No `.gitignore` in the project
328- Committing `node_modules/`, `.env`, or build artifacts
329- Long-lived branches that diverge significantly from main
330- Force-pushing to shared branches
331- A breaking change shipped under a minor or patch version bump
332- A release with no tag, or a version number hand-edited out of sync with the tag
333- A user-facing release with no changelog entry, or a changelog that's just dumped commit messages
334 
335## Verification
336 
337For every commit:
338 
339- [ ] Commit does one logical thing
340- [ ] Message explains the why, follows type conventions
341- [ ] Tests pass before committing
342- [ ] No secrets in the diff
343- [ ] No formatting-only changes mixed with behavior changes
344- [ ] `.gitignore` covers standard exclusions
345 
346For every release (anything with consumers):
347 
348- [ ] The version bump matches the change: breaking → major, additive → minor, fix → patch
349- [ ] The release is tagged, and the version is derived from the tag, not hand-edited out of sync
350- [ ] The changelog has a curated, human-readable entry grouped by impact for this version

Security

Review

  • Gen Agent Trust Hubpass
  • Socketpass
  • Snykpass
  • Runlayerwarn
  • ZeroLeakspass

Preview

addyosmani/agent-skillsaddyosmani/agent-skills

$ npx -y skills add addyosmani/agent-skills --skill git-workflow-and-versioning

▸ installing to .claude/skills…

✓ git-workflow-and-versioning ready

Repoaddyosmani/agent-skills
TypeSkills
CategoryCode Review & Refactor
ForDeveloper
UpdatedJul 2026
License—
First seenJul 26, 2026

Tags

Skill

Related

6 picks
Type
  1. mattpocock avatarimprove-codebase-architectureScan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.SkillsJul 2026566k189k
  2. mattpocock avatardomain-modelingBuild and sharpen a project's domain model. Use when the user wants to pin down domain terminology or a ubiquitous language, record an architectural decision,…SkillsJul 2026275k189k
  3. juliusbrussee avatarcaveman-reviewUltra-compressed code review comments. Cuts noise from PR feedback while preserving the actionable signal. Each comment is one line: location, problem, fix.SkillsJul 2026270k93k
  4. mattpocock avatarcodebase-designShared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a…SkillsJul 2026266k189k
  5. mattpocock avatarcode-reviewReview the changes since a fixed point (commit, branch, tag, or merge-base) along two axes — Standards (does the code follow this repo's documented coding…SkillsJul 2026201k189k
  6. mattpocock avatarresolving-merge-conflictsUse when you need to resolve an in-progress git merge/rebase conflict.SkillsJul 2026183k189k