| name | pre-push |
| description | Run all validations before pushing to remote |
/pre-push - Pre-push Validation Skill
Final validation before pushing commits to remote repository.
Purpose
Validate branch conventions and push commits to remote. Quality checks (fmt, clippy, tests)
are delegated to the .githooks/pre-push hook, which runs automatically when git push executes.
Hook delegation: cargo fmt --all -- --check, cargo clippy --all-targets --all-features -- -D warnings,
and cargo test --all are all run by .githooks/pre-push on every git push.
Run make setup once to activate the hook if you haven't already.
Validation Checklist
All of the following MUST pass before pushing:
1. Branch Naming Convention
git branch --show-current
Verify branch name follows convention based on Issue labels (priority order):
| Priority | Issue Label | Branch Prefix | Example |
|---|
| 1 | enhancement | feature/ | feature/84-agent-skills |
| 2 | bug | bugfix/ | bugfix/42-fix-parsing |
| 3 | refactor | refactor/ | refactor/30-cleanup-code |
| 4 | documentation | doc/ | doc/50-update-readme |
| 5 | (no label) | feature/ | feature/99-misc-task |
Additional: hotfix/<issue>-<desc> for critical production fixes
FORBIDDEN branches for direct push:
main - Use PR only
develop - Use PR only (if applicable)
2. Remote Branch Target
git remote -v
git branch -vv
Verify:
Steps
Step 1: Check Branch Name
BRANCH=$(git branch --show-current)
echo "Current branch: $BRANCH"
Verify:
Step 2: Verify Unpushed Commits
git log origin/$(git branch --show-current)..HEAD --oneline 2>/dev/null || git log --oneline -5
Review what will be pushed.
Step 3: Final Confirmation
Before pushing, confirm:
Step 4: Push
git push -u origin $(git branch --show-current)
The .githooks/pre-push hook will automatically run cargo fmt --all -- --check,
cargo clippy --all-targets --all-features -- -D warnings, and cargo test --all
before the push completes.
Error Handling
Hook Failures (fmt / clippy / test)
If the .githooks/pre-push hook reports a failure:
- Read the hook output to identify which check failed
- Fix the issue (format error, clippy warning, or test failure)
- Commit the fix
- Re-run
/pre-push
Wrong Branch
WARNING: You are on branch 'main'. Direct pushes to main are not allowed.
CRITICAL: Always create branches from origin/develop:
git fetch origin
git checkout -b feature/<issue>-<description> origin/develop
- Create a feature branch from origin/develop (not main!)
- Push the feature branch
- Create a PR targeting
develop
Hook Not Active
If the hook does not run (no [pre-push] output during push):
make setup
Then re-run the push.
Example Usage
User: "pushする前にチェックして"
Claude executes /pre-push skill:
- Checks branch:
feature/84-agent-skills - VALID
- Reviews unpushed commits
- Reports: "Branch and commits look good. Pushing now (hook will run quality checks)."
- Executes
git push -u origin feature/84-agent-skills
.githooks/pre-push runs fmt/clippy/test automatically
Summary Output
After push completes successfully, output:
Pre-push Complete
=================
[PASS] Branch: feature/84-agent-skills (valid naming)
[PASS] Hook: cargo fmt, clippy, tests passed
[INFO] Commits pushed: X commits
Pushed to origin/feature/84-agent-skills