CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/svelte-best-practices

Svelte 5 runes, component patterns, reactivity, and SvelteKit data loading best practices

99

1.11x
Quality

99%

Does it follow best practices?

Impact

99%

1.11x

Average score across 10 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-1/

Shopping Cart State Manager

Problem/Feature Description

A small e-commerce startup is building a product browsing page with a shopping cart sidebar. The engineering team needs a reusable Svelte 5 component that manages cart state: items can be added, removed, or have their quantities updated. The component must display a running total, the count of unique items, and flag when the cart exceeds a configurable maximum item count.

The team recently migrated their codebase from Svelte 4 and wants the new component written entirely using Svelte 5 conventions. The component will consume a static list of available products passed in from the outside, and expose a callback so the parent can react when the user checks out.

A large product catalog (the full inventory JSON, potentially thousands of entries) is sometimes passed in for search/filter purposes, but it is always replaced as a whole rather than mutated item-by-item.

Output Specification

Produce a single file: CartManager.svelte

The component should:

  • Accept a list of available products and a max-items limit as inputs from the parent
  • Accept a checkout callback so the parent is notified when the user clicks "Checkout"
  • Maintain reactive cart state (items and quantities)
  • Expose computed summaries: total price, unique item count, and whether the cart is over the limit
  • Provide add/remove/update-quantity actions
  • Render a minimal UI showing the cart contents, totals, and a Checkout button

Also produce a notes.md file briefly explaining the reactivity approach and which rune was chosen for each piece of state and why.

evals

scenario-1

criteria.json

task.md

tile.json