Skip to main content

commit

Complete pre-commit workflow - select and run applicable quality checks, then validate/create conventional commit messages

Source facts

Repository
vm0-ai/vm0
Last source activity
July 13, 2026 at 05:51
Detected SKILL.md language
English
Stars
1,152
Forks
70

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

File Explorer
4 files

Showing SKILL.md

SKILL.md
Source instructions · Read-only preview
name
commit
description
Complete pre-commit workflow - select and run applicable quality checks, then validate/create conventional commit messages
context
fork
You are a commit specialist for the vm0 project. Your role is to ensure code quality and proper commit messages before every commit. ## Operations 1. **Check** - Identify the affected scope and run its applicable pre-commit quality checks 2. **Message** - Validate or create conventional commit messages Run both operations together for a complete pre-commit workflow. --- # Operation 1: Quality Checks ## Scope Selection 1. Read and follow the **Pre-Commit Checks** section in `CLAUDE.md`. 2. Inspect `git status --short` and `git diff --cached --name-only`. 3. Identify the affected languages, workspaces, crates, packages, generated outputs, and runtime consumers. 4. Run every applicable formatter, linter, type or static check, and test for that scope. 5. Expand to broader or cross-language checks for shared configuration, generated artifacts, contracts, build or deployment tooling, or uncertain impact. Do not run an unrelated language ecosystem's full suite. Rust-only or Python-only changes do not require Turbo checks unless they affect Turbo inputs or consumers. Documentation-only changes require their relevant formatter, validator, or specialized checks rather than unrelated code suites. The root `lefthook.yml` selects formatting and static checks from staged paths. It does not replace manually selecting and running the relevant tests. ## Command Selection - **Turbo / TypeScript:** Prefer affected-workspace checks. Use the full commands documented in `CLAUDE.md` when the change crosses workspaces or cannot be isolated safely. - **Rust:** From `crates/`, run formatting, Clippy, documentation checks, and tests for the affected crate(s). Use workspace-wide checks for shared or cross-crate changes. - **Python (`crates/runner/mitm-addon`):** Run Ruff formatting and linting, basedpyright, and pytest in that package. - **Documentation or configuration:** Run the formatter, validator, or specialized tests that consume the changed files. ## Execution Order **IMPORTANT: Run selected checks sequentially, one at a time.** Each check can take several minutes in this monorepo. Running them in parallel will saturate CPU/memory and make everything slower (or freeze the machine). Within each affected ecosystem, use this order when the check applies: 1. **Format** - Apply the repository formatter 2. **Lint / Static Analysis** - Fix underlying issues rather than suppressing them 3. **Type Check** - Fix type errors without bypasses 4. **Test** - Run the tests selected from the affected behavior and consumers Run only one Vitest process at a time. Do not run multiple Cargo checks concurrently. ## Output Format ``` Pre-Commit Check Results Affected scope: [languages, workspaces, crates, packages, and consumers] Checks: - [command]: [PASSED/FIXED/FAILED] Skipped ecosystems: [ecosystems omitted because they are unrelated] Summary: [Ready to commit / Issues need attention] ``` ## Troubleshooting If local Rust checks fail with `Cannot allocate memory`, `os error 12`, or `ENOMEM` during `cargo test`, `cargo clippy`, `cargo doc`, `rustc`, or linker output: 1. Check that no other `cargo`, `rustc`, `clippy`, `rustdoc`, or linker-heavy process is already running. 2. Retry the same command once with constrained cargo parallelism: `CARGO_BUILD_JOBS=1 cargo ...`. 3. If the failure happened inside lefthook/pre-commit, rerun the commit or hook with `CARGO_BUILD_JOBS=1` in the environment. 4. Treat this as a local resource failure unless it reproduces with `CARGO_BUILD_JOBS=1` or the output contains an actual compiler, lint, or test failure unrelated to allocation. Do not start multiple Rust checks at the same time to "make up" for an ENOMEM failure. That usually makes the next run less reliable. If hooks are slow or lint times out: ```bash find turbo -name "node_modules" -type d -prune -exec rm -rf {} + cd turbo && pnpm install ``` --- # Operation 2: Commit Message ## Format ``` <type>[optional scope]: <description> [optional body] [optional footer(s)] ``` ## Rules (STRICT) - **Type must be lowercase** - `feat:` not `Feat:` - **Description starts lowercase** - `add feature` not `Add feature` - **No period at end** - `fix bug` not `fix bug.` - **Under 100 characters** - Be concise - **Imperative mood** - `add` not `added` or `adds` ## Types and Release Triggers | Type | Purpose | Release | |------|---------|---------| | `feat` | New feature | Minor (1.2.0 → 1.3.0) | | `fix` | Bug fix | Patch (1.2.0 → 1.2.1) | | `deps` | Dependencies | Patch | | `<any>!` | Breaking change | Major (1.2.0 → 2.0.0) | | `docs` | Documentation | No | | `style` | Code style | No | | `refactor` | Refactoring | No | | `test` | Tests | No | | `chore` | Build/tools | No | | `ci` | CI config | No | | `perf` | Performance | No | | `build` | Build system | No | | `revert` | Revert commit | No | **Tip:** Want a refactor to trigger release? Use `fix: refactor ...` ## Quick Examples | Wrong | Correct | |-------|---------| | `Fix: User login` | `fix: resolve user login issue` | | `added new feature` | `feat: add user authentication` | | `Updated docs.` | `docs: update api documentation` | | `FEAT: New API` | `feat: add payment processing api` | ## Validation Process 1. Check staged changes: `git diff --cached` 2. Analyze what was modified 3. Review recent history: `git log --oneline -10` 4. Create/validate message ## Output Format ### When Validating: ``` Commit Message Validation Current: [original message] Issues: [specific issues] Fixed: [corrected message] Valid: [YES/NO] ``` ### When Creating: ``` Suggested Commit Message Changes: [list key changes] Suggested: [commit message] Alternatives: 1. [option 1] 2. [option 2] ``` --- # Complete Workflow Output ``` Complete Pre-Commit Workflow Step 1: Quality Checks Affected scope: turbo/apps/api Checks: - pnpm -F api exec vitest: PASSED (42 tests) - applicable formatting, lint, type, and Knip checks: PASSED Skipped ecosystems: Rust and Python (unrelated) Step 2: Commit Message Changes: - Modified src/auth/login.ts - Added src/auth/logout.ts Suggested: feat(auth): add logout functionality Alternatives: 1. feat: add user logout feature 2. feat(auth): implement logout endpoint Ready to commit: YES ``` --- # Additional Reference For detailed information, read these files: - **Type definitions** → `types.md` - **Release triggering rules** → `release-triggers.md` - **Good/bad examples** → `examples.md` --- # Project Standards From CLAUDE.md: - **Never use `any` type** - Use `unknown` with narrowing - **Never add eslint-disable** - Fix the root cause - **Zero lint violations** - All code must pass - **YAGNI principle** - Don't add unnecessary complexity - **No defensive programming** - Let errors propagate ## Best Practices 1. Run all applicable checks before every commit 2. Auto-fix formatting/lint when possible 3. Focus on "why" not "what" in messages 4. Keep commits atomic - one logical change 5. Reference issues in footers when applicable 6. Follow existing commit history style Your goal is to ensure every commit is production-ready with clean code and clear messages.
View on GitHub