Postcss plugins

From oyi77/1ai-skills · View interactive version

Postcss plugins is an AI agent skill from the GitHub repository oyi77/1ai-skills. Use when postCSS plugin ecosystem — Autoprefixer, cssnano, nesting, custom plugins, preset configuration.

How to use this skill

Skill file

Overview

PostCSS is a CSS transformation tool with a rich plugin ecosystem. Autoprefixer adds vendor prefixes, cssnano minifies, nesting enables CSS nesting, and custom plugins can transform CSS in any way.

Capabilities

When to Use

Trigger phrases:

When NOT to Use

Pseudo Code

The postcss-plugins workflow follows a standard pipeline pattern.

Core flow:

# postcss-plugins primary flow
input = prepare(raw_data)
result = process(input, config={autoprefixer, configuration, cssnano, custom, ecosystem})
validate(result)
deliver(result)

Error handling:

on error:
  log(error_details)
  retry_with_backoff(max=3)
  if still_failing: alert_and_escalate()

Core Workflow

# postcss-plugins primary flow
input = prepare(raw_data)
result = process(input, config={autoprefixer, configuration, cssnano, custom, ecosystem})
validate(result)
deliver(result)

Error Handling

on error:
  log(error_details)
  retry_with_backoff(max=3)
  if still_failing: alert_and_escalate()

Configuration

// postcss.config.js
module.exports = {
  plugins: {
    "postcss-import": {},
    "postcss-nesting": {},
    "postcss-preset-env": {
      stage: 2,
      features: {
        "nesting-rules": false, // using postcss-nesting instead
      },
    },
    autoprefixer: {},
    cssnano: process.env.NODE_ENV === "production" ? {} : false,
  },
}

Autoprefixer Config

// .browserslistrc
> 0.5%
last 2 versions
not dead
not ie 11

Custom Plugin

// postcss-plugin-example.js
module.exports = (opts = {}) => {
  return {
    postcssPlugin: "postcss-add-prefix",
    Declaration(decl) {
      if (decl.prop.startsWith("my-")) {
        decl.prop = `--custom-${decl.prop.slice(3)}`
      }
    },
  }
}
module.exports.postcss = true

CSS Nesting

/* Input */
.card {
  background: white;
  & .title {
    font-size: 1.5rem;
    &:hover {
      color: blue;
    }
  }
  @media (max-width: 768px) {
    padding: 1rem;
  }
}

/* Output (after postcss-nesting) */
.card { background: white; }
.card .title { font-size: 1.5rem; }
.card .title:hover { color: blue; }
@media (max-width: 768px) { .card { padding: 1rem; } }

preset-env Features

/* Modern CSS with fallbacks */
.card {
  color: oklch(60% 0.2 250);           /* oklch color */
  container-type: inline-size;           /* container queries */
  text-wrap: balance;                    /* text balancing */
  &:has(> img) { grid-template-columns: 1fr 2fr; }  /* :has() selector */
}

Common Patterns

How to Use

  1. Define content goal (traffic, engagement, conversion, brand awareness)
  2. Research target audience pain points and search intent
  3. Generate content using appropriate AI tools
  4. Edit and humanize output for authenticity
  5. Optimize for target platform (SEO, hashtags, format)
  6. Schedule and distribute across channels
  7. Measure performance and iterate

Red Flags

Verification

Process

  1. Analyze the task requirements
  2. Apply domain expertise
  3. Verify output quality

Anti-Rationalization Table

| Rationalization | Reality |

|---|---|

| "Good enough content works" | Quality content drives engagement. Mediocre content gets ignored. |

| "I will optimize later" | SEO and distribution need optimization from the start. |

| "Templates are good enough" | Templates are a starting point. Custom content outperforms generic. |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.