You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnvalues.length>0 ? (values.reduce((acc,curr)=>acc+curr,0)/values.length)+'ms' : 'could not collect';
27
+
}
28
+
25
29
constserver=newMcpServer({
26
30
name: 'React',
27
31
version: '0.0.0',
@@ -286,7 +290,6 @@ server.tool(
286
290
server.tool(
287
291
'review-react-runtime',
288
292
`Run this tool every time you propose a performance related change to verify if your suggestion actually improves performance.
289
-
290
293
<requirements>
291
294
This tool has some requirements on the code input:
292
295
- The react code that is passed into this tool MUST contain an App functional component without arrow function.
@@ -307,12 +310,12 @@ server.tool(
307
310
308
311
<iterate>
309
312
(repeat until every metric is good or two consecutive cycles show no gain)
310
-
- Always run the tool once on the original code before any modification
311
-
- Run the tool again after making the modification, and apply one focused change based on the failing metric plus React-specific guidance:
313
+
- Apply one focused change based on the failing metric plus React-specific guidance:
312
314
- LCP: lazy-load off-screen images, inline critical CSS, preconnect, use React.lazy + Suspense for below-the-fold modules. if the user requests for it, use React Server Components for static content (Server Components).
- CLS: reserve space via explicit width/height or aspect-ratio, keep stable list keys, use fixed-size skeleton loaders, animate only transform/opacity, avoid inserting ads or banners without placeholders.
315
-
- Compare the results of your modified code compared to the original to verify that your changes have improved performance.
317
+
318
+
Stop when every metric is classified as good. Return the final metric table and the list of applied changes.
0 commit comments