- Created solid.md to document the SOLID principles for clean code practices. - Created tdd.md to outline Test Driven Development principles and practices. - Added kana-rust-backend-best-practice.md as a reference guide for building a Rust backend using Axum and SeaORM. - Established push-flow-convention.md to enforce pre-commit and pre-push hooks with versioning rules. - Introduced AGENTS.md to provide guidance on best practices and available commands for Kilo. - Configured kilo.json to include new skills and agents for enhanced functionality. - Added lefthook.yml for managing git hooks to ensure code quality and adherence to conventions.
4.0 KiB
4.0 KiB
name, description
| name | description |
|---|---|
| commit-and-push | Enforce Conventional Commits specification for all commit messages and push workflows |
Commit and Push Rule
All commits MUST follow the Conventional Commits v1.0.0 specification. No exceptions.
Commit Message Format
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Types
| Type | When to use |
|---|---|
feat |
New feature — correlates with MINOR in semver |
fix |
Bug fix — correlates with PATCH in semver |
chore |
Maintenance, deps, config — no production code change |
docs |
Documentation only |
style |
Formatting, whitespace — no logic change |
refactor |
Code restructure — no feature or fix |
perf |
Performance improvement |
test |
Adding or correcting tests |
build |
Build system or external dependency changes |
ci |
CI configuration and scripts |
revert |
Reverts a previous commit |
Breaking Changes
Append ! after type/scope to indicate a breaking change. This correlates with MAJOR in semver.
feat(api)!: remove deprecated /v1/users endpoint
BREAKING CHANGE: /v1/users has been removed. Use /v2/users instead.
A BREAKING CHANGE: footer can also be used in the commit body.
Rules
- Type is ALWAYS lowercase.
- Description is imperative mood ("add", not "added" or "adds").
- Description is lowercase, no trailing period.
- Keep subject line under 72 characters.
- Scope is optional but recommended for
featandfix— use the affected module name. - One logical change per commit. If a commit spans multiple types, split into multiple commits.
- Body wraps at 72 characters. Use it to explain why, not what.
- Footer uses
git trailerformat (e.g.,BREAKING CHANGE:,Reviewed-by:,Refs:).
Lefthook Hooks
Every commit and push MUST go through Lefthook's pre-commit and pre-push hooks. Hooks are the gatekeeper — if they fail, the commit/push does not happen.
pre-commitruns lint-staged on staged files. Commit is blocked until lint-staged passes.pre-pushruns lint-staged diff check and version bump. Push is blocked until both pass.- If a hook fails, fix the root cause. Do not work around it.
Push
- Every push MUST pass pre-commit and pre-push hooks (see
push-flow-conventionskill). - NEVER use
--no-verifyto bypass hooks. No exceptions. No "just this once." If hooks fail, fix the issue and retry. - NEVER use
git commit --no-verify. If pre-commit fails, fix linting/formatting and restage. - NEVER use
git push --no-verify. If pre-push fails, fix the failing check and push again. - Commit message quality is enforced — reject vague messages like "fix stuff", "update", "wip", "misc".
- If Lefthook is not installed, run
pnpm exec lefthook installbefore committing. Do not commit without hooks registered. - NEVER add
Co-Authored-Bytrailers for AI tools (e.g.,Co-Authored-By: Claude Code <noreply@anthropic.com>). Commits are authored by humans only. No AI attribution in commit messages. - NEVER stage all files in one commit (
git add .orgit add -Athen commit). Group related changes into separate, focused commits. Each commit = one logical change. If a feature touches auth + billing, split into separate commits per module. - Stage files deliberately by name (
git add src/auth/login.ts src/auth/types.ts). Review what's staged before committing (git status,git diff --cached).
Examples
feat(auth): add google oauth sign-in
fix(cart): correct total calculation when discount is zero
chore: update eslint config
docs: add setup guide to README
refactor(billing): extract invoice calculation to service layer
test(users): add unit tests for avatar upload
perf(api): cache user profile queries
feat(api)!: change response format for /orders endpoint
Reference
Full specification: conventionalcommits.org/en/v1.0.0