remediate_component
Optimizes React components by hoisting static code, memoizing unstable props with useCallback/useMemo, and applying React.memo when ROI exceeds 1.5. Edits the component file directly.
Instructions
Automatically optimizes a React component's AST by hoisting static declarations, wrapping unstable callbacks/objects in useCallback/useMemo, and wrapping the component in React.memo if the ROI score is above 1.5. Mutates the file on disk.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file_path": "<file_path>",
"component_name": "<component_name>",
"unstable_props": "<unstable_props>",
"roi_score": "<roi_score>"
},
"name": "remediate_component"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Absolute path to the React component file on disk | |
| roi_score | Yes | Estimated ROI score from profiling (usually 0 to 5) justifying memoization overhead | |
| component_name | Yes | Name of the React component to optimize | |
| unstable_props | Yes | Comma-separated or space-separated list of props to memoize/wrap in hooks |