| name | postcss-config |
| description | PostCSS configuration template and validation logic for Tailwind CSS processing with Autoprefixer. Includes 4 required standards (required base plugins, critical plugin order with tailwindcss first and autoprefixer last, file naming as postcss.config.js, required dependencies). Use when creating or auditing postcss.config.js files to ensure correct CSS build pipeline. |
PostCSS Configuration Skill
This skill provides postcss.config.js template and validation logic for CSS processing configuration.
Purpose
Manage postcss.config.js configuration to:
- Configure Tailwind CSS processing
- Set up Autoprefixer for browser compatibility
- Ensure consistent CSS build pipeline
- Maintain correct plugin order
Usage
This skill is invoked by the postcss-agent when:
- Creating new postcss.config.js files
- Auditing existing PostCSS configurations
- Validating PostCSS against standards
Template
The standard PostCSS template is located at:
templates/postcss.config.template.js
The 4 PostCSS Standards
Rule 1: Required Base Plugins
Must include both required plugins:
tailwindcss- Tailwind CSS processingautoprefixer- Browser prefix automation
Rule 2: Plugin Order (CRITICAL)
Plugins must be in this exact order:
tailwindcss- FIRSTautoprefixer- LAST
✅ ALWAYS: Use Tailwind first, Autoprefixer last (reversed order causes CSS processing errors)
Rule 3: File Naming
Must be named exactly postcss.config.js:
- ALWAYS use
.jsextension (not.tsor.mjs) - Vite expects
postcss.config.js
Rule 4: Required Dependencies
Must have in package.json devDependencies:
{
"devDependencies": {
"postcss": "^8.4.0",
"tailwindcss": "^3.4.0",
"autoprefixer": "^10.4.0"
}
}
Validation
To validate a postcss.config.js file:
- Check that file exists at workspace root
- Read package.json for dependencies
- Parse config and check plugin array
- Verify plugin order (tailwindcss first, autoprefixer last)
- Check all required dependencies exist
- Report violations
Validation Approach
// Rule 1: Check required plugins
const hasTailwind = plugins.some(
(p) => p === "tailwindcss" || p.includes("tailwindcss"),
);
const hasAutoprefixer = plugins.some(
(p) => p === "autoprefixer" || p.includes("autoprefixer"),
);
// Rule 2: Check plugin order
const tailwindIndex = plugins.findIndex(
(p) => p === "tailwindcss" || p.includes("tailwindcss"),
);
const autoprefixerIndex = plugins.findIndex(
(p) => p === "autoprefixer" || p.includes("autoprefixer"),
);
if (tailwindIndex > autoprefixerIndex) {
errors.push("Rule 2: autoprefixer must be last plugin (after tailwindcss)");
}
// Rule 4: Check dependencies
const deps = packageJson.devDependencies || {};
if (!deps.postcss) errors.push("Rule 4: Missing postcss in devDependencies");
if (!deps.tailwindcss)
errors.push("Rule 4: Missing tailwindcss in devDependencies");
if (!deps.autoprefixer)
errors.push("Rule 4: Missing autoprefixer in devDependencies");
Repository Type Considerations
- Consumer Repos: Must strictly follow all 4 standards unless exception declared
- Library Repos: May have additional plugins for component library needs (e.g., postcss-import)
Exception Declaration
Consumer repos may declare exceptions in package.json:
{
"metasaver": {
"exceptions": {
"postcss-config": {
"type": "custom-plugins",
"reason": "Requires postcss-import for component library structure"
}
}
}
}
Best Practices
- Place postcss.config.js at workspace root (where package.json is)
- Use template as starting point
- Keep plugin order: tailwindcss → autoprefixer
- Include PostCSS in devDependencies
- Re-audit after making changes
- Minimal configuration - only what's needed
Integration
This skill integrates with:
- Repository type provided via
scopeparameter. If not provided, use/skill scope-check /skill audit-workflow- Bi-directional comparison workflow/skill remediation-options- Conform/Update/Ignore choicestailwind-agent- Tailwind CSS configuration coordination