Skip to content
Agentmart
Submit a tool

setup-pre-commit

Configura hooks de pre-commit com Husky, lint-staged (Prettier), verificação de tipos e testes no repositório atual.

Skill by hcb2019

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/hcb2019-setup-pre-commit

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Configura hooks de pre-commit com Husky, lint-staged (Prettier), verificação de tipos e testes no repositório atual. Use quando o usuário quiser adicionar hooks de pre-commit, configurar Husky, configurar lint-staged ou adicionar formatação/verificação de tipos/testes no momento do commit.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/setup-pre-commit

What's inside

Skill name
setup-pre-commit
Description
Configura hooks de pre-commit com Husky, lint-staged (Prettier), verificação de tipos e testes no repositório atual. Use quando o usuário quiser adicionar hooks de pre-commit, configurar Husky, configurar lint-staged ou adicionar formatação/verificação de tipos/testes no momento do commit.
License
MIT
Instructions
88 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Set Up Pre-Commit Hooks

## What Gets Configured

- **Husky** pre-commit hook
- **lint-staged** running Prettier on all staged files
- **Prettier** config (if absent)
- **typecheck** and **test** scripts in the pre-commit hook

## Steps

### 1. Detect package manager

Check for `package-lock.json` (npm), `pnpm-lock.yaml` (pnpm), `yarn.lock` (yarn), `bun.lockb` (bun). Use whatever is present. Default: npm if unclear.

### 2. Install dependencies

Install as devDependencies:

```
husky lint-staged prettier
```

### 3. Initialize Husky

```bash
npx husky init
```

This creates the `.husky/` directory and adds `prepare: "husky"` to package.json.

### 4. Create `.husky/pre-commit`

Write this file (no shebang needed for Husky v9+):

```
npx lint-staged
npm run typecheck
npm run test
```

**Adapt**: Replace `npm` with the detected package manager. If the repository doesn't have a `typecheck` or `test` script in package.json, omit those lines and warn the user.

### 5. Create `.lintstagedrc`

```json
{
  "*": "prettier --ignore-unknown --write"
}
```

### 6. Create `.prettierrc` (if absent)

Create only if no Prettier config exists. Use these defaults:

```json
{
  "useTabs": false,
  "tabWidth": 2,
  "printWidth": 80,
  "singleQuote": false,
  "trailingComma": "es5",
  "semi": true,
  "arrowParens": "always"
}
```

### 7. Verify

- [ ] `.husky/pre-commit` exists and is executable
- [ ] `.lintstagedrc` exists
- [ ] `prepare` script in package.json is `"husky"`
- [ ] `prettier` config exists
- [ ] Run `npx lint-staged` to verify it works

### 8. Commit

Add all changed/created files and commit with message: `Add pre-commit hooks (husky + lint-staged + prettier)`

This will run the new pre-commit hooks — a good smoke test that everything works.

## Notes

- Husky v9+ doesn't need shebangs in hook files
- `prettier --ignore-unknown` skips files Prettier can't parse (images, etc.)
- The pre-commit runs lint-staged first (fast, staged files only), then full typecheck and tests

From hcb2019/claude-code-skills, MIT.

More from hcb2019/claude-code-skills

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Jun 8, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from hcb2019

Cite this page

setup-pre-commit skill. Agent Mart. https://agentmart.dev/skills/hcb2019-setup-pre-commit (last updated 2026-10-24)