@teakit/sheet

Use this skill when writing code for @teakit/sheet.

A TypeScript toolkit for keyed business sheets (Record<string, readonly T[]>) — fixed period sheets, aggregation, rollup/rolldown, and transform/combine helpers. Not a linear-algebra library.

Core Rules

  1. Import with the canonical named import.
  2. Do not use default imports unless this package explicitly supports them.
  3. Use the canonical creation or entry API.
  4. Do not generate unsupported aliases, constructors, or compatibility APIs.
  5. Prefer exact inputs and explicit options when relevant.
  6. Read the relevant reference file before generating code.

Workflow

  1. Identify the operation or concept.
  2. Load only the relevant reference file from references/.
  3. Read examples, API Reference, Agent Contract, and Agent Notes.
  4. Generate code using only documented public APIs.
  5. For repository changes, run relevant verification commands.

Quick Example

import { Sheet } from "@teakit/sheet";

const forecast = Sheet.range("2024-Q2", "2025-Q1", { by: "quarter" }).fill(0);
const yearly = Sheet.rollup(forecast, { to: "year" }); // skips "-"; default sum

Reference Selection

Read the smallest reference that answers the current task.

NeedRead
Sheet shape, no-data, key order, immutabilitysheet
The four fixed period shapes & detectionperiod-shapes
Error type and codeserrors
Validate & clone unknown inputfrom
Check a value is a sheetisSheet
Assert a value is a sheetassertSheet
Build a fixed period sheetrange
Sum a sheetsum
Average a sheetmean
Median of a sheetmedian
Roll finer periods up to coarserrollup
Expand coarser periods down to finerrolldown
Map every cell into a new sheetmap
Fold a sheet to a single valuereduce
Flatten a sheet into entriesentries
Build from sparse entriesfromEntries
Copy a known sheetclone
Stabilize key set & row lengthnormalize
Turn rows into columnstranspose
Merge sheets with a resolvermerge
Pair sheets into tupleszip
Plain-object formtoObject
JSON-serializable formtoJSON