8-bit-pixel-art-patter…
Create pixelated borders, shadows, and effects for 8-bit retro components. Apply when building 8-bit styled UI components that…
Hoist RegExp creation outside render or memoize with useMemo(). Apply when using regular expressions in React components or frequently called functions.
Claude Code
$ npx -y skills add theorcdev/8bitcn-ui --skill js-hoist-regexp --agent claude-code
Codex
$ npx skills add theorcdev/8bitcn-ui --skill js-hoist-regexp -a codex -y
Cursor
$ npx skills add theorcdev/8bitcn-ui --skill js-hoist-regexp -a cursor -y
Gemini CLI
$ npx skills add theorcdev/8bitcn-ui --skill js-hoist-regexp -a gemini-cli -y
GitHub Copilot
$ npx skills add theorcdev/8bitcn-ui --skill js-hoist-regexp -a github-copilot -y
OpenCode
$ npx skills add theorcdev/8bitcn-ui --skill js-hoist-regexp -a opencode -y
Windsurf
$ npx skills add theorcdev/8bitcn-ui --skill js-hoist-regexp -a windsurf -y
name: js-hoist-regexp description: Hoist RegExp creation outside render or memoize with useMemo(). Apply when using regular expressions in React components or frequently called functions.
Don't create RegExp inside render. Hoist to module scope or memoize with `useMemo()`.
**Incorrect (new RegExp every render):**
function Highlighter({ text, query }: Props) {
const regex = new RegExp(`(${query})`, 'gi')
const parts = text.split(regex)
return <>{parts.map((part, i) => ...)}</>
}**Correct (memoize or hoist):**
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
function Highlighter({ text, query }: Props) {
const regex = useMemo(
() => new RegExp(`(${escapeRegex(query)})`, 'gi'),
[query]
)
const parts = text.split(regex)
return <>{parts.map((part, i) => ...)}</>
}**Warning (global regex has mutable state):**
Global regex (`/g`) has mutable `lastIndex` state:
const regex = /foo/g
regex.test('foo') // true, lastIndex = 3
regex.test('foo') // false, lastIndex = 0Accessible retro components that you can copy and paste into your apps.Free. Open Source. Built on shadcn/ui. Documentation · Components · Blocks · Themes · Discord
Create pixelated borders, shadows, and effects for 8-bit retro components. Apply when building 8-bit styled UI components that…
Create documentation with gaming-specific examples, retro styling, and 8-bit terminology. Apply when documenting gaming blocks,…
Optimize 8-bit animations for smooth performance. Apply when creating animated pixel art, game UI effects, or any retro-styled…
Import directly from source files instead of barrel files. Apply when using libraries like lucide-react, @mui/material, or…
Use next/dynamic for lazy-loading heavy components. Apply when importing large components like editors, charts, or rich text…
Best practices for wrapping shadcn/ui components. Apply when creating 8-bit styled variants of existing shadcn/ui components.
Migrates React projects and components from Radix UI to Base UI. Use when asked to migrate from radix, move to base-ui, convert…
tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One…