Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

run-pre-commit-checks

БесплатноБез исполняемых скриптовНе проверен

Run every check of the pre-commit hook, or one step alone to debug it. Use when about to commit, or when the pre-commit hook fails.

torrustот torrust★ 539 звёзд на GitHub

Об этом скилле

Run Pre-commit Checks

Git Hook (Recommended Setup)

The repository ships a pre-commit Git hook that runs ./contrib/dev-tools/git/hooks/pre-commit.sh automatically on every git commit. Install it once after cloning:

./contrib/dev-tools/git/install-git-hooks.sh

After installation the hook fires automatically; you do not need to invoke the script manually before each commit.

For AI agents: before invoking the script manually, check whether the hook is installed:

./contrib/dev-tools/git/check-git-hooks.sh

If installed, skip the manual run — git commit will trigger it automatically. Running both would execute every check twice.

Automated Checks

⏱️ Expected runtime: ~1 minute on a modern developer machine with warm caches. AI agents should set a command timeout of at least 3 minutes before invoking ./contrib/dev-tools/git/hooks/pre-commit.sh.

Run the pre-commit script. It must exit with code 0 before every commit.

For AI agents: set TORRUST_GIT_HOOKS_LOG_DIR=.tmp so per-step log files are written inside the workspace (git-ignored) instead of /tmp (outside workspace, requiring permission prompts):

TORRUST_GIT_HOOKS_LOG_DIR=.tmp ./contrib/dev-tools/git/hooks/pre-commit.sh

Restricted Agent Sandboxes

Some restricted sandboxes also omit Cargo from the PATH inherited by hook subprocesses. When both restrictions apply, run:

PATH="$HOME/.cargo/bin:$PATH" \
TORRUST_GIT_HOOKS_LOG_DIR=.tmp \
./contrib/dev-tools/git/hooks/pre-commit.sh

This is an agent-environment workaround. Normal developer environments should continue using the standard command above.

The script runs these steps in order:

  1. ./contrib/dev-tools/checks/format-project-words.sh - formats project-words.txt with LC_ALL=C sort -u
  2. cargo run --quiet --package clippy-allow-reasons -- --staged - prospective native-reason check for changed staged Clippy allow attributes. The command resolves the first available base reference from origin/develop, upstream/develop, torrust/develop, or local develop.
  3. cargo run --quiet --package source-location-check -- --staged - check, on the staged content, that non-test Rust code does not use Location::caller(), #[track_caller] or torrust-located-error (ADR 20261118045443_errors_do_not_record_source_locations). Exceptions go in contrib/dev-tools/checks/source-location-check/allow-list.txt, one reason per entry.
  4. cargo run --quiet --package frontmatter-validator --bin frontmatter-validator -- --staged - read-only v1 frontmatter check of the staged content of staged Markdown files. A staged edit to a draft or open issue spec without v1 frontmatter fails with legacy-shape. See contrib/dev-tools/checks/frontmatter-validator/README.md for the migration checklist.
  5. cargo run --quiet --package frontmatter-validator --bin frontmatter-validator -- --skill-layout - repository-wide check of the agent skills in the index: every skill at .claude/skills/<name>/SKILL.md, the redirect stubs under .github/skills/ and their inventory, each skill's name, and the index .claude/skills/README.md. See the validator README for each finding.
  6. cargo run --quiet --package frontmatter-validator --bin frontmatter-validator -- --skill-descriptions - check of each skill's description in the index: whole as YAML reads it (not cut by a # comment) and 200 characters or less. See the add-new-skill skill's description rules.
  7. cargo run --quiet --package agent-reply-validator --bin agent-reply-validator -- --all - check of the staged content of every agent reply file in the index: every file in an agent-replies/ folder or named like a reply file. See the agent-reply-v1 schema in docs/schemas/README.md.
  8. cargo machete --with-metadata - unused dependency check
  9. cargo deny check bans - workspace layer-boundary dependency check
  10. cargo +nightly fmt --all -- --check - nightly Rust formatting check
  11. linter all - all linters (markdown, lychee local links, YAML, TOML, clippy, rustfmt, shellcheck, cspell)
  12. ./contrib/dev-tools/checks/lint-containerfile.sh - hadolint check of the Containerfile
  13. cargo test --doc --workspace - documentation tests

If the formatter changes the dictionary, the hook exits non-zero before the verification steps. Stage project-words.txt and retry the commit. Run the formatter independently with:

./contrib/dev-tools/checks/format-project-words.sh

This is an interim action related to EPIC #2003 and may be replaced or refactored after its automation design decision.

When scripting the gate before a commit, test the hook's own exit code. Never pipe it into tail, grep, or another filter inside an && chain: the pipeline returns the filter's status, so a failing gate still lets the commit run.

./contrib/dev-tools/git/hooks/pre-commit.sh > .tmp/p
Полный SKILL.md на GitHub

Установить run-pre-commit-checks в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл run-pre-commit-checks?

Run every check of the pre-commit hook, or one step alone to debug it. Use when about to commit, or when the pre-commit hook fails.

Как установить скилл run-pre-commit-checks?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл run-pre-commit-checks запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить run-pre-commit-checks с