SuperAPI AI Directory

commit

General & other

View repository

Updated 10-15 21:02

About this skill

Commit Skill

Execute the workflow below right now. Do not ask questions, just execute immediately.

Collect current state

git status --short
git diff --stat
git diff --cached --stat
git log --oneline -3

Execution instructions

1. Determine commit scope

First determine the commit scope from the user request and hints. Do not stage anything before determining the scope.

  • If there is a path, directory, glob, or filename: only changed files falling under that path are targets.
  • If there is only a topic (e.g., "only login-related", "only docs"): first scan the diff of all changed files, then select only the files related to the request as targets.
  • If no scope is mentioned: all changed files are targets.
  • If a scope is specified but no files fall under it: stop without committing and report that fact. Do not substitute a full commit.

Do not stage, commit, or modify files outside the scope. Leave files outside the scope that were already staged as they are.

2. Analyze target files

Check the contents of only the target files.

git diff -- <대상 파일들>
git diff --cached -- <대상 파일들>
git diff --no-index -- /dev/null <새 파일>   # untracked 파일 내용 확인

3. Group by purpose

Not by file location or extension, but change intentgroup by.

  • Changes that constitute one feature, bug, or topic are one group. If implementation and its tests/docs share the same purpose, group them together.
  • Separate unrelated purposes into different groups.
  • Put one file in only one group. If a file mixes multiple purposes, put it in the group of its main purpose and note the additional changes in the body.
  • If everything is one purpose, finish with a single commit. Do not force a split.
  • Attach one type to each group:
    • feat - Adding a new feature
    • fix - Bug fix
    • docs - Documentation update
    • style - Code style fix (no behavior change)
    • refactor - Code refactoring
    • test - Adding/modifying tests
    • chore - Maintenance work

4. Commit per group

For each group, stage only that group's files, and pass the same paths to the commit as pathspec. A pathspec commit commits only the specified paths even if other files are staged in the index.

git add -- <아직 stage 안 된 그룹 파일들>
git commit -m "$(cat <<'EOF'
<type>(<scope>): <subject>
EOF
)" -- <그룹 파일 전체>
  • git add pass only paths that are git status --short from ?? or whose second column is not empty. git rm If you pass a deletion path already staged with (D ), the entire add fails.
  • If all of a group's files are already staged, git add skip and commit directly.
  • git add ., git add -A, git commit -a Do not use commands that capture everything without paths, such as . Do not follow git hints even if they recommend it.
  • git commit Pass all of the group's paths to the pathspec. Include deleted files and the old and new paths of renames.

5. Verify results

git log --oneline -<커밋 수>
git status --short

Check whether out-of-scope changes remain. Report both the list of commits created and the list of files left uncommitted.

Commit message rules

  • Format: <type>(<scope>): <subject>
  • Commit messages must be written in Korean
  • Use imperative present tense: "add", "fix", "remove"
  • Subject within 50 characters, no period at the end
  • Add a detailed description in the body if needed
  • Co-Authored-By: Trailers must never be included in the commit message under any circumstances (Co-Authored-By: Claude, Co-Authored-By: Codex etc. all prohibited)
  • Other signature phrases indicating the generating tool (Generated with ... etc.) are also not to be included in the commit message

Preventing Korean commit message corruption

git commit -m "한글" When using , Korean may be corrupted depending on the terminal environment. Always use the HEREDOC or temporary file method.

macOS/Linux (HEREDOC method - recommended)

git commit -m "$(cat <<'EOF'
feat(auth): JWT 로그인 및 미들웨어 추가

- JWT 토큰 생성 구현
- 보호된 라우트용 인증 미들웨어 추가
EOF
)" -- src/auth/

Windows PowerShell (temporary file method)

In PowerShell, -m passing Korean with the option causes encoding issues. Use a UTF-8 temporary file:

chcp 65001
# commit_msg.txt에 UTF-8로 메시지 작성 후:
git commit -F commit_msg.txt -- <그룹 파일들>
Remove-Item commit_msg.txt

User hint (may include commit scope): $ARGUMENTS