用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/redpanda-data/console --skill react-best-practices命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Connect Query patterns for API calls. Use when working with mutations, queries, or data fetching.
TypeScript, React, and JavaScript best practices enforced by Ultracite/Biome.
Write and run Playwright E2E tests for Redpanda Console using testcontainers. Analyzes test failures, adds missing testids, and improves test stability. Use when user requests E2E tests, Playwright tests, integration tests, test failures, missing testids, or mentions 'test workflow', 'browser testing', 'end-to-end', or 'testcontainers'.
基于 SOC 职业分类
| name | react-best-practices |
| description | Client-side React performance optimization patterns. |
Client-side React optimization patterns for Cloud UI. 29 rules organized by category and impact.
| Rule | Key Point |
|---|---|
bundle-barrel-imports | Import from source files, not barrel index.ts |
bundle-code-splitting | React.lazy + Suspense for heavy components, conditional loads, deferred 3rd-party |
bundle-preload | Preload critical resources |
| Rule | Key Point |
|---|---|
rerender-memo | Memoize expensive computations |
rerender-dependencies | Minimize hook dependency arrays |
rerender-derived-state | Compute during render, not in effects |
rerender-functional-setstate | setState(prev => ...) to avoid stale closures |
rerender-lazy-state-init | useState(() => expensive()) not useState(expensive()) |
rerender-simple-expression-in-memo | Don't memoize trivial expressions |
rerender-transitions | useTransition for non-urgent updates |
rerender-defer-reads | Read URL params / storage inside callbacks, not at render |
| Rule | Key Point |
|---|---|
rendering-conditional-render | Short-circuit with && / ternary, avoid render in effects |
rendering-hoist-jsx | Move static JSX outside components |
rendering-content-visibility | CSS content-visibility: auto for off-screen |
rendering-activity | React <Activity> for hidden UI |
rendering-animate-svg-wrapper | Wrap animated SVGs to isolate re-renders |
rendering-svg-precision | Limit SVG coordinate precision |
| Rule | Key Point |
|---|---|
async-suspense-boundaries | Granular <Suspense> boundaries |
async-defer-await | Don't await non-blocking work |
async-dependencies | Load deps in parallel, not sequentially |
| Rule | Key Point |
|---|---|
js-caching-patterns | Module-level Map caches for repeated calls + storage reads |
js-batch-dom-css | Batch DOM reads/writes to avoid layout thrashing |
js-index-maps | Pre-index arrays into Maps for O(1) lookups |
js-length-check-first | Check .length before expensive operations |
js-tosorted-immutable | Use .toSorted() / .toReversed() for immutable transforms |
RegExp hoisting is enforced by Biome (useTopLevelRegex).
| Rule | Key Point |
|---|---|
client-event-listeners | Clean up event listeners in useEffect return |
client-passive-event-listeners | { passive: true } for scroll/touch handlers |
| Rule | Key Point |
|---|---|
advanced-event-handler-refs | Stable callback refs to avoid child re-renders |
advanced-use-latest | useLatest pattern for always-current values in callbacks |