agentleFS
Ericcccccc777Ericcccccc777/CCC-MAGI/skills/commit/SKILL.md

commit

Skill1 starsChanged 5 months agoApache-2.0View on GitHub

This skill should be used at stage 8 of the feature workflow, after the user has completed their smoke test (stage 7) and wants to commit the changes. It inspects the staged and unstaged diff, proposes a Conventional Commits message, and runs git commit — which in turn triggers the project's pre-commit hooks. Use this always for commits; do not commit freely without this skill. Trigger when the user invokes /commit, says "commit this", "ship it", "let's commit", or similar intent.

  • Commits and pushes

193 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use create-branch, review-r and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SentrySkill

    create-branch

    Create a git branch following Sentry naming conventions. Use when asked to "create a branch", "new branch", "start a branch", "make a branch", "switch to a new branch", or when starting new work on the default branch.

    Also in 4 projects that use this

  • luischanciSkill

    review-r

    Run the R code review protocol on R scripts. Checks code quality, reproducibility, domain correctness, and professional standards. Produces a report without editing files.

    Also in 3 projects that use this

  • MicrosoftSkill

    act-on-feedback

    Act on user feedback attached to the current session. Use when the user submits feedback on the session's changes via the Submit Feedback button.

    Also in 3 projects that use this

  • MicrosoftSkill

    generate-run-commands

    Generate or modify run commands for the current session. Use when the user wants to set up or update run commands that appear in the session's Run button.

    Also in 3 projects that use this

  • AWSSkill

    issue

    Implement a GitHub issue end-to-end — branch, code, test, docs, and commit.

    Also in 9 projects that use this

  • luischanciSkill

    validate-bib

    Validate bibliography entries against citations in all manuscript files. Find missing entries and unused references.

    Also in 3 projects that use this

  • +2 more from luischanci

The file

Show its rules and text

We split this skill into the rules it gives an agent

22 rules. 0 are common, 17 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 174 edited versions we read keep these.

  • 17

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Look at the output above.

    line 45
  2. Distinctive:

    If there are unstaged changes that should be in this commit, ask the user whether to git add them.

    line 47
  3. Distinctive:

    If the staged diff is empty, stop.

    line 48
  4. Distinctive:

    If the staged diff mixes unrelated changes (e.g., one feature's code + an unrelated doc fix), propose splitting into separate commits and …

    line 49
  5. Distinctive:

    Check whether the appropriate file is also in the diff.

    line 59
  6. Distinctive:

    If user picks any "needs update" option, halt the skill cleanly.

    line 74
  7. Distinctive:

    Wait for confirmation. The skill stages the deletion if the user agrees.

    line 84
  8. Very specific:

    If the user passed $ARGUMENTS, treat it as a subject override — honor it, but still pick the correct type/scope

    line 94
  9. Very specific:

    Body should reference affected scenario IDs: When the commit changes user-visible behavior, list the scenarios from …

    line 107
  10. Distinctive:

    Wait for user approval before running git commit.

    line 130
  11. Distinctive:

    If a hook blocks the commit:

    line 156
  12. Very specific:

    Do not attempt to bypass the hook (--no-verify) unless the user explicitly instructs, with reason.

    line 160
  13. Distinctive:

    After a successful commit, clean up transient state files for this feature:

    line 166
  14. Distinctive:

    If a feature was committed but the user wants to start a follow-up commit on the same feature without re-running stages, ask before cleanup.

    line 175
  15. Distinctive:

    If either failed for this change, do not push.

    line 183
  16. Distinctive:

    Branching: commit directly to main by default unless the project's commit convention says otherwise.

    line 196
  17. Distinctive:

    Never push to GitHub: if either Stage 7 (CEO smoke test) or the auditor audit has failed for this change.

    line 198
  18. Distinctive:

    All pre-commit hooks passed (or the user explicitly overrode them with a documented reason)

    line 205
  19. Very specific:

    After the commit is created and (if applicable) pushed, archive the checkpoint — the feature is done, no more /pickup needed:

    line 213
  20. Very specific:

    If the feature shipped only part of its planned items, mark only those done and leave the rest todo — the function stays in-progress, …

    line 243
  21. Distinctive:

    If you smoke-tested and decided NOT to ship (rollback / defer), do NOT archive — leave the checkpoint open so resume works:

    line 248
  22. Distinctive:

    After Stage 8 completes (commit created + pushed if applicable), display (in CEO's OS locale):

    line 264

“Common” is measured: kept by at least 6 in 10 of the 174 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/commit

Drive stage 8 of the feature workflow: produce a Conventional Commits message and commit the changes. Hooks enforce quality gates.

Constitutional basis: Constitution § 5 (Spec and reality stay in sync) — the doc-in-sync check in Step 1 is the operational guard against spec drift at commit time. Constitution § 1 & § 4 — push to GitHub only after BOTH the CEO smoke test (Stage 7) and the auditor audit have passed.

Authoritative sources

  1. Conventional Commits convention — <type>(<scope>): <subject> format
  2. The diff itself — the single most important input
  3. Root CLAUDE.md § Doc-in-sync responsibility — doc-in-sync rule
  4. CEO spec at {{spec_dir}}<feature>.md — read when Step 1's doc-in-sync check needs to enumerate touched scenarios

Current repo context

Inspect before proposing a message:

<git_status> !git status --short </git_status>

<git_diff_cached> !git diff --cached </git_diff_cached>

<git_diff_unstaged> !git diff </git_diff_unstaged>

<recent_commits> !git log -5 --oneline </recent_commits>

Workflow

Step 1 — Review what's being committed

Look at the output above.

  • If there are unstaged changes that should be in this commit, ask the user whether to git add them. Do not stage blindly.
  • If the staged diff is empty, stop. Nothing to commit. Report to the user.
  • If the staged diff mixes unrelated changes (e.g., one feature's code + an unrelated doc fix), propose splitting into separate commits and wait for user direction.
  • Doc-in-sync check (per root CLAUDE.md § Two-file feature spec model + § Doc-in-sync responsibility):

    From git diff --name-only (cached + unstaged), identify touched feature surfaces using {{feature_folder_pattern}}. For backend-touching paths ({{backend_code_paths}}, if configured), map to the owning feature by name match; when ambiguous, ask the user.

    For each touched feature <X>, decide which file the change demands updating:

    • User-visible behavior, data model, public API → {{spec_dir}}<X>.md (CEO spec)
    • Internal tech detail only (file split, library swap with same shape, store key rename) → {{implementation_dir}}<X>-implementation.md

    Check whether the appropriate file is also in the diff. If NOT, surface to the user before proposing the commit message:

    "Doc-in-sync check: this commit touches <feature> code (paths: <list>) but neither {{spec_dir}}<feature>.md nor {{implementation_dir}}<feature>-implementation.md is in the diff. Per the doc-in-sync rule:

    • User-visible / data-model / API changes → CEO spec must update in same commit
    • Internal-only refactors → implementation notes must update if the file exists; exception otherwise
    • Stylistic / rename / formatting / behavior-preserving fixes → exception (no doc update needed)

    Which category does this commit fall into?

    • Exception → proceed (I'll note the category in the commit body if material)
    • CEO spec needs update → halt; you update the spec, re-stage, re-invoke /commit
    • Implementation notes need update → halt; you update the file, re-stage, re-invoke /commit
    • Override with reason → proceed and the reason goes in the commit body"

    If user picks any "needs update" option, halt the skill cleanly. Do not proceed to Step 2.

    If multiple features are touched at once, double-check that each owning spec covers what its feature now does, and that no untouched spec is silently invalidated by a cross-feature change (e.g., feature X code adds a column to a shared table that feature Y's spec also references). Heuristic only; ask the user when uncertain.

    Do NOT skip this check. It is the structural defense against spec drift, which Constitution § 5 mandates the harness prevent. The skill has no judgment authority to bypass it.

  • Plan file deletion check (per root CLAUDE.md § Doc-in-sync responsibility / Plan files are transient): if {{spec_dir}}<feature>-plan.md exists for any feature touched by this commit and the implementation has landed, the plan file must be deleted in this commit. Surface to the user:

    "{{spec_dir}}<feature>-plan.md is still in the tree. Plan files are transient — they exist for Stage 4 → Stage 5 hand-off and are deleted at Stage 8. If this commit ships the implementation, the plan file should be deleted as part of it. Delete now and re-stage?"

    Wait for confirmation. The skill stages the deletion if the user agrees.

Step 2 — Derive the Conventional Commits message

Follow Conventional Commits:

  • Format: <type>(<scope>): <subject>
  • Types: feat, fix, refactor, perf, test, docs, chore, style
  • <scope> is optional; use it when the change is clearly scoped to a feature or area
  • <subject> is imperative, lowercase, no period
  • If the user passed $ARGUMENTS, treat it as a subject override — honor it, but still pick the correct type/scope

Pick the type from what the diff actually does:

  • New user-visible capability → feat
  • Bug fix → fix
  • Changes code shape without changing behavior → refactor
  • Performance improvement only → perf
  • Tests added/updated only → test
  • Documentation only (including CLAUDE.md, constitution.md, scoped rule files) → docs
  • Tooling, config, dependencies → chore
  • Formatting only, no meaning change → style

Body should reference affected scenario IDs. When the commit changes user-visible behavior, list the scenarios from {{spec_dir}}<feature>.md it touches, by ID:

feat(<feature>): <subject>

Affected scenarios:
- <feature> scenario 3.4 (<one-line behavior description> — fix)
- <feature> scenario 3.8 (<one-line behavior description> — new)

Doc-in-sync:
- {{spec_dir}}<feature>.md updated
- {{implementation_dir}}<feature>-implementation.md updated

Why: months later when an error tracker regression points at a commit, git blame of the test that fails maps directly to a scenario ID, which maps directly to the CEO-spec section that defines the expected behavior. Trivial commits (typo, formatting) don't need this; behavior commits do.

Step 3 — Propose, don't commit yet

Show the user:

  • The type, scope, subject you chose (and a body, if the change warrants one)
  • A one-line summary of what the diff actually does, so the user can sanity-check

Wait for user approval before running git commit.

Wait for user response before continuing.

Step 4 — Commit

On approval, run:

git commit -m "<type>(<scope>): <subject>"

Or, with a body:

git commit -m "<subject line>" -m "<body>"

Step 5 — Hook results

Pre-commit hooks run automatically (see CLAUDE.md § Hooks):

  • Pre-commit typecheck — blocks commit on type/syntax errors
  • Pre-commit lint bans — blocks commit on anti-flag patterns (per {{anti_flag_rules}} in AGENTS.md)
  • Pre-commit cycles — blocks commit if dependency cycles detected (only enabled when dependency_flow is non-empty)

If a hook blocks the commit:

  1. Report the hook output to the user verbatim.
  2. Offer to fix the specific issues the hook flagged.
  3. Do not attempt to bypass the hook (--no-verify) unless the user explicitly instructs, with reason.

On successful commit, report the commit hash and one-line message.

Step 6 — State cleanup

After a successful commit, clean up transient state files for this feature:

rm -f .harness/state/auditor-approvals/<feature>-stage*.json
rm -f .harness/state/test-fix/<feature>-attempts.json

Why: state files exist to gate Stages 2 / 3 / 4 / 5 / 6 in flight. Once the commit lands, the gates have served their purpose; leaving them around invites confusion in future work on the same feature ("did Stage 5 already approve, or is that an old approval?"). For trivial-change and stability-fix lanes, the relevant state files are typically absent — the cleanup is a no-op then.

If a feature was committed but the user wants to start a follow-up commit on the same feature without re-running stages, ask before cleanup.

Step 7 — Push to GitHub (only after both gates passed)

Per Constitution § 1 & § 4, push to GitHub only after BOTH:

  • Stage 7 CEO smoke test PASSED
  • Stage 6 / Stage 5 auditor audit returned PASS, CONCERNS, or WAIVED (FAIL halts; CONCERNS advances but should be reviewed; WAIVED requires explicit waiver_reason and cannot have Universal Core blocking items)

If either failed for this change, do not push. Surface to the user: "Push withheld — Constitution § 4 requires CEO smoke test pass before push; please complete Stage 7 then re-invoke push."

On approval, push:

git push

Rules

  • Never use --no-verify except on explicit user instruction with a stated reason.
  • Never commit without showing the proposed message first. The user must see the message before it becomes history.
  • Never force-push, rebase, or rewrite history from this skill. Out of scope.
  • Branching: commit directly to main by default unless the project's commit convention says otherwise. Only use a feature branch if the user already has one checked out or explicitly asks.
  • Never squash multiple logically distinct changes into one commit. If the diff mixes concerns, split it.
  • Never push to GitHub if either Stage 7 (CEO smoke test) or the auditor audit has failed for this change. (Constitution § 1 & § 4.)

Completion criteria

Stage 8 is complete when:

  • A commit exists on the current branch with a message that matches Conventional Commits format
  • All pre-commit hooks passed (or the user explicitly overrode them with a documented reason)
  • The user has seen the resulting commit hash and message
  • (If pushing) The push happened only after both the CEO smoke test and the auditor audit passed

Checkpoint + decision-log integration (MAGI Archivist)

After the commit is created and (if applicable) pushed, archive the checkpoint — the feature is done, no more /pickup needed:

bash .harness/scripts/checkpoint-write.sh \
  --feature <feature-slug> \
  --stage-complete 8 \
  --archive

This moves .harness/state/workflow-checkpoints/<feature>.json → .harness/state/workflow-checkpoints/_archived/<feature>-<timestamp>.json. The archived file is gitignored but kept locally for audit / retrospective.

Log the commit decision:

bash .harness/scripts/decision-log-append.sh \
  --feature <feature-slug> --stage 8 --by "CEO" \
  --decision "shipped <feature>" \
  --evidence "$(git rev-parse --short HEAD)"

Mark the project todolist done. Shipping a feature completes its work, so flip the feature's todolist items doing → done (the function status auto-derives to done once all its items are done — see .harness/docs/todolist.md):

# For each item of this feature that this commit shipped:
bash .harness/scripts/todolist-write.sh --list   # find the feature's fn-id + item ids
bash .harness/scripts/todolist-write.sh --set-item-status --fn-id <feature-slug> --item-id <id> --item-status done

If the feature shipped only part of its planned items, mark only those done and leave the rest todo — the function stays in-progress, correctly reflecting that more is planned. The todolist is committed (team-shared), so this update lands in the same commit as the code.

If you smoke-tested and decided NOT to ship (rollback / defer), do NOT archive — leave the checkpoint open so resume works:

bash .harness/scripts/decision-log-append.sh \
  --feature <feature-slug> --stage 7 --by "CEO" \
  --decision "smoke test failed: <symptom>; reverting to Stage 5 to fix"

bash .harness/scripts/checkpoint-write.sh \
  --feature <feature-slug> --stage 5
  # (resets current_stage; preserves audit history + stages_completed)

Final message to CEO (natural-language, workflow complete)

After Stage 8 completes (commit created + pushed if applicable), display (in CEO's OS locale):

🎉 <feature> 已 ship!
   Commit: <short-sha> "<commit message first line>"
   Branch: <branch>
   Push 状态: <推送到远端 origin/main / 仅本地 / N/A>

整个 9-stage 流程跑完了。MAGI 团队归位:
  ✅ MAGI Planner (Stage 1-2) - spec 完成
  ✅ MAGI Programmer (Stage 5) - 代码完成
  ✅ MAGI Tester (Stage 6) - 测试完成
  ✅ MAGI Verdict - 全 stage audit 通过
  ✅ MAGI Archivist - checkpoint 归档到 _archived/

接下来可以:
  👉 「做下一个功能 X」    — 我启动新的 /feature-draft
  👉 「看看下一步做啥」     — 我跑 /next 推荐
  👉 「先休息」             — bye! 下次见 (我会自动 /pickup 帮你回到状态)

This is the natural break point. No auto-progression — CEO chooses when to start the next workflow cycle.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.