Skip to main content
command

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.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --command setup/setup-formatting
Open on GitHub

What 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 --python to 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-formatting

2Manually: put the files in place

.claude/commands/setup-formatting.md

Call it with /setup-formatting. For all projects use ~/.claude/commands/

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

Similar slash commands

All slash commands for Code review and refactoring →

From the same set804

The whole set →
fix-github-issue This command takes a GitHub issue number, investigates the related code, and works through a fix with tests. Use it to carry an issue from its report to a commit. 386installs add-authentication-system Build an authentication layer for an existing application with a selected sign-in method. The command covers user accounts, session handling, access rules, and common security controls. 382installs nextjs-middleware-creator Generates modular Next.js middleware and helper scripts for routing. It sets up JWT authentication, rate limiting, and security headers. 381installs interactive-documentation A slash command that builds documentation with runnable code examples, playgrounds and API testing. Useful once a plain README stops being enough. 372installs add-performance-monitoring Sets up application performance monitoring, alerting rules, and observability metrics. Useful when preparing an application for production workloads. 369installs report Generate task, sprint, and performance reports with /task-report. Use it for a standup, project review, or a closer look at blockers and dependencies. 368installs vercel-edge-function Generate a TypeScript starter for a Vercel Edge Function, with request handlers and examples for geolocation or JWT checks. Use it when adding an edge API route to a Next.js project. 364installs vercel-environment-sync A hook that inspects environment variables after an .env edit and points you to the right Vercel sync commands. Useful when local and deployed values drift apart. 363installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor