Agent skill

Write Rule

by sergioazoc in sergioazoc/oxlint-tailwindcss

Patterns, conventions, and examples for implementing new oxlint Tailwind CSS rules and their tests.

MITAuto-check passedFrontend & Design

Install Write Rule

skills CLI
$ npx skills add sergioazoc/oxlint-tailwindcss --skill write-rule -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install sergioazoc/oxlint-tailwindcss write-rule --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/sergioazoc/oxlint-tailwindcss.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/write-rule .claude/skills/write-rule && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
write-rule
GitHub stars
101
Token cost
~2.3k tokens
SKILL.md length
1,050 words
Files
1
Repo updated
First seen
Licence
MIT

At a glance

Patterns, conventions, and examples for implementing new oxlint Tailwind CSS rules and their tests.

  • Works in 6 steps: packages/oxlint-tailwindcss/src/index.ts… → packages/docs/rules/_extras/.md and… → The hand-written rule lists and rule… → …
  • Understanding rule implementation
  • SKILL.md covers Pick the reference by rule kind, Fixes, Tests and Registration
  • Calls pnpm and npm

What it does

Write Rule is an agent skill from sergioazoc/oxlint-tailwindcss. Patterns, conventions, and examples for implementing new oxlint Tailwind CSS rules and their tests. Use when creating, scaffolding, or understanding rule implementation.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Frontend & Design, covering Design systems and Project scaffolding. It works with Tailwind CSS and shadcn/ui. The repository describes itself as: Tailwind CSS v4 lint rules for oxlint that read your design system: unknown, conflicting and deprecated classes, theme colors and class order, with autofixes. The licence is MIT.

When your agent uses it

  • Understanding rule implementation
  • Tasks that involve Design systems
  • Tasks that involve Project scaffolding

Example prompts

  • “/write-rule”

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. packages/oxlint-tailwindcss/src/index.ts — the import and the rules map entry (the key is the public rule name). The rule's meta.docs is…
  2. packages/docs/rules/_extras/.md and packages/docs/es/rules/_extras/.md, then pnpm -C packages/docs generate (it does not build first; pnpm…
  3. The hand-written rule lists and rule counts: packages/docs/rules/index.md and packages/docs/es/rules/index.md (both the category section…
  4. CLAUDE.md's rule count and rule lists (DS-dependent / DS-optional users, suggestion and reportClassReplacements counts), and the source…
  5. A packages/oxlint-tailwindcss/CHANGELOG.md entry. A new rule is a minor bump (see Versioning in CLAUDE.md); check the published version…
  6. If the rule needed a pattern this skill or CLAUDE.md doesn't describe, update them in the same PR.

What it can do on your machine

Read from SKILL.md and the folder at commit 1e4b9ee. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pnpm
    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pnpm and npm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Write Rule loads about 2.3k tokens when it runs. Until then it costs about 45 tokens; SKILL.md has 1,050 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~45
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from sergioazoc/oxlint-tailwindcss at commit 1e4b9ee, republished under its MIT licence (© sergioazoc). 1,050 words, ~2,348 tokens.

Download SKILL.mdSave it as .claude/skills/write-rule/SKILL.md (or your agent's skills folder).
name
write-rule
description
Patterns, conventions, and examples for implementing new oxlint Tailwind CSS rules and their tests. Use when creating, scaffolding, or understanding rule implementation.
argument-hint
[rule-name]

If a rule name is provided as $ARGUMENTS, scaffold the rule at packages/oxlint-tailwindcss/src/rules/$ARGUMENTS.ts (exported under the camelCase name, e.g. noDemoThing) and its test at packages/oxlint-tailwindcss/tests/rules/$ARGUMENTS.test.ts, then register it (see Registration). Paths in the table and under Tests are relative to packages/oxlint-tailwindcss/. The helpers named here are documented in CLAUDE.md ("Shared helpers", "Key Constraints"); the reference files below are the patterns to copy — read the one that matches the rule's kind before writing.

Pick the reference by rule kind

Every rule is defineRule({ meta, createOnce }) from @oxlint/plugins, builds a check(locations: ClassLocation[]) function, and returns createExtractorVisitors(context, check) from ../utils/extractors. Don't hand-write the four visitors or pass DEFAULT_EXTRACTOR_CONFIG: that ignores the user's settings.tailwindcss extractor config. The one exception is a rule that compares an element's whole class list rather than each class string (no-borrowed-component-styles): it keeps Program from createExtractorVisitors (the settings check) and adds its own JSXAttribute visitor that calls extractFromJSXAttribute / extractFromCallExpression with getExtractorConfig(context). context.settings, context.filename, and options are unavailable in createOnce(), so read them lazily inside check through the helpers below. A rule that touches the design system starts check with if (locations.length === 0) return: the visitors call check([]) on every node, and without the guard an empty call triggers a DS load (and locations[0] throws). Both DS kinds declare entryPoint: { type: 'string' } in their schema next to their own options, because createLazyLoader reads the rule-level entryPoint.

KindCopyKey pieces
DS-dependent (needs the design system, fails loud)src/rules/no-unnecessary-arbitrary-value.tscreateLazyLoader(context); in check, safeGetDS(getDS, context, locations[0].node), which reports designSystemUnavailable and returns null; ...DS_UNAVAILABLE_MESSAGE in meta.messages; defaultOptions: [{}] when entryPoint is the only option
DS-optional (uses the DS when configured, static fallback otherwise)src/rules/no-deprecated-classes.tssoftGetDS(getDS) plus a deterministic static path when it returns null. softGetDS only guards the load: a later worker-service call (declarations, sort, canonicalize) can still throw, so wrap it in catch (e) { if (!isFatalError(e)) throw e; /* static path */ } as no-dark-without-light does. Never declares DS_UNAVAILABLE_MESSAGE
No DS, with optionssrc/rules/max-class-count.tscreateLazyOptions<Options, T>(context, compile) from ../utils/context; meta.defaultOptions (omit it when schema: [])

Fixes

src/utils/class-parser.ts is the home for class parsing (splitUtilityAndVariant, extractVariants, stripProjectPrefix, splitImportant / reattachImportant); don't split on : by hand, since brackets and parentheses can contain it. A rule that reads the variant chain strips the project prefix first (it comes first in the chain); a DS-optional rule gets it with softGetDS(getDS)?.cache.prefix ?? '', as enforce-consistent-line-wrapping does, and tests/fixtures/with-prefix.css exercises it.

Rewrite the utility, not the whole class: splitUtilityAndVariant separates the variant chain (the project prefix included) and splitImportant / reattachImportant round-trip ! — the DS-dependent reference shows the sequence. Split the class string with splitClassesWithSeparators(loc.value), build offending: { cls, replacement }[] from split.classes, and pass it to reportClassReplacements(context, loc, split, split.classes, offending, { messageId }) from ../utils/report. It reports data: { className, replacement } (rename the second key with replacementKey, as enforce-canonical does), so the messages use those placeholders. It puts the autofix on the first offender and a suggestReplace suggestion on each later one, and rebuilds with rebuildClassString, which keeps the multiline wrapping enforce-consistent-line-wrapping introduces — rebuilding with .join(' ') would flatten it. Declare fixable: 'code', hasSuggestions: true, and a suggestReplace message. When a replacement comes from a name table and must exist in the project's design system, guard it with makeReplacementGuard(cache) from ../utils/replacement, as no-deprecated-classes does: pass it the rebuilt class (variant and ! included). It wraps the tolerant cache.isValid. Suggestion-only rules (prefer-scale-token, no-unknown-classes) report suggest by hand instead.

Show full SKILL.md (507 more words)Show less

Tests

Tests live in tests/rules/<rule-name>.test.ts, use RuleTester from oxlint/plugins-dev, and give JSX cases filename: 'test.tsx'.

  • DS-dependent: run every case through runWithFixture(ruleTester, name, rule, ENTRY_POINT, cases) or makeFixtureRunner(ENTRY_POINT) from ../utils/with-fixture. They inject settings.tailwindcss.entryPoint; without it the rule reports designSystemUnavailable. A beforeAll that calls resetDesignSystem() + getLoadedDesignSystem(ENTRY_POINT) only warms the cache. Reference: tests/rules/no-unnecessary-arbitrary-value.test.ts (it also shows how to assert the suggestReplace suggestions).
  • DS-optional: a plain ruleTester.run (no entryPoint) exercises the static fallback, and a makeFixtureRunner block exercises the DS path. Reference: tests/rules/no-dark-without-light.test.ts.
  • Options only: a plain ruleTester.run, with options: [{ … }] on the cases that override the default. Reference: tests/rules/max-class-count.test.ts.
  • When an expected error passes data, include every placeholder its message uses: the RuleTester hydrates the message from data and fails on a partial one.
  • Cover the posture: a DS-dependent rule gets one case with no entryPoint expecting designSystemUnavailable; a DS-optional rule gets one case whose settings.tailwindcss.entryPoint points at a missing CSS file and still produces the static result. For a DS-optional rule, also add expect(rule.meta?.messages).not.toHaveProperty(DS_UNAVAILABLE_MESSAGE_ID) next to the existing one in tests/integration/fatal-errors.test.ts — that assertion is per rule, not automatic.
  • A fixer also gets its row in tests/integration/multiline-preservation.test.ts.

Fixtures live in tests/fixtures/ (default.css is the usual entry point). Run one file with pnpm -C packages/oxlint-tailwindcss exec vitest run tests/rules/<rule-name>.test.ts; also run tests/integration/fatal-errors.test.ts (it iterates every registered rule) and tests/integration/multiline-preservation.test.ts.

Registration

A new rule is wired in at:

  1. packages/oxlint-tailwindcss/src/index.ts — the import and the rules map entry (the key is the public rule name). The rule's meta.docs is ruleDocs('<name>', { description, category, recommended, designSystem }) from ../utils/rule-docs: category places it on rules/index.md and in the generated rule list, recommended puts it in the generated recommended configs, and designSystem must match what the rule does (docs-sync checks it). The docs generator reads this registry from the built dist/index.cjs, so run pnpm build before step 2.
  2. packages/docs/rules/_extras/<rule>.md and packages/docs/es/rules/_extras/<rule>.md, then pnpm -C packages/docs generate (it does not build first; pnpm -C packages/docs build does both). An _extras file replaces the whole generated body (options, examples, auto-fix), so copy the section layout of an existing one of the same kind; the ES copy uses neutral tuteo. The regenerated rules/<rule>.md and es/rules/<rule>.md are tracked — commit them, don't hand-write them. The ✗ / ✓ examples in both _extras files run as tests (tests/docs/doc-examples.test.ts): give options with // options: { … } and the fixed result with // → <line>; packages/docs/CLAUDE.md has the grammar.
  3. The hand-written rule lists and rule counts: packages/docs/rules/index.md and packages/docs/es/rules/index.md (both the category section and the matching DS-group table under "Defaults reference"), packages/docs/index.md, packages/docs/es/index.md, README.md, and the count in the first line of packages/oxlint-tailwindcss/README.md (its config and rule table are generated from meta.docs).
  4. CLAUDE.md's rule count and rule lists (DS-dependent / DS-optional users, suggestion and reportClassReplacements counts), and the source comments that enumerate helper users (the headers of src/utils/report.ts and src/utils/replacement.ts), when the new rule changes them.
  5. A packages/oxlint-tailwindcss/CHANGELOG.md entry. A new rule is a minor bump (see Versioning in CLAUDE.md); check the published version with npm view oxlint-tailwindcss version before picking the number.
  6. If the rule needed a pattern this skill or CLAUDE.md doesn't describe, update them in the same PR.

© sergioazoc, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/write-rule of sergioazoc/oxlint-tailwindcss.

Open the folder on GitHubat commit 1e4b9ee

Compare with similar skills

Write Rule next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Write Rule compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Write Rule this skillsergioazoc/oxlint-tailwindcss101—~2.3kAutomated safety check: PassMIT
Anyrobot Shadcn Frontend JSopsrobot-ai/opsrobot135—~3.3kAutomated safety check: NotesApache-2.0
UI StylingOhh-889/skyroc79513 repos~2.5kAutomated safety check: PassMIT
Creative Tim UI Blockscreativetimofficial/ui12k—~2.1kAutomated safety check: NotesMIT
Cosscrafter-station/petdex4.2k—~1.4kAutomated safety check: PassMIT
Activepieces Design Systemactivepieces/activepieces25k—~3.6kAutomated safety check: PassCustom licence

Similar skills

  • Anyrobot Shadcn Frontend JS

    opsrobot-ai/opsrobot

    AnyRobot 前端开发核心指南:提供 JavaScript + React + shadcn/ui 开发的精简实用规范和最佳实践。

    135 GitHub stars~3.3k tokensUpdated 4 mo ago
    Frontend & DesignAuto-check: notes
  • UI Styling

    Ohh-889/skyroc

    Create beautiful, accessible user interfaces with shadcn/ui components (built on Radix UI + Tailwind), Tailwind CSS utility-first styling, and canvas-based visual designs.

    795 GitHub starsUsed in 13 repos~2.5k tokens
    Frontend & DesignAuto-check passed
  • Creative Tim UI Blocks

    creativetimofficial/ui

    Helps install, generate and review Creative Tim UI blocks: shadcn/ui-based React and Tailwind sections that follow a restrained, production-minded design philosophy.

    12k GitHub stars~2.1k tokensUpdated 7 mo ago
    Frontend & DesignAuto-check: notes
  • Coss

    crafter-station/petdex

    Helps implement coss UI components correctly. An agent skill from crafter-station/petdex.

    4.2k GitHub stars~1.4k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Activepieces Design System

    activepieces/activepieces

    Design system for Activepieces (open-source AI automation platform, "open source replacement for Zapier").

    25k GitHub stars~3.6k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Ss Learn

    bitjaru/styleseed

    Capture a human-approved UI design lesson as a privacy-minimized local StyleSeed candidate, review it, and prepare an opt-in share package without transmitting project code, prompts, screenshots, or…

    973 GitHub stars~1.3k tokensUpdated 2 days ago
    Frontend & DesignAuto-check passed

More from sergioazoc/oxlint-tailwindcss

  • Oxlint Tailwindcss

    sergioazoc/oxlint-tailwindcss

    Set up oxlint-tailwindcss — Tailwind CSS v4 lint rules for oxlint — in a project, and act on its diagnostics.

    101 GitHub stars~1.9k tokensUpdated yesterday
    Auto-check passed

Questions about Write Rule

What does Write Rule do?

Patterns, conventions, and examples for implementing new oxlint Tailwind CSS rules and their tests. Write Rule is an agent skill from sergioazoc/oxlint-tailwindcss. Patterns, conventions, and examples for implementing new oxlint Tailwind CSS rules and their tests.

When should I use Write Rule?

Write Rule fits situations like: understanding rule implementation; tasks that involve Design systems; tasks that involve Project scaffolding.

How do I install Write Rule in Claude Code?

Run `npx skills add sergioazoc/oxlint-tailwindcss --skill write-rule -a claude-code`. Or copy the skill folder (.claude/skills/write-rule in sergioazoc/oxlint-tailwindcss) into .claude/skills/write-rule in your project. Claude Code loads it when a task matches its description.

How do I install Write Rule in Codex?

Run `npx skills add sergioazoc/oxlint-tailwindcss --skill write-rule -a codex`. Or copy the skill folder (.claude/skills/write-rule in sergioazoc/oxlint-tailwindcss) into .agents/skills/write-rule in your project. Codex loads it when a task matches its description.

Can I use Write Rule in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add sergioazoc/oxlint-tailwindcss --skill write-rule -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/write-rule, .gemini/skills/write-rule, .github/skills/write-rule and .opencode/skills/write-rule in your project.

What does Write Rule need to run?

Going by SKILL.md and its folder, Write Rule needs the command-line tools its instructions call (pnpm and npm).

Does Write Rule access the network?

SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Write Rule safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Write Rule use?

Write Rule is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Write Rule use?

About 2.3k tokens (SKILL.md is roughly 9.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Write Rule?

Skills that share tags, products or a category with Write Rule: Anyrobot Shadcn Frontend JS (opsrobot-ai/opsrobot, 135 stars), UI Styling (Ohh-889/skyroc, 795 stars), Creative Tim UI Blocks (creativetimofficial/ui, 12k stars) and Coss (crafter-station/petdex, 4.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Write Rule?

sergioazoc (a GitHub user) maintains it in sergioazoc/oxlint-tailwindcss, which has 101 GitHub stars. The repository was last updated on October 10, 2026.

Source: sergioazoc/oxlint-tailwindcss on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.