Back to skills
SkillHub ClubShip Full StackFull Stack

commit

Imported from https://github.com/fohte/dotfiles.

Packaged view

This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.

Stars
1
Hot score
77
Updated
March 20, 2026
Overall rating
C2.8
Composite score
2.8
Best-practice grade
B77.6

Install command

npx @skill-hub/cli install fohte-dotfiles-commit

Repository

fohte/dotfiles

Skill path: config/claude/skills/commit

Imported from https://github.com/fohte/dotfiles.

Open repository

Best for

Primary workflow: Ship Full Stack.

Technical facets: Full Stack.

Target audience: everyone.

License: Unknown.

Original source

Catalog source: SkillHub Club.

Repository owner: fohte.

This is still a mirrored public skill entry. Review the repository before installing into production workflows.

What it helps with

  • Install commit into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
  • Review https://github.com/fohte/dotfiles before adding commit to shared team environments
  • Use commit for development workflows

Works across

Claude CodeCodex CLIGemini CLIOpenCode

Favorites: 0.

Sub-skills: 0.

Aggregator: No.

Original source / Raw SKILL.md

---
name: commit
description: Use this skill when committing changes. This skill enforces writing meaningful commit messages with both Why and What sections, and provides Git workflow guidelines.
---

# Commit

このスキルはコミットのワークフロー全体をカバーする。

## 絶対禁止事項

- **`git commit --amend` は禁止**: 履歴を直線的に保つため
- **`git reset --soft|hard` は禁止**: 変更の巻き戻しは行わない
- **一行だけの what コミットは禁止**: 必ず Why を記述する
- **会話中に作業していない変更をコミットすることは禁止**: `git status` で表示された変更であっても、その会話セッション中に自分が行った変更のみをコミットすること。関係のない変更が存在する場合は無視する
- **GitHub の Issue/PR 参照は禁止**: `Closes #123`、`Fixes #123`、`https://github.com/.../issues/123`、`https://github.com/.../pull/123` などの issue/PR 参照は一切記載しない。OSS の issue や PR にリンクされることを避けるため

## コミットの粒度

- 論理的なチェックポイントでコミットすること
- 1 つの機能、1 つの修正、または 1 つのまとまった変更につき 1 コミット
- 複数の独立した変更を 1 コミットにまとめない

## コミットメッセージフォーマット

```
<scope>: <subject>

<body>
```

### Subject line (1 行目)

- **スコープ**: 変更対象の設定ディレクトリを指定 (例: `zsh`, `nvim`, `tmux`, `bin`)
    - 機能単位やスクリプト名で細分化可能 (例: `zsh/history`, `nvim/cmp`, `bin/tmux-session-fzf`)
    - 複数スコープの場合は `, ` で区切る (例: `claude, bin`)
- **説明**: 小文字で始まり、現在形の命令形を使用 (例: `add`, `fix`, `refactor`, `update`, `remove`)
- **問題を解決する場合**: 「何をした」ではなく「何を直した」を書く
    - Good: `fix EDITOR being set to "nvim not found"`
    - Bad: `simplify EDITOR to use nvim directly`

### Body (2 行目以降)

**必須**。空行を挟んで Why と What を記述する。

- **Why**: なぜこの変更が必要なのか。問題の原因、背景、動機を説明
- **What** (任意): 変更内容の詳細。subject だけで十分に説明できている場合は省略可

## 良い例

```
zsh: fix EDITOR being set to "nvim not found"

`$(which nvim)` was executed before mise initialized PATH, causing
`which nvim` to output "nvim not found" which was then set as EDITOR.
This broke git rebase -i by opening "not" and "found" as files.
```

```
tmux: add visual distinction for inactive panes

In multi-pane layouts, it was difficult to identify which pane was
active. Add dimmed styling to inactive panes to make the active pane
more obvious.
```

```
nvim/cmp: disable completion in comment contexts

Autocompletion in comments was triggering unnecessarily and
interrupting the writing flow.
```

## 悪い例

```
zsh: simplify EDITOR to use nvim directly
```

- 問題: Why がない。なぜ simplify が必要だったのか不明

```
zsh: update vim.zsh
```

- 問題: 何をしたのか分からない。body もない

```
fix bug
```

- 問題: scope がない。何のバグか分からない。body もない

## コミット手順

1. `git status` で変更内容を確認
2. `git diff` でステージング前の差分を確認
3. `git log --oneline -5` で最近のコミットスタイルを確認
4. 変更を add してコミット (HEREDOC を使用してフォーマットを保持):

```bash
git add <files>
git commit -m "$(cat <<'EOF'
<scope>: <subject>

<body - Why と What を記述>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
EOF
)"
```

5. `git status` で成功を確認

## pre-commit フック

- フックが失敗した場合: 問題を修正し、**元のメッセージを使用して**再度コミット
- フックがファイルを変更した場合 (フォーマッタなど): 変更されたファイルを add して再度コミット

## セルフチェック

コミット前に以下を確認:

1. Why が書かれているか?
2. Subject は「何を直した」になっているか? (問題解決の場合)
3. 1 つの論理的なまとまりになっているか?
commit | SkillHub