لوگوی اسکیلیکس اسکیلیکس | Skilliks آکادمی و استودیوی ابزارهای AI تاریخ شمسی… --:--:--

Configuring Lefthook

آزاد تازه‌وارد تاییدشده امن

قواعد و مراحل استاندارد عامل‌های هوش مصنوعی را به دستیار هوش مصنوعی اضافه می‌کند تا خروجی یکدست بگیرید. (شامل ۱۶ گام عملی · سازگار با Claude Code).

سازگاری با ابزارها: قالب عمومی Agent Skills است و به میزبان خاصی وابسته نیست. مشاهدهٔ جدول سازگاری

متن دستورالعمل (SKILL.md)

دسترسی کامل فعال است
---
name: configuring-lefthook
description: Set up fast Git hooks with Lefthook - fix and check the staged files before a commit, check the commit message, and reinstall dependencies after a pull or checkout. Use when working on lefthook.yml, when a hook fails, or when hooks do not run.
license: MIT
compatibility: Requires git >= 2.40 and lefthook 2.
metadata:
  author: famiglio
  category: tooling
---

# Configuring Lefthook

Run quick checks on the staged files at every commit, so small problems never reach the repository. Keep slow checks, such as the full test suite, in CI.

## Prerequisites

- The project is a Git repository with a `package.json`.
- Look for an existing hook manager: `lefthook.yml`, `.config/lefthook.yml`, or `.husky/`. If the project uses Husky, keep it and add the jobs there. Never install a second hook manager.

## Procedure

1. **Install.**
   - In a project that uses the spellbook configs, run `pnpm dlx @famiglio/sbx init lefthook`. It merges the jobs into an existing `lefthook.yml`.
   - By hand:

     ```bash
     pnpm add -D lefthook
     ```

     Add `"prepare": "lefthook install"` to the scripts, so `pnpm install` installs the hooks. With pnpm, also allow the package's own install script, which sets up the `lefthook` binary, in `pnpm-workspace.yaml`:

     ```yaml
     allowBuilds:
       lefthook: true
     ```

2. **Write the configuration**, in `lefthook.yml` or `.config/lefthook.yml`:

   ```yaml
   assert_lefthook_installed: true
<!-- ‹guest · 2026-12-05› -->

   pre-commit:
     piped: true
     jobs:
       - name: 'lint'
         run: 'pnpm exec eslint --no-warn-ignored --fix {staged_files}'
         stage_fixed: true
       - name: 'format'
         run: 'pnpm exec prettier --ignore-unknown --write {staged_files}'
         stage_fixed: true
       - name: 'lint:spelling'
         run: 'pnpm exec cspell --no-progress --no-summary --no-must-find-files {staged_files}'

   commit-msg:
     jobs:
       - name: 'lint:commit'
         run: 'pnpm exec commitlint --edit {1} --verbose'

   post-merge:
     jobs:
       - name: 'install'
         files: 'git diff --name-only HEAD@{1} HEAD'
         glob: 'pnpm-lock.yaml'
         run: 'pnpm install'
   ```

   - `piped: true` runs the jobs in order, so Prettier formats what ESLint fixed.
   - `stage_fixed: true` adds the fixes to the commit.
   - `{staged_files}` keeps the hook fast. Never check the whole repository in `pre-commit`.
   - Add a `fail_text` to tell people how to fix a failure.

3. **When a hook fails, fix the problem and commit again.** Never skip hooks with `--no-verify` or `LEFTHOOK=0` unless the user asks. A person can skip one job with `LEFTHOOK_EXCLUDE=<job> git commit …`.

## Verification

```bash
pnpm exec lefthook validate
pnpm exec lefthook check-install
pnpm exec lefthook run pre-commit
```
<!-- ‹guest · 2026-12-05› -->

The first command prints `All good`, the second finds the hooks installed, and the third passes.

این نسخه با نشانه‌گذاری اختصاصی حساب شما نمایش داده می‌شود. برای نصب سریع، به تب نصب و راه‌اندازی بروید.

مهارت‌های مشابه و پیشنهادی

مشاهدهٔ همه ←
عامل‌های هوش مصنوعی
✦ Pro

REA

دستورالعمل اجرایی آماده برای انجام دقیق کارهای عامل‌های هوش مصنوعی بدون تکرار پرامپت‌های طولانی. (شامل ۶۵ گام عملی · سا…

⚡ /reverse-engineer-anything SKILL.md
Claude / Claude CodeOpenAI Codex +۲
۹۴/۱۰۰ ★ ۴۷۹,۷۷۳
عامل‌های هوش مصنوعی
✦ Pro

Verification Before Completion

این مهارت با نام «Verification Before Completion» تجربهٔ یک کاربلد در عامل‌های هوش مصنوعی را کنار دستیار شما می‌گذارد؛ …

⚡ /verification-before-completion SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
عامل‌های هوش مصنوعی
✦ Pro

Dispatching Parallel Agents

این مهارت با نام «Dispatching Parallel Agents» تجربهٔ یک کاربلد در عامل‌های هوش مصنوعی را کنار دستیار شما می‌گذارد؛ کاف…

⚡ /dispatching-parallel-agents SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
عامل‌های هوش مصنوعی
✦ Pro

Using Git Worktrees

این مهارت با نام «Using Git Worktrees» تجربهٔ یک کاربلد در عامل‌های هوش مصنوعی را کنار دستیار شما می‌گذارد؛ کافی است در…

⚡ /using-git-worktrees SKILL.md
Cline
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
عامل‌های هوش مصنوعی
✦ Pro

Subagent-Driven Development

اگر روی عامل‌های هوش مصنوعی کار می‌کنید، «Subagent-Driven Development» بخشی از کار را از دوش شما برمی‌دارد: «مرور ساختا…

⚡ /subagent-driven-development SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
عامل‌های هوش مصنوعی
✦ Pro

The Rule

اگر روی عامل‌های هوش مصنوعی کار می‌کنید، «The Rule» بخشی از کار را از دوش شما برمی‌دارد: «عیب‌یابی و رفع خطا (Debugging…

⚡ /using-superpowers SKILL.md
Claude / Claude CodeOpenAI Codex +۱
۹۱/۱۰۰ ★ ۳۲۴,۲۹۰