commit-work
npx machina-cli add skill kasperjunge/agent-resources/commit-work --openclawCommit Work
Commit workflow that ensures quality gates pass and changelog is updated before committing.
When to Use
- After
/code-reviewpasses with no critical issues - When asked to commit, save, or wrap up work
- Before creating a PR
Input
Default: Commit current staged/unstaged changes.
If argument provided:
- GitHub issue number/URL: Fetch context with
scripts/gh_issue_phase.sh get-issue $ARGto reference the issue in the commit message.
Workflow
┌─────────────────────┐
│ 1. Run quality │
│ checks │
│ ty → ruff → pytest
└─────────┬───────────┘
│
▼
┌─────────────┐
│ All pass? │───No──→ STOP. Fix issues first.
└─────┬───────┘
│Yes
▼
┌─────────────────────┐
│ 2. Update CHANGELOG │
└─────────┬───────────┘
│
▼
┌─────────────────────┐
│ 3. Stage + Commit │
└─────────┬───────────┘
│
▼
┌─────────────────────┐
│ 4. Verify success │
└─────────────────────┘
Step 1: Run Quality Checks
Run in this order. Stop on first failure. Prefer the deterministic scripts in scripts/.
scripts/run_quality_checks.sh
If any fail: Fix the issue. Do not proceed to commit.
No exceptions:
- "It's a flaky test" → Fix the test or mark it properly
- "I manually tested it" → Automated tests must pass
- "We can fix it later" → Later never comes. Fix now.
Step 2: Update CHANGELOG
Create or update CHANGELOG.md in project root. After editing, verify the [Unreleased] section has entries:
uv run python scripts/ensure_changelog_unreleased.py
IMPORTANT: Review ALL staged changes, not just the most recent work. The changelog entry must cover everything being committed. If multiple features, fixes, or changes are being committed together, document all of them.
Format:
# Changelog
## [Unreleased]
### Added
- New feature description
### Changed
- Modified behavior description
### Fixed
- Bug fix description
### Removed
- Removed feature description
Rules:
- Add entry under
[Unreleased]section - Use appropriate category (Added/Changed/Fixed/Removed)
- Be concise but specific - what changed and why it matters
- If CHANGELOG.md doesn't exist, create it
Step 3: Stage and Commit
git add -A # Or specific files if preferred
git commit -m "$(cat <<'EOF'
Short summary in imperative mood (max 50 chars)
Longer description if needed. Explain what changed and why.
Keep lines under 72 characters.
Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
Commit message guidelines:
- First line: imperative mood, max 50 chars ("Add feature" not "Added feature")
- Blank line after summary
- Body: explain what and why, not how
- Reference issues if applicable
- Cover ALL changes: Review
git diff --stagedto ensure the message describes everything being committed, not just the most recent work. If the user wants only a subset of changes committed, they will specify which ones.
Step 4: Verify Success
scripts/verify_clean_tree.sh
git log -1 # Verify commit message looks correct
Step 5: GitHub Issue Update
If a GitHub issue was provided or is available from prior phases:
Post commit details as a phase comment and set the label:
echo "Committed: $(git log -1 --format='%H %s')" | scripts/gh_issue_phase.sh post-phase $ISSUE done
scripts/gh_issue_phase.sh set-label $ISSUE phase:done
Pass the issue number to the release skill if continuing (e.g., /release #42).
Red Flags - STOP
- Tests failing → Fix before commit
- Linting errors → Fix before commit
- Type errors → Fix before commit
- No changelog entry → Add one
- Vague commit message → Rewrite it
Common Mistakes
| Mistake | Fix |
|---|---|
| Skipping checks "to save time" | Checks catch bugs. Run them. |
| Committing with failing tests | Fix the test or the code |
| Forgetting changelog | Always update before commit |
| "WIP" or "fix" commit messages | Write meaningful messages |
| Not verifying after commit | Always check git status/log |
Source
git clone https://github.com/kasperjunge/agent-resources/blob/main/skills/development/workflow/commit-work/SKILL.mdView on GitHub Overview
Commit-work automates finalizing code once a code review passes. It runs quality gates, updates the changelog, and creates a properly described commit. It can reference a related GitHub issue in the commit message when provided an issue URL or number.
How This Skill Works
The skill executes the quality gate sequence (scripts/run_quality_checks.sh) in order, updates CHANGELOG.md via the ensure_changelog_unreleased.py utility, then stages and creates a commit with an imperative subject and a detailed body. After committing, it runs a verification step and, if an issue argument was supplied, posts phase details and updates the issue label.
When to Use It
- After /code-review passes with no critical issues
- When asked to commit, save, or wrap up work
- Before creating a PR
- When you want to reference a GitHub issue in the commit message by providing an argument
- When you need a CHANGELOG entry added for all changes being committed
Quick Start
- Step 1: Run quality checks: scripts/run_quality_checks.sh
- Step 2: Update changelog: uv run python scripts/ensure_changelog_unreleased.py and ensure entries
- Step 3: Stage and commit: git add -A; git commit -m "<imperative subject>" and verify with scripts/verify_clean_tree.sh
Best Practices
- Run the quality checks in the documented order (ty → ruff → pytest) using scripts/run_quality_checks.sh.
- Review all staged changes with git diff --staged to ensure the changelog and code reflect every modification.
- Keep the commit subject in imperative mood and under 50 characters; provide a clear, longer body if needed.
- Ensure a CHANGELOG.md entry exists under [Unreleased] and covers all features, changes, and fixes.
- Verify the final tree with scripts/verify_clean_tree.sh and review the last commit with git log -1; if a GitHub issue was provided, update it accordingly.
Example Use Cases
- A new login feature is completed and, after code-review passes, commit-work runs to update the changelog and create a well-documented commit for the PR.
- A bug fix is finalized; commit-work ensures tests pass, updates CHANGELOG under [Unreleased] with a Fixed entry, and creates the commit.
- Commit-work is run with an issue number argument to reference the issue context in the commit message.
- A multi-file refactor is committed after all quality gates pass and the Unreleased changelog section lists Added or Changed items.
- Sprint task ready for PR: all changes are captured, changelog updated, and the commit message follows the imperative convention.