Loading...
Loading...
ReactLynx best practices covering dual-thread architecture and React patterns. Provides rules reference for writing, static analysis for reviewing, and auto-fix for refactoring.
npx skill4agent add lynx-community/skills reactlynx-best-practices| Input | Required | Description |
|---|---|---|
| No | The ReactLynx source code to analyze (string or file path) |
| No | Workflow mode: |
mode| Context | Auto-Selected Mode |
|---|---|
| User is asking for best practices or guidelines | |
| User wants to check/analyze existing code for issues | |
| User wants to fix/refactor code with auto-fixes | |
rules/*.mdscripts/index.mjsrules/*.mdworkflow.reviewCode(sourceCode)ruleIdrules/<ruleId>.mdimpactimpactDescriptionnode -e "
import fs from 'fs';
import { ReactLynxWorkflow, formatScanReport } from '<path_to_skill>/scripts/index.mjs';
// <sourceCode>: string (source code) or file path
const input = '<sourceCode>';
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));
"fixableIssuesmanualIssuesappliedFixesTOOL CALL: AskUserQuestion(
question: "🔧 Found {fixableIssues} auto-fixable issues. Would you like me to apply these fixes?",
options: ["Yes, apply fixes", "No, show me the issues first", "Skip auto-fix"]
)node -e "
import fs from 'fs';
import { ReactLynxWorkflow, formatFixPlan } from '<path_to_skill>/scripts/index.mjs';
// <sourceCode>: string (source code) or file path
const input = '<sourceCode>';
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 && plan.fixableIssues > 0) {
console.log(formatFixPlan(plan));
// ASK USER: 'Would you like me to apply these auto-fixes?'
// If yes:
const { fixed, appliedFixes } = workflow.applyAutoFixes(sourceCode);
console.log('Fixed code:', fixed);
}
"rules/| Rule | Impact | Description |
|---|---|---|
| detect-background-only | CRITICAL | Native APIs in background contexts, use |
| proper-event-handlers | MEDIUM | Correct event handler usage |
| main-thread-scripts-guide | MEDIUM | Main thread scripts guide |
| hoist-static-jsx | LOW | Performance optimization |
TOOL CALL: Read(<path_to_skill>/scripts/index.d.ts)function runSkill(source: string): Diagnostic[];
function runSkillWithFixes(source: string): DiagnosticWithFix[];
function analyzeBackgroundOnlyUsage(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[] };
}type WorkflowMode = 'writing' | 'review' | 'refactor';
interface Diagnostic {
ruleId: string;
message: string;
severity: 'error' | 'warning' | 'info';
location: { start: { line: number; column: number }; end: { line: number; column: number } };
}
interface DiagnosticWithFix extends Diagnostic {
fixes?: Fix[];
}
interface Fix {
type: 'wrap-in-useEffect' | 'add-directive' | 'add-import' | 'move-to-event-handler';
description: string;
oldCode: string;
newCode: string;
location: { start: { line: number; column: number }; end: { line: number; column: number } };
}
interface ScanSummary {
totalFiles: number;
filesWithIssues: number;
totalIssues: number;
errorCount: number;
warningCount: number;
infoCount: number;
results: ScanResult[];
}
interface FixPlan {
totalIssues: number;
fixableIssues: number;
manualIssues: number;
files: FilePlan[];
}