Commit and Push by Feature
Compatibility wrapper that groups changes into feature/function commits while delegating issue, branch, publication, and pull-request safety to the canonical GitHub delivery contract.
Process
Inspect changes:
- Run
git status and git diff to understand all changes.
- Pack install artifact boundary: Treat
.agents/project.json as the committed project designation. When pack configuration changed, bucket and commit .agents/project.json. Treat .claude/skills/** and .codex/skills/** as generated local skill roots recreated by /pack, $pack, or scripts/pack.sh refresh; generated skill roots must not be staged or committed. If those roots are untracked, leave them uncommitted and report them as generated local artifacts. If any path under those roots is already tracked or modified as a tracked file, stop unless the current task explicitly includes repository hygiene to untrack or ignore generated skill roots.
Identify logical buckets:
- Group changes into feature/function buckets (e.g., "auth", "api", "ui", "tests", "docs", "build", "refactor"). Prefer 2–6 commits total unless the change set is tiny.
Commit each bucket:
- For each bucket:
- Stage only the files for that bucket (use
git add <paths>; avoid git add -A unless it's the final bucket and everything belongs together).
- Create a conventional commit message:
feat(<scope>): <summary> for new functionality
fix(<scope>): <summary> for bug fixes
refactor(<scope>): <summary> for refactors without behavior change
test(<scope>): <summary> for tests only
docs(<scope>): <summary> for documentation
chore(<scope>): <summary> for tooling/config
- Include a short body only if it clarifies intent or risk.
- Verify
git diff --cached matches the bucket before committing.
- If there are uncommitted leftover changes at the end, bucket them; do not leave a dirty working tree. Do not bucket generated local skill roots under
.claude/skills/** or .codex/skills/**, even in final leftover cleanup.
Issue-backed branch handling:
- Follow
docs/github-delivery-contract.md.
- Run
/github-issue ensure, then /github-branch ensure before committing. Reuse unambiguous existing state; stop on ambiguous issue, branch, remote, or dirty-tree ownership.
- Never commit tracked mutations on the detected primary branch. If the current tree is on primary, create the issue-backed non-primary branch before staging.
Publish and report:
- Run
/github-branch publish, then /github-pr upsert to create or update one ready pull request. Do not merge it.
- Output a concise summary: issue, branch, commits, working-tree state, push status, and pull-request URL or blocker.
Output
## Commits
| Hash | Message |
|------|---------|
| abc1234 | feat(auth): add OAuth2 login flow |
| def5678 | docs(readme): update setup instructions |
Branch: current branch
Working tree: clean
Constraints
- Do not amend or rewrite history unless explicitly asked.
- Do not commit secrets; if you detect likely secrets, stop and report before committing.
- If pre-commit hooks/tests fail, fix and retry.
Default Shipping Contract
Follow the shared shipping contract convention in CLAUDE.md.
1---2name: commit-and-push-by-feature-23description: Commit and push all changes to GitHub grouped by logical feature/function buckets with conventional commit messages4---5
6# Commit and Push by Feature
7
8Compatibility wrapper that groups changes into feature/function commits while delegating issue, branch, publication, and pull-request safety to the canonical GitHub delivery contract.
9
10## Process
11
121. **Inspect changes:**
13 - Run `git status` and `git diff` to understand all changes.
14 - **Pack install artifact boundary:** Treat `.agents/project.json` as the committed project designation. When pack configuration changed, bucket and commit `.agents/project.json`. Treat `.claude/skills/**` and `.codex/skills/**` as generated local skill roots recreated by `/pack`, `$pack`, or `scripts/pack.sh refresh`; generated skill roots must not be staged or committed. If those roots are untracked, leave them uncommitted and report them as generated local artifacts. If any path under those roots is already tracked or modified as a tracked file, stop unless the current task explicitly includes repository hygiene to untrack or ignore generated skill roots.
15
162. **Identify logical buckets:**
17 - Group changes into feature/function buckets (e.g., "auth", "api", "ui", "tests", "docs", "build", "refactor"). Prefer 2–6 commits total unless the change set is tiny.
18
193. **Commit each bucket:**
20 - For each bucket:
21 - Stage only the files for that bucket (use `git add <paths>`; avoid `git add -A` unless it's the final bucket and everything belongs together).
22 - Create a conventional commit message:
23 - `feat(<scope>): <summary>` for new functionality
24 - `fix(<scope>): <summary>` for bug fixes
25 - `refactor(<scope>): <summary>` for refactors without behavior change
26 - `test(<scope>): <summary>` for tests only
27 - `docs(<scope>): <summary>` for documentation
28 - `chore(<scope>): <summary>` for tooling/config
29 - Include a short body only if it clarifies intent or risk.
30 - Verify `git diff --cached` matches the bucket before committing.
31 - If there are uncommitted leftover changes at the end, bucket them; do not leave a dirty working tree. Do not bucket generated local skill roots under `.claude/skills/**` or `.codex/skills/**`, even in final leftover cleanup.
32
334. **Issue-backed branch handling:**
34 - Follow `docs/github-delivery-contract.md`.
35 - Run `/github-issue ensure`, then `/github-branch ensure` before committing. Reuse unambiguous existing state; stop on ambiguous issue, branch, remote, or dirty-tree ownership.
36 - Never commit tracked mutations on the detected primary branch. If the current tree is on primary, create the issue-backed non-primary branch before staging.
37
385. **Publish and report:**
39 - Run `/github-branch publish`, then `/github-pr upsert` to create or update one ready pull request. Do not merge it.
40 - Output a concise summary: issue, branch, commits, working-tree state, push status, and pull-request URL or blocker.
41
42## Output
43
44```
45## Commits
46| Hash | Message |
47|------|---------|
48| abc1234 | feat(auth): add OAuth2 login flow |
49| def5678 | docs(readme): update setup instructions |
50
51Branch: current branch
52Working tree: clean
53```
54
55## Constraints
56
57- Do not amend or rewrite history unless explicitly asked.
58- Do not commit secrets; if you detect likely secrets, stop and report before committing.
59- If pre-commit hooks/tests fail, fix and retry.
60
61
62## Default Shipping Contract
63
64Follow the shared shipping contract convention in CLAUDE.md.