[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EDZQFVA5SX2Z4EMWYT22FP":3,"skill-same:01M7EDZQFVA5SX2Z4EMWYT22FP":54},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":14,"categories":15,"keywords":16,"publishedAt":17,"linkOnly":18,"markdownContent":19,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":12,"repositoryHtmlUrl":25,"repositoryHomepageUrl":6,"ownerHtmlUrl":26,"ownerBlogUrl":27,"ownerDescription":28,"updatedAt":29,"install":30,"resources":43},"01M7EDZQFVA5SX2Z4EMWYT22FP","web-typescript-frontend-patterns",null,"Plaetorius\u002Fengineering-harness","Plaetorius","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F46137705?v=4","01M7EDZ4R8H5FQXH3HRT7PQCCT","01M7EDZ4TJ6VR9DVHS97FTHVEY",0,"MIT","https:\u002F\u002Fgithub.com\u002FPlaetorius\u002Fengineering-harness\u002Fblob\u002Fmain\u002Fpacks\u002Fweb-typescript\u002Fskills\u002Fweb-typescript-frontend-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: web-typescript-frontend-patterns\ndescription: Decide how to structure React and Next.js App Router code: server\u002Fclient boundaries, data and mutation flow, state ownership, forms, loading and error handling, and interaction accessibility. Use when adding or restructuring interactive UI behavior; skip for pure styling edits and backend-only work.\n---\n\nRead the repository's existing components, data layer and conventions before choosing a pattern. Match what is already there; this skill only fills gaps. Check the installed framework versions, because App Router, React and form-handling APIs change between releases.\n\n## Shape components for reuse\n\n- Prefer composition to configuration. A card, panel or list item that takes children (and optional named slots) outlasts one that grows a prop for every variation.\n- For a widget made of cooperating parts (tabs, accordion, menu), expose a small family of parts that share state through a scoped context, and fail loudly with a clear message when a part is used outside its parent.\n- When logic is reusable but markup is not, extract a hook; when markup is reusable but logic varies, pass a render function or children-as-function. Do not extract until a second real use exists.\n- Small reusable hooks worth having: debounced value (for search-as-you-type), previous value, media query, and a data hook that exposes `data`, `error`, `pending` and `refetch`. Check what the repository already provides before adding any.\n\nConcrete examples of each are in [pattern examples](patterns.md).\n\n## Place the boundary first\n\n1. Render on the server by default. A component becomes a client component only because it needs browser state, effects, event handlers or browser-only APIs.\n2. Push the client boundary down to the smallest interactive leaf. A page that is mostly static should stay a server component with one small client island.\n3. Props that cross the boundary must be serializable and must contain only what the browser is allowed to see. Select the needed fields on the server; never pass a whole database row or session object.\n4. Server-only modules (secrets, privileged clients) must be impossible to import from client code. Use the framework's server-only marker where available.\n5. A hidden button is not authorization. The server operation re-checks who the caller is and what they may do.\n\n## Move data deliberately\n\n- Read on the server where possible, close to the data, and stream slow parts behind Suspense so the rest of the page is usable.\n- Writes go through one mutation path per intent (server action, route handler or operation runner, whichever the repository already uses). Do not add a second path that skips validation.\n- Validate input at the boundary with a schema, return typed results, and map failures to user-facing messages from the translation files, not raw error text.\n- After a write, revalidate or refetch the affected data instead of patching several caches by hand.\n- Optimistic updates are for fast, rarely failing actions. Show the expected result immediately, and roll back with a visible explanation if the server refuses.\n- Treat realtime messages as hints to refetch, not as trusted payloads. Refetch after reconnect, tab refocus and regained connectivity.\n- Guard against stale responses, double submission and unmount during a request. Cancel or ignore results that no longer match the current input.\n\n## Own state at the lowest sensible level\n\n- Reach for a reducer plus a scoped provider when several fields change together by named events (steps of a wizard, a board with selection and filters). Split the provider into state and dispatch if consumers that only dispatch should not re-render.\n- Prefer, in order: derived from props or server data; URL (search params, path) for anything a person might share, bookmark or go back to; local component state; a shared provider only when distant components truly need the same live value.\n- Never store a value that can be computed from other state. Computing during render is simpler and cannot drift.\n- Use effects only to synchronize with something outside React (subscriptions, timers, browser APIs, third-party widgets) and always clean up. An effect that sets state from other state is usually a bug in disguise.\n- Server state (fetched data) and interaction state (is this menu open) are different things with different lifecycles; keep them apart.\n- Keep timers that render time on a single shared tick source or a server-aligned clock, and show the same value everywhere on the page.\n\n## Forms\n\n- Use native form elements and a real submit path so Enter, autofill and assistive technology work without extra code.\n- Every control has a visible label tied to it, hint and error text connected through `aria-describedby`, and `aria-invalid` when wrong.\n- Validate on submit first, then on change after the first error. Never wipe what the person typed after a failure.\n- Disable or guard the submit control while pending and say what is happening. Confirm success where the person is looking, not only in a console or a toast they may miss.\n- Autosave long forms and show the save state in text. Warn before discarding unsaved work.\n- Move focus to the first invalid field or to the error summary after a failed submit.\n\n## Loading, empty and error states\n\nEvery data-driven view defines four states: loading (skeleton that matches the final layout to avoid shifting), empty (what belongs here and the one action to fill it), error (what failed, what to try, a retry that works) and success. Use route-level loading and error boundaries for whole pages and local boundaries around independent widgets so one failure does not blank the screen. Distinguish \"not found\" and \"not allowed\" from \"something broke\".\n\n## Performance, only with evidence\n\nLists of about fifty or more rows that are actually rendered together deserve virtualization; below that, plain rendering is usually faster to build and to debug. Measure before optimizing: look at the actual bundle, render counts or the profiler. Typical wins are real: fewer client components, dynamic import of heavy rarely used widgets, correctly sized and lazy images, stable list keys, virtualization for lists that are truly long (hundreds of rows), and moving expensive work to the server. Memoization is a targeted tool for a measured re-render problem, not a default coat.\n\n## Failure containment\n\nWrap independent regions in error boundaries (the framework's route-level error files for pages, a small boundary component for widgets) so a crash in one panel leaves the rest usable. A fallback names what failed, never prints a raw exception message to the user, offers a working retry, and logs details where the team can see them. Reset the boundary when the input that caused the failure changes.\n\n## Interaction accessibility\n\n- Use the right element: `button` for actions, `a` for navigation, `dialog` or a tested primitive for modals. Do not attach click handlers to generic containers.\n- Dialogs trap focus, close on Escape, restore focus to the opener and name themselves. Route changes and async content updates move focus or announce through a polite live region.\n- Everything reachable by pointer is reachable by keyboard in a sensible order with a visible focus indicator.\n- Composite widgets (menus, comboboxes, listboxes) follow the standard keyboard model: arrow keys move the active option, Enter or Space selects, Escape closes, Home and End jump to the ends, and the active option is exposed to assistive technology. Prefer a tested primitive from the project's component library over hand-rolling one; see [pattern examples](patterns.md) for the minimum a custom one needs.\n- Motion is optional: prefer CSS transitions, keep them short, and disable or reduce them under `prefers-reduced-motion`. Never rely on motion alone to convey state.\n\n## Finish\n\nRun the repository's own lint, typecheck and tests, then exercise the changed flow in a real browser when one is available: success path, error path, keyboard only, a narrow phone viewport. Static checks do not prove layout or interaction. State what was run and what was not.\n\n## Provenance\n\nAdapted from the React\u002FNext.js patterns skill of the `everything-claude-code` project (README declares the MIT license; the fork this was read from carries no license file). Reworded, reorganized and fitted to this harness, with new examples. See [NOTICE](NOTICE.md).\n","Read the repository's existing components, data layer and conventions before choosing a pattern. Match what is already there; this skill only fills gaps. Check the installed framework versions, because App Router, React and form-handling APIs change between releases.\n\n## Shape components for reuse\n\n- Prefer composition to configuration. A card, panel or list item that takes children (and optional named slots) outlasts one that grows a prop for every variation.\n- For a widget made of cooperating parts (tabs, accordion, menu), expose a small family of parts that share state through a scoped context, and fail loudly with a clear message when a part is used outside its parent.\n- When logic is reusable but markup is not, extract a hook; when markup is reusable but logic varies, pass a render function or children-as-function. Do not extract until a second real use exists.\n- Small reusable hooks worth having: debounced value (for search-as-you-type), previous value, media query, and a data hook that exposes `data`, `error`, `pending` and `refetch`. Check what the repository already provides before adding any.\n\nConcrete examples of each are in [pattern examples](patterns.md).\n\n## Place the boundary first\n\n1. Render on the server by default. A component becomes a client component only because it needs browser state, effects, event handlers or browser-only APIs.\n2. Push the client boundary down to the smallest interactive leaf. A page that is mostly static should stay a server component with one small client island.\n3. Props that cross the boundary must be serializable and must contain only what the browser is allowed to see. Select the needed fields on the server; never pass a whole database row or session object.\n4. Server-only modules (secrets, privileged clients) must be impossible to import from client code. Use the framework's server-only marker where available.\n5. A hidden button is not authorization. The server operation re-checks who the caller is and what they may do.\n\n## Move data deliberately\n\n- Read on the server where possible, close to the data, and stream slow parts behind Suspense so the rest of the page is usable.\n- Writes go through one mutation path per intent (server action, route handler or operation runner, whichever the repository already uses). Do not add a second path that skips validation.\n- Validate input at the boundary with a schema, return typed results, and map failures to user-facing messages from the translation files, not raw error text.\n- After a write, revalidate or refetch the affected data instead of patching several caches by hand.\n- Optimistic updates are for fast, rarely failing actions. Show the expected result immediately, and roll back with a visible explanation if the server refuses.\n- Treat realtime messages as hints to refetch, not as trusted payloads. Refetch after reconnect, tab refocus and regained connectivity.\n- Guard against stale responses, double submission and unmount during a request. Cancel or ignore results that no longer match the current input.\n\n## Own state at the lowest sensible level\n\n- Reach for a reducer plus a scoped provider when several fields change together by named events (steps of a wizard, a board with selection and filters). Split the provider into state and dispatch if consumers that only dispatch should not re-render.\n- Prefer, in order: derived from props or server data; URL (search params, path) for anything a person might share, bookmark or go back to; local component state; a shared provider only when distant components truly need the same live value.\n- Never store a value that can be computed from other state. Computing during render is simpler and cannot drift.\n- Use effects only to synchronize with something outside React (subscriptions, timers, browser APIs, third-party widgets) and always clean up. An effect that sets state from other state is usually a bug in disguise.\n- Server state (fetched data) and interaction state (is this menu open) are different things with different lifecycles; keep them apart.\n- Keep timers that render time on a single shared tick source or a server-aligned clock, and show the same value everywhere on the page.\n\n## Forms\n\n- Use native form elements and a real submit path so Enter, autofill and assistive technology work without extra code.\n- Every control has a visible label tied to it, hint and error text connected through `aria-describedby`, and `aria-invalid` when wrong.\n- Validate on submit first, then on change after the first error. Never wipe what the person typed after a failure.\n- Disable or guard the submit control while pending and say what is happening. Confirm success where the person is looking, not only in a console or a toast they may miss.\n- Autosave long forms and show the save state in text. Warn before discarding unsaved work.\n- Move focus to the first invalid field or to the error summary after a failed submit.\n\n## Loading, empty and error states\n\nEvery data-driven view defines four states: loading (skeleton that matches the final layout to avoid shifting), empty (what belongs here and the one action to fill it), error (what failed, what to try, a retry that works) and success. Use route-level loading and error boundaries for whole pages and local boundaries around independent widgets so one failure does not blank the screen. Distinguish \"not found\" and \"not allowed\" from \"something broke\".\n\n## Performance, only with evidence\n\nLists of about fifty or more rows that are actually rendered together deserve virtualization; below that, plain rendering is usually faster to build and to debug. Measure before optimizing: look at the actual bundle, render counts or the profiler. Typical wins are real: fewer client components, dynamic import of heavy rarely used widgets, correctly sized and lazy images, stable list keys, virtualization for lists that are truly long (hundreds of rows), and moving expensive work to the server. Memoization is a targeted tool for a measured re-render problem, not a default coat.\n\n## Failure containment\n\nWrap independent regions in error boundaries (the framework's route-level error files for pages, a small boundary component for widgets) so a crash in one panel leaves the rest usable. A fallback names what failed, never prints a raw exception message to the user, offers a working retry, and logs details where the team can see them. Reset the boundary when the input that caused the failure changes.\n\n## Interaction accessibility\n\n- Use the right element: `button` for actions, `a` for navigation, `dialog` or a tested primitive for modals. Do not attach click handlers to generic containers.\n- Dialogs trap focus, close on Escape, restore focus to the opener and name themselves. Route changes and async content updates move focus or announce through a polite live region.\n- Everything reachable by pointer is reachable by keyboard in a sensible order with a visible focus indicator.\n- Composite widgets (menus, comboboxes, listboxes) follow the standard keyboard model: arrow keys move the active option, Enter or Space selects, Escape closes, Home and End jump to the ends, and the active option is exposed to assistive technology. Prefer a tested primitive from the project's component library over hand-rolling one; see [pattern examples](patterns.md) for the minimum a custom one needs.\n- Motion is optional: prefer CSS transitions, keep them short, and disable or reduce them under `prefers-reduced-motion`. Never rely on motion alone to convey state.\n\n## Finish\n\nRun the repository's own lint, typecheck and tests, then exercise the changed flow in a real browser when one is available: success path, error path, keyboard only, a narrow phone viewport. Static checks do not prove layout or interaction. State what was run and what was not.\n\n## Provenance\n\nAdapted from the React\u002FNext.js patterns skill of the `everything-claude-code` project (README declares the MIT license; the fork this was read from carries no license file). Reworded, reorganized and fitted to this harness, with new examples. See [NOTICE](NOTICE.md).\n",{},"main","d5f52b0a47554bbb7a19a178d3bd242c175b1621","packs\u002Fweb-typescript\u002Fskills\u002Fweb-typescript-frontend-patterns","https:\u002F\u002Fgithub.com\u002FPlaetorius\u002Fengineering-harness","https:\u002F\u002Fgithub.com\u002FPlaetorius","https:\u002F\u002Fprediction.live","cybersecurity for real estate agencies","2026-10-30 08:07:26",{"source":7,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add Plaetorius\u002Fengineering-harness --skill web-typescript-frontend-patterns",{"tool":36,"command":37},"bunx","bunx skills add Plaetorius\u002Fengineering-harness --skill web-typescript-frontend-patterns",{"tool":39,"command":40},"pnpm","pnpm dlx skills add Plaetorius\u002Fengineering-harness --skill web-typescript-frontend-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FPlaetorius\u002Fengineering-harness\u002Fblob\u002Fmain\u002Fpacks\u002Fweb-typescript\u002Fskills\u002Fweb-typescript-frontend-patterns\u002FSKILL.md",true,[44,50],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"NOTICE.md","REFERENCE","参考文档",774,"https:\u002F\u002Fgithub.com\u002FPlaetorius\u002Fengineering-harness\u002Fblob\u002Fmain\u002Fpacks\u002Fweb-typescript\u002Fskills\u002Fweb-typescript-frontend-patterns\u002FNOTICE.md",{"path":51,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":52,"sourceHtmlUrl":53},"patterns.md",5943,"https:\u002F\u002Fgithub.com\u002FPlaetorius\u002Fengineering-harness\u002Fblob\u002Fmain\u002Fpacks\u002Fweb-typescript\u002Fskills\u002Fweb-typescript-frontend-patterns\u002Fpatterns.md",[55,62,69,76,83,90],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":17},"01M7EE15EJFDDRMJJZD4J5DX52","example-review","Review synthetic example changes for their stated acceptance criteria.","https:\u002F\u002Fgithub.com\u002FPlaetorius\u002Fengineering-harness\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fexample-pack\u002Fskills\u002Fexample-review\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":17},"01M7EE0ZKM50KENXQEXBMYY4C6","second-reader","Independent second reader for supply-chain and data documents (RFQs, supplier quotes, emails, PDFs including scanned, spreadsheets, CSV\u002FJSON). Extracts values with source evidence, runs deterministic checks, compares quotes against an RFQ and a bid price, and briefs the human on what they may have missed while they review the same material. Every step is logged in a SQLite ledger.","https:\u002F\u002Fgithub.com\u002FPlaetorius\u002Fengineering-harness\u002Fblob\u002Fmain\u002Fskills\u002Fsecond-reader\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":17},"01M7EE0TPNA6DJGNCD1BFRTNN6","second-reader-offline","The no-AI, no-network variant of second-reader for confidential client documents. Reads with local rules and OCR, checks and compares with code, and produces a self-contained HTML report on the user's own machine. The assistant must not read the documents or the report.","https:\u002F\u002Fgithub.com\u002FPlaetorius\u002Fengineering-harness\u002Fblob\u002Fmain\u002Fskills\u002Fsecond-reader-offline\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":17},"01M7EE0QDXBTY46Y0A53YBFV11","review","Review an engineering plan, diff, code or architecture from a general or selected professional perspective, challenging assumptions with evidence and no automatic implementation edits.","https:\u002F\u002Fgithub.com\u002FPlaetorius\u002Fengineering-harness\u002Fblob\u002Fmain\u002Fskills\u002Freview\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":17},"01M7EE0NFB4M0J33ZT16E57269","review-diff","Compatibility entry point for evidence-based diff review; establish the intended baseline and inspect consequential changes read-only.","https:\u002F\u002Fgithub.com\u002FPlaetorius\u002Fengineering-harness\u002Fblob\u002Fmain\u002Fskills\u002Freview-diff\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":17},"01M7EE0J9AQG23MYB6VCHPWAK8","plan-feature","Plan a new subsystem, cross-cutting feature, migration or explicitly requested design before implementation. Routine local edits can proceed directly.","https:\u002F\u002Fgithub.com\u002FPlaetorius\u002Fengineering-harness\u002Fblob\u002Fmain\u002Fskills\u002Fplan-feature\u002FSKILL.md",[],[]]