commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSmart Commit
智能提交
Simple, validated commit creation. Run checks locally, no agents needed for standard commits.
简单、经过验证的提交创建方式。本地运行检查,标准提交无需使用Agent。
Quick Start
快速开始
bash
/commitbash
/commitWorkflow
工作流
Phase 1: Pre-Commit Safety Check
阶段1:提交前安全检查
bash
undefinedbash
undefinedCRITICAL: Verify we're not on dev/main
CRITICAL: Verify we're not on dev/main
BRANCH=$(git branch --show-current)
if [[ "$BRANCH" == "dev" || "$BRANCH" == "main" || "$BRANCH" == "master" ]]; then
echo "STOP! Cannot commit directly to $BRANCH"
echo "Create a feature branch: git checkout -b issue/<number>-<description>"
exit 1
fi
undefinedBRANCH=$(git branch --show-current)
if [[ "$BRANCH" == "dev" || "$BRANCH" == "main" || "$BRANCH" == "master" ]]; then
echo "STOP! Cannot commit directly to $BRANCH"
echo "Create a feature branch: git checkout -b issue/<number>-<description>"
exit 1
fi
undefinedPhase 2: Run Validation Locally
阶段2:本地运行验证
Run every check that CI runs:
bash
undefined运行CI会执行的所有检查:
bash
undefinedBackend (Python)
Backend (Python)
poetry run ruff format --check app/
poetry run ruff check app/
poetry run mypy app/
poetry run ruff format --check app/
poetry run ruff check app/
poetry run mypy app/
Frontend (Node.js)
Frontend (Node.js)
npm run format:check
npm run lint
npm run typecheck
Fix any failures before proceeding.npm run format:check
npm run lint
npm run typecheck
在继续之前修复所有检查失败的问题。Phase 3: Review Changes
阶段3:查看更改
bash
git status
git diff --staged # What will be committed
git diff # Unstaged changesbash
git status
git diff --staged # What will be committed
git diff # Unstaged changesPhase 4: Stage and Commit
阶段4:暂存并提交
bash
undefinedbash
undefinedStage files
Stage files
git add <files>
git add <files>
Or all: git add .
Or all: git add .
Commit with conventional format
Commit with conventional format
git commit -m "<type>(#<issue>): <brief description>
- [Change 1]
- [Change 2]
Co-Authored-By: Claude noreply@anthropic.com"
git commit -m "<type>(#<issue>): <brief description>
- [Change 1]
- [Change 2]
Co-Authored-By: Claude noreply@anthropic.com"
Verify
Verify
git log -1 --stat
undefinedgit log -1 --stat
undefinedCommit Types
提交类型
| Type | Use For |
|---|---|
| New feature |
| Bug fix |
| Code improvement |
| Documentation |
| Tests only |
| Build/deps/CI |
| 类型 | 适用场景 |
|---|---|
| 新功能 |
| Bug修复 |
| 代码优化 |
| 文档更新 |
| 仅测试代码 |
| 构建/依赖/CI相关 |
Rules
规则
- Run validation locally - Don't spawn agents to run lint/test
- NO file creation - Don't create MD files or documentation
- One logical change per commit - Keep commits focused
- Reference issues - Use format in commit message
#123 - Subject line < 72 chars - Keep it concise
- 本地运行验证 - 不要启动Agent来运行lint或测试
- 禁止创建文件 - 不要创建MD文件或文档
- 每次提交一个逻辑更改 - 保持提交聚焦
- 关联问题 - 在提交信息中使用格式
#123 - 主题行少于72个字符 - 保持简洁
Quick Commit
快速提交
For trivial changes (typos, single-line fixes):
bash
git add . && git commit -m "fix(#123): Fix typo in error message
Co-Authored-By: Claude <noreply@anthropic.com>"针对微小更改(拼写错误、单行修复):
bash
git add . && git commit -m "fix(#123): Fix typo in error message
Co-Authored-By: Claude <noreply@anthropic.com>"Related Skills
相关技能
- create-pr: Create pull requests from commits
- review-pr: Review changes before committing
- fix-issue: Fix issues and commit the fixes
- issue-progress-tracking: Auto-updates GitHub issues with commit progress
- create-pr: 从提交创建拉取请求
- review-pr: 提交前审查更改
- fix-issue: 修复问题并提交更改
- issue-progress-tracking: 自动更新GitHub问题的提交进度
Rules
规则详情
Each category has individual rule files in loaded on-demand:
rules/| Category | Rule | Impact | Key Pattern |
|---|---|---|---|
| Atomic Commits | | CRITICAL | One logical change per commit, atomicity test |
| Commit Splitting | | HIGH | |
| Conventional Format | | HIGH | type(scope): description, breaking changes |
Total: 3 rules across 3 categories
每个分类的独立规则文件位于目录,按需加载:
rules/| 分类 | 规则 | 影响级别 | 核心模式 |
|---|---|---|---|
| 原子提交 | | 关键 | 每次提交一个逻辑更改,原子性测试 |
| 提交拆分 | | 高 | |
| 规范格式 | | 高 | type(scope): description, 破坏性更改 |
总计:3个分类下的3条规则
References
参考资料
- Conventional Commits
- Recovery
- Conventional Commits
- 恢复指南