Commit

From masharratt/claude-flow-novice · View interactive version

Commit is an AI agent skill from the GitHub repository masharratt/claude-flow-novice. Stage, commit, push changes via background github-commit-agent. Optional args for message override or push control. Use when committing/pushing work.

How to use this skill

Skill file

Commit and Push Skill

Purpose: Stage relevant changes, create a conventional commit, and push to remote, all delegated to a background github-commit-agent so the main conversation stays unblocked.

Usage

/commit
/commit "optional commit message override"
/commit --no-push

Behavior

When invoked, spawn a background github-commit-agent with run_in_background: true.

Agent prompt to use

You are handling a git commit and push operation.

Context:
- Working directory: {CWD}
- User args: {ARGS}

Steps:
0. **SEO pre-flight (if applicable):** If `scripts/seo-check.sh` exists in repo root, run `bash scripts/seo-check.sh` BEFORE staging. If it exits non-zero, abort the commit and return the violation output to the user. Do not auto-fix. This catches SEO regressions (trailing slashes, canonical URLs, hardcoded fly.dev domains) before they reach the pre-commit hook, giving clearer error attribution.
1. Run `git status` (no -uall flag) to see untracked/modified files.
2. Run `git diff --stat HEAD` to understand scope of changes.
3. Run `git log --oneline -5` to match existing commit message style.
4. Stage relevant files by name (avoid `git add -A` or `git add .` to prevent accidentally including secrets or large binaries). Skip: .env, *.key, *.pem, credentials.*, *.secret.
4b. **Commit-time docs (MANDATORY per CLAUDE.md):** Every commit must update `readme/feature-status.md` (production readiness tracker) and `readme/state-machines.md` (entity lifecycle) when features, statuses, test coverage, or stateful transitions change. Create them if missing. The pre-commit hook `cfn-docs-sync-check.sh` warns when these are stale or missing; do not ignore the warning.
5. If the user provided a message override in args, use it. Otherwise draft a conventional commit message (feat/fix/chore/docs/refactor) focused on "why" not "what", 1-2 sentences max.
6. Commit using HEREDOC format:
   git commit -m "$(cat <<'EOF'
   <message>

   Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
   EOF
   )"
7. Unless --no-push was passed, run `git push`.
8. Run `git status` to confirm clean working tree.
9. Return: branch name, commit hash, files committed, push status.

Important:
- NEVER force push, reset --hard, or use --no-verify.
- NEVER commit .env or credential files.
- If the pre-commit hook fails, fix the issue and create a NEW commit (never --amend).
- If on main/master and push would be force push, warn and abort.

After spawning

Args parsing

| Arg | Behavior |

|-----|----------|

| (none) | Auto-generate commit message, push |

| "message text" | Use provided message, push |

| --no-push | Commit only, skip push |

| --no-push "message" | Commit with message, skip push |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.