Get the FREE Ultimate OpenClaw Setup Guide →

committing-code

npx machina-cli add skill oryanmoshe/agent-skills/committing-code --openclaw
Files (1)
SKILL.md
3.7 KB

Committing Code

Overview

Every commit message uses conventional commits with gitmoji. The format is consistent, scannable, and conveys intent at a glance.

Format

<emoji> <type>: <short description>

<body — what changed and why>

Co-Authored-By: Claude <agent> <noreply@anthropic.com>

The short description is imperative mood, lowercase, no period. The body uses bullet points for multiple changes.

Gitmoji Reference

EmojiTypeWhen to use
šŸŽ‰featInitial commit / first commit in a repo
✨featNew feature or capability
šŸ›fixBug fix
ā™»ļørefactorCode restructuring without behavior change
šŸ“docsDocumentation only
šŸ”§choreConfig, tooling, non-code changes
āœ…testAdding or updating tests
šŸš€perfPerformance improvement
šŸ”„choreRemoving code or files
šŸ—ļørefactorArchitectural change
šŸ’„styleUI/cosmetic change
šŸ”’securitySecurity fix
ā¬†ļøchoreDependency upgrade
🚚refactorMoving or renaming files

Examples

Good:

✨ feat: add user authentication with JWT

- Add login/logout endpoints in auth.controller.ts
- Add JWT middleware for protected routes
- Add refresh token rotation
- Add auth integration tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
šŸ› fix: prevent race condition in websocket reconnect

The reconnect logic was firing multiple times when the connection
dropped during a message send, causing duplicate subscriptions.
Added a mutex guard around the reconnect path.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
ā™»ļø refactor: rename getUserById to fetchUser across codebase

Aligns with the fetch* naming convention for async data access.
Updated all call sites, tests, and type definitions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Bad:

updated stuff          # No type, no emoji, vague
feat: Add Feature      # No emoji, capitalized
✨ feat: add feature.  # Trailing period
šŸ›āœØ fix/feat: stuff   # Multiple types

Rules

  1. One type per commit. If changes span multiple types, split into multiple commits.
  2. Body explains WHY, not just WHAT. The diff shows what changed — the message explains the reasoning.
  3. Use bullet points in the body when listing multiple changes.
  4. Always include Co-Authored-By when the commit was AI-assisted.
  5. Use HEREDOC for multi-line messages to preserve formatting:
    git commit -m "$(cat <<'EOF'
    ✨ feat: add new feature
    
    Body text here.
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
    EOF
    )"
    

Commit Frequency

Commit early and often:

  • After each logical unit of work (one feature, one fix, one refactor)
  • After adding a new file or skill
  • After updating documentation alongside code changes
  • Never batch unrelated changes into a single commit

Pre-Commit Checklist

Before committing, verify:

  • README.md is updated if the change affects user-facing documentation (new features, skills, APIs, installation steps)
  • AGENTS.md is updated if the change affects project structure, conventions, or available skills
  • Documentation changes are part of the same commit as the code they describe — not a separate "docs" commit after the fact

Source

git clone https://github.com/oryanmoshe/agent-skills/blob/main/skills/committing-code/SKILL.mdView on GitHub

Overview

Every commit message uses conventional commits with gitmoji for clarity and consistency. Messages follow the emoji-type subject format, with a body listing changes and rationale, and always include Co-Authored-By when AI-assisted.

How This Skill Works

Technically, the skill maps code changes to a conventional commit skeleton by selecting an emoji and type (feat, fix, docs, etc.), then prompts for a concise subject in imperative mood. The body uses bullet points to explain what changed and why, and a Co-Authored-By line is appended when AI-assisted; multi-line messages are preserved with a HEREDOC.

When to Use It

  • When committing after completing a logical unit of work (feature, bug fix, or refactor).
  • When adding a new feature or capability that should be discoverable by type (feat).
  • When fixing a bug and documenting the reasoning in the body (fix).
  • When updating documentation or configuration related to code (docs).
  • When preparing an initial commit or a release-related change (initial, chore upgrades, etc.).

Quick Start

  1. Step 1: Decide the emoji and type that best match the change (e.g., ✨ feat for a new feature).
  2. Step 2: Write a concise subject in lowercase with no period, e.g., '✨ feat: add user login flow'.
  3. Step 3: Use a HEREDOC-based git commit to include a multi-line body and Co-Authored-By line, e.g., git commit -m "$(cat <<'EOF' ... EOF)".

Best Practices

  • Use only one type per commit; if changes span multiple intents, split into separate commits.
  • Write the body to explain WHY the change was made, not just WHAT.
  • Bullet point multiple changes in the body for readability.
  • Always include Co-Authored-By when the commit was AI-assisted.
  • Use HEREDOC formatting to preserve newlines and spacing in the commit message.

Example Use Cases

  • ✨ feat: add user authentication with JWT - Add login/logout endpoints in auth.controller.ts - Add JWT middleware for protected routes - Add refresh token rotation - Add auth integration tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
  • šŸ› fix: prevent race condition in websocket reconnect - Debounce reconnect attempts - Add mutex guard around reconnect path - Update related tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
  • ā™»ļø refactor: rename getUserById to fetchUser across codebase - Align naming with fetch* conventions - Update call sites, tests, and types Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
  • šŸ“ docs: add contributing guide - Document commit conventions and gitmoji - Explain Co-Authored-By policy Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
  • āœ… test: update unit tests for auth flow - Add coverage for token refresh - Update mocks - Improve test reliability Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers ↗