Commit And Push
Commit and publish the intended local changes without sweeping in unrelated work.
Scope
This skill covers branch creation, staging, commit, push, and pull request creation. It defaults to remote publication.
Context To Gather
Before committing, gather delivery context in this order:
- Issue
- Prefer a user-provided issue number or URL.
- Otherwise, if GitHub context is available, inspect the current branch PR with
gh pr view --json number,title,closingIssuesReferences,url.
- If no clear issue is available, continue without one.
- Docs / specs
- Prefer user-specified paths first.
- Otherwise inspect the smallest relevant set of files under
docs/ and specs/ needed to understand scope.
- If no relevant docs exist, continue without them.
- Use docs/specs for factual context only.
Branch Naming
- If already on a non-default branch and its name clearly matches the work, keep it.
- If on
main, master, or another default branch, create a new branch.
- When creating a new branch, use the authenticated GitHub login as the namespace unless the user explicitly asks for another naming pattern.
- Prefer
{github-login}/#{issue-number}-{feature} when an issue is known.
- Otherwise prefer
{github-login}/{feature-summary}.
- Use lowercase kebab-case.
huoshijie/#25-agent-outline-events
octocat/import-docx-nested-lists
Workflow
- Inspect scope with
git status -sb and the relevant diff.
- If the worktree is mixed, stage only the intended files. Do not default to
git add -A.
- Resolve branch strategy using the naming rules above.
- If this path depends on
gh, check gh auth status before the first gh command.
- If creating a new branch requires the authenticated GitHub login namespace and
gh is unauthenticated, ask the user to run gh auth login and retry this step.
- Review the staged file list before committing. If scope is ambiguous, ask which files belong in the commit.
- Run the most relevant checks for the touched area when practical.
- Write the commit message using the format below.
- If an issue or docs/specs were found, mention them in the commit body only after verifying that the references are relevant and safe to include.
- Respect the user's requested publication scope.
- If the user explicitly asked only for a local commit, stop after the commit.
- Otherwise push the branch and create the PR.
- If a push is required:
- Prefer
git push -u origin HEAD or git push -u origin $(git branch --show-current) when the branch has no upstream yet.
- Otherwise use a normal
git push on the tracked remote.
- Before pushing, inspect the staged names and diff for accidental secrets. If the repo has an existing secret scan command or hook, run it. Otherwise do a manual check and stop on suspicion.
- If a PR is required:
- If this path depends on
gh, check gh auth status before the first gh command. If unauthenticated, ask the user to run gh auth login and retry this step.
- If a PR already exists for the branch, reuse it.
- Create an open, ready-for-review PR by default. Only create a draft PR when the user explicitly asks for one.
- Infer the base branch from the repository default branch unless the user specifies another target.
- Prefer
gh pr create / gh pr view for PR discovery and creation.
- Report back branch name, commit hash, validation, publication actions taken, and any linked issue/docs used.
Commit Format
Use Angular Git Commit Guidelines.
type(scope): subject
<optional body>
Docs: docs/path.md, specs/feature.md
Close #123
- Prefer lowercase
type, scope, and subject.
- Keep
subject imperative and behavior-focused.
- Omit
scope only when there is no clear bounded area.
- Omit optional lines when they do not apply.
Examples:
feat(user): add user login API
Close #45
fix(payment): resolve timeout error during checkout
Safety
- Do not rewrite user history unless explicitly requested.
- Do not rename an already-pushed branch without asking.
- Do not read, infer, expose, or stage local credential material or authentication stores. If GitHub authentication is required, ask the user to run
gh auth login themselves.
1---2name: commit-and-push3description: Safely commit and publish local code changes.4---56# Commit And Push78Commit and publish the intended local changes without sweeping in unrelated work.910## Scope1112This skill covers branch creation, staging, commit, push, and pull request creation. It defaults to remote publication.1314## Context To Gather1516Before committing, gather delivery context in this order:17181. Issue19 - Prefer a user-provided issue number or URL.20 - Otherwise, if GitHub context is available, inspect the current branch PR with `gh pr view --json number,title,closingIssuesReferences,url`.21 - If no clear issue is available, continue without one.222. Docs / specs23 - Prefer user-specified paths first.24 - Otherwise inspect the smallest relevant set of files under `docs/` and `specs/` needed to understand scope.25 - If no relevant docs exist, continue without them.26 - Use docs/specs for factual context only.2728## Branch Naming2930- If already on a non-default branch and its name clearly matches the work, keep it.31- If on `main`, `master`, or another default branch, create a new branch.32- When creating a new branch, use the authenticated GitHub login as the namespace unless the user explicitly asks for another naming pattern.33- Prefer `{github-login}/#{issue-number}-{feature}` when an issue is known.34- Otherwise prefer `{github-login}/{feature-summary}`.35- Use lowercase kebab-case.36- `huoshijie/#25-agent-outline-events`37- `octocat/import-docx-nested-lists`3839## Workflow40411. Inspect scope with `git status -sb` and the relevant diff.422. If the worktree is mixed, stage only the intended files. Do not default to `git add -A`.433. Resolve branch strategy using the naming rules above.44 - If this path depends on `gh`, check `gh auth status` before the first `gh` command.45 - If creating a new branch requires the authenticated GitHub login namespace and `gh` is unauthenticated, ask the user to run `gh auth login` and retry this step.464. Review the staged file list before committing. If scope is ambiguous, ask which files belong in the commit.475. Run the most relevant checks for the touched area when practical.486. Write the commit message using the format below.497. If an issue or docs/specs were found, mention them in the commit body only after verifying that the references are relevant and safe to include.508. Respect the user's requested publication scope.51 - If the user explicitly asked only for a local commit, stop after the commit.52 - Otherwise push the branch and create the PR.539. If a push is required:54 - Prefer `git push -u origin HEAD` or `git push -u origin $(git branch --show-current)` when the branch has no upstream yet.55 - Otherwise use a normal `git push` on the tracked remote.56 - Before pushing, inspect the staged names and diff for accidental secrets. If the repo has an existing secret scan command or hook, run it. Otherwise do a manual check and stop on suspicion.5710. If a PR is required:58 - If this path depends on `gh`, check `gh auth status` before the first `gh` command. If unauthenticated, ask the user to run `gh auth login` and retry this step.59 - If a PR already exists for the branch, reuse it.60 - Create an open, ready-for-review PR by default. Only create a draft PR when the user explicitly asks for one.61 - Infer the base branch from the repository default branch unless the user specifies another target.62 - Prefer `gh pr create` / `gh pr view` for PR discovery and creation.6311. Report back branch name, commit hash, validation, publication actions taken, and any linked issue/docs used.6465## Commit Format6667Use Angular Git Commit Guidelines.6869```text70type(scope): subject7172<optional body>7374Docs: docs/path.md, specs/feature.md75Close #12376```7778- Prefer lowercase `type`, `scope`, and `subject`.79- Keep `subject` imperative and behavior-focused.80- Omit `scope` only when there is no clear bounded area.81- Omit optional lines when they do not apply.8283Examples:8485```text86feat(user): add user login API8788Close #4589```9091```text92fix(payment): resolve timeout error during checkout93```9495## Safety9697- Do not rewrite user history unless explicitly requested.98- Do not rename an already-pushed branch without asking.99- Do not read, infer, expose, or stage local credential material or authentication stores. If GitHub authentication is required, ask the user to run `gh auth login` themselves.