@vivekcsein-logo
  • Home
  • About
  • Development

    • Web Development
    • Performance & Optimization
    • Backend & APIs
    • Authentication & Security

    Specialized

    • SEO & Ad Monetization
    • AR Experiences
    • Animation
    • Figma to Code
  • Articles
  • Projects
  • Marketplace
  • Contact
@vivekcsein-logo

A portfolio full stack developer with a passion for building scalable and high-performance web applications.

Explore

  • Home
  • About

Services

  • Web Development
  • Backend & APIs
  • Performance Optimization
  • Security & Authentication

Connect

  • Contact
  • Privacy
  • Terms
  • Home
  • About
  • Web Development
  • Backend & APIs
  • Performance Optimization
  • Security & Authentication
  • Contact
  • Privacy
  • Terms

© @vivekcsein. All rights reserved.

  • Home
  • All Articles47
  • Featured
  • Recently Added
  • Most Read
  • Bookmarks
Topics
  • Interview3
  • 3d4
  • Ai Prompts2
  • Business3
  • Deployment1
  • Dev2
    • A Friendly Guide to Conventional Commits
    • Why Authentication Security Is Worth Paying For (and How We Build It)
  • Frontend5
  • Getting Started2
  • Security2
  • Seo2
  • Workflow10
  • Backend1
  • Deployment1
  • Security1
  • Javascript1
  • Client Advisory5
  • Engineering2
Collections
  • Docs
  • Tutorials
  • Resources
  • Articles
“A better developer every single day.”
— Vivek
  1. Docs
  2. Dev
  3. A Friendly Guide to Conventional Commits
Dev

A Friendly Guide to Conventional Commits

A developer-friendly guide explaining Git commit prefixes (feat, fix, chore, style, etc.) with real-world examples and a cheat sheet for better codebase history.

Updated Oct 13, 20264 min read
On this page

On this page

  • 1. Quick Cheat Sheet
  • 2. Standard Commit Structure
  • Examples with Scopes & Bodies
  • 3. Real-World Developer Scenarios
  • 🛠️ Installing or Updating Dependencies
  • 🎨 Creating Drafts, Templates & UI
  • 🧹 Formatting, Linting & Verification
  • 🗄️ Database & Environment Settings
  • ⚡ Performance & Testing
  • 4. Enforcing Rules in a Node.js Project
  • Step 1: Install Dev Dependencies
  • Step 2: Create the Commitlint Configuration File
  • Step 3: Set Up Husky Git Hooks
  • 5. Pro-Tips for Better Commit History

Using a standard format for your Git commit messages helps you and your team quickly scan project history, understand changes at a glance, and automate releases.

This guide breaks down commit message conventions into simple, practical, and human-readable patterns you can use in your day-to-day workflow, including how to enforce them automatically in a Node.js project.


1. Quick Cheat Sheet#

PrefixWhen to use itExample
featAdding a new user-facing feature or capabilityfeat: add Google login option
fixResolving a bug or unexpected behaviorfix: resolve crash on checkout page
choreMaintenance, tooling updates, or configschore: update react to v18
docsDocumentation changes onlydocs: update setup steps in README
styleCode formatting (spacing, quotes, semicolons)style: run prettier on source files
refactorRestructuring code without changing behaviorrefactor: simplify user auth logic
perfCode changes that specifically improve speedperf: optimize image loading
testAdding or updating unit/e2e teststest: add unit test for payment handler
ciUpdating CI/CD pipelines or GitHub Actionsci: add automated PR check workflow
buildBuild system or external dependency changesbuild: add production build command
revertUndoing a previous commitrevert: undo dark mode commit

2. Standard Commit Structure#

A standard Conventional Commit message follows this structure:

text
<type>(<scope>): <short description>

[optional detailed description body]

[optional footer(s)]

Examples with Scopes & Bodies#

Adding a Feature#

text
feat(auth): add multi-factor authentication

- Add SMS verification code inputs
- Integrate Twilio API service

Fixing a Bug with Code Cleanup#

text
fix(checkout): resolve discount calculation bug

- Fix logic causing incorrect total calculation
- Remove obsolete helper functions and unused files

3. Real-World Developer Scenarios#

Here is how to handle common daily tasks with clear commit messages:

🛠️ Installing or Updating Dependencies#

When adding packages (e.g., knip, tailwindcss, lodash):

  • chore(deps): add knip to devDependencies
  • build(deps): upgrade react to v18.3.0

🎨 Creating Drafts, Templates & UI#

  • Project Scaffolding: chore: add initial project boilerplate template
  • Process Templates: docs(github): add PR and issue templates
  • Frontend UI Features: feat(ui): add basic navigation bar and user profile layout

🧹 Formatting, Linting & Verification#

When running npm run format, lint:fix, or running test suites across the project:

  • style: format and lint fix codebase
  • chore: run lint:fix and codebase verification

🗄️ Database & Environment Settings#

  • chore: update .env.example with new API keys
  • feat(db): add user_preferences table migration

⚡ Performance & Testing#

  • perf(ui): lazy load heavy image components
  • test(auth): add unit tests for token expiration logic

4. Enforcing Rules in a Node.js Project#

To prevent team members or yourself from accidentally writing invalid commit messages, you can automate validation using Commitlint and Husky.

Step 1: Install Dev Dependencies#

Install the required CLI and conventional configuration package as development dependencies:

bash
npm install --save-dev @commitlint/cli @commitlint/config-conventional husky

Step 2: Create the Commitlint Configuration File#

Create a file named commitlint.config.js in your project root directory. This config enforces your accepted prefix types and ensures subjects are written in lowercase:

javascript
/** @type {import('@commitlint/types').UserConfig} */
module.exports = {
  extends: ["@commitlint/config-conventional"],
  rules: {
    "type-enum": [
      2,
      "always",
      [
        "feat",
        "fix",
        "docs",
        "style",
        "refactor",
        "perf",
        "test",
        "build",
        "ci",
        "chore",
        "revert",
      ],
    ],
    "subject-case": [2, "never", ["upper-case", "pascal-case"]],
  },
};

Step 3: Set Up Husky Git Hooks#

Initialize Husky so it triggers automatically when you run git commit:

bash
npx husky init

This creates a .husky folder. Next, configure the commit-msg hook to validate every commit message against your rules:

bash
echo "npx --no -- commitlint --edit \$1" > .husky/commit-msg

Now, any time someone tries to commit with a bad message like fixed the bug, Git will block the commit and display your rules!


5. Pro-Tips for Better Commit History#

  1. Focus on Primary Intent: If a commit fixes a bug AND deletes dead code, use fix as the prefix and mention the file deletion in the commit body.
  2. Consider Splitting Commits: When possible, keep functional fixes in one commit (fix:...) and cleanup in a separate commit (chore:...).
  3. Use Breaking Change Flags: If an API change breaks backward compatibility, add ! after the prefix:
    • feat(api)!: remove deprecated v1 user endpoints
Next Why Authentication Security Is Worth Paying For (and How We Build It)

Keep reading

  • Dev

    Why Authentication Security Is Worth Paying For (and How We Build It)

    A client-facing business case for a hardened authentication backend, plus the step-by-step roadmap we follow to build it: shared rate limiting, key rotation, multi-factor sign-in and verifiable security.

    7 min read·Oct 13, 2026
  • Workflow

    Stage 2 — Professional Development Environment

    Set up Biome, Husky, lint-staged and Conventional Commits so formatting, linting and import order are enforced automatically on every commit.

    3 min read·Oct 2, 2026
  • Workflow

    Stage 1 — Project Initialization

    Create the Next.js app every later stage builds on: App Router, TypeScript, Tailwind CSS, Biome, Bun and Turbopack, verified and running locally.

    2 min read·Oct 2, 2026

On this page

  • 1. Quick Cheat Sheet
  • 2. Standard Commit Structure
  • Examples with Scopes & Bodies
  • 3. Real-World Developer Scenarios
  • 🛠️ Installing or Updating Dependencies
  • 🎨 Creating Drafts, Templates & UI
  • 🧹 Formatting, Linting & Verification
  • 🗄️ Database & Environment Settings
  • ⚡ Performance & Testing
  • 4. Enforcing Rules in a Node.js Project
  • Step 1: Install Dev Dependencies
  • Step 2: Create the Commitlint Configuration File
  • Step 3: Set Up Husky Git Hooks
  • 5. Pro-Tips for Better Commit History