reactlynx-best-practices
БесплатноЗапускает вложенные скриптыНе проверенReviews, writes, and refactors ReactLynx code and component libraries for Lynx dual-thread best practices. Applies when writing ReactLynx components, or…
от lynx-community★ 28 звёзд на GitHubОб этом скилле
ReactLynx Best Practices
Use this skill when writing, reviewing, or refactoring ReactLynx code. ReactLynx follows the React programming model, but Lynx's dual-thread runtime changes how side effects, lifecycle timing, event handlers, and main-thread scripts should be reasoned about.
This skill intentionally does not require @ast-grep/napi or any native parser at runtime. The bundled scanner is a lightweight heuristic helper for common issues. The agent must still read the code and apply the rule documents in rules/*.md.
When to Apply
- Writing new ReactLynx components or application code.
- Publishing or reviewing reusable ReactLynx component libraries.
- Reviewing ReactLynx code for thread-boundary, lifecycle, event, lynx.__globalProps, code-splitting, or performance issues.
- Refactoring code that calls
lynx.getJSModule,NativeModules,runOnMainThread,runOnBackground,lazy,Suspense, oruseLayoutEffect. - Investigating performance traces that include ReactLynx render, diff, commit, patch, or setState events.
Official References
- Thinking in ReactLynx: https://lynxjs.org/next/react/thinking-in-reactlynx.html
- Rendering Process and Lifecycle: https://lynxjs.org/next/react/lifecycle.html
- Main Thread Script: https://lynxjs.org/next/react/main-thread-script.html
- Code Splitting: https://lynxjs.org/next/react/code-splitting.html
- Performance Profiling: https://lynxjs.org/next/react/performance/profiling
- lynx.__globalProps: https://lynxjs.org/next/api/lynx-api/lynx/lynx-global-props.html
- globalPropsMode: https://lynxjs.org/next/zh/api/rspeedy/react-rsbuild-plugin.pluginreactlynxoptions.globalpropsmode.html
- Rslib React and preserved JSX: https://rslib.rs/guide/solution/react
- TypeScript JSX emit modes: https://www.typescriptlang.org/docs/handbook/jsx
- ReactLynx 0.121.0
React.createElementsupport: https://github.com/lynx-family/lynx-stack/blob/main/packages/react/CHANGELOG.md#01210
Workflow
1. Classify the task
Use one of these modes:
| Mode | Use when |
|---|---|
writing |
The user asks for new ReactLynx code or best-practice guidance |
review |
The user asks to check, audit, explain, or validate existing code |
refactor |
The user asks to fix or rewrite existing code |
If the mode is not explicit, infer it from the user's wording. Prefer review before refactor when code has not been inspected yet.
2. Inspect the code
For repository work, search before editing:
rg "lynx.getJSModule|NativeModules|useLayoutEffect|main-thread:|runOnMainThread|runOnBackground|lazy\\(|Suspense|background only|globalPropsMode|__globalProps|jsx|exports" <target>
Read nearby components, custom hooks, custom components that forward event handlers, Rspeedy config, and performance-related code before making changes.
3. Run the helper scanner when source is available
The scanner catches common background-only and lifecycle issues. It is not a complete parser and must not replace code review.
node -e "
import fs from 'fs';
import { ReactLynxWorkflow, formatScanReport } from '<path_to_skill>/scripts/index.mjs';
const input = '<sourceCodeOrFilePath>';
const sourceCode = fs.existsSync(input) ? fs.readFileSync(input, 'utf-8') : input;
const workflow = new ReactLynxWorkflow('review');
const summary = workflow.reviewCode(sourceCode);
console.log(formatScanReport(summary));
"
4. Apply the rule checklist
Always combine scanner output with these manual checks:
- Dual-thread boundaries: render code may run on the main thread; side effects and native APIs must be background-only.
- Background-only propagation: code called only from background-only code is background-only, but custom prop and custom hook boundaries often need an explicit
'background only'directive. - Lifecycle:
useLayoutEffectis unsupported; useuseEffectfor background side effects or main-thread layout events/refs for layout reads. - Events: normal
bind*/catch*handlers run on the background thread;main-thread:*handlers require'main thread'and have stricter limitations. - MTS: captured values must be JSON-serializable, captured variables cannot be modified, nested main-thread functions are unsupported, and cross-thread calls must use
runOnMainThread()orrunOnBackground(). - Shared modules: import helpers with
with { runtime: 'shared' }only for code sharing, not state sharing. - Component libraries: publish type-erased
distESM with authored JSX preserved in JSX-bearing.jsxfiles and matching declarations; export the actual.jsor.jsxentry that the build emits. Expose TS/TSX source only through an explicit source field or supported condition. Check Rslib, TypeScript, Babel, and SWC output for classic, automatic, or custom-factory JSX lowering. Treat intentionalReact.createElementaccording to the@lynx-js/reactpeer range instead of assuming every call is incompatible. lynx.__globalProps: Host-injected cros
Установить reactlynx-best-practices в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл reactlynx-best-practices?
Reviews, writes, and refactors ReactLynx code and component libraries for Lynx dual-thread best practices. Applies when writing ReactLynx components, or handling background-only, useLayoutEffect, bindtap/catchtap, main-thread:*, runOnMainThread/runOnBackground, lazy/Suspense, globalPropsMode/__globalProps, component-library publishing (preserved JSX vs React.createElement), or render/diff/commit performance traces. Excludes vanilla Lynx Element PAPI without ReactLynx JSX (use vanilla-lynx), running-app debugging via DevTool/CDP (use lynx-devtool), or Rspeedy/tsconfig config (use lynx-typescript).
Как установить скилл reactlynx-best-practices?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл reactlynx-best-practices запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic