[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M719MWH1DD641BCEG8VSZ59J":3,"skill-same:01M719MWH1DD641BCEG8VSZ59J":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":30,"linkOnly":31,"markdownContent":32,"markdownBody":33,"frontMatter":34,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":14,"repositoryHtmlUrl":40,"repositoryHomepageUrl":6,"ownerHtmlUrl":41,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":42,"install":43,"resources":56},"01M719MWH1DD641BCEG8VSZ59J","react-component-performance",null,"Diagnose slow React components and suggest targeted performance fixes.","sapsapshen\u002Fai-memory-router","sapsapshen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F20347959?v=4","01M6XDQEF1DP50DKF37H81J3J5","shenmian","01M6XDQEJPE41Y3DT2763X8ZJN",0,"MIT","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Freact-component-performance\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29],"performance","react component performance","react","component","react component","diagnose","fixes","components","react components","2026","safe","2026-11-10 10:12:30",false,"---\nname: react-component-performance\ndescription: Diagnose slow React components and suggest targeted performance fixes.\nrisk: safe\nsource: \"Dimillian\u002FSkills (MIT)\"\ndate_added: \"2026-03-25\"\n---\n\n# React Component Performance\n\n## Overview\n\nIdentify render hotspots, isolate expensive updates, and apply targeted optimizations without changing UI behavior.\n\n## When to Use\n\n- When the user asks to profile or improve a slow React component.\n- When you need to reduce re-renders, list lag, or expensive render work in React UI.\n\n## Workflow\n\n1. Reproduce or describe the slowdown.\n2. Identify what triggers re-renders (state updates, props churn, effects).\n3. Isolate fast-changing state from heavy subtrees.\n4. Stabilize props and handlers; memoize where it pays off.\n5. Reduce expensive work (computation, DOM size, list length).\n6. **Validate**: open React DevTools Profiler → record the interaction → inspect the Flamegraph for components rendering longer than ~16 ms → compare against a pre-optimization baseline recording.\n\n## Checklist\n\n- Measure: use React DevTools Profiler or log renders; capture baseline.\n- Find churn: identify state updated on a timer, scroll, input, or animation.\n- Split: move ticking state into a child; keep heavy lists static.\n- Memoize: wrap leaf rows with `memo` only when props are stable.\n- Stabilize props: use `useCallback`\u002F`useMemo` for handlers and derived values.\n- Avoid derived work in render: precompute, or compute inside memoized helpers.\n- Control list size: window\u002Fvirtualize long lists; avoid rendering hidden items.\n- Keys: ensure stable keys; avoid index when order can change.\n- Effects: verify dependency arrays; avoid effects that re-run on every render.\n- Style\u002Flayout: watch for expensive layout thrash or large Markdown\u002Fdiff renders.\n\n## Optimization Patterns\n\n### Isolate ticking state\n\nMove a timer or animation counter into a child so the parent list never re-renders on each tick.\n\n```tsx\n\u002F\u002F ❌ Before – entire parent (and list) re-renders every second\nfunction Dashboard({ items }: { items: Item[] }) {\n  const [tick, setTick] = useState(0);\n  useEffect(() => {\n    const id = setInterval(() => setTick(t => t + 1), 1000);\n    return () => clearInterval(id);\n  }, []);\n  return (\n    \u003C>\n      \u003CClock tick={tick} \u002F>\n      \u003CExpensiveList items={items} \u002F> {\u002F* re-renders every second *\u002F}\n    \u003C\u002F>\n  );\n}\n\n\u002F\u002F ✅ After – only \u003CClock> re-renders; list is untouched\nfunction Clock() {\n  const [tick, setTick] = useState(0);\n  useEffect(() => {\n    const id = setInterval(() => setTick(t => t + 1), 1000);\n    return () => clearInterval(id);\n  }, []);\n  return \u003Cspan>{tick}s\u003C\u002Fspan>;\n}\n\nfunction Dashboard({ items }: { items: Item[] }) {\n  return (\n    \u003C>\n      \u003CClock \u002F>\n      \u003CExpensiveList items={items} \u002F>\n    \u003C\u002F>\n  );\n}\n```\n\n### Stabilize callbacks with `useCallback` + `memo`\n\n```tsx\n\u002F\u002F ❌ Before – new handler reference on every render busts Row memo\nfunction List({ items }: { items: Item[] }) {\n  const handleClick = (id: string) => console.log(id); \u002F\u002F new ref each render\n  return items.map(item => \u003CRow key={item.id} item={item} onClick={handleClick} \u002F>);\n}\n\n\u002F\u002F ✅ After – stable handler; Row only re-renders when its own item changes\nconst Row = memo(({ item, onClick }: RowProps) => (\n  \u003Cli onClick={() => onClick(item.id)}>{item.name}\u003C\u002Fli>\n));\n\nfunction List({ items }: { items: Item[] }) {\n  const handleClick = useCallback((id: string) => console.log(id), []);\n  return items.map(item => \u003CRow key={item.id} item={item} onClick={handleClick} \u002F>);\n}\n```\n\n### Prefer derived data outside render\n\n```tsx\n\u002F\u002F ❌ Before – recomputes on every render\nfunction Summary({ orders }: { orders: Order[] }) {\n  const total = orders.reduce((sum, o) => sum + o.amount, 0); \u002F\u002F runs every render\n  return \u003Cp>Total: {total}\u003C\u002Fp>;\n}\n\n\u002F\u002F ✅ After – recomputes only when orders changes\nfunction Summary({ orders }: { orders: Order[] }) {\n  const total = useMemo(() => orders.reduce((sum, o) => sum + o.amount, 0), [orders]);\n  return \u003Cp>Total: {total}\u003C\u002Fp>;\n}\n```\n\n### Additional patterns\n\n- **Split rows**: extract list rows into memoized components with narrow props.\n- **Defer heavy rendering**: lazy-render or collapse expensive content until expanded.\n\n## Profiling Validation Steps\n\n1. Open **React DevTools → Profiler** tab.\n2. Click **Record**, perform the slow interaction, then **Stop**.\n3. Switch to **Flamegraph** view; any bar labeled with a component and time > ~16 ms is a candidate.\n4. Use **Ranked chart** to sort by self render time and target the top offenders.\n5. Apply one optimization at a time, re-record, and compare render counts and durations against the baseline.\n\n## Example Reference\n\nLoad `references\u002Fexamples.md` when the user wants a concrete refactor example.\n","# React Component Performance\n\n## Overview\n\nIdentify render hotspots, isolate expensive updates, and apply targeted optimizations without changing UI behavior.\n\n## When to Use\n\n- When the user asks to profile or improve a slow React component.\n- When you need to reduce re-renders, list lag, or expensive render work in React UI.\n\n## Workflow\n\n1. Reproduce or describe the slowdown.\n2. Identify what triggers re-renders (state updates, props churn, effects).\n3. Isolate fast-changing state from heavy subtrees.\n4. Stabilize props and handlers; memoize where it pays off.\n5. Reduce expensive work (computation, DOM size, list length).\n6. **Validate**: open React DevTools Profiler → record the interaction → inspect the Flamegraph for components rendering longer than ~16 ms → compare against a pre-optimization baseline recording.\n\n## Checklist\n\n- Measure: use React DevTools Profiler or log renders; capture baseline.\n- Find churn: identify state updated on a timer, scroll, input, or animation.\n- Split: move ticking state into a child; keep heavy lists static.\n- Memoize: wrap leaf rows with `memo` only when props are stable.\n- Stabilize props: use `useCallback`\u002F`useMemo` for handlers and derived values.\n- Avoid derived work in render: precompute, or compute inside memoized helpers.\n- Control list size: window\u002Fvirtualize long lists; avoid rendering hidden items.\n- Keys: ensure stable keys; avoid index when order can change.\n- Effects: verify dependency arrays; avoid effects that re-run on every render.\n- Style\u002Flayout: watch for expensive layout thrash or large Markdown\u002Fdiff renders.\n\n## Optimization Patterns\n\n### Isolate ticking state\n\nMove a timer or animation counter into a child so the parent list never re-renders on each tick.\n\n```tsx\n\u002F\u002F ❌ Before – entire parent (and list) re-renders every second\nfunction Dashboard({ items }: { items: Item[] }) {\n  const [tick, setTick] = useState(0);\n  useEffect(() => {\n    const id = setInterval(() => setTick(t => t + 1), 1000);\n    return () => clearInterval(id);\n  }, []);\n  return (\n    \u003C>\n      \u003CClock tick={tick} \u002F>\n      \u003CExpensiveList items={items} \u002F> {\u002F* re-renders every second *\u002F}\n    \u003C\u002F>\n  );\n}\n\n\u002F\u002F ✅ After – only \u003CClock> re-renders; list is untouched\nfunction Clock() {\n  const [tick, setTick] = useState(0);\n  useEffect(() => {\n    const id = setInterval(() => setTick(t => t + 1), 1000);\n    return () => clearInterval(id);\n  }, []);\n  return \u003Cspan>{tick}s\u003C\u002Fspan>;\n}\n\nfunction Dashboard({ items }: { items: Item[] }) {\n  return (\n    \u003C>\n      \u003CClock \u002F>\n      \u003CExpensiveList items={items} \u002F>\n    \u003C\u002F>\n  );\n}\n```\n\n### Stabilize callbacks with `useCallback` + `memo`\n\n```tsx\n\u002F\u002F ❌ Before – new handler reference on every render busts Row memo\nfunction List({ items }: { items: Item[] }) {\n  const handleClick = (id: string) => console.log(id); \u002F\u002F new ref each render\n  return items.map(item => \u003CRow key={item.id} item={item} onClick={handleClick} \u002F>);\n}\n\n\u002F\u002F ✅ After – stable handler; Row only re-renders when its own item changes\nconst Row = memo(({ item, onClick }: RowProps) => (\n  \u003Cli onClick={() => onClick(item.id)}>{item.name}\u003C\u002Fli>\n));\n\nfunction List({ items }: { items: Item[] }) {\n  const handleClick = useCallback((id: string) => console.log(id), []);\n  return items.map(item => \u003CRow key={item.id} item={item} onClick={handleClick} \u002F>);\n}\n```\n\n### Prefer derived data outside render\n\n```tsx\n\u002F\u002F ❌ Before – recomputes on every render\nfunction Summary({ orders }: { orders: Order[] }) {\n  const total = orders.reduce((sum, o) => sum + o.amount, 0); \u002F\u002F runs every render\n  return \u003Cp>Total: {total}\u003C\u002Fp>;\n}\n\n\u002F\u002F ✅ After – recomputes only when orders changes\nfunction Summary({ orders }: { orders: Order[] }) {\n  const total = useMemo(() => orders.reduce((sum, o) => sum + o.amount, 0), [orders]);\n  return \u003Cp>Total: {total}\u003C\u002Fp>;\n}\n```\n\n### Additional patterns\n\n- **Split rows**: extract list rows into memoized components with narrow props.\n- **Defer heavy rendering**: lazy-render or collapse expensive content until expanded.\n\n## Profiling Validation Steps\n\n1. Open **React DevTools → Profiler** tab.\n2. Click **Record**, perform the slow interaction, then **Stop**.\n3. Switch to **Flamegraph** view; any bar labeled with a component and time > ~16 ms is a candidate.\n4. Use **Ranked chart** to sort by self render time and target the top offenders.\n5. Apply one optimization at a time, re-record, and compare render counts and durations against the baseline.\n\n## Example Reference\n\nLoad `references\u002Fexamples.md` when the user wants a concrete refactor example.\n",{"name":5,"risk":29,"source":35,"date_added":36,"description":7},"Dimillian\u002FSkills (MIT)","2026-03-25","main","7a38d8e7073e61c16eda85681cb32fb68a8657a5","skills-store\u002Fglobal\u002Freact-component-performance","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router","https:\u002F\u002Fgithub.com\u002Fsapsapshen","2026-04-14 21:12:12",{"source":8,"skillName":5,"commands":44,"prompt":54,"zipAvailable":55},[45,48,51],{"tool":46,"command":47},"npx","npx skills add sapsapshen\u002Fai-memory-router --skill react-component-performance",{"tool":49,"command":50},"bunx","bunx skills add sapsapshen\u002Fai-memory-router --skill react-component-performance",{"tool":52,"command":53},"pnpm","pnpm dlx skills add sapsapshen\u002Fai-memory-router --skill react-component-performance","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Freact-component-performance\u002FSKILL.md",true,[57,63],{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},"agents\u002Fopenai.yaml","REFERENCE","参考文档",238,"https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Freact-component-performance\u002Fagents\u002Fopenai.yaml",{"path":64,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":65,"sourceHtmlUrl":66},"references\u002Fexamples.md",2381,"https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Freact-component-performance\u002Freferences\u002Fexamples.md",[68,78,85,93,99,107],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":72,"licenseFileUrl":73,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":77},"01M72R8PZX1ABFHJGTYPA4CAF1","webapp-testing","To test local web applications, write native Python Playwright scripts.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fwebapp-testing\u002FSKILL.md",[],[],"2026-11-10 22:39:42",{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":77},"01M72QG37MMZNDY7X7GXPAK5W6","python-packaging","Comprehensive guide to creating, structuring, and distributing Python packages using modern packaging tools, pyproject.toml, and publishing to PyPI.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fpython-packaging\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":72,"licenseFileUrl":89,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":77},"01M72NXR0QMP9G46TW6A2DH59C","canvas-design","These are instructions for creating design philosophies - aesthetic movements that are then EXPRESSED VISUALLY. Output only .md files, .pdf files, and .png files.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fcanvas-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fcanvas-design\u002FSKILL.md",[],[],{"skillNo":94,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":72,"licenseFileUrl":95,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":77},"01M72N55TK3EEQ4QK4AWDC2KZS","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":72,"licenseFileUrl":103,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":77},"01M72MTWC150CFAP4Y5GSNKF80","slack-gif-creator","A toolkit providing utilities and knowledge for creating animated GIFs optimized for Slack.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fslack-gif-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fslack-gif-creator\u002FSKILL.md",[],[],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":72,"licenseFileUrl":111,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":77},"01M72KPT3VVNSP88MNAY466TZT","frontend-design","You are a frontend designer-engineer, not a layout generator.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Ffrontend-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Ffrontend-design\u002FSKILL.md",[],[]]