Logotipo de Design System Linting

Design System Linting

Organización
staple-lab
design-system-linting

Use when setting up or extending lint rules that enforce a design system - token enforcement (no raw hex or magic numbers), import boundaries, jsx-a11y, stylelint, and writing custom ESLint rules. Triggers on "lint rules", "enforce tokens", "no hardcoded colors", "eslint plugin", "stylelint".

Descripción general

Editorstaple-lab
Repositoriodesign-system-skills
Nombre de la habilidaddesign-system-linting
Estrellas
7
Forks
0
Archivos incluidos
Solo instrucciones
LicenciaMIT
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando la petición encaja con la habilidad.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Todo en las instrucciones

    Todo lo que necesita el modelo está en las instrucciones: no hay archivos adicionales que sincronizar.

  • Código abierto

    Publicada por staple-lab en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Design System Linting en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/staple-lab/design-system-skills/tree/main/plugins/design-system/skills/design-system-linting
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/staple-lab/design-system-skills.git /tmp/design-system-skills
mkdir -p .claude/skills
cp -r /tmp/design-system-skills/plugins/design-system/skills/design-system-linting .claude/skills/design-system-linting
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Design System Linting en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición encaja con la habilidad, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Design System Linting automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Design System Linting no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición que encaja con la habilidad, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

Design system linting

A design system that relies on people remembering it decays. Lint rules are how the system defends itself between code reviews — and they work at the only moment that matters, while the developer is still holding the context.

Rule of thumb: if you would say it in code review more than twice, make it a lint rule. If you cannot express it as a rule, it probably belongs in the API's type signature instead.

The four layers

LayerEnforcesTool
Token enforcementNo raw hex, no magic spacing, no ad-hoc durationscustom ESLint plugin + Stylelint
Import boundariesPublic entry points only; no deep imports; no primitives in product codeeslint-plugin-import / custom
AccessibilityStatic a11y defectseslint-plugin-jsx-a11y
CorrectnessHook rules, dead exports, bundle hygieneeslint-plugin-react-hooks, knip

Token enforcement

The rules that pay for themselves. Copy ${CLAUDE_PLUGIN_ROOT}/templates/lint/eslint-plugin-design-system.mjs — it ships four rules, dependency-free:

  • no-raw-color — flags hex, rgb(), hsl(), oklch() literals in JSX style, template literals, CSS-in-JS objects and className arbitrary values. Autofixes to the nearest token when one matches exactly, and names the closest candidates when it does not.
  • no-hardcoded-dimension — flags px values that are not on the spacing/radius scale. Ignores 0, 1px (hairlines are legitimate), and values inside calc() where the intent is usually relative.
  • no-primitive-token — flags components referencing --ds-color-blue-600 instead of a semantic token. This is the highest-value rule in the set — a primitive reference is invisible until the day someone tries to add a theme, at which point it is a hundred-file migration.
  • no-deep-import — flags @acme/ui/dist/components/Button/Button instead of @acme/ui or @acme/ui/button.
js
// eslint.config.mjs
import ds from './tools/eslint-plugin-design-system.mjs';

export default [
  {
    files: ['src/**/*.{ts,tsx}'],
    plugins: { ds },
    rules: {
      'ds/no-raw-color': 'error',
      'ds/no-hardcoded-dimension': ['error', { allow: [0, 1] }],
      'ds/no-primitive-token': 'error',
      'ds/no-deep-import': 'error',
    },
    settings: { designSystem: { tokens: './tokens/dist/tokens.json' } },
  },
  {
    // The design system itself defines the primitives — it is allowed to use them.
    files: ['src/design-system/tokens/**', 'tokens/**'],
    rules: { 'ds/no-primitive-token': 'off', 'ds/no-raw-color': 'off' },
  },
];

The rules read the generated tokens/dist/tokens.json, so they stay in sync with the tokens automatically. That is the whole point of one registry: the lint rules and the docs cannot disagree.

Rolling it out without a revolt

Turning error on across an existing codebase produces 4,000 violations and a team that disables the rule. Sequence it:

  1. Ship as warn. Measure. npx eslint . -f json | jq gives you the count by rule and by directory — the honest baseline.
  2. Autofix what is mechanical. Exact colour matches usually convert cleanly; run it as one reviewable commit that touches nothing else.
  3. error on new and changed code only — lint the diff in CI (eslint $(git diff --name-only origin/main)). New code is clean from day one, and the backlog is not a blocker.
  4. Ratchet. Add directories to the error set as they get migrated. A count that only goes down is a target the team can hit.
  5. Never --no-verify your way past it. One exception becomes the norm within a month.

Accessibility rules

eslint-plugin-jsx-a11y, strict config, plus the mapping for your components — without it the plugin cannot see through <Button> to the <button> underneath:

js
settings: {
  'jsx-a11y': {
    components: { Button: 'button', TextField: 'input', Link: 'a', Image: 'img' },
  },
},

The rules worth being strict about: alt-text, anchor-is-valid, click-events-have-key-events, no-noninteractive-element-interactions, label-has-associated-control, no-autofocus (autofocus strands screen-reader users mid-page).

These catch static defects only — roughly the same 30–40% ceiling as axe. They do not replace the behavioural tests.

Stylelint

For CSS Modules, vanilla CSS or .css.ts:

js
export default {
  extends: ['stylelint-config-standard'],
  rules: {
    'color-no-hex': true,
    'declaration-property-value-disallowed-list': {
      '/^(padding|margin|gap|inset|top|right|bottom|left)/': [/^\d+px$/],
      'transition-duration': [/^\d+m?s$/],
      'z-index': [/^\d+$/],
    },
    'declaration-no-important': true,
    'custom-property-pattern': '^ds-[a-z0-9-]+$',
  },
};

declaration-no-important is worth the argument it will start. !important inside a design system means the specificity design is wrong, and each one makes the next override harder.

Import boundaries

js
'no-restricted-imports': ['error', {
  patterns: [
    { group: ['@acme/ui/dist/*', '@acme/ui/src/*'], message: 'Import from @acme/ui or @acme/ui/<component>. Deep imports break on any internal refactor.' },
    { group: ['@radix-ui/*', '@base-ui/*'], message: 'Product code uses @acme/ui, not the primitives directly. If a component is missing, ask for it — that request is the roadmap.' },
  ],
}],

That second rule is as much a product signal as a constraint: every violation is a real gap in the system, and the list of them is the most honest backlog you will get.

Beyond lint

  • knip — dead exports and unused dependencies. Design systems accumulate both fast.
  • publint + @arethetypeswrong/cli — packaging correctness in CI. Broken exports maps are the most common way a design system release breaks consumers, and neither typecheck nor tests catch it.
  • size-limit — a budget per entry point, failing the build on regression. A component library that silently grows 40kb loses the argument for existing.
  • Danger / CI comment — post the token-violation delta on each PR. Visible numbers move behaviour more than a rule nobody reads.

Writing a custom rule

Keep them boring and precise. A rule with false positives gets disabled, and a disabled rule enforces nothing:

js
export const noRawColor = {
  meta: {
    type: 'problem',
    docs: { description: 'Use semantic design tokens instead of raw colour values' },
    fixable: 'code',
    schema: [],
    messages: {
      raw: 'Raw colour "{{value}}". Use a semantic token{{suggestion}}.',
    },
  },
  create(context) {
    const tokens = loadTokens(context);   // from settings.designSystem.tokens
    return {
      Literal(node) {
        if (typeof node.value !== 'string' || !COLOR_RE.test(node.value)) return;
        const match = tokens.byHex.get(normalise(node.value));
        context.report({
          node,
          messageId: 'raw',
          data: { value: node.value, suggestion: match ? ` — try ${match}` : '' },
          fix: match ? (fixer) => fixer.replaceText(node, `'var(${cssVar(match)})'`) : undefined,
        });
      },
    };
  },
};

Always name the replacement in the message. "Use a design token" tells the developer nothing; "try color.bg.accent" gets fixed in five seconds.

Preguntas frecuentes

¿Qué hace la habilidad de IA Design System Linting?

Use when setting up or extending lint rules that enforce a design system - token enforcement (no raw hex or magic numbers), import boundaries, jsx-a11y, stylelint, and writing custom ESLint rules. Triggers on "lint rules", "enforce tokens", "no hardcoded colors", "eslint plugin", "stylelint".

¿Por qué usar Design System Linting en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Design System Linting está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Design System Linting en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/staple-lab/design-system-skills/tree/main/plugins/design-system/skills/design-system-linting. TypingMind lee el archivo SKILL.md de esa carpeta e instala su contenido como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Design System Linting?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Design System Linting?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Design System Linting con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Design System Linting?

Sí. staple-lab la ha publicado en GitHub bajo la licencia MIT. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇