home / skills / laurigates / claude-plugins / configure-formatting

configure-formatting skill

/configure-plugin/skills/configure-formatting

This skill helps you configure and audit code formatting across Biome, Prettier, Ruff, and rustfmt to enforce modern standards.

npx playbooks add skill laurigates/claude-plugins --skill configure-formatting

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
7.7 KB
---
model: haiku
created: 2025-12-16
modified: 2026-02-10
reviewed: 2025-12-16
description: Check and configure code formatting (Biome, Prettier, Ruff, rustfmt)
allowed-tools: Glob, Grep, Read, Write, Edit, Bash, AskUserQuestion, TodoWrite, WebSearch, WebFetch
argument-hint: "[--check-only] [--fix] [--formatter <biome|prettier|ruff|rustfmt>]"
name: configure-formatting
---

# /configure:formatting

Check and configure code formatting tools against modern best practices.

## When to Use This Skill

| Use this skill when... | Use another approach when... |
|------------------------|------------------------------|
| Setting up Biome, Prettier, Ruff format, or rustfmt for a project | Running an existing formatter (`biome format`, `ruff format`) |
| Migrating from Prettier to Biome or Black to Ruff | Fixing individual formatting issues in specific files |
| Auditing formatter configuration for completeness and best practices | Configuring linting rules (`/configure:linting` instead) |
| Adding format-on-save and CI format checks | Setting up pre-commit hooks only (`/configure:pre-commit` instead) |
| Standardizing formatting settings across a monorepo | Editing `.editorconfig` or `.vscode/settings.json` manually |

## Context

- Biome config: !`test -f biome.json && echo "EXISTS" || echo "MISSING"`
- Prettier config: !`find . -maxdepth 1 \( -name '.prettierrc*' -o -name 'prettier.config.*' \) 2>/dev/null`
- Ruff config: !`grep -l 'tool.ruff.format' pyproject.toml 2>/dev/null`
- Black config: !`grep -l 'tool.black' pyproject.toml 2>/dev/null`
- Rustfmt config: !`find . -maxdepth 1 \( -name 'rustfmt.toml' -o -name '.rustfmt.toml' \) 2>/dev/null`
- EditorConfig: !`test -f .editorconfig && echo "EXISTS" || echo "MISSING"`
- Package JSON: !`test -f package.json && echo "EXISTS" || echo "MISSING"`
- Python project: !`test -f pyproject.toml && echo "EXISTS" || echo "MISSING"`
- Rust project: !`test -f Cargo.toml && echo "EXISTS" || echo "MISSING"`
- Pre-commit: !`test -f .pre-commit-config.yaml && echo "EXISTS" || echo "MISSING"`
- Project standards: !`test -f .project-standards.yaml && echo "EXISTS" || echo "MISSING"`

## Parameters

Parse from `$ARGUMENTS`:

- `--check-only`: Report compliance status without modifications
- `--fix`: Apply all fixes automatically without prompting
- `--formatter <formatter>`: Override formatter detection (biome, prettier, ruff, rustfmt)

## Version Checking

**CRITICAL**: Before flagging outdated formatters, verify latest releases using WebSearch or WebFetch:

1. **Biome**: Check [biomejs.dev](https://biomejs.dev/) or [GitHub releases](https://github.com/biomejs/biome/releases)
2. **Prettier**: Check [prettier.io](https://prettier.io/) or [npm](https://www.npmjs.com/package/prettier)
3. **Ruff**: Check [docs.astral.sh/ruff](https://docs.astral.sh/ruff/) or [GitHub releases](https://github.com/astral-sh/ruff/releases)
4. **rustfmt**: Bundled with Rust toolchain - check [Rust releases](https://releases.rs/)

## Execution

Execute this code formatting configuration workflow:

### Step 1: Detect project languages and existing formatters

Check for language indicators and formatter configurations:

| Indicator | Language | Detected Formatter |
|-----------|----------|-------------------|
| `biome.json` with formatter | JavaScript/TypeScript | Biome |
| `.prettierrc.*` | JavaScript/TypeScript | Prettier |
| `pyproject.toml` [tool.ruff.format] | Python | Ruff |
| `pyproject.toml` [tool.black] | Python | Black (legacy) |
| `rustfmt.toml` or `.rustfmt.toml` | Rust | rustfmt |

**Modern formatting preferences:**
- **JavaScript/TypeScript**: Biome (preferred) or Prettier
- **Python**: Ruff format (replaces Black)
- **Rust**: rustfmt (standard)

### Step 2: Analyze current formatter configuration

For each detected formatter, check configuration completeness:
1. Config file exists with required settings (indent, line width, quotes, etc.)
2. Ignore patterns configured
3. Format scripts defined in package.json / pyproject.toml
4. Pre-commit hook configured
5. CI/CD check configured

### Step 3: Generate compliance report

Print a formatted compliance report:

```
Code Formatting Compliance Report
==================================
Project: [name]
Language: [detected]
Formatter: [detected]

Configuration:  [status per check]
Format Options: [status per check]
Scripts:        [status per check]
Integration:    [status per check]

Overall: [X issues found]
Recommendations: [list specific fixes]
```

If `--check-only`, stop here.

### Step 4: Install and configure formatter (if --fix or user confirms)

Based on detected language and formatter preference, install and configure. Use configuration templates from [REFERENCE.md](REFERENCE.md).

1. Install formatter package
2. Create configuration file (biome.json, .prettierrc.json, pyproject.toml section, rustfmt.toml)
3. Add format scripts to package.json or Makefile/justfile
4. Create ignore file if needed (.prettierignore)

### Step 5: Create EditorConfig integration

Create or update `.editorconfig` with settings matching the formatter configuration.

### Step 6: Handle migrations (if applicable)

If legacy formatter detected (Prettier -> Biome, Black -> Ruff):
1. Import existing configuration
2. Install new formatter
3. Remove old formatter
4. Update scripts
5. Update pre-commit hooks

Use migration guides from [REFERENCE.md](REFERENCE.md).

### Step 7: Configure pre-commit hooks

Add formatter to `.pre-commit-config.yaml` using the appropriate hook repository.

### Step 8: Configure CI/CD integration

Add format check step to GitHub Actions workflow.

### Step 9: Configure editor integration

Create or update `.vscode/settings.json` with format-on-save and `.vscode/extensions.json` with formatter extension.

### Step 10: Update standards tracking

Update `.project-standards.yaml`:

```yaml
components:
  formatting: "2025.1"
  formatting_tool: "[biome|prettier|ruff|rustfmt]"
  formatting_pre_commit: true
  formatting_ci: true
```

### Step 11: Print completion report

Print a summary of changes made, scripts added, and next steps (run format, verify CI, enable format-on-save).

For detailed configuration templates, migration guides, and pre-commit configurations, see [REFERENCE.md](REFERENCE.md).

## Agentic Optimizations

| Context | Command |
|---------|---------|
| Quick compliance check | `/configure:formatting --check-only` |
| Auto-fix all issues | `/configure:formatting --fix` |
| Check Biome formatting | `biome format --check --reporter=github` |
| Check Prettier formatting | `npx prettier --check . 2>&1 | tail -5` |
| Check Ruff formatting | `ruff format --check --output-format=github` |
| Check rustfmt formatting | `cargo fmt --check 2>&1 | head -20` |

## Flags

| Flag | Description |
|------|-------------|
| `--check-only` | Report status without offering fixes |
| `--fix` | Apply all fixes automatically without prompting |
| `--formatter <formatter>` | Override formatter detection (biome, prettier, ruff, rustfmt) |

## Examples

```bash
# Check compliance and offer fixes
/configure:formatting

# Check only, no modifications
/configure:formatting --check-only

# Auto-fix and migrate to Biome
/configure:formatting --fix --formatter biome
```

## Error Handling

- **Multiple formatters detected**: Warn about conflict, suggest migration
- **No package manager found**: Cannot install formatter, error
- **Invalid configuration**: Report parse error, offer to replace with template
- **Formatting conflicts**: Report files that would be reformatted

## See Also

- `/configure:linting` - Configure linting tools
- `/configure:editor` - Configure editor settings
- `/configure:pre-commit` - Pre-commit hook configuration
- `/configure:all` - Run all compliance checks
- **Biome documentation**: https://biomejs.dev
- **Ruff documentation**: https://docs.astral.sh/ruff
- **rustfmt documentation**: https://rust-lang.github.io/rustfmt

Overview

This skill checks and configures project code formatters (Biome, Prettier, Ruff, rustfmt) to align with modern best practices. It detects existing formatter configs, generates a compliance report, and can apply fixes or migrations for consistent formatting across projects and CI. Use it to standardize formatting in monorepos, add format-on-save, or migrate legacy formatters.

How this skill works

The skill scans the repo for language indicators and configuration files (biome.json, .prettierrc*, pyproject.toml tool.ruff.format or tool.black, rustfmt.toml, .editorconfig, package.json). It evaluates completeness (options, ignore patterns, scripts, pre-commit and CI integration) and emits a structured compliance report. With --fix it installs and writes configs, updates scripts, sets up pre-commit and CI steps, and updates .editorconfig and editor settings.

When to use it

  • Setting up Biome, Prettier, Ruff format, or rustfmt for a project
  • Auditing formatter configuration for completeness and CI/pre-commit integration
  • Migrating Prettier -> Biome or Black -> Ruff across a codebase
  • Standardizing formatting settings across a monorepo
  • Adding format-on-save and automated format checks in CI

Best practices

  • Prefer Biome for JS/TS, Ruff format for Python, and rustfmt for Rust unless project constraints require legacy tools
  • Run the skill with --check-only first to get a non-destructive compliance report
  • Use --fix for automated installation and safe migration, but review changes in a dedicated PR
  • Keep .editorconfig in sync with formatter settings for editor consistency
  • Add formatter steps to CI and include pre-commit hooks for early enforcement

Example use cases

  • Scan a monorepo to detect mixed Prettier and Biome settings and generate migration steps
  • Add Ruff format to a Python project that currently uses Black and update pre-commit hooks
  • Create biome.json, add format script to package.json, and enable format-on-save in .vscode/settings.json
  • Insert a GitHub Actions job that runs biome format --check or ruff format --check in CI
  • Run the skill --check-only to produce a compliance report before proposing changes

FAQ

What does --check-only do?

It performs detection and reports compliance without making any filesystem changes.

Can the skill migrate settings from Prettier to Biome or Black to Ruff?

Yes. It imports existing settings where possible, installs the new formatter, updates scripts and hooks, and removes legacy config when requested.