Back to Skills

code-formatter

Automatically formats and validates code files using Prettier and other formatting tools.Use when users mention "format my code", "fix formatting", "apply code style","check formatting", "make code consistent", or "clean up code formatting".Handles JavaScript, TypeScript, JSON, CSS, Markdown, and many other file types.

1,313stars157forksUpdated 2/10/2026

Security Assessment

Safe(100/100)
Security Score100/100

About code-formatter

The 'code-formatter' skill automates the process of formatting and validating code files to ensure consistency and adherence to a set coding style. It utilizes Prettier, a popular code formatting tool, and integrates with other formatting tools to clean up and enforce consistent code formatting across various file types, including JavaScript, TypeScript, JSON, CSS, and Markdown. By triggering this skill with phrases like 'format my code', 'fix formatting', or 'apply code style', users can easily standardize the appearance of their codebase, ensuring a more maintainable and readable code structure.

The main capabilities of this skill include automatic formatting of code using predefined rules, validation of code formatting with Prettier's `--check` option, and the ability to apply these formatting rules to specific files or directories. Users can configure formatting preferences through `.prettierrc` or `.editorconfig` files, and exclude files or directories with `.prettierignore`. Additionally, the skill supports enforcing formatting via git hooks with tools like Husky and lint-staged to ensure that code adheres to the specified style before commits. This functionality is essential for teams looking to maintain clean and uniform code in collaborative projects, reducing the time spent on manual formatting and improving overall code quality.

FAQ

What file types are supported by the code-formatter skill?

The skill supports a wide range of file types including JavaScript, TypeScript, JSON, CSS, and Markdown. It can be extended to other file types as needed.

Do I need to install Prettier globally to use this skill?

You can use Prettier either globally or locally in your project. However, it must be installed and accessible for the skill to work correctly.

Can I automatically enforce code formatting before commits?

Yes, you can enforce code formatting by using git hooks with tools like Husky and lint-staged, which are supported by this skill.

What are the system requirements for using the code-formatter skill?

The skill requires Node.js and npm/npx installed on your system. You also need write permissions for the target files and Prettier installed either globally or locally.

Install code-formatter

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill