safe-commit

⚠️ MANDATORY - YOU MUST invoke this skill when committing. Complete commit workflow with all safety checks. Invokes security-scan, quality-check, and run-tests skills. Shows diff, gets user approval, creates commit with conventional format. NO AI attribution. User approval REQUIRED except during PR creation. NEVER commit manually.

16 stars

Best use case

safe-commit is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

⚠️ MANDATORY - YOU MUST invoke this skill when committing. Complete commit workflow with all safety checks. Invokes security-scan, quality-check, and run-tests skills. Shows diff, gets user approval, creates commit with conventional format. NO AI attribution. User approval REQUIRED except during PR creation. NEVER commit manually.

Teams using safe-commit should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/safe-commit/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/testing-security/safe-commit/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/safe-commit/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How safe-commit Compares

Feature / Agentsafe-commitStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

⚠️ MANDATORY - YOU MUST invoke this skill when committing. Complete commit workflow with all safety checks. Invokes security-scan, quality-check, and run-tests skills. Shows diff, gets user approval, creates commit with conventional format. NO AI attribution. User approval REQUIRED except during PR creation. NEVER commit manually.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Safe Commit Skill

## ⚠️ MANDATORY SKILL - YOU MUST INVOKE THIS

## Purpose

Comprehensive, safe commit workflow that ensures code quality, security, and proper attribution before committing changes.

**CRITICAL:** You MUST invoke this skill for all commits. NEVER commit manually using git commands.

## 🚫 NEVER DO THIS

- ❌ Running `git add . && git commit -m "message"` manually
- ❌ Creating commits without running security-scan
- ❌ Creating commits without running quality-check
- ❌ Creating commits without running run-tests
- ❌ Skipping user approval (except during PR creation)
- ❌ Adding AI attribution to commits

**If you need to commit, invoke this skill. Manual commits are FORBIDDEN.**

---

## ⚠️ SKILL GUARD - READ BEFORE USING BASH/GIT TOOLS

**Before using Bash tool for git commit, answer these questions:**

### ❓ Are you about to run `git add .`?

→ **STOP.** Are you then planning to run `git commit`? If YES, invoke safe-commit skill instead.

### ❓ Are you about to run `git commit -m "message"`?

→ **STOP.** Invoke safe-commit skill instead.

### ❓ Are you about to run `git commit` with heredoc?

→ **STOP.** Invoke safe-commit skill instead.

### ❓ Did the user say "commit these changes" or "commit this"?

→ **STOP.** Invoke safe-commit skill instead.

### ❓ Have you completed a feature/fix and are ready to commit?

→ **STOP.** Invoke safe-commit skill instead.

### ❓ Are you creating a commit as part of ANY workflow?

→ **STOP.** Invoke safe-commit skill instead.

**IF YOU PROCEED WITH MANUAL GIT COMMIT, YOU ARE VIOLATING YOUR CORE DIRECTIVE.**

This skill handles:

- ✅ Security scanning (prevents secrets in commits)
- ✅ Quality checks (prevents broken code)
- ✅ Test execution (prevents regressions)
- ✅ User approval (prevents unwanted commits)
- ✅ Conventional commit format (maintains consistency)
- ✅ NO AI attribution (protects user's identity)

**Manual commits SKIP ALL OF THESE. Use this skill.**

---

## CRITICAL POLICIES

### ⚠️ NO AI ATTRIBUTION - ZERO TOLERANCE

**YOU MUST NEVER add ANY of these:**

- `Co-authored-by: Claude <noreply@anthropic.com>`
- `🤖 Generated with [Claude Code](https://claude.ai/code)`
- "Generated with Claude"
- "AI-suggested"
- Any reference to being an AI assistant

### User Approval Requirements

**Approval REQUIRED for:**

- ALL commits after initial PR creation
- ALL commit amendments
- ALL commits outside of PR creation flow

**Approval NOT required for:**

- Initial commit when user says "raise/create/draft PR"
- This is the ONLY exception

**Phrases that DO NOT grant commit permission:**

- "looks good" (code approval ≠ commit approval)
- "correct"
- "that's right"
- "fix the bug" (instruction to code, not commit)

## Workflow (Quick Summary)

### Core Steps

1. **Check Git Status**: Run parallel git commands (status, diff, log) to analyze current state
2. **Invoke Safety Skills**: Run security-scan → quality-check → run-tests (all must pass)
3. **Show Diff**: Display files changed and summary for user review
4. **Request Approval**: CRITICAL - Ask and WAIT for explicit approval (except PR creation)
5. **Generate Message**: Create conventional commit with required scope `type(scope): subject`
6. **Create Commit**: Stage all changes, commit with heredoc, NO AI attribution
7. **Verify Success**: Confirm commit created, correct files, proper author (Pedro)
8. **Status Check**: Verify working directory clean

### Optional: PRD Task Auto-Update

If commit message contains `[PRD Task N]` or `[Task N]`, automatically update progress tracker in PRD file.

**For detailed workflow with git commands, message examples, and verification steps:**

```
Read `~/.claude/skills/safe-commit/references/WORKFLOW-STEPS.md`
```

Use when: Performing commit, need specific git commands, or want detailed examples

**For PRD task auto-update details:**

```
Read `~/.claude/skills/safe-commit/references/PRD-TASK-UPDATE.md`
```

Use when: Working with PRD tracking or implementing progress automation

**For pre-commit hook handling:**

```
Read `~/.claude/skills/safe-commit/references/PRE-COMMIT-HOOKS.md`
```

Use when: Dealing with hook-modified files or commit amendment scenarios

---

## Integration with Other Skills

This skill invokes:

- **`security-scan`** - Step 2.1
- **`quality-check`** - Step 2.2
- **`run-tests`** - Step 2.3

This skill is invoked by:

- **`create-pr`** - As part of PR creation workflow

---

## Exception: PR Creation Flow

When invoked by `create-pr` skill:

- Skip Step 4 (user approval)
- Proceed directly to commit
- This is the ONLY time auto-commit is allowed

**The `create-pr` skill is only invoked when user explicitly says "raise/create/draft PR"**

---

## Error Handling

### If security scan fails:

```
❌ Cannot commit: Security issues detected

[Details from security-scan skill]

Please fix security issues and try again.
```

### If quality check fails:

```
❌ Cannot commit: Code quality issues detected

[Details from quality-check skill]

Please fix linter/formatter issues and try again.
```

### If tests fail:

```
❌ Cannot commit: Tests failing or coverage below threshold

[Details from run-tests skill]

Please fix failing tests and improve coverage, then try again.
```

### If git commit fails:

```
❌ Commit failed

Error: [git error message]

Possible causes:
- Pre-commit hook failure
- Git configuration issue
- File system permissions

Please investigate and retry.
```

---

## Best Practices

1. **Always run in order** - Security → Quality → Tests → Commit
2. **No skipping checks** - All must pass
3. **Get explicit approval** - Don't assume permission (except PR creation)
4. **Descriptive messages** - Help future you understand why
5. **Proper scopes** - Never omit scope from commit message
6. **Verify attribution** - Always ensure Pedro is sole author
7. **Clean commits** - Stage all changes, commit once

---

## Commit Message Quality Checklist

Before committing, verify message has:

- ✅ Type and scope in format: `type(scope):`
- ✅ Imperative mood in subject
- ✅ Subject ≤ 50 characters
- ✅ Body explains why (if needed)
- ✅ References issues/tickets (if applicable)
- ✅ NO AI attribution anywhere
- ✅ NO Co-authored-by tags

---

## Emergency Override

If user explicitly states "force commit" or "skip checks":

**YOU MUST:**

1. Warn about risks
2. List which checks are being skipped
3. Get explicit re-confirmation
4. Document in commit message what was skipped
5. Create follow-up ticket for remediation

**This should be EXTREMELY RARE.**

Related Skills

conventional-commits

16
from diegosouzapw/awesome-omni-skill

Writes and reviews Conventional Commits commit messages (v1.0.0) to support semantic versioning and automated changelogs. Use when drafting git commit messages, PR titles, release notes, or when enforcing a conventional commit format (type(scope): subject, BREAKING CHANGE, footers, revert).

Conventional Commit Generator

16
from diegosouzapw/awesome-omni-skill

This skill should be used when the user asks to "create a conventional commit", "generate conventional commits", "commit with conventional format", "group my changes for commits", "make a conventional commit message", or mentions "semantic commits", "commitizen", "commit conventions". Analyzes staged and unstaged changes, groups related modifications, and generates properly formatted conventional commit messages with interactive commit grouping options.

committing-staged-with-message

16
from diegosouzapw/awesome-omni-skill

Generate commit message for staged changes, pause for approval, then commit. Stage files first with `git add`, then run this skill.

commit

16
from diegosouzapw/awesome-omni-skill

現在の変更をgit commitする。変更内容を分析し、適切なコミットメッセージを自動生成してコミットを作成する。

commit-validator

16
from diegosouzapw/awesome-omni-skill

Validates commit messages against Conventional Commits specification using programmatic validation. Replaces the git-conventional-commit-messages text file with a tool that provides instant feedback.

AI Safety Auditor

16
from diegosouzapw/awesome-omni-skill

Audit AI systems for safety, bias, and responsible deployment

update-docs-and-commit

16
from diegosouzapw/awesome-omni-skill

Updates documentation files (changelog, architecture, project_status) based on git changes, then stages and commits all changes. Use after completing features or fixes.

deployment-safety

16
from diegosouzapw/awesome-omni-skill

Pre-deployment checklists, rollback strategies, and post-deploy verification. Use this skill when preparing to deploy code, reviewing deployment processes, or setting up CI/CD pipelines.

zoonk-commit

16
from diegosouzapw/awesome-omni-skill

Guidelines for writing commit messages and PR descriptions. Use when creating commits, writing PR descriptions, or asking about commit format.

unsafe-checker

16
from diegosouzapw/awesome-omni-skill

CRITICAL: Use for unsafe Rust code review and FFI. Triggers on: unsafe, raw pointer, FFI, extern, transmute, *mut, *const, union, #[repr(C)], libc, std::ffi, MaybeUninit, NonNull, SAFETY comment, soundness, undefined behavior, UB, safe wrapper, memory layout, bindgen, cbindgen, CString, CStr, 安全抽象, 裸指针, 外部函数接口, 内存布局, 不安全代码, FFI 绑定, 未定义行为

type-safety-validation

16
from diegosouzapw/awesome-omni-skill

End-to-end type safety with Zod, tRPC, Prisma, and TypeScript 5.7+ patterns. Use when creating Zod schemas, setting up tRPC, validating input, implementing exhaustive switch statements, branded types, or type checking with ty.

safety

16
from diegosouzapw/awesome-omni-skill

Git, command, Kubernetes, data, workspace, and temporary files safety rules. Use when committing, pushing, using kubectl, handling multi-repo workspaces, or performing destructive operations.