Skip to content
Skillv1.0.0

husky

Run scripts on Git hooks with Husky. Use when a user asks to run linters before commit, validate commit messages, run tests before push, or set up Git hooks for a team.

by terminalskills(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from terminalskills/skills (skills/husky/SKILL.md). Install upstream with npx skills add terminalskills/skills --skill husky. Copyright stays with the author (Apache-2.0).

Husky

Overview

Husky manages Git hooks from package.json. Run linters, formatters, tests, and commit checks automatically before commits and pushes.

Instructions

Step 1: Setup

npm install -D husky lint-staged
npx husky init

Step 2: Pre-commit Hook

# .husky/pre-commit — Run lint-staged before each commit
npx lint-staged
// package.json — lint-staged configuration
{
  "lint-staged": {
    "*.{ts,tsx}": ["eslint --fix", "prettier --write"],
    "*.{css,md,json}": ["prettier --write"]
  }
}

Step 3: Pre-push Hook

# .husky/pre-push — Run tests before pushing
npm test

Guidelines

  • Husky v9+ uses .husky/ directory with plain shell scripts.
  • lint-staged runs linters only on staged files — fast even in large repos.
  • Don't run full test suite in pre-commit (too slow); save it for pre-push or CI.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/terminalskills-skills-husky/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

terminalskills-skills-husky.ocm.jsonjson
{
  "ocm": "1",
  "id": "terminalskills-skills-husky",
  "kind": "skill",
  "name": "husky",
  "description": "Run scripts on Git hooks with Husky. Use when a user asks to run linters before commit, validate commit messages, run tests before push, or set up Git hooks for a team.",
  "publisher": "terminalskills",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "husky",
      "git-hooks",
      "pre-commit",
      "lint",
      "ci",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Run scripts on Git hooks with Husky. Use when a user asks to run linters before commit, validate commit messages, run tests before push, or set up Git hooks for a team."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/terminalskills/skills",
      "path": "skills/husky/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/terminalskills/skills/blob/HEAD/skills/husky/SKILL.md",
      "key": "terminalskills/skills/skills/husky/SKILL.md"
    },
    "compatibility": "Any Git repository, Node.js",
    "license": "Apache-2.0"
  },
  "instructions": "# Husky\n\n## Overview\nHusky manages Git hooks from package.json. Run linters, formatters, tests, and commit checks automatically before commits and pushes.\n\n## Instructions\n\n### Step 1: Setup\n```bash\nnpm install -D husky lint-staged\nnpx husky init\n```\n\n### Step 2: Pre-commit Hook\n```bash\n# .husky/pre-commit — Run lint-staged before each commit\nnpx lint-staged\n```\n\n```json\n// package.json — lint-staged configuration\n{\n  \"lint-staged\": {\n    \"*.{ts,tsx}\": [\"eslint --fix\", \"prettier --write\"],\n    \"*.{css,md,json}\": [\"prettier --write\"]\n  }\n}\n```\n\n### Step 3: Pre-push Hook\n```bash\n# .husky/pre-pus",
  "cost": {
    "context_tokens": 218
  }
}

Fetch it by URL: GET /api/v1/registry/terminalskills-skills-husky/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.