Back to Skills

precommit

verified

Running precommit checks and build validation. ALWAYS use after ANY code changes.

View on GitHub

Marketplace

motlin-claude-code-plugins

motlin/claude-code-plugins

Plugin

build

productivity

Repository

motlin/claude-code-plugins
3stars

plugins/build/skills/precommit/SKILL.md

Last Verified

January 24, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/motlin/claude-code-plugins/blob/main/plugins/build/skills/precommit/SKILL.md -a claude-code --skill precommit

Installation paths:

Claude
.claude/skills/precommit/
Powered by add-skill CLI

Instructions

# Precommit and Build Validation

## ๐Ÿ”‹ Battery Check

**CRITICAL**: Before running any build or test commands, check if the machine is on battery power:

```bash
scripts/check-battery || { echo "โšก Skipping precommit on battery power"; exit 0; }
just precommit
```

- If on battery power, skip the build and report: "โšก **Skipped precommit checks (on battery power)**"
- If on AC power, proceed with the build

## โš™๏ธ Running Precommit

Run `just precommit` to validate code:

- Use a timeout of at least 10 minutes
- Don't check if the justfile or recipe exists first
- This command typically runs autoformatting, builds, tests, and other quality checks

## ๐Ÿ“‹ Handle Missing Recipe

If the command fails because the justfile doesn't exist or the 'precommit' recipe is not defined, clearly explain this situation. Indicate whether the justfile file is missing or whether just the `precommit` recipe is missing.

## โŒ Handle Check Failures

When precommit fails (due to: type checking errors, test failures, linting issues, build errors):

- Analyze the error output to understand what failed
- Fix the specific failures
- Run the precommit command again
- Continue the fix-and-retry cycle until precommit completes successfully with exit code 0

## โœ… Reporting Results

Your final message MUST start with one of:

- "โšก **Skipped precommit checks (on battery power)**" - if skipped due to battery
- "โœ… **Precommit checks passed**" - if ran successfully
- "โœ… **Precommit checks passed** (after fixing [brief description])" - if fixed issues

## Agents

| Task                    | Use                                  |
| ----------------------- | ------------------------------------ |
| Run precommit and fix   | `build:precommit-runner` agent       |
| Test all branch commits | `/build:test-branch` command         |
| Test and autosquash     | `build:build-fixer-autosquash` agent |

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
1795 chars