| name | commit-task |
| description | Commit a verified task implementation to git |
Skill: commit-task
Load Context
- Scan
task-state/ for a task with state: "verified"
- Read that task's title, id, and module fields
- Run
git status to see all changed files
- Run
git diff --stat to understand the scope of changes
Pre-checks
- If no
verified task exists → abort: "No verified task to commit. Run /verify-task first."
- If the working tree has no changes → abort: "No changes detected. The task may already be committed or code was not saved."
- If the current branch is
main or master → abort: "Direct commits to the main branch are not allowed."
Steps
Step 1: Review changed files
List all staged and unstaged changed files, and check each one:
- Confirm all changed files belong to this task's scope
- If unrelated files are present (e.g. debug code, files from another module) → explain to the user and ask whether to exclude them
Step 2: Stage relevant files
Stage files individually (do not use git add -A):
git add src/modules/<feature>/<file1>
git add src/modules/<feature>/<file2>
Also stage the task state JSON:
git add task-state/<feature>/task-NN-<slug>.json
Step 3: Construct the commit message
Format: <type>(<module>): <description>
- Type rules:
feat — new feature
fix — bug fix
chore — config, types, or tooling changes
test — test-only changes
- Description: imperative mood, under 50 characters, English
- If the task relates to an issue, add to the body:
Refs: #<issue>
Example:
feat(auth): add user registration endpoint
Implements POST /api/auth/register with email uniqueness check
and bcrypt password hashing.
Refs: #12
Step 4: Commit
git commit -m "<message>"
Confirm exit code is 0. If non-zero, print the error and abort.
Step 5: Update task state
{
"state": "committed",
"updatedAt": "<current ISO timestamp>"
}
Commit this state update separately:
git add task-state/<feature>/task-NN-<slug>.json
git commit -m "chore(<feature>): mark task-NN as committed"
Step 6: Check feature completion
Scan all JSON files under task-state/<feature>/:
- All
committed → inform: "🎉 All tasks for <feature> are committed. Run /open-pr <feature> to open a PR."
- Remaining
pending tasks → show the next pending task and suggest: "Run /implement-task to continue."
Error Handling
| Situation | Action |
|---|
| Pre-commit hook fails | Print hook output, do not bypass the hook, ask the user to fix the issue and retry |
| Commit message rejected by commitlint | Adjust the message to match the lint rules and retry |
Changed files contain possible secrets (.env, secret, password in filename) | Abort and warn: "Possible sensitive file detected — please verify before committing manually" |
Done When