2.13.0-beta.20). Features may change before the next stable release.Switch to stable →Skills
Improve React performance with ak:react-best-practices
Audit and refine React or Next.js code with version-aware rules, measured baselines, focused tests, and an explicit mutation boundary.
Use ak:react-best-practices to review or improve React and Next.js
performance. Its bundled January 2026 rule set contains 45 patterns across
async waterfalls, bundle size, server work, client fetching, re-renders,
rendering, JavaScript hot paths, and advanced callback patterns.
Choose ak:react-best-practices for measured optimization
Use ak:react-best-practices when
- A React component, Next.js route, server function, or bundle has a defined performance problem or budget.
- You want a focused performance audit with ranked findings before mutation.
- You need to remove waterfalls, reduce shipped code, narrow re-renders, or improve a measured hot path.
- You want implementation guidance tied to the project’s actual React, Next.js, browser, and deployment versions.
Choose another workflow when
- You need general React feature implementation rather than performance work.
Use
ak:frontend-development. - The visual or interaction design is unresolved. Use
ak:frontend-design. - You are diagnosing an unexplained failure. Use
ak:debugorak:fixbefore optimizing. - You only want independent verification of an existing patch. Use
ak:code-revieworak:test.
Prepare a baseline and compatibility map
Before you start:
- Complete Onboarding, and confirm Engineer Kit is installed for the current runtime and scope.
- Read the installed React, Next.js, bundler, server runtime, browser target, package manager, data library, and deployment model from the project.
- Provide the affected route/component, user-visible symptom, performance budget, representative workload, and current measurements.
- Identify generated files, server/client boundaries, caching semantics, CSP, hydration policy, analytics, and test requirements.
- State whether dependency installation, config changes, bundle analysis, browser profiling, local servers, remote telemetry, or deployment is allowed.
| Priority | Rule area | Apply when evidence shows |
|---|---|---|
| Critical | Async waterfalls and bundle size | Avoidable serial latency or unnecessary initial code |
| High | Server performance | Duplicate work, oversized RSC payloads, or server-side fetch serialization |
| Medium-high | Client data fetching | Repeated requests or duplicated global subscriptions |
| Medium | Re-renders and rendering | Excess computation, layout work, hydration issues, or jank |
| Low-medium | JavaScript hot paths | Profiling shows repeated lookup, allocation, storage, or iteration cost |
| Low | Advanced callback patterns | Stable subscriptions are needed and the framework supports the pattern |
| Runtime | Invocation | Availability boundary |
|---|---|---|
| Claude Code | /ak:react-best-practices ... | Can inspect and edit with available project/browser tools; measurements depend on the session. |
| Cursor | /ak:react-best-practices ... | Uses the user-verified slash spelling; broader Agent, Hook, browser, and profiling parity is not established. |
| Codex | $ak:react-best-practices ... | Uses native Skill discovery; projected Hooks are partial and browser/profiling tools depend on the session. |
See Runtime adapters for component-level differences.
Run the Skill
The declared argument shape is [component or pattern]. Ask for an audit-only
pass when you do not want code changes; otherwise state the allowed files and
required measurements.
/ak:react-best-practices "Audit the existing Next.js product route for server waterfalls and client bundle cost. Use the installed versions and current profiler/build output, propose ranked changes first, implement only the top approved change, preserve behavior, add focused tests, and do not install packages or deploy."/ak:react-best-practices "Audit the existing Next.js product route for server waterfalls and client bundle cost. Use the installed versions and current profiler/build output, propose ranked changes first, implement only the top approved change, preserve behavior, add focused tests, and do not install packages or deploy."$ak:react-best-practices "Audit the existing Next.js product route for server waterfalls and client bundle cost. Use the installed versions and current profiler/build output, propose ranked changes first, implement only the top approved change, preserve behavior, add focused tests, and do not install packages or deploy."| Input | Include |
|---|---|
| Outcome | Which user interaction, route, render, request, or build should improve |
| Baseline | Timing, bundle, request waterfall, render count, memory, CPU, Web Vital, or profiler evidence |
| Compatibility | React/Next.js versions, server host, browser range, CSP, caching, and data libraries |
| Mutation boundary | Audit only or allowed components, config, imports, dependencies, generated files, and deployment |
| Acceptance | Behavioral tests plus the measurement and regression threshold that defines success |
Observe an evidence-led optimization
- The run establishes the baseline. It reproduces the target workload and records the current performance and behavior before editing.
- The run maps compatibility. It checks whether referenced APIs such as
Activity,useEffectEvent, Next.jsafter,next/dynamic,optimizePackageImports, Reactcache, ortoSortedexist in the project’s supported versions. - The run ranks findings by impact and confidence. Critical network and bundle issues come before speculative micro-optimizations.
- The run implements a bounded change. It preserves data dependencies, error behavior, accessibility, hydration, cache invalidation, and server or client ownership.
- The run verifies behavior and performance. Focused tests and the same baseline procedure run again; regressions or inconclusive measurements stay visible.
- The run reports the evidence. Changed files, rule applied, before/after results, dependencies, environment limits, and rejected or deferred findings are listed.
Keep optimization side effects explicit
A faster example can change behavior
Parallelizing work, moving code across server/client boundaries, adding caches, deferring side effects, or injecting pre-hydration scripts can change ordering, freshness, error handling, CSP, privacy, and recovery behavior. Approve the semantic change, not only the expected speedup.
- Use
Promise.allonly for independent operations. Preserve dependency and failure semantics. - Cross-request in-memory caches behave differently on long-lived servers, serverless isolates, and multi-instance deployments. Define keys, TTL, invalidation, tenant isolation, and fallback behavior.
- Direct imports, dynamic imports, SWR, LRU caches, or partial-dependency helpers may require compatible packages and configuration. Do not install them merely to match a reference example.
- Inline hydration scripts must comply with CSP, escaping, privacy, and the project’s server-rendering contract.
- Bundle analysis, profiling, builds, and browser runs can consume substantial CPU, memory, storage, ports, and time. Remote telemetry can send project or user data.
- Commit, publication, rollout, and deployment remain separate approvals.
Verify the result
A complete result should provide:
- The baseline method and result, affected user path, environment, and dataset.
- Ranked findings with rule identity, evidence, compatibility, expected impact, confidence, and behavior risk.
- Exact changed files, imports, config, dependencies, generated output, and server/client boundary changes.
- Focused typecheck and behavioral test results plus comparable before/after performance evidence.
- Cache, hydration, error, accessibility, and fallback behavior where the change touches them.
- An explicit disposition for inconclusive measurements and deferred findings.
Troubleshoot or continue
| Symptom | Safe next step |
|---|---|
| A referenced API does not exist | Preserve the installed versions and use a supported equivalent, or propose a separate upgrade with its own migration evidence. |
| The benchmark is noisy | Fix the dataset, build mode, device, network, cache state, and number of runs before drawing a conclusion. |
| Parallel work changes errors or ordering | Restore the dependency boundary, add failure tests, and parallelize only operations proven independent. |
| A cache returns stale or cross-user data | Disable the cache, inspect keys and lifetime, add tenant/freshness tests, and reintroduce it only with an explicit invalidation contract. |
| Bundle size improves but UX regresses | Re-check loading, prefetch, error, offline, and interaction behavior; keep the user outcome above a single bundle metric. |
| The runtime does not recognize the Skill | Confirm target and scope, restart the session, then follow Runtime cannot find a Skill or Agent. |
Continue with ak:frontend-development for implementation,
ak:web-testing for browser evidence, or the
Engineer Kit overview for coordinated delivery.
Know the current limits
- The Skill is a static January 2026 guideline set, not a live React, Next.js, browser, package, or host compatibility database.
- Impact labels and example metrics prioritize investigation; they do not prove the same gain in your application.
- The shipped Skill contains rule documents, not a project-specific profiler, benchmark suite, visual-regression harness, or deployment monitor.
- It does not replace correctness, accessibility, security, privacy, cross-browser, or production load testing.
- Stable and beta contain identical Skill content and resources for this release pair. Beta Codex Hook diagnostics do not change this workflow.
Build Shopify apps and themes with ak:shopify
Implement a Shopify app, extension, Function, or theme while keeping API versions, store credentials, remote mutations, and publication explicit.
Build TanStack Start, Form, or AI features with ak:tanstack
Implement a version-aware TanStack feature while protecting generated routes, provider credentials, server boundaries, tests, and deployment targets.