Логотип Design System Linting

Design System Linting

Организация
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".

Обзор

Издательstaple-lab
Репозиторийdesign-system-skills
Название навыкаdesign-system-linting
Звёзды
7
Форки
0
Файлы в комплекте
Только инструкции
ЛицензияMIT
Ссылки
  • Инструкции в формате Markdown

    Модель загружает файл SKILL.md по мере необходимости, поэтому токены расходуются только при подходящем запросе.

  • Работает с любой большой языковой моделью

    Навыки ИИ — это обычный Markdown, а не код для конкретного поставщика, поэтому они работают с GPT, Claude, Gemini, Grok и локальными моделями.

  • Всё необходимое — в инструкциях

    Всё необходимое для модели содержится в инструкциях — никаких дополнительных файлов для синхронизации.

  • Открытый исходный код

    Издатель навыка на GitHub — staple-lab. Перед установкой изучите исходные материалы.

Установка

Установите навык ИИ Design System Linting в TypingMind, чтобы использовать его с любой LLM, или добавьте его в другой агент, который умеет читать SKILL.md.

1

Установка в TypingMind

TypingMind устанавливает навык прямо из его папки на GitHub: читает SKILL.md, собирает файлы ресурсов и сохраняет результат локально.

  1. Откройте приложение и перейдите в раздел «Плагины → Навыки».
  2. Выберите «Установить из GitHub».
  3. Вставьте указанную ниже ссылку на папку навыка и подтвердите установку.
    https://github.com/staple-lab/design-system-skills/tree/main/plugins/design-system/skills/design-system-linting
  4. Включите навык в каждом чате, где хотите его использовать.
Плагины → Навыки → Добавить навык → По ссылке GitHub, затем вставьте ссылку на папку и нажмите «Продолжить».
2

Установка в другом агенте

Любой агент с поддержкой формата Agent Skills может использовать этот навык — скопируйте папку в каталог навыков этого агента.

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
После копирования перезапустите Claude Code, чтобы загрузить новый навык.

Использование в TypingMind

Включите навык Design System Linting в любом чате TypingMind, и дальше модель всё сделает сама. Его название и описание хранятся в системном промпте, а при появлении подходящего запроса модель сама загружает полные инструкции. Вам не нужно вызывать навык вручную, и до фактического использования он не расходует токены.

Модель сама загружает навык Design System Linting, как только появляется подходящий для него запрос.

Работает с любой моделью ИИ

Навыки ИИ — это обычные инструкции в Markdown, а не код для конкретного поставщика, поэтому навык Design System Linting не привязан к модели, для которой он был создан. Установите его один раз в TypingMind и используйте с GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama или локальной моделью, которую запускаете самостоятельно, — со своими ключами API.

  • Загружается только при необходимости

    Системный промпт содержит только название и описание. Инструкции загружаются при первом подходящем запросе, поэтому неиспользуемый навык не расходует токены.

  • Меняйте модели прямо в чате

    Навык состоит из инструкций, а не кода, поэтому смена модели не нарушает его работу: новая модель читает тот же файл SKILL.md.

Инструкции навыка

Это содержимое файла SKILL.md, которое загружает модель. Прочитайте его перед установкой: навык — это инструкции, которым будет следовать ваша модель.

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.

Часто задаваемые вопросы

Что делает навык ИИ 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".

Зачем использовать Design System Linting в TypingMind?

Потому что вы устанавливаете навык один раз и используете его с любой моделью. Design System Linting — это обычный текст в формате Markdown, а не код для конкретного поставщика, поэтому один и тот же навык работает с GPT-5, Claude, Gemini, Grok или локальной моделью. Вы можете менять модель прямо во время чата, и навык продолжит работать. TypingMind использует ваши собственные ключи API, поэтому вы платите поставщикам напрямую, а не оформляете подписку с оплатой за каждое место. Ваши навыки и чаты остаются в вашем собственном хранилище.

Как установить Design System Linting в TypingMind?

В TypingMind откройте «Плагины → Навыки → Установить из GitHub» и вставьте https://github.com/staple-lab/design-system-skills/tree/main/plugins/design-system/skills/design-system-linting. TypingMind прочитает файл SKILL.md и установит навык, который можно включать отдельно для каждого чата.

Какие модели ИИ могут использовать Design System Linting?

Любая модель, которую вы подключите в TypingMind. Навыки ИИ — это обычные инструкции в формате Markdown, а не код для конкретного поставщика, поэтому GPT, Claude, Gemini, Grok и локальные модели могут загружать этот навык, когда запрос ему соответствует.

Со сколькими моделями ИИ можно использовать Design System Linting?

С любым количеством. В TypingMind вы можете использовать Design System Linting с любой моделью, которая поддерживает навыки, в том числе с GPT, Claude, Gemini, Grok, DeepSeek, Mistral и Llama. Для этого вы используете собственные ключи API.

Бесплатен ли навык ИИ Design System Linting?

Да. Навык опубликован на GitHub по лицензии MIT. Издатель — staple-lab. Вы платите только своему поставщику ИИ за использованные токены.

Что такое навыки ИИ?

Навык ИИ — это набор инструкций, которыми модель ИИ может пользоваться каждый раз, когда ей нужно выполнить конкретную задачу. Он соответствует открытому формату Agent Skills: файл SKILL.md с названием и описанием, а также любые скрипты, шаблоны или справочные файлы, которые могут понадобиться модели. Модель читает инструкции, только когда ваш запрос соответствует навыку, поэтому установленный навык ничего не стоит, пока не используется.

Чем навыки ИИ отличаются от плагинов и серверов MCP?

Плагин или сервер MCP даёт модели новые инструменты, которые она может вызывать: при вызове где-то выполняется код и возвращает результат. Навык ИИ, напротив, даёт модели знания и описывает порядок действий: как подойти к задаче, какие шаги выполнить и каким должен быть хороший результат. Навыки — это обычный текст в формате Markdown, поэтому им не нужны сервер, ключ API или среда выполнения, и они работают с любой моделью.

Все

Создайте своё рабочее пространство с ИИ прямо сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇