setup-react-rules
БесплатноЗапускает вложенные скриптыНе проверенEnforce React/TS/security rules via PostToolUse hooks -- ban raw HTML, TS escape hatches, XSS vectors, barrel imports, missing passive listeners. Use when…
от redpanda-data★ 34 звезды на GitHubОб этом скилле
Setup React Rules
PostToolUse hooks on Edit/Write (auto-skip component library dirs):
Enforced Rules
HTML/Components: ban raw HTML elements (use @/components/ui/), ban inline style={{}} (use Tailwind), ban icon inside AlertTitle (use icon prop), require handler on buttons (onClick/asChild/type="submit"/disabled)
TypeScript: ban as any, as Record<string,any>, @ts-ignore, @ts-expect-error
Security: ban dangerouslySetInnerHTML, eval(), new Function(), .innerHTML = (XSS/OWASP A03)
Performance: ban barrel imports (use direct paths), ban missing { passive: true } on scroll/touch/wheel, ban static import of heavy deps (chart.js/d3/three.js/pdf-lib -- use React.lazy())
Styling: ban raw hex/rgb in className (use design tokens), ban !important, ban outline: none (use focus-visible), ban visual overrides on registry components (use variant prop)
Navigation: ban onClick + navigate() (use <Button asChild><Link>), require aria-label on icon-only buttons
React Compiler: ban manual useMemo/useCallback/React.memo, ban class components
Protobuf: enforce create() wrapper for message spreads (v2)
Opt-in Rules
REACT_RULES_BAN_USEEFFECT=1: ban useEffect/useLayoutEffect/useInsertionEffect. Escape:// allow: useEffect [reason]REACT_RULES_BAN_TYPE_ASSERTIONS=1: banas X(allowas const). Force type guards/generics/schema validation.
Soft Guidance (Claude-enforced, not hooks)
- Named useEffect functions describe purpose. No name without "and"? Split.
useSyncExternalStorefor browser API subscriptions (navigator.onLine, matchMedia, scroll)- Form-level
validatecross-field validation (react-hook-form v7.72+)
Functional Programming (Claude-enforced)
- Pure render -- no side effects in component body
- Immutable state -- spread/filter/map, never mutate
- Derive don't sync --
useMemonotuseState+useEffect useReducerfor 3+ interrelateduseState- Extract data transforms to named pure functions
- Discriminated unions for variant prop types
- Generic
<T>for reusable typed components
See REFERENCE.md for patterns + examples.
Steps
- Copy
scripts/react-rules-check.sh+scripts/fp-check.sh+scripts/tailwind-check.sh+scripts/_hook-lib.sh->.claude/hooks/.chmod +x. - Add to PostToolUse (Edit|Write) in
.claude/settings.json. - Optional:
codex-compatfor.codex/hooks.json.
Verify
- Block raw HTML,
as any,@ts-ignorein TSX - Auto-skip component library dirs
- Opt-in rules work when env vars set
Установить setup-react-rules в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл setup-react-rules?
Enforce React/TS/security rules via PostToolUse hooks -- ban raw HTML, TS escape hatches, XSS vectors, barrel imports, missing passive listeners. Use when enforcing React patterns or component library standards.
Как установить скилл setup-react-rules?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл setup-react-rules запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic