prettier-config
Generates .prettierrc configuration file for code formatting with Prettier. Defines formatting rules for consistent code style across the project.
When & Why to Use This Skill
The Prettier Config skill automates the generation of optimized .prettierrc configuration files to ensure consistent code formatting across development projects. It eliminates manual setup errors by researching the latest Prettier version standards, verifying non-deprecated options, and providing a validated, JSON-compliant configuration that integrates seamlessly with modern IDEs and CI/CD pipelines.
Use Cases
- Project Initialization: Rapidly set up a standardized coding style for new repositories by generating a verified .prettierrc file in seconds.
- Team Style Standardization: Enforce uniform formatting rules (quotes, semicolons, trailing commas) across multi-developer teams to minimize Git diff noise and merge conflicts.
- Legacy Codebase Modernization: Update outdated formatting configurations to match current Prettier best practices and modern JavaScript standards.
- Tooling Compatibility: Create configurations that are pre-validated for compatibility with ESLint and other linting tools to ensure a frictionless development environment.
| name | prettier-config |
|---|---|
| description | Generates .prettierrc configuration file for code formatting with Prettier. Defines formatting rules for consistent code style across the project. |
Prettier Config Skill
Purpose
Generate Prettier configuration file for code formatting.
🚨 MANDATORY FILE COUNT
This skill MUST create exactly 1 file:
.prettierrc(preferred format - JSON without extension)
🔍 BEFORE GENERATING - CRITICAL RESEARCH REQUIRED
⚠️ HIGH PRIORITY: Verify current Prettier configuration options to prevent outdated settings
Required Research Steps:
- Prettier Version: Check current Prettier version and configuration format
- Verify
.prettierrcformat is still recommended - Check if any configuration options have been deprecated
- Verify
- Configuration Options: Verify the following options are still valid:
singleQuote- Still accepts boolean valuessemi- Still accepts boolean valuestrailingComma- Still accepts "es5" / "all" / "none" values
- Default Values: Check if Prettier defaults have changed
- Verify current default for
printWidth(usually 80) - Verify current default for
tabWidth(usually 2) - Check if
endOfLinedefault is still "lf"
- Verify current default for
- Optional Settings: Research if new recommended options have been added:
printWidth- Line length (default 80)tabWidth- Spaces per indentation (default 2)endOfLine- Line ending style (lf/crlf/auto)arrowParens- Arrow function parentheses
- File Format Alternatives: Check if format is deprecated
- Verify
.prettierrc(JSON) is still preferred - Check
.prettierrc.json,.prettierrc.js, package.json field
- Verify
Output
Create the file: .prettierrc
Supported Formats (in order of preference):
.prettierrc(preferred - JSON without extension).prettierrc.json(explicit JSON format).prettierrc.js(JavaScript with dynamic logic)prettierfield inpackage.json
Template
See: examples.md in this directory for complete template and detailed examples.
⚠️ IMPORTANT: The examples.md file contains December 2025 configurations. Always verify current Prettier options before using.
Execution Checklist
- Research current Prettier version and recommended config format
- Verify
singleQuote,semi,trailingCommaoptions are still valid - Check if option syntax or values have changed
- Verify default values haven't changed (printWidth, tabWidth, endOfLine)
- Check for new recommended options
- Create
.prettierrcwith minimal, verified configuration - Verify file format is still recommended (not deprecated)
🛑 BLOCKING VALIDATION CHECKPOINT
STOP! Before proceeding to the next skill, verify:
Automated Verification
Run this command to verify the file exists:
if [ -f ".prettierrc" ] || [ -f ".prettierrc.json" ] || [ -f ".prettierrc.js" ] || grep -q "prettier" package.json 2>/dev/null; then
echo "✓ Prettier configuration found"
if [ -f ".prettierrc" ]; then
echo "✓ Using .prettierrc (preferred format)"
# Validate JSON syntax
if command -v jq >/dev/null 2>&1; then
jq empty .prettierrc && echo "✓ Valid JSON syntax" || echo "✗ Invalid JSON syntax"
elif command -v node >/dev/null 2>&1; then
node -e "JSON.parse(require('fs').readFileSync('.prettierrc', 'utf8'))" && echo "✓ Valid JSON" || echo "✗ Invalid JSON"
fi
fi
else
echo "✗ Prettier configuration missing"
exit 1
fi
Manual Verification
- ✓
.prettierrcexists at project root (or alternative format) - ✓ File contains valid JSON syntax
- ✓ File includes
singleQuoteoption (verify current syntax) - ✓ File includes
semioption (verify current syntax) - ✓ File includes
trailingCommaoption (verify current values) - ✓ Configuration options use current Prettier syntax
- ✓ All option values are valid for current Prettier version
If Validation Fails
DO NOT PROCEED to the next skill. Create or fix the missing/incorrect file immediately.
Notes
- Minimal Configuration: Uses only 3 essential options (singleQuote, semi, trailingComma)
- Prettier Defaults: Relies on Prettier's sensible defaults for other options
- Single Quotes:
"singleQuote": true- Uses single quotes for strings - Semicolons:
"semi": true- Requires semicolons at end of statements - Trailing Commas:
"trailingComma": "es5"- ES5 compatible trailing commas (objects, arrays) - Works with ESLint: Compatible with eslint-plugin-prettier integration
- Git-Friendly: Minimal diffs when configuration changes
- Optional Settings: Can add
printWidth,tabWidth,endOfLineif needed - Format Flexibility: Supports .prettierrc, .json, .js, package.json field
- Always verify current options - Prettier may change configuration schema
- JSON Preferred: Simple, declarative, no build step required
- Team Consistency: Ensures all developers use same formatting rules