Format Javascript Files

Claude Code Hook · post-tool

A Claude Code hook that automatically formats JavaScript and TypeScript files using Prettier after every edit. It ensures consistent code style without manual intervention and works for developers using Claude Code.

Automatically format JavaScript/TypeScript files after any Edit operation using prettier. This hook runs 'npx prettier --write' on any .js, .ts, .jsx, or .tsx file that Claude modifies, ensuring consistent code formatting. Uses npx so prettier doesn't need to be globally installed. Includes error suppression so it won't fail if prettier is not available.

Install

npx claude-code-templates@latest --hook post-tool/format-javascript-files

View on GitHub