[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6MD7CDNY5R4YT54G6GY4TY4":3,"skill-same:01M6MD7CDNY5R4YT54G6GY4TY4":110},{"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":23,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":53,"commitSha":54,"skillDirectory":55,"forksCount":56,"repositoryHtmlUrl":57,"repositoryHomepageUrl":58,"ownerHtmlUrl":59,"ownerBlogUrl":58,"ownerDescription":60,"updatedAt":61,"install":62,"resources":75},"01M6MD7CDNY5R4YT54G6GY4TY4","react",null,"Build React 19 components and hooks under React Compiler: state, Effects, memoization, props\u002Frefs, Actions, use(), compiler\u002Flint setup, and Vitest tests. Excludes React Native, other frameworks, and backend-only Node.js.","compozy\u002Fcompozy","compozy","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F205107042?v=4","01M6JWVTXX4DX38AWZ7SPFEKEV","CompozyOS","01M6JWVV2P34GM1PDATVB2EV05",2871,"MIT","https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发","SCENARIO","使用场景",[5,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"use","effects","native","react 19","tests","frameworks","build","hooks","only","backend","github","react native","read","vitest","actions","compiler","state","lint","components","2026-11-10 10:12:30",false,"---\nname: react\ndescription: \"Build React 19 components and hooks under React Compiler: state, Effects, memoization, props\u002Frefs, Actions, use(), compiler\u002Flint setup, and Vitest tests. Excludes React Native, other frameworks, and backend-only Node.js.\"\nallowed-tools: Read, Grep, Glob\nmetadata:\n  author: Pedro Nauck\n  github: https:\u002F\u002Fgithub.com\u002Fpedronauck\n  repository: https:\u002F\u002Fgithub.com\u002Fpedronauck\u002Fskills\n---\n# React\n\nTargets **React 19.2** and **React Compiler 1.0** (`babel-plugin-react-compiler`), linted by **`eslint-plugin-react-hooks` 7.1+**. Read the reference matched by the API or behavior being changed. Load adjacent references only for concerns the change crosses; reuse relevant context already read.\n\n## The compiler is the optimizer\n\nThe compiler applies the equivalent of `memo` to every component and memoizes calculations inside components and hooks, at build time. It does this *more* granularly than hand-written hooks can — it memoizes after early returns, where `useMemo` is structurally forbidden.\n\nThe price is that the **Rules of React** stopped being style advice and became a build-time contract. When a component violates them, the compiler **bails**: it silently skips optimizing that component and moves on. The build stays green, the tests stay green, and the component is simply never optimized. Write code the compiler cannot bail on.\n\nTwo consequences that invert pre-compiler habits:\n\n- Reflexive `useMemo`\u002F`useCallback` on cheap values is now noise, and an **incomplete dependency array is worse than no memoization at all** — the compiler refuses to optimize a component whose manual memoization it cannot match.\n- A rule violation costs optimization silently rather than raising an error, so the lint rules are the only thing standing between you and a quietly unoptimized app. Enable them before enabling the compiler.\n\n## Decide memoization first\n\n| Situation | Do |\n| --- | --- |\n| New value or callback consumed only by render\u002FJSX | Write it plainly; the compiler memoizes it |\n| Value feeds a `useEffect` (or another hook's) dependency array and identity must hold | Keep `useMemo`\u002F`useCallback` — the escape hatch react.dev names by name |\n| Value crosses to a non-compiled consumer (vanilla lib instance, `addEventListener`, uncompiled package) | Keep manual memoization |\n| Manual memoization you keep for any reason | Make its deps exhaustive, or the component bails |\n| Working memoization in existing code | Leave it — removing it changes compilation output; test before touching |\n| Same expensive call repeated across components | Compiler memoization is per-component, never shared; hoist to a module-level cache or the data layer |\n| Expensive work in a plain module-level util | Not memoized at all; the compiler only covers components and hooks |\n| `memo()` with a custom `areEqual` comparator | Keep it; the compiler has no equivalent |\n\n*Done when:* each memoization added or changed by this task traces to a row above, and no row was satisfied by adding a hook the compiler already covers.\n\n## Branches\n\n| When you are… | Reference |\n| --- | --- |\n| Writing or reviewing any component or hook body — purity, mutation, refs, globals | `references\u002Frules-of-react.md` |\n| Removing, keeping, or debating a `useMemo`\u002F`useCallback`\u002F`memo`, or a component was skipped by the compiler | `references\u002Fcompiler.md` |\n| Installing or configuring the compiler, the lint preset, or adopting it incrementally | `references\u002Fcompiler-setup.md` |\n| Reaching for `useEffect`, or deriving\u002Fsyncing state | `references\u002Feffects.md` |\n| Shaping components, composition, props, or TypeScript types | `references\u002Fcomponents-and-types.md` |\n| Choosing where state lives, wiring context or an external store | `references\u002Fstate.md` |\n| Using `use()`, Actions, `useOptimistic`, `\u003CActivity>`, metadata, or other React 19 APIs | `references\u002Freact19-apis.md` |\n| Writing or fixing component\u002Fhook tests | `references\u002Ftesting.md` |\n\nApply the technical rules relevant to the changed behavior.\n\n## Tripwires\n\n**Purity** — render computes from props, state, and context only. `Math.random()`, `Date.now()`, `new Date()`, `crypto.randomUUID()`, and `performance.now()` belong in a state initializer, an event handler, or an effect.\n\n**Mutation** — props, state, hook arguments, hook return values, and any value already handed to JSX are read-only; copy before changing (`setItems([...items].sort())`). A value created in this render that never escapes is yours to mutate freely.\n\n**Reassignment** — treat a destructured prop as read-only: rename on destructure (`{ value: valueFromProps }`) and derive a new `const`.\n\n**Refs** — read and write `ref.current` in effects and event handlers. During render the only sanctioned touch is one-time lazy init: `if (ref.current === null) ref.current = …`.\n\n**Globals** — module scope holds constants; per-render values live in `useState`\u002F`useContext` and outward writes in an effect. Counters, arrays, and ad-hoc caches touched during render break Fast Refresh and forfeit compilation.\n\n**Components are static** — declare components and hooks at module scope. Defining one inside another component (or returning one from a factory) makes a new type every render, resetting state and tearing down DOM.\n\n**Effects** — an effect exists to synchronize with something outside React. Synchronous `setState` in an effect to derive or copy state is an error-level lint violation; compute during render instead.\n\n**Errors** — child render errors are caught by an Error Boundary, never by `try`\u002F`catch` around JSX.\n\n**Refs are props** — `forwardRef` is deprecated in 19; accept `ref` in the props type. Likewise `\u003CContext value={…}>`, not `\u003CContext.Provider>`.\n\n**Escape hatch** — `\"use no memo\"` is a bisection tool carrying a written reason and a removal plan, not a fix.\n\n## Related skills\n\n`tanstack` for TanStack Query, Router, and Form. `xstate-store` for `@xstate\u002Fstore`. `shadcn` for component primitives and CVA variants. `tailwindcss` for styling. `vitest` for runner configuration beyond `references\u002Ftesting.md`.\n","# React\n\nTargets **React 19.2** and **React Compiler 1.0** (`babel-plugin-react-compiler`), linted by **`eslint-plugin-react-hooks` 7.1+**. Read the reference matched by the API or behavior being changed. Load adjacent references only for concerns the change crosses; reuse relevant context already read.\n\n## The compiler is the optimizer\n\nThe compiler applies the equivalent of `memo` to every component and memoizes calculations inside components and hooks, at build time. It does this *more* granularly than hand-written hooks can — it memoizes after early returns, where `useMemo` is structurally forbidden.\n\nThe price is that the **Rules of React** stopped being style advice and became a build-time contract. When a component violates them, the compiler **bails**: it silently skips optimizing that component and moves on. The build stays green, the tests stay green, and the component is simply never optimized. Write code the compiler cannot bail on.\n\nTwo consequences that invert pre-compiler habits:\n\n- Reflexive `useMemo`\u002F`useCallback` on cheap values is now noise, and an **incomplete dependency array is worse than no memoization at all** — the compiler refuses to optimize a component whose manual memoization it cannot match.\n- A rule violation costs optimization silently rather than raising an error, so the lint rules are the only thing standing between you and a quietly unoptimized app. Enable them before enabling the compiler.\n\n## Decide memoization first\n\n| Situation | Do |\n| --- | --- |\n| New value or callback consumed only by render\u002FJSX | Write it plainly; the compiler memoizes it |\n| Value feeds a `useEffect` (or another hook's) dependency array and identity must hold | Keep `useMemo`\u002F`useCallback` — the escape hatch react.dev names by name |\n| Value crosses to a non-compiled consumer (vanilla lib instance, `addEventListener`, uncompiled package) | Keep manual memoization |\n| Manual memoization you keep for any reason | Make its deps exhaustive, or the component bails |\n| Working memoization in existing code | Leave it — removing it changes compilation output; test before touching |\n| Same expensive call repeated across components | Compiler memoization is per-component, never shared; hoist to a module-level cache or the data layer |\n| Expensive work in a plain module-level util | Not memoized at all; the compiler only covers components and hooks |\n| `memo()` with a custom `areEqual` comparator | Keep it; the compiler has no equivalent |\n\n*Done when:* each memoization added or changed by this task traces to a row above, and no row was satisfied by adding a hook the compiler already covers.\n\n## Branches\n\n| When you are… | Reference |\n| --- | --- |\n| Writing or reviewing any component or hook body — purity, mutation, refs, globals | `references\u002Frules-of-react.md` |\n| Removing, keeping, or debating a `useMemo`\u002F`useCallback`\u002F`memo`, or a component was skipped by the compiler | `references\u002Fcompiler.md` |\n| Installing or configuring the compiler, the lint preset, or adopting it incrementally | `references\u002Fcompiler-setup.md` |\n| Reaching for `useEffect`, or deriving\u002Fsyncing state | `references\u002Feffects.md` |\n| Shaping components, composition, props, or TypeScript types | `references\u002Fcomponents-and-types.md` |\n| Choosing where state lives, wiring context or an external store | `references\u002Fstate.md` |\n| Using `use()`, Actions, `useOptimistic`, `\u003CActivity>`, metadata, or other React 19 APIs | `references\u002Freact19-apis.md` |\n| Writing or fixing component\u002Fhook tests | `references\u002Ftesting.md` |\n\nApply the technical rules relevant to the changed behavior.\n\n## Tripwires\n\n**Purity** — render computes from props, state, and context only. `Math.random()`, `Date.now()`, `new Date()`, `crypto.randomUUID()`, and `performance.now()` belong in a state initializer, an event handler, or an effect.\n\n**Mutation** — props, state, hook arguments, hook return values, and any value already handed to JSX are read-only; copy before changing (`setItems([...items].sort())`). A value created in this render that never escapes is yours to mutate freely.\n\n**Reassignment** — treat a destructured prop as read-only: rename on destructure (`{ value: valueFromProps }`) and derive a new `const`.\n\n**Refs** — read and write `ref.current` in effects and event handlers. During render the only sanctioned touch is one-time lazy init: `if (ref.current === null) ref.current = …`.\n\n**Globals** — module scope holds constants; per-render values live in `useState`\u002F`useContext` and outward writes in an effect. Counters, arrays, and ad-hoc caches touched during render break Fast Refresh and forfeit compilation.\n\n**Components are static** — declare components and hooks at module scope. Defining one inside another component (or returning one from a factory) makes a new type every render, resetting state and tearing down DOM.\n\n**Effects** — an effect exists to synchronize with something outside React. Synchronous `setState` in an effect to derive or copy state is an error-level lint violation; compute during render instead.\n\n**Errors** — child render errors are caught by an Error Boundary, never by `try`\u002F`catch` around JSX.\n\n**Refs are props** — `forwardRef` is deprecated in 19; accept `ref` in the props type. Likewise `\u003CContext value={…}>`, not `\u003CContext.Provider>`.\n\n**Escape hatch** — `\"use no memo\"` is a bisection tool carrying a written reason and a removal plan, not a fix.\n\n## Related skills\n\n`tanstack` for TanStack Query, Router, and Form. `xstate-store` for `@xstate\u002Fstore`. `shadcn` for component primitives and CVA variants. `tailwindcss` for styling. `vitest` for runner configuration beyond `references\u002Ftesting.md`.\n",{"name":5,"metadata":48,"description":7,"allowed-tools":52},{"author":49,"github":50,"repository":51},"Pedro Nauck","https:\u002F\u002Fgithub.com\u002Fpedronauck","https:\u002F\u002Fgithub.com\u002Fpedronauck\u002Fskills","Read, Grep, Glob","main","65613632bb94072e27fc5015d17387e28a870111",".agents\u002Fskills\u002Freact",187,"https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy","https:\u002F\u002Fcompozy.com","https:\u002F\u002Fgithub.com\u002Fcompozy","An OS for AI agents","2026-11-15 03:55:11",{"source":8,"skillName":5,"commands":63,"prompt":73,"zipAvailable":74},[64,67,70],{"tool":65,"command":66},"npx","npx skills add compozy\u002Fcompozy --skill react",{"tool":68,"command":69},"bunx","bunx skills add compozy\u002Fcompozy --skill react",{"tool":71,"command":72},"pnpm","pnpm dlx skills add compozy\u002Fcompozy --skill react","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact\u002FSKILL.md",true,[76,82,86,90,94,98,102,106],{"path":77,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":80,"sourceHtmlUrl":81},"references\u002Fcompiler-setup.md","REFERENCE","参考文档",6053,"https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact\u002Freferences\u002Fcompiler-setup.md",{"path":83,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":84,"sourceHtmlUrl":85},"references\u002Fcompiler.md",11964,"https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact\u002Freferences\u002Fcompiler.md",{"path":87,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":88,"sourceHtmlUrl":89},"references\u002Fcomponents-and-types.md",9610,"https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact\u002Freferences\u002Fcomponents-and-types.md",{"path":91,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":92,"sourceHtmlUrl":93},"references\u002Feffects.md",9455,"https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact\u002Freferences\u002Feffects.md",{"path":95,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":96,"sourceHtmlUrl":97},"references\u002Freact19-apis.md",6839,"https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact\u002Freferences\u002Freact19-apis.md",{"path":99,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":100,"sourceHtmlUrl":101},"references\u002Frules-of-react.md",9578,"https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact\u002Freferences\u002Frules-of-react.md",{"path":103,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":104,"sourceHtmlUrl":105},"references\u002Fstate.md",5708,"https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact\u002Freferences\u002Fstate.md",{"path":107,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":108,"sourceHtmlUrl":109},"references\u002Ftesting.md",3997,"https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact\u002Freferences\u002Ftesting.md",[111,143,168,190,201,213],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":115,"licenseFileUrl":116,"sourceHtmlUrl":117,"categories":118,"keywords":122,"publishedAt":43},"01M6MD7W312X49RNEJRKKVKTTD","security-review","Security code review for vulnerabilities. Use when asked to \"security review\", \"find vulnerabilities\", \"check for security issues\", \"audit security\", \"OWASP review\", or review code for injection, XSS, authentication, authorization, cryptography issues. Provides systematic review with confidence-based reporting.","CC-BY-SA-4.0","https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecurity-review\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecurity-review\u002FSKILL.md",[119],{"categoryNo":120,"categoryName":121,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000007","代码审查",[123,124,125,126,127,128,129,130,131,132,133,134,36,135,136,137,138,139,24,140,141,142],"security","security review","review","injection","authentication","code review","issues","Bash","code","xss","audit","systematic","reporting","cryptography","owasp","systematic review","for","task","when","audit security",{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":147,"categories":148,"keywords":154,"publishedAt":43},"01M6MD5K93G1GP8VA56V2FEPZV","lesson-learned","Extract evidence-backed engineering lessons from recent changes or incidents. Use for requested reflection, lesson updates, or retiring an obsolete workflow rule.","https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Flesson-learned\u002FSKILL.md",[149],{"categoryNo":150,"categoryName":151,"taxonomyType":152,"taxonomyTypeDesc":153},"01JBSEEDCAT000000000000039","教师与教育","PROFESSION","适用职业",[155,156,157,139,158,159,160,161,162,163,164,165,24,166,167],"learned","lesson learned","lesson","changes","evidence","incidents","workflow","engineering","updates","extract","rule","lessons","reflection",{"skillNo":169,"name":9,"nameZh":6,"description":170,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":171,"categories":172,"keywords":173,"publishedAt":43},"01M6MDPNH3J60VRCGTPHVTHZR8","Operate CompozyOS. Use when working with CompozyOS sessions, agents, native tools, skills, tasks, Loops, Goals, Terminal, desktops and windows, automation, extensions, or configuration. Don't use for unrelated projects.","https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002Fskills\u002Fcompozy\u002FSKILL.md",[],[9,174,175,176,177,139,178,179,24,180,181,182,183,184,185,186,26,187,188,189,141],"sessions","windows","projects","operate","runtime","true","automation","tasks","extensions","with","loops","unrelated","goals","terminal","configuration","Tools",{"skillNo":191,"name":192,"nameZh":6,"description":193,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":194,"categories":195,"keywords":196,"publishedAt":43},"01M6MDPHKNPQHJ1TF21E1HSFNF","remotion-upgrade","Upgrade Remotion, and related packages","https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002Fpackages\u002Flaunch-video\u002F.agents\u002Fskills\u002Fremotion-upgrade\u002FSKILL.md",[],[197,198,199,200],"remotion upgrade","upgrade","Remotion","packages",{"skillNo":202,"name":203,"nameZh":6,"description":204,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":205,"categories":206,"keywords":207,"publishedAt":43},"01M6MDPFT91ZWC7Z09MRNZPAJG","remotion-studio","Preview a Remotion video","https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002Fpackages\u002Flaunch-video\u002F.agents\u002Fskills\u002Fremotion-studio\u002FSKILL.md",[],[208,209,199,210,211,212],"studio","remotion studio","Video","preview","remotion video",{"skillNo":214,"name":215,"nameZh":6,"description":216,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":217,"categories":218,"keywords":219,"publishedAt":43},"01M6MDPD5XDZPYB5NAZGKMPXWC","remotion-saas","Build an app with Remotion","https:\u002F\u002Fgithub.com\u002Fcompozy\u002Fcompozy\u002Fblob\u002Fmain\u002Fpackages\u002Flaunch-video\u002F.agents\u002Fskills\u002Fremotion-saas\u002FSKILL.md",[],[220,221,199,183,222,30],"saas","remotion saas","app"]