CtrlK
BlogDocsLog inGet started
Tessl Logo

base/typescript-engineering

Use this skill whenever the user asks you to write, edit, review, refactor, debug, or design TypeScript or TSX code. It is especially relevant for application code, backend routes, React/UI work, schemas, runtime boundaries, persistence, async workflows, API contracts, tests, lint/typecheck fixes, and code review. Apply it even when the user does not explicitly mention "TypeScript" if the files or project are TypeScript-based.

89

1.26x
Quality

85%

Does it follow best practices?

Impact

95%

1.26x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-4/

Make Shipment Sync Reliable

Problem/Feature Description

Operations runs a TypeScript job that syncs shipment status from a carrier API into the local system. When the carrier is slow, the job can hang. When the carrier returns intermittent failures, the job either hides the problem or writes partial results in unpredictable order.

Refactor the job so it can be exercised reliably in tests and so failures are visible enough for operators to act on. Keep the behavior focused on shipment synchronization rather than rebuilding the whole app.

Output Specification

Produce a TypeScript project in the current directory. Include updated source files and focused tests for successful syncs, carrier timeouts, retryable failures, and non-retryable failures.

Input Files

The following files are provided as inputs. Extract them before beginning.

=============== FILE: AGENTS.md ===============

Project Instructions

  • Application modules use named exports.
  • Tests use Vitest.
  • Keep job code under src/jobs/.
  • Keep external integrations under src/integrations/.

=============== FILE: package.json =============== { "type": "module", "scripts": { "test": "vitest run", "typecheck": "tsc --noEmit" }, "devDependencies": { "@types/node": "^20.14.10", "typescript": "^5.5.3", "vitest": "^2.0.4" } }

=============== FILE: tsconfig.json =============== { "compilerOptions": { "target": "ES2022", "module": "NodeNext", "moduleResolution": "NodeNext", "strict": true, "exactOptionalPropertyTypes": true, "skipLibCheck": true }, "include": ["src/**/*.ts"] }

=============== FILE: src/jobs/syncShipments.ts =============== type Shipment = { id: string; carrierTrackingId: string; status?: string; };

let lastSyncedIds: string[] = [];

async function helper(trackingId: string) { return fetch("https://carrier.example/status/" + trackingId).then((response) => response.json()); }

async function saveStatus(id: string, status: string) { console.log("saved", id, status); }

export async function syncShipments(shipments: Shipment[]) { shipments.forEach(async (shipment) => { try { const carrierStatus = await helper(shipment.carrierTrackingId); if (carrierStatus.status) { await saveStatus(shipment.id, carrierStatus.status); lastSyncedIds.push(shipment.id); } } catch (error) { console.warn("ignored carrier failure"); } });

return lastSyncedIds; }

evals

SKILL.md

tile.json