commit
Validate code with lints and tests, then commit and push
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Validated Commit and Push
This skill ensures code quality before committing by running all checks, then commits and pushes.
Process
Step 1: Run Formatting Check
cd backend && cargo fmt --check
If this fails, run cargo fmt to auto-fix, then re-check.
Step 2: Run Clippy Lints
cd backend && cargo clippy --workspace --all-targets --all-features -- -D warnings
If clippy fails, fix the issues before proceeding. Do NOT commit code with clippy warnings.
Step 3: Run Tests
cd backend && cargo test --workspace
If tests fail, fix the failing tests before proceeding. Do NOT commit code with failing tests.
Step 4: Check for Changes
git status
Review what will be committed. If there are no changes, inform the user and stop.
Step 5: Stage Changes
git add -A
Step 6: Create Commit
Ask the user for a commit message, or generate one based on the changes.
IMPORTANT: Never include:
- "Generated with Claude Code"
- "Co-Authored-By: Claude"
- Any AI/Claude attribution
Commit message format:
git commit -m "Short description of changes"
For multi-line messages:
git commit -m "$(cat <<'EOF'
Short summary
Longer description if needed
EOF
)"
Step 7: Push to Remote
git push origin HEAD
If push fails due to upstream changes, pull first:
git pull --rebase origin HEAD && git push origin HEAD
Failure Handling
If ANY step fails (fmt, clippy, or tests):
- Stop immediately
- Report the failure to the user
- Do NOT proceed to commit
- Help fix the issues if requested
Quick Commands Reference
# Full validation + commit + push
cd backend && cargo fmt --check && cargo clippy --workspace --all-targets --all-features -- -D warnings && cargo test --workspace && cd .. && git add -A && git commit -m "message" && git push
# Auto-fix formatting
cd backend && cargo fmt
# Check only (no commit)
cd backend && cargo fmt --check && cargo clippy --workspace --all-targets --all-features -- -D warnings && cargo test --workspace
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-03-11
- 索引更新时间
- 2026-03-11
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!