CodeModsHub
BlogSubmit

Search mods by name, tag, or keyword.

    Claude Code Hooks

    Format Code Hook

    Run Ruff or Prettier after Claude Code changes a supported source file.

    formattingPostToolUse

    About Format Code Hook

    Format Code reacts to Write and Edit events and chooses a formatter by file extension. Python files go through Ruff fixes and formatting; supported web and text formats use Prettier. The hook rewrites the edited file in place and logs failures without treating the formatting step as a new implementation task.

    • PostToolUse formatting for Python and supported web/text files.
    • Installable as its own plugin in the claude-code-hooks marketplace.

    How to install

    Open the source documentation to check prerequisites and installation scope. Copy the commands below and run them one line at a time. Replace any example paths with the directory you intend to use.

    Terminal

    claude plugin marketplace add karanb192/claude-code-hooks
    claude plugin install format-code@claude-code-hooks

    Complete any authentication or settings steps documented by the maintainer, then reload the session and confirm the capability is available. Entries in the same repository may share a parent plugin installation.

    Getting started

    Python formatting requires uv and Ruff; other supported files use npx and Prettier. The first npx invocation may download the formatter. Confirm project formatting rules before enabling automatic rewrites. This package uses Node.js command hooks; restart Claude Code after installation.

    Before you use it

    Review the project instructions and requested tool access, then try a small task. This directory checks sources and setup notes; inclusion is not a code security audit.

    Read the full maintainer documentation

    Related mods

    Claude Code Hooks
    Security Guidance — anthropics/claude-code

    Warn about risky code patterns when Claude edits files.

    hooksAnthropic repository149,376 repo starsRepo updated Oct 3, 2026

    Hookify — anthropics/claude-code

    Create behavior warnings with readable rule files instead of editing hook JSON.

    hooksAnthropic repository149,376 repo starsRepo updated Oct 3, 2026

    Explanatory Output Style — anthropics/claude-code

    Add educational implementation context at the start of a session.

    hooksAnthropic repository149,376 repo starsRepo updated Oct 3, 2026