Proactively choose the right state management pattern: derived state, URL state, server state, local state, lifted state, Context, or external store. Always apply without being asked.
84
76%
Does it follow best practices?
Impact
97%
1.16xAverage score across 5 eval scenarios
Passed
No known issues
{
"context": "Tests whether the agent proactively applies correct state management patterns when building an e-commerce app with cart, search, and product data. The task describes only business requirements -- the agent must choose the right state pattern for each concern without being told.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Cart state at appropriate shared level",
"description": "Cart state is managed in React Context with a custom hook (useCart) since it is accessed from many distant components (header, product pages, cart page, cart drawer). The cart is NOT in useState of a single component, and NOT in an external store (overkill for low-frequency cart updates).",
"max_score": 16
},
{
"name": "Cart derived values computed not stored",
"description": "Subtotal, tax, grand total, and item count are computed inline or with useMemo from the cart items array, NOT stored in separate useState variables. There is no useEffect that watches cart items and sets derived totals.",
"max_score": 16
},
{
"name": "Product search and filters in URL",
"description": "Product search query and category filter on the catalog page use URL search params (useSearchParams or equivalent), NOT useState. Users can share a filtered catalog URL or refresh without losing filters.",
"max_score": 16
},
{
"name": "Product data fetched in custom hook not Context",
"description": "Product listing and product detail data are fetched in custom hooks (useProducts, useProduct) or a data-fetching library, NOT stored in React Context or a global store.",
"max_score": 14
},
{
"name": "Optimistic cart update",
"description": "When adding to cart triggers the POST /api/cart call, the cart UI updates immediately (optimistically) without waiting for the server response, with rollback on failure.",
"max_score": 12
},
{
"name": "Context custom hook with null guard",
"description": "The cart Context is wrapped in a custom hook (useCart) that checks for null and throws a descriptive error if used outside the CartProvider.",
"max_score": 10
},
{
"name": "Local UI state colocated",
"description": "Component-local UI state (cart drawer open/close, quantity picker, product image gallery) uses useState in the owning component, NOT in Context or a global store.",
"max_score": 8
},
{
"name": "Fetch cleanup with AbortController",
"description": "Data-fetching useEffect hooks include AbortController or cancelled flag in cleanup to prevent stale responses.",
"max_score": 8
}
]
}