Interpretive guidance for Prettier code formatting across multiple file types (JS/TS, YAML, JSON, CSS, HTML). Use when configuring Prettier, troubleshooting formatting issues, or understanding tool selection for these file types.
Inherits all available tools
Additional assets for this skill
This skill inherits all available tools. When active, it can use any tool Claude has access to.
default-config.json5default-ignorePrettier is an opinionated code formatter that supports many languages. This skill provides interpretive guidance on when Prettier is the right tool and how our configuration balances strictness with flexibility.
Fetch official Prettier documentation when needed:
Key principle: End style debates by enforcing consistent formatting automatically.
What this means:
Our overrides:
Prettier handles:
.js, .jsx, .ts, .tsx, .mjs, .cjs).yaml, .yml).json, .json5, .jsonc)Not Prettier:
The linting script uses this priority:
biome.json exists)For JS/TS specifically:
biome.json exists: use biome (modern all-in-one)eslint.config.js exists: use eslint + prettierFor YAML/JSON:
Best practice: Add .prettierrc to project root for team consistency.
{
"singleQuote": true,
"trailingComma": "all"
}
Config file discovery: Prettier searches up from file location for config files.
When no project config exists:
~/.prettierrc.json5 (user global config)Our default config in this skill directory provides sensible defaults for personal projects.
Our config uses printWidth: 300 for YAML via overrides - allows long lines for CI/CD pipelines and configuration values that shouldn't wrap.
Before Prettier:
name: 'my-app'
version: "1.0.0"
dependencies:
- lodash
- express
After Prettier:
name: my-app
version: 1.0.0
dependencies:
- lodash
- express
Prettier normalizes:
Note: For package.json, Prettier respects npm's key ordering conventions.
Problem: ESLint and Prettier disagree on formatting.
Solution: Use eslint-config-prettier to disable ESLint formatting rules:
npm install -D eslint-config-prettier
Then add to ESLint config:
export default [
// ... other configs
require("eslint-config-prettier"),
];
Problem: Prettier changes files you didn't want changed.
Solution: Use .prettierignore:
# Don't format generated files
*.generated.ts
api/types.ts
# Vendor code
vendor/
Problem: Prettier uses defaults instead of your config.
Debug:
prettier --find-config-path path/to/file.ts
Common causes:
.prettierrc not .prettierc)The mr-sparkle PostToolUse hook:
prettier --write if project has Prettier configBefore committing formatted files:
.prettierignore excludes generated/vendor filesdefault-config.json5 - Fallback configuration with opinionated defaultsdefault-ignore - Standard ignore patternsRemember: Prettier's value is ending style debates. Resist the urge to configure extensively.