Agent skill

Precommit

by sd0xdev in sd0xdev/sd0x-harness

Pre-commit checks — lint:fix - build - test. An agent skill from sd0xdev/sd0x-harness.

MITAuto-check passedDevelopment

Install Precommit

skills CLI
$ npx skills add sd0xdev/sd0x-harness --skill precommit -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install sd0xdev/sd0x-harness precommit --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/sd0xdev/sd0x-harness.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/precommit .claude/skills/precommit && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
precommit
GitHub stars
192
Token cost
~1.8k tokens
SKILL.md length
795 words
Files
1
Skills in repo
91
Repo updated
First seen
Licence
MIT

At a glance

Pre-commit checks — lint:fix - build - test. An agent skill from sd0xdev/sd0x-harness.

  • Works in 2 steps: Check for runner script → Fallback (no runner script)
  • Tasks that involve Linting and formatting
  • SKILL.md covers Trigger, When NOT to Use, Workflow Steps and Task, plus 1 more section
  • Calls mvn, bundle and node

What it does

Precommit is an agent skill from sd0xdev/sd0x-harness. Pre-commit checks — lint:fix - build - test

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Linting and formatting. The repository describes itself as: The harness layer for Claude Code — a reference implementation of harness engineering with hook-enforced dual review, state-machine gates that survive context compaction, and… The licence is MIT.

When your agent uses it

  • Tasks that involve Linting and formatting

Example prompts

  • “/precommit”

Requirements

  • Python 3
  • Node.js
  • Pre-approved tools (allowed-tools): Bash(node:*), Bash(pnpm:*), Bash(yarn:*), Bash(npm:*), Bash(npx:*), Bash(python*:*), Bash(pytest:*), Bash(ruff:*), Bash(mypy:*), Bash(cargo:*), Bash(go:*), Bash(golangci-lint:*), Bash(./gradlew:*), Bash(mvn:*), Bash(bundle:*), Bash(rubocop:*), Bash(rspec:*), Bash(git:*), Read, Grep, Glob

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. Check for runner script
  2. Fallback (no runner script)

What it can do on your machine

Read from SKILL.md and the folder at commit c9a2036. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash(node:*)
    • Bash(pnpm:*)
    • Bash(yarn:*)
    • Bash(npm:*)
    • Bash(npx:*)
    • Bash(python*:*)
    • Bash(pytest:*)
    • Bash(ruff:*)
    • Bash(mypy:*)
    • Bash(cargo:*)

    …and 11 more on the same allowed-tools line.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • mvn
    • bundle
    • node
    • cargo
    • pytest
    • go
    • ruff
    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Precommit loads about 1.8k tokens when it runs. Until then it costs about 14 tokens; SKILL.md has 795 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~14
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from sd0xdev/sd0x-harness at commit c9a2036, republished under its MIT licence (© sd0xdev). 795 words, ~1,844 tokens.

Download SKILL.mdSave it as .claude/skills/precommit/SKILL.md (or your agent's skills folder).
name
precommit
description
Pre-commit checks — lint:fix -> build -> test
allowed-tools
Bash(node:*), Bash(pnpm:*), Bash(yarn:*), Bash(npm:*), Bash(npx:*), Bash(python*:*), Bash(pytest:*), Bash(ruff:*), Bash(mypy:*), Bash(cargo:*), Bash(go:*), Bash(golangci-lint:*), Bash(./gradlew:*), Bash(mvn:*), Bash(bundle:*), Bash(rubocop:*), Bash(rspec:*), Bash(git:*), Read, Grep, Glob

Pre-Commit Checks (Full)

Trigger

  • Keywords: precommit, pre-commit, lint and test, quality gate

When NOT to Use

  • Quick checks without build (use /precommit-fast)
  • Verification loop without lint:fix (use /verify)
  • Just running tests (run directly)

Workflow Steps

StepGoalSafetySkip if Missing
comment_blocksReject over-long comment blocks (@rules/docs-writing.md § Code Comments)read-onlyyes
lint-fixAuto-fix code style issuesread-writeyes
buildVerify compilation succeedsread-onlyyes
test-unitRun full test suiteread-onlyyes

Failure behavior: continue-all (run all steps, report all results)

comment_blocks is a policy step, and the asymmetry is deliberate (POLICY_STEPS in scripts/precommit-runner.js): it can FAIL the run, but it never counts as "validation ran". A run where policy was the only thing that executed still reports ⚠️ NO CHECKS RUN, so a repo whose real checks are pytest/cargo cannot bank a ✅ PASS on a passing comment scan alone. It runs first because it is static and cheap.

Task

Run pre-commit checks: lint:fix -> build -> test

Step 1: Check for runner script

Use Glob to check if .claude/scripts/precommit-runner.js exists in the project root.

  • Found → run: node .claude/scripts/precommit-runner.js --mode full --tail 80
    • If runner emits ## Overall: ✅ PASS, use its output and skip to the Output section.
    • If runner emits ## Overall: ⚠️ NO CHECKS RUN, do NOT treat it as a pass — fall through to Step 2 ecosystem detection so the project's real checks run. The marker means no project validation executed and no policy step failed — every validation step was a skip or unavailable, and any policy step (comment_blocks) either skipped or passed (a FAILING policy step is ❌ FAIL, never this marker — line 30's asymmetry) — whether because the repo declares no runnable checks or because the required tools were not available to the runner (which orchestrates the ecosystem table below itself: it detects pyproject.toml/Cargo.toml/go.mod/… and runs those checks as first-class steps). The runner self-notes its own verdict (review-state.js note precommit pass|fail); on ⚠️ NO CHECKS RUN it notes nothing — the slot is untouched and the reminder persists, which is the correct reading of "nothing validated".
    • If runner fails (## Overall: ❌ FAIL), treat as a real precommit failure (do not silently fallback).
  • NOT found → Auto-install attempt (see precommit-fast for identical auto-install logic), then fallback to Step 2.
Show full SKILL.md (435 more words)Show less
Step 2: Fallback (no runner script)

Detect the project ecosystem to run steps manually.

Ecosystem detection:

ManifestEcosystemLint-fixBuildTest
package.jsonNode.js{pm} lint:fix{pm} build{pm} test:ci / test / test:fast / test:unit
pyproject.tomlPythonruff check --fix .—pytest tests/unit/
Cargo.tomlRustcargo clippy --fixcargo buildcargo test
go.modGogolangci-lint run --fixgo build ./...go test ./...
build.gradle / build.gradle.ktsJava (Gradle)./gradlew spotlessApply./gradlew build./gradlew test
pom.xmlJava (Maven)mvn spotless:applymvn compilemvn test
GemfileRubybundle exec rubocop -a—bundle exec rspec

How the runner executes this table (WB2b): a required tool missing from the environment (ruff, pytest, cargo, go, golangci-lint, mvn, bundle, the gradle wrapper — the runner never falls back to a global gradle) marks that step unavailable, which blocks ✅ PASS — incomplete validation must not let a sibling check mint the receipt. A repo-declared capability absent is an ordinary skip, but only on definitive non-membership evidence — never a manifest grep, and never an ambiguous probe failure (broken build config, broken task, network-dependent resolution), which stays unavailable: Ruby rubocop/rspec membership is read from Gemfile.lock text — rspec counts rspec or its executable provider rspec-core — after bundle check passes (a failing bundle check or unreadable lockfile is unavailable); Gradle spotless skips only on Gradle's own Task 'spotlessApply' not found diagnostic from gradlew help --task spotlessApply (a marker-less failure is unavailable — Gradle realizes tasks lazily, so a configured-but-broken task fails the probe exactly like an absent one); Maven spotless skips only on the No plugin found for prefix marker from mvn help:describe -Dplugin=spotless — any other failure is unavailable. All probes are bounded (PRECOMMIT_PROBE_TIMEOUT_MS, default 120s; output capped) and logged; a probe timeout is unavailable, never a skip. Python tests run pytest tests/unit/ when that directory exists, else bare pytest (config-driven discovery — a repo with no tests fails loudly on exit 5 instead of silently skipping). Clippy runs with --allow-dirty --allow-staged: precommit operates on a dirty tree by definition.

For Node.js projects, auto-detect package manager from lockfile.

Steppackage.json scriptIf missing
lint:fixlint:fixSkip with note
buildbuildSkip with note
testtest:ci → test → test:fast → test:unitSkip with note

After lint:fix completes, run git diff --name-only to capture auto-fixed files.

After a conclusive fallback run, self-note the outcome — the runner cannot see a run it did not perform, and the rounds count stays path-independent (a failure is a failure whichever engine ran it):

bash
CHECKER=".claude/scripts/review-state.js"; [ -f "$CHECKER" ] || CHECKER="scripts/review-state.js"
node "$CHECKER" note precommit pass   # every executed check passed
node "$CHECKER" note precommit fail   # the checks ran and at least one failed

An inconclusive run (the checks could not execute at all) notes nothing — exactly like the runner's ⚠️ NO CHECKS RUN: the slot stays untouched and the reminder persists. The note is advisory; a failed note is reported and never fails the run.

Output

markdown
## Precommit (full)

## Results

| Step | Status | Notes |
|------|--------|-------|
| lint:fix | ✅/❌/⏭️/⛔ | ⏭️ = repo opted out (skip); ⛔ = required tool unavailable (blocks PASS) |
| build | ✅/❌/⏭️/⛔ | same legend |
| test | ✅/❌/⏭️/⛔ | same legend |

## Changed Files (after lint:fix)

- <files or "(none)">

## Overall: ✅ PASS / ❌ FAIL / ⚠️ NO CHECKS RUN (no project validation executed AND no policy step failed — validation steps all skipped/unavailable, policy steps skipped or passed; fall through to Step 2, needs human if nothing runnable exists)

## Checklist

- [ ] All available checks pass
- [ ] git status reviewed

© sd0xdev, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/precommit of sd0xdev/sd0x-harness.

Open the folder on GitHubat commit c9a2036

Compare with similar skills

Precommit next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Precommit compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Precommit this skillsd0xdev/sd0x-harness192—~1.8kAutomated safety check: PassMIT
Go Pedantrychromedp/chromedp13k—~3.7kAutomated safety check: PassMIT
Kedro Babysitkedro-org/kedro11k—~4kAutomated safety check: PassCustom licence
Trellis Checkanjiemo/SunnyBeach1787 repos~666Automated safety check: PassApache-2.0
WooCommerce Dev Cyclewoocommerce/woocommerce11k3 repos~431Automated safety check: PassCustom licence
Adk Setupgoogle/adk-python22k—~993Automated safety check: NotesApache-2.0

Similar skills

  • Go Pedantry

    chromedp/chromedp

    This skill should be used when the user is writing Go code and needs guidance on Go-specific pedantry: error wrapping with fmt.Errorf and %w, interface design (accept interfaces return structs)…

    13k GitHub stars~3.7k tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • Kedro Babysit

    kedro-org/kedro

    Run Kedro's local lint / format / type-check / tests on changed files (uses the project's pre-commit hooks, ruff, mypy, pytest, lint-imports, detect-secrets, Make targets — in the right venv), or…

    11k GitHub stars~4k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Trellis Check

    anjiemo/SunnyBeach

    Comprehensive quality verification: spec compliance, lint, type-check, tests, cross-layer data flow, code reuse, and consistency checks.

    178 GitHub starsUsed in 7 repos~666 tokens
    DevelopmentAuto-check passed
  • WooCommerce Dev Cycle

    woocommerce/woocommerce

    Workflow for WooCommerce development: run PHP and JavaScript tests, lint and fix code style on the current branch, and follow guides for i18n and markdown.

    11k GitHub starsUsed in 3 repos~431 tokens
    DevelopmentAuto-check passed
  • Adk Setup

    google/adk-python

    Official

    Sets up a local ADK Python development environment in a git clone of the open-source adk-python repository: a uv virtual environment, all dependency extras, pre-commit hooks, and a first unit-test…

    22k GitHub stars~993 tokensUpdated today
    DevelopmentAuto-check: notes
  • Dep Validate

    blokadaorg/blokada

    A skill your agent uses to validate risky dependency bumps end to end as a local or cloud-launched agent.

    3.3k GitHub stars~5.7k tokensUpdated today
    DevelopmentAuto-check: notes

More from sd0xdev/sd0x-harness

All 91 skills in this repo
  • Adr

    sd0xdev/sd0x-harness

    Write an Architecture Decision Record (ADR) for a feature — Context / Decision / Status / Consequences / Alternatives, filed as docs/features/<feature/adr-<NNN-<title.md with a 3-digit zero-padded…

    192 GitHub stars~4.8k tokensUpdated yesterday
    Auto-check passed
  • Load PR Review

    sd0xdev/sd0x-harness

    Load GitHub PR review comments into AI session — analyze, triage, plan.

    192 GitHub stars~4.4k tokensUpdated yesterday
    Auto-check passed
  • Next Step

    sd0xdev/sd0x-harness

    Change-aware next step advisor. An agent skill from sd0xdev/sd0x-harness.

    192 GitHub stars~1.6k tokensUpdated yesterday
    Auto-check passed
  • Obsidian CLI

    sd0xdev/sd0x-harness

    Obsidian vault integration via official CLI. An agent skill from sd0xdev/sd0x-harness.

    192 GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Orchestrate

    sd0xdev/sd0x-harness

    Agent-driven workflow orchestration (v1 report-only). An agent skill from sd0xdev/sd0x-harness.

    192 GitHub stars~2.5k tokensUpdated yesterday
    Auto-check passed
  • PR Comment

    sd0xdev/sd0x-harness

    Post friendly review comments to a GitHub PR — prepare locally, preview, then submit as atomic review.

    192 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed

Questions about Precommit

What does Precommit do?

Pre-commit checks — lint:fix - build - test. An agent skill from sd0xdev/sd0x-harness. Precommit is an agent skill from sd0xdev/sd0x-harness.

When should I use Precommit?

Precommit fits situations like: tasks that involve Linting and formatting.

How do I install Precommit in Claude Code?

Run `npx skills add sd0xdev/sd0x-harness --skill precommit -a claude-code`. Or copy the skill folder (skills/precommit in sd0xdev/sd0x-harness) into .claude/skills/precommit in your project. Claude Code loads it when a task matches its description.

How do I install Precommit in Codex?

Run `npx skills add sd0xdev/sd0x-harness --skill precommit -a codex`. Or copy the skill folder (skills/precommit in sd0xdev/sd0x-harness) into .agents/skills/precommit in your project. Codex loads it when a task matches its description.

Can I use Precommit in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add sd0xdev/sd0x-harness --skill precommit -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/precommit, .gemini/skills/precommit, .github/skills/precommit and .opencode/skills/precommit in your project.

What does Precommit need to run?

Going by SKILL.md and its folder, Precommit needs the command-line tools its instructions call (mvn, bundle, node, cargo, pytest and go). Our summary lists: Python 3; Node.js. Its frontmatter pre-approves these tools: Bash(node:*), Bash(pnpm:*), Bash(yarn:*), Bash(npm:*), Bash(npx:*), Bash(python*:*), Bash(pytest:*), Bash(ruff:*), Bash(mypy:*), Bash(cargo:*), Bash(go:*), Bash(golangci-lint:*), Bash(./gradlew:*), Bash(mvn:*), Bash(bundle:*), Bash(rubocop:*), Bash(rspec:*), Bash(git:*), Read, Grep, Glob.

Does Precommit access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Precommit safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Precommit use?

Precommit is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Precommit use?

About 1.8k tokens (SKILL.md is roughly 7.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Precommit?

Skills that share tags, products or a category with Precommit: Go Pedantry (chromedp/chromedp, 13k stars), Kedro Babysit (kedro-org/kedro, 11k stars), Trellis Check (anjiemo/SunnyBeach, 178 stars) and WooCommerce Dev Cycle (woocommerce/woocommerce, 11k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Precommit?

sd0xdev (a GitHub user) maintains it in sd0xdev/sd0x-harness, which has 192 GitHub stars. The repository holds 91 skills in this directory. The repository was last updated on October 6, 2026.

Source: sd0xdev/sd0x-harness on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.