The Problem
Dani runs a 31-person software company, and the git history reads like a crime scene. The repo has 3,247 commits -- a solid majority of which say things like "fix stuff", "update", "wip final", and "FINALLY WORKS!!!" When production breaks at 2 AM, engineers spend 45 minutes just deciphering what changes might have caused the issue before they can even start debugging.
The math is brutal: 8 engineers averaging 23 commits per week, with roughly 12 minutes wasted per unclear commit trying to understand context. That's 22 hours of engineering time per week -- more than half a full-time salary -- lost to poor commit hygiene. Last month proved the real cost: a 3-hour production outage traced back to a "quick fix" commit from two weeks prior. Nobody could identify what the change was supposed to do without reading the entire diff line by line. Customer impact: $47,000 in lost revenue and 23 support tickets.
Code reviews compound the problem. Reviewers spend more time asking "what does this change do?" than actually reviewing logic. Average PR review time is 6.7 hours from submission to approval -- the target is 2.5. Two-thirds of review comments are requests for clarification rather than technical feedback. New team members take 40% longer to ramp up because the code history tells them nothing.
The Solution
Using the git-commit-pro, code-reviewer, and cicd-pipeline skills, Dani overhauls the team's commit workflow: semantic analysis of staged changes to generate conventional commit messages, automated pre-commit quality checks, CI/CD integration for changelog generation, and a team adoption plan that gets buy-in without slowing anyone down.
Step-by-Step Walkthrough
Step 1: Analyze Staged Changes and Generate a Commit Message
Dani starts with a real change -- the RBAC middleware a senior engineer just finished. Instead of the usual "add auth stuff" commit, the engineer asks the agent to look at what's actually staged:
Analyze my staged changes and generate a conventional commit message that explains what changed and why.
The analysis breaks down every file and its role in the change:
Staged changes detected:
| File | Changes | Purpose |
|---|---|---|
src/auth/middleware.ts | +47, ~12, -3 | Core RBAC permission checking logic |
src/auth/types.ts | +23 (new file) | UserRole and Permission type definitions |
tests/auth/middleware.spec.ts | +89 | 3 test suites, 23 test cases (94% coverage) |
docs/api/authentication.md | ~15 | Updated API docs with RBAC examples |
Change analysis:
- Purpose: Implement role-based access control system
- Scope: Authentication middleware expansion, new type definitions
- Breaking changes: None detected (backward compatible)
- Dependencies: Added
jsonwebtoken@^9.0.0, removed deprecatedauth-helpers
Generated commit message:
feat(auth): implement role-based access control middleware
Add RBAC system with permission checking for route-level authorization.
Includes admin/editor/viewer role hierarchy and configurable permissions.
- Add RoleMiddleware with permission validation logic
- Create UserRole and Permission type definitions
- Implement role hierarchy checking (admin > editor > viewer)
- Add comprehensive test suite with 94% coverage
- Update API documentation with RBAC examples
Closes #156, addresses security requirements from audit
Compare that to "add auth stuff." A reviewer reading this commit message immediately knows the scope, the motivation, and what to look for in the diff. Six months from now, when someone runs git log --grep="RBAC", they'll find exactly this commit.
Step 2: Pre-Commit Quality Validation
Good commit messages describe what changed; pre-commit validation makes sure what changed is actually good. Before the commit goes through, the engineer runs the changes through the code reviewer:
Review the changes before committing to catch potential issues and ensure code quality standards.
The review comes back with a structured assessment:
Quality checks:
- Code style: Follows team ESLint rules, TypeScript strict mode enabled
- Security: No hardcoded secrets, proper input validation, JWT handling is secure
- Performance: O(1) role lookup via Map, minimal overhead on auth pipeline
- Testing: Edge cases covered, mocking strategy appropriate
- Documentation: Consider adding JSDoc comments to public methods (minor)
Issues identified:
auth/middleware.ts:34-- Role permissions are looked up on every request. For high-traffic apps, consider caching the permission map. Not blocking, but worth a follow-up PR.auth/types.ts:12--UserRoleenum could be a string union type for better TypeScript inference. Stylistic, not functional.
Impact analysis:
- 4 files affected, all within the auth module (isolated scope)
- 3 new exports, 0 breaking changes to public API
- +2.3KB bundle size (acceptable for a security feature)
- Less than 1ms overhead per authenticated request
Verdict: Safe to commit. The caching optimization is a good idea but belongs in a separate PR.
This catches the kind of thing that normally surfaces 4 hours into a code review -- or worse, in production.
Step 3: Enforce Conventional Commits Across the Team
One engineer writing good commits doesn't fix the repo. Dani needs the whole team on board. The first step is understanding how bad things actually are:
Ensure all team commits follow conventional format and integrate with CI/CD for automated changelog generation.
An audit of the last 50 commits tells the story:
| Metric | Current State |
|---|---|
| Non-conventional format | 67% ("fix stuff", "update", "wip") |
| Missing scope | 34% (feat: add feature instead of feat(auth): add feature) |
| No body text | 78% (zero context or rationale) |
| No issue references | 89% (can't link changes to requirements) |
The fix is a combination of tooling and team process. Git hooks enforce the standard without requiring willpower:
# .husky/commit-msg
commitlint --edit $1
# commitlint.config.js rules:
# - Type required: feat|fix|docs|style|refactor|perf|test|chore
# - Scope required: component/module (auth, api, ui, db)
# - Subject: imperative mood, under 50 chars, no trailing period
# - Body: wrap at 72 chars, explain the "why"
# - Footer: issue references, breaking change notes
The pre-commit hook validates the message format and runs linting. The commit-msg hook suggests improvements for messages that technically pass but could be clearer. The pre-push hook blocks pushes with non-conventional commits unless explicitly overridden. None of these slow down a developer who's already writing good messages -- they only catch the "fix stuff" commits before they enter the repo.
Step 4: Wire It Into CI/CD
With conventional commits enforced locally, the CI/CD pipeline can now do things that were impossible before:
# .github/workflows/commit-quality.yml
name: Commit Quality Check
on: [pull_request]
jobs:
validate-commits:
runs-on: ubuntu-latest
steps:
- name: Check Commit Messages
run: commitlint --from ${{ github.event.pull_request.base.sha }}
- name: Analyze Change Impact
run: git-commit-pro analyze --pr ${{ github.event.number }}
- name: Generate Preview Changelog
run: conventional-changelog --preset angular --unreleased-only
Automated quality gates: PRs with non-conventional commits get blocked at the CI level. PRs are auto-labeled based on commit types (feat = "enhancement", fix = "bug", docs = "documentation"), which means the project board updates itself.
Release automation: Semantic versioning happens automatically. feat commits bump the minor version, fix commits bump the patch version, feat! (breaking change) bumps the major version. Changelogs generate themselves from commit messages. Release notes pull from commit bodies and link to the relevant issues and PRs.
No more manually maintaining a CHANGELOG.md. No more arguing about version numbers. No more release notes that say "various bug fixes and improvements."
Step 5: Team Adoption Without the Revolt
Tooling enforcement without team buy-in creates resentment. Dani rolls out the change in phases:
Week 1: Share the audit results with the team. The numbers do the convincing -- 22 hours/week lost, $47,000 incident, 6.7-hour review times. No one argues with the data.
Week 2: Install git hooks and provide a conventional commits cheat sheet. The agent generates example messages from actual recent PRs so engineers see what their own changes would look like with proper messages.
Week 3: Enable CI enforcement. By now most engineers are already writing conventional commits because the hooks have been training them for a week.
Week 4: Turn on automated changelogs and release notes. The team sees the payoff -- release day goes from a 2-hour manual process to a single merge.
Progress tracking keeps the momentum going:
| Metric | Before | After 4 Weeks |
|---|---|---|
| Conventional commit adoption | 23% | 91% |
| Average PR review time | 6.7 hours | 2.8 hours |
| Time to identify problematic commits | 45 minutes | 12 minutes |
| Developer satisfaction (git workflow) | 5.2/10 | 8.4/10 |
Real-World Example
Dani's company isn't an outlier. A 40-person SaaS company inherited a codebase with 14,000+ commits, 90% of which were incomprehensible. Production incidents routinely took hours to diagnose because git blame pointed to commits like "updates" and "misc fixes." Code reviews stalled because reviewers had no context. The team was evaluating $18,000/year change management tools to solve the problem.
On Monday, they ran git-commit-pro's audit against their recent history. Seeing concrete examples of what good messages would look like for their actual changes -- not hypothetical ones -- made the case better than any presentation could.
By Tuesday, conventional commit hooks were catching bad messages before they entered the repo. CI/CD integration auto-generated changelogs and labeled PRs by change type. The code-reviewer skill started analyzing changes before commits, catching issues that previously surfaced hours into review cycles.
By Wednesday, reviewers could understand changes from the commit message alone. PRs that previously needed 3 rounds of "what does this do?" clarification were getting approved in a single pass.
Two months later: review velocity improved 73%. Production debugging time dropped 80% because git log and git blame actually told useful stories. The $18,000 change management tool was never purchased. And the thing engineers mention most in retros isn't the time savings -- it's that git stopped being a source of daily frustration and became something that actually helps them work.