setup-formatting — Claude Code command: what it does, how to install
A Claude Code command that configures code formatters and enforces project style rules. Useful when setting up Prettier, Black, or rustfmt with git hooks.
npx claude-code-templates@latest --command setup/setup-formattingWhat setup-formatting does
This command automates code formatting setup across a project. It begins by scanning the directory with find. The agent looks for JavaScript, TypeScript, Python, or Rust files. It also inspects existing configs such as .prettierrc, pyproject.toml, or rustfmt.toml, alongside package manifests.
Next, it installs appropriate tools like Prettier, Black, or rustfmt. The setup defines indentation and line length rules. Beyond basic configuration, it prepares .vscode/settings.json settings and pre-commit hooks for CI validation.
Claude Code needs Read, Write, Edit, and Bash permissions to run this command. Without Bash access, package installation fails. You can target specific stacks with flags like --python, --typescript, or --multi-language.
What it helps with
- install and configure Prettier, Black, or rustfmt
- standardize indentation, quotes, and line length rules
- automate style checks inside pre-commit hooks and CI pipelines
- configure format-on-save settings in
.vscode/settings.json
Example prompts for the agent
- Run
/setup-formatting --pythonto configure Black and project rules - Set up Prettier formatting with
/setup-formatting --typescript - Configure multi-language formatting via
/setup-formatting --multi-language
How to install setup-formatting
1claude-code-templates
npx claude-code-templates@latest --command setup/setup-formatting2Manually: put the files in place
.claude/commands/setup-formatting.mdCall it with /setup-formatting. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/setup-formatting.mdCall it with /prompts:setup-formatting. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/setup-formatting.prompt.mdManually: put the files in place
.gemini/commands/setup-formatting.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about setup-formatting
How to install setup-formatting in Claude Code?
Run npx claude-code-templates@latest --command setup/setup-formatting in your terminal. It saves the command file to .claude/commands/setup-formatting.md.
What does setup-formatting do?
It detects project languages, installs matching formatters like Prettier or Black, and writes configuration files. The command also configures pre-commit hooks and editor settings.
What permissions does setup-formatting require?
The command requires Read, Write, Edit, and Bash tools. Claude Code uses them to inspect repository files, install formatters, and edit configuration files.
Source text
setup-formatting.md · MIT
--- allowed-tools: Read, Write, Edit, Bash argument-hint: "[language] | --javascript | --typescript | --python | --multi-language" description: Configure comprehensive code formatting tools with consistent style enforcement --- # Setup Code Formatting Configure comprehensive code formatting with consistent style enforcement: **$ARGUMENTS** ## Current Project State - Languages detected: !`find . -name "*.js" -o -name "*.ts" -o -name "*.py" -o -name "*.rs" | head -5` - Existing formatters: @.prettierrc or @pyproject.toml or @rustfmt.toml - Package manager: @package.json or @requirements.txt or @Cargo.toml - IDE config: @.vscode/settings.json or @.editorconfig ## Task Setup comprehensive code formatting system with automated enforcement and team consistency: **Language Focus**: Use $ARGUMENTS to configure JavaScript/TypeScript, Python, Rust, or multi-language formatting **Formatting Setup**: 1. **Tool Installation** - Prettier, Black, rustfmt, language-specific formatters and plugins 2. **Configuration** - Style rules, line length, indentation, quotes, trailing commas, language-specific options 3. **IDE Integration** - Editor extensions, format-on-save, keyboard shortcuts, workspace settings 4. **Automation** - Pre-commit hooks, CI/CD formatting checks, automated formatting scripts 5. **Team Sync** - Shared configurations, style guides, enforcement policies, onboarding documentation 6. **Validation** - Formatting verification, CI integration, team compliance monitoring **Advanced Features**: Custom rules, framework-specific formatting, performance optimization, incremental formatting. **Consistency**: Cross-platform compatibility, team standardization, legacy code migration strategies. **Output**: Complete formatting system with automated enforcement, team configurations, and style compliance monitoring.
© davila7 · MIT · davila7/claude-code-templates