docs: add AI agent style-rules guide - #248
Merged
Merged
Conversation
Adds docs/ai-agents.md — a condensed, rule-based brief for AI coding agents (and humans) writing tasty styles. It is not an API reference: it covers every rule enforced by @tenphi/eslint-plugin-tasty in the smallest form that still reads well as standalone markdown, so an agent briefed with it produces lint-clean styles on the first pass. Organized so a reader can stop early and still be mostly correct: config lookup, where styles live, property choice, value syntax, state maps, sub-elements, special keys, tastyStatic constraints, checklist. Rules are stated as wrong/right pairs and tables rather than prose. Linked from the docs hub (By Task) and the README reference list. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Not wired into eslint.config.js yet — enabling it will start linting the style objects under src/, which is a separate change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
📦 Snapshot releasePublished |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
docs/ai-agents.md— a 206-line, rule-based brief on writing correct tasty styles, aimed at AI coding agents working in consumer projects (not at this repo).It is deliberately not an API tour. It covers every rule enforced by
@tenphi/eslint-plugin-tastyin the smallest form that still works as standalone, publishable markdown, so an agent briefed with it writes lint-clean styles on the first pass.Also links it from the docs hub (By Task) and the README reference list, and adds the eslint plugin as a devDependency (separate commit).
Why
Agents reliably get tasty's value syntax wrong in predictable ways — raw hex instead of
#tokens,calc()instead of(…),var(--x)instead of$x, CSS longhands instead of shorthands, state maps missing the''default. The plugin catches all of it, but only after the code is written. This gives the same ruleset up front, in a form that fits in a context window.Structure
Ordered so a reader can stop early and still be mostly correct. Rules are stated as ❌ → ✅ pairs and tables rather than prose, which is what agents follow most reliably.
valid-color-token,valid-preset,valid-recipe,valid-custom-unit,no-unknown-state-aliasno-styles-prop,no-runtime-styles-mutationknown-property,prefer-shorthand-property,prefer-longhand-property,prefer-hidevalid-value,valid-custom-property,no-raw-color-values,prefer-custom-property-syntax,consistent-token-usage,prefer-auto-calc,valid-boolean-property,no-important,valid-directional-modifier,valid-radius-shape,prefer-directional-shorthand,valid-transitionvalid-state-key,require-default-state,valid-default-state-order,no-nested-state-map,valid-styles-structure,no-own-at-root,valid-state-definitionvalid-sub-element,no-nested-selectorvalid-styles-structure(at-rule shapes,recipe)tastyStatic()static-no-dynamic-values,static-valid-selectorAll 34 rules in the plugin's recommended + strict configs are covered.
Reviewer notes
dockand single-cornerradiusmodifiers are deliberately omitted. The plugin'sconstants.tsdocumentsinset: '0 bottom dock'and corner names (top-left, …) as requiring tasty >= 2.10, but this repo is at 2.9.0 andsrc/styles/radius.tsonly matchesDIRECTIONS(top/right/bottom/left), with nodockhandling anywhere insrc/. Worth a look separately:prefer-directional-shorthand's autofix for a 4-valueradiuscurrently emits syntax 2.9.0 cannot parse.docs/is inpackage.jsonfiles, so the guide reaches npm consumers on whatever release lands next.formatscript targetssrc/**/*.{ts,tsx}only, and the existing docs use compact (unpadded) tables; formatting this file made it both inconsistent with its neighbours and larger.@tenphi/eslint-plugin-tasty@0.11.3and is not wired intoeslint.config.js— enabling it will start linting the style objects undersrc/, which belongs in its own PR.pnpm lintpasses as-is.🤖 Generated with Claude Code