pre-commit-hooks

Configure pre-commit hooks for JavaScript/TypeScript, Python, and PHP projects.

3|2|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/liauw-media/CodeAssist --skill pre-commit-hooks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pre-commit-hooks
Source: https://github.com/liauw-media/CodeAssist/tree/main/skills/safety/pre-commit-hooks
Command: npx skills add https://github.com/liauw-media/CodeAssist --skill pre-commit-hooks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Without automated pre-commit checks, low-quality or insecure code can enter the repository, leading to longer QA cycles and more defects.

Core Features & Use Cases

  • Language-specific setups: JS/TS, Python, PHP have tailored pre-commit configurations.
  • Minimum hooks enforced: Formatting, linting, type checks, tests, and secret checks.
  • Universal safeguards: Trails: no secrets, consistent formatting, and commit message validation.

Quick Start

Use the provided setup instructions to install Husky, lint-staged, and configure pre-commit hooks; enable automatic checks before commits.

Frequently Asked Questions about pre-commit-hooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent secrets and formatting errors from being committed to my Git repository?

Pre-commit hooks run automated checks—linting, formatting, type checking, and secret scanning—before every commit, blocking code that fails validation. This Skill configures language-specific hooks for JavaScript/TypeScript, Python, and PHP, plus universal safeguards like secret detection and trailing whitespace removal.

How do I set up pre-commit hooks for a JavaScript or TypeScript project?

Install Husky and lint-staged, then configure pre-commit hooks to run your linter, formatter, and type checker on staged files before commits. This Skill provides the setup and configuration needed to enforce these checks automatically.

Can I use pre-commit hooks with Python projects to catch type errors and security issues?

Yes. Pre-commit hooks for Python can run Black, isort, Ruff, mypy for type checking, and bandit for security scanning before commits. This Skill includes configurations for all these tools to prevent type errors and security vulnerabilities from reaching your repository.

What's the best way to enforce code quality standards across multiple languages in one repository?

Pre-commit hooks apply language-specific configurations—JS/TS, Python, PHP each have tailored checks—alongside universal safeguards for secrets and commit messages. This unified approach ensures consistent quality regardless of which language files are being committed.

Why should I use pre-commit hooks instead of just running checks manually?

Pre-commit hooks automate enforcement, running checks on every commit without manual intervention. This prevents low-quality or insecure code from entering the repository, reducing QA cycles and defects by catching issues immediately.

Does this work with PHP projects using Laravel?

Yes. Pre-commit hooks for PHP/Laravel run PHP CS Fixer, PHPStan, and Psalm to enforce formatting, static analysis, and type safety. This Skill includes the configurations needed to set these up as automated pre-commit checks.