ts-core

Author Native SDK app cores in the TypeScript subset compiled to native code.

7.6k|312|Updated May 8, 2026
One-click install
npx skills add https://github.com/vercel-labs/zero-native --skill ts-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ts-core
Source: https://github.com/vercel-labs/zero-native/tree/main/skill-data/ts-core
Command: npx skills add https://github.com/vercel-labs/zero-native --skill ts-core

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing Native SDK application logic requires following a closed TypeScript subset that compiles ahead-of-time to native code, and violating its purity, determinism, or shape rules produces build errors that are hard to resolve without guidance.

Core Features & Use Cases

  • App Core Authoring: Guides writing Model, Msg, update, and pure helper functions in src/core.ts that pass the @native-sdk/core subset checker and compile to native code.
  • Subset Error Resolution: Explains every teaching diagnostic (NS1001-NS1069) covering banned ecosystem APIs, purity violations, fixed-shape rules, byte-text handling, and local mutation ownership.
  • Effects and Wiring: Covers Cmd effects, Sub subscriptions, host-event channels (frameMsg, keyMsg, pinchMsg, dropMsg), derived values, and splitting cores into modules under src/.
  • Use Case: When building a Native SDK app like a soundboard or notes manager, use this guide to write the deterministic core logic, fix checker errors, and wire effects such as audio playback and timers.

Quick Start

Ask the assistant to write or fix a src/core.ts app core for a Native SDK app following the TypeScript subset rules.

Frequently Asked Questions about ts-core

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write app logic for a Native SDK app in TypeScript?

Write a src/core.ts module exporting a Model interface, a Msg discriminated union, an initialModel function, and one pure update function. The @native-sdk/core frontend checks the subset and the core compiler compiles it to native code.

What TypeScript features are banned in the Native SDK core subset?

Banned features include npm imports, async/Promises, regexes, generators, eval, mutation of shared data, module-level let, Map/Set, typeof/instanceof checks, string concatenation, and class inheritance. Each violation produces a named teaching diagnostic with the fix.

Can I mutate arrays in a Native SDK TypeScript core?

Yes, arrays your function creates locally can be mutated with push, pop, splice, sort, and indexed writes until they escape by being returned, stored, or aliased. Parameters, model data, and module constants are never mutable.

How do effects and timers work in a Native SDK core?

Effects are returned as Cmd data alongside the model from update or initialModel, and recurring timers come from an exported subscriptions function returning Sub values. The runtime interprets commands after the model commits and dispatches results back as Msgs.

When should I use Zig instead of the TypeScript core path?

Use the TypeScript core path for new apps unless the user explicitly chose Zig. A tree containing both src/core.ts and src/main.zig is a teaching error, since the build detects the core path from the file tree.