CtrlK
BlogDocsLog inGet started
Tessl Logo

simon/skills

Auto-generated tile from GitHub (10 skills)

92

1.16x
Quality

94%

Does it follow best practices?

Impact

92%

1.16x

Average score across 44 eval scenarios

SecuritybySnyk

Advisory

Suggest reviewing before use

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-21/

Product Catalog Caching Service

Problem / Feature Description

An e-commerce platform's product detail pages fetch live inventory and pricing from an upstream catalog API managed by a third-party logistics partner. The API is slow (average 300 ms per call) and rate-limited to 50 concurrent connections. During a recent flash sale, every page view triggered a fresh upstream call, resulting in thousands of simultaneous requests, a cascade of rate-limit errors, and a two-hour outage.

The backend team has been asked to build a TypeScript caching module that sits between the platform's product service and the upstream catalog API. The module must deduplicate concurrent requests for the same product (if ten users request product abc-123 at the same time, only one upstream call should go out), cache results with a configurable TTL, and enforce a hard cap on simultaneous upstream connections so the rate limit cannot be breached again.

The module should load its configuration (cache TTL, max concurrent connections, upstream base URL) from environment variables and fail fast with a clear error message if required variables are missing or invalid.

Write the module in TypeScript and run it directly under Node.js 22+ without a separate compilation step.

Output Specification

Deliver the following files:

  • src/catalog-cache.ts — the caching module (or split across multiple files if you prefer)
  • src/config.ts — environment configuration loading and validation
  • src/demo.ts — a short runnable script that demonstrates the module working: simulate several concurrent fetches for the same product and show that only one upstream call is made; then simulate a batch fetch across many products with the concurrency cap enforced
  • package.json — with a start script that runs src/demo.ts using node
  • README.md — documents the environment variables and how to run the demo

The demo does not need a real upstream API; use a simulated fetch function with an artificial delay (e.g., setTimeout) that logs when it is called so the deduplication and concurrency limiting are observable in the output.

evals

README.md

tile.json