/lynx:reactlynx-best-practicesfrom lynx
Reviews, writes, and refactors ReactLynx components and libraries for Lynx dual-thread best practices. Covers lifecycle, events, thread-boundary, performance traces, and component library publishing.
Ships in lynx. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
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.
lynx.getJSModule, NativeModules, runOnMainThread, runOnBackground, lazy, Suspense, or useLayoutEffect.React.createElement support: https://github.com/lynx-family/lynx-stack/blob/main/packages/react/CHANGELOG.md#01210Use 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.
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.
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));
"
Always combine scanner output with these manual checks:
'background only' directive.useLayoutEffect is unsupported; use useEffect for background side effects or main-thread layout events/refs for layout reads.bind*/catch* handlers run on the background thread; main-thread:* handlers require 'main thread' and have stricter limitations.runOnMainThread() or runOnBackground().with { runtime: 'shared' } only for code sharing, not state sharing.dist ESM with authored JSX preserved in JSX-bearing .jsx files and matching declarations; export the actual .js or .jsx entry 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 intentional React.createElement according to the @lynx-js/react peer range instead of assuming every call is incompatible.lynx.__globalProps: Host-injected cross-page/global data updated through updateGlobalProps.globalPropsMode: 'reactive' triggers root forceUpdate; 'event' requires explicit updates with useGlobalPropsChanged. When migrating to 'event', scan direct lynx.__globalProps reads because root forceUpdate no longer applies.Suspense, CSS scope awareness, and error handling for important boundaries.displayName values to identify hot render/diff/update paths before optimizing.For refactor mode:
Use auto-fixes only as suggestions. The current auto-fixes are designed for detect-background-only diagnostics and should be reviewed before applying.
node -e "
import fs from 'fs';
import { ReactLynxWorkflow, formatFixPlan } 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('refactor');
workflow.reviewCode(sourceCode);
const plan = workflow.generateFixPlan();
if (plan) {
console.log(formatFixPlan(plan));
}
"
| Rule | Impact | Use for |
|---|---|---|
| detect-background-only | CRITICAL | lynx.getJSModule, NativeModules, 'background only', custom event/hook boundaries |
| avoid-use-layout-effect | MEDIUM | Lifecycle and layout reads |
| proper-event-handlers | MEDIUM | bindtap, catchtap, propagation, dataset, custom prop handlers |
| main-thread-scripts-guide | MEDIUM | main-thread:*, useMainThreadRef, cross-thread calls, shared modules |
| component-library-packaging | HIGH | ReactLynx component-library exports, type-erased ESM, preserved JSX, Rslib, tsc |
| global-props-mode | MEDIUM | globalPropsMode config, direct lynx.__globalProps reads, useGlobalPropsChanged migration |
| code-splitting | MEDIUM | lazy, Suspense, standalone lazy bundles, CSS bundle scope |
| performance-profiling | MEDIUM | ReactLynx trace events, flow IDs, displayName |
| hoist-static-jsx | LOW | Static JSX and render cost |
function runSkill(source: string): Diagnostic[];
function runSkillWithFixes(source: string): DiagnosticWithFix[];
function analyzeBackgroundOnlyUsage(source: string): Diagnostic[];
function analyzeLifecycleUsage(source: string): Diagnostic[];
function generateFixes(source: string, diagnostic: Diagnostic): Fix[];
function applyFix(source: string, fix: Fix): string;
function applyFixes(source: string, fixes: Fix[]): string;
function formatScanReport(summary: ScanSummary): string;
function formatFixPlan(plan: FixPlan): string;
class ReactLynxWorkflow {
constructor(mode: WorkflowMode);
reviewCode(source: string): ScanSummary;
generateFixPlan(): FixPlan | null;
applyAutoFixes(source: string): { fixed: string; appliedFixes: Fix[] };
}
rules/avoid-use-layout-effect.md (opens in a new tab)rules/code-splitting.md (opens in a new tab)rules/component-library-packaging.md (opens in a new tab)rules/detect-background-only.md (opens in a new tab)rules/global-props-mode.md (opens in a new tab)rules/hoist-static-jsx.md (opens in a new tab)rules/main-thread-scripts-guide.md (opens in a new tab)rules/performance-profiling.md (opens in a new tab)rules/proper-event-handlers.md (opens in a new tab)scripts/index.d.ts (opens in a new tab)scripts/index.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub lynx-community/skills --plugin lynx15 skills in this plugin
/agent-lynxagent-lynx is Lynx for your agent, providing a CLI and a set of sub-skills for your Lynx tasks: lynx-devtool: Android/iOS/Desktop DevTool/CDP/App/connector debugging, DOM/CSS/ReactLynx, UI snapshots/ref actions, annotated screenshots, sources, runtime/console logs and reload/open; lynx-trace-record/lynx-trace-analysis: performance trace capture/export/validation & analysis; lynx-recorder/lynx-recorder-fixture: Recorder/Testbench capture/replay diagnosis & fixture editing; lynx-tasm-codec: native TASM (template.js) encode/decode/compare;/lynx-api-docsAuthoritative Lynx engine references for generating, reviewing, migrating, or debugging Lynx TSX/TTML pages, CSS, layouts, selectors, and elements. Use for Lynx-specific styling and Web-to-Lynx differences; always retrieve the relevant installed docs before changing code./lynx-check-css-supportQuery @lynx-js/css-defines compat_data to check Lynx CSS property and nested feature/value support by rendering backend and Lynx version, or check whether a newer dataset version exists. Use when asked whether CSS is supported in Lynx or ReactLynx, which backends support it, when support was added, whether a style change is compatible, whether the bundled data is current, or when inspecting the raw definition JSON./lynx-debug-info-remappingRemap the function_id:pc_index to the original source code position by provided debug info json file./lynx-devtoolDebug live Lynx apps, pages, and devices with the agent-lynx CLI or Node.js connector. Use for client/session discovery, UI snapshots and @eN ref actions, annotated screenshots, DOM/CSS or ReactLynx inspection, JS evaluation, console logs, and CDP/App commands on Android, iOS, or Desktop./lynx-recorderRecord Lynx page interactions into a TestBench replay file using agent-lynx. Use when asked to start or stop a recording, capture page interactions for replay, or troubleshoot recording capture. For inspecting or editing an existing fixture, use lynx-recorder-fixture.2 plugins in one repository ship this exact skill · first indexed Aug 20, 2026
Other plugins' skills for the same job