Add commit

From brabos-ai/code-addiction · View interactive version

Add commit is an AI agent skill from the GitHub repository brabos-ai/code-addiction. Use when committing changes mid-workflow with smart message generation. Triggers: commit, git commit, salvar progresso, checkpoint, conventional commits, push changes, commitar, fazer commit.

How to use this skill

Skill file

add-commit — Smart Commit

<!-- uses:

-->

Smart commit for mid-workflow progress: analyzes the changeset and generates a Conventional Commits message adapted to the number of files changed.

When to Use

When NOT to Use

Adaptive Message Logic

The message format adapts to changeset size:

≤ 3 files changed — single-line message:

type(scope): objective description in present tense

> 3 files changed — list format:

type: general summary

- context/module: what changed
- context/module: what changed
- context/module: what changed

Conventional Commits Type Detection

Infer the type from the diff content:

| Type | When to use |

|------|-------------|

| feat | New feature, new functionality |

| fix | Bug fix, error correction |

| refactor | Code restructure without behavior change |

| chore | Config, deps, scripts, tooling |

| docs | Documentation only |

| test | Test files only |

| style | Formatting, whitespace, lint fixes |

When ambiguous, show the inferred type and ask the user to confirm, as one numbered item with a RECOMMENDED line (add-interaction).

Execution Flow

STEP 1 — Analyze changeset:

git status --short

Count ALL lines in the output as N — this includes:

Then read diff content to understand what changed:

git diff HEAD               # unstaged tracked changes
git diff --cached HEAD      # staged changes
git status --short          # untracked file names (use paths for context)

STEP 2 — Infer commit type and scope:

Based on diff content, determine the Conventional Commits type.

Scope = the main module/directory affected (optional, use when clear).

STEP 3 — Generate message:

Apply adaptive logic (≤ 3 vs > 3 files).

STEP 4 — Handle staging:

⚠️ Security check (ALWAYS — even with --silent):

If .env, *.key, secrets.*, *.pem, *.p12 appear in the output of git status --short, STOP and warn — never auto-stage sensitive files silently.

⚠️ Sensitive files detected: [list files]
Remove them from the changeset or add to .gitignore before proceeding.

STEP 5 — Commit:

git commit -m "generated message"

STEP 6 — Push (if --push flag):

git push

Examples

Few files (≤ 3):

feat(auth): add JWT refresh token endpoint

Many files (> 3):

refactor: extract service layer from controllers

- auth: move login/register logic to AuthService
- user: extract UserService from UserController
- order: decouple OrderService dependencies
- shared: add BaseService abstract class

Rules

ALWAYS:

NEVER:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.