Reference
Primitives
For your agentCopy this and give it to the AI you're building with.
Run `cubek skill`, read all of it and follow it exactly (no CLI: download https://cubek.dev/SKILL.md verbatim with curl; don't summarize it); when you use tasks, storage, secrets or outbound fetch, follow its "Primitives" section. Run `cubek check` after every edit until it is clean.
kv.get<T>(k),set(k, v, { ttl: "10m" }),incr(k, by?, { ttl: "1m" })(ttl from creation),delete(k).task.on("name", async (p: { id: string }) => {...}),task.run("name", { id }, { delay: "5m", retries: 3 }),task.schedule("name", "0 8 * * *")(cron, UTC); tasks may run twice: be idempotent.storage.put(key, bytesOrString, { contentType }),get(key)→Bytes | null,delete,list(prefix), signedurl(key)/uploadUrl(key, { maxSize }).realtime.publish("room:1", event); private: a browser listens withrealtime.token("room:1")from the page (public:*: no token, frontend.md).fetch(url, { method, headers, body, timeout: "5s" })(≤ 10 s) →res.status,res.json<T>(),res.text(); public addresses only (http.md).secrets.get("NAME")→string | null;log.info/warn/error(msg, data?),console.log.- Email: POST to a provider's API with
fetch+secrets.get("EMAIL_API_KEY")from a task (tasks.md). validate.string/number/boolean/literal/enum/array/object/record,.optional() .nullable();.parsethrows,.safeParse→{ success, data | error };Infer<typeof v>.crypto.randomUUID(),randomInt(max),hmac(crypto.md);encoding.base64/hex.encode/decode;markdown.render(s)→SafeHtml,markdown.html(s)→ string (feeds);csv.parse(text, { header: true });fmt.date(iso, { format: "date", timeZone? }),fmt.number(n, { decimals: 2 }),fmt.currency(n, "EUR").- Time zones (IANA, DST):
time.toLocal(iso, "Europe/Madrid")→{ year, month, day, hour, minute, weekday, ... },time.fromLocal({ year, month, day, hour }, zone)→ UTC ISO,time.format,time.isZone(time.md).