ns-typescript

Enforces TypeScript toolchain, compiler, and import conventions for ns-style pnpm projects.

2|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/nseng-ai/ns --skill ns-typescript-nseng-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ns-typescript
Source: https://github.com/nseng-ai/ns/tree/main/skills/internal/typescript/ns-typescript
Command: npx skills add https://github.com/nseng-ai/ns --skill ns-typescript-nseng-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? TypeScript projects with strict compiler settings and multi-package pnpm workspaces accumulate inconsistent import styles, misused optional properties, and ad-hoc toolchain commands. This Skill gives an agent the exact project overlay — tsconfig baseline, commands, and idioms — so edits and reviews follow the same contract every time. ## Core Features & Use Cases - Toolchain baseline: Standardizes pnpm 11, Node 24, Vitest 4, oxlint, oxfmt, and native TypeScript 7 commands, including the full validation gate sequence to run before declaring work done. - Compiler and type-shape guidance: Explains how to work under exactOptionalPropertyTypes, noUncheckedIndexedAccess, and erasableSyntaxOnly, including the conditional-spread idiom for omitting undefined optional properties and when to use foo?: T versus foo: T | undefined. - Import conventions: Enforces relative .ts imports within packages, curated workspace subpath exports across packages, and top-level import type for signature types. - Use Case: When reviewing a pull request that adds { env: undefined } to an options object, the agent rewrites construction with the conditional spread pattern instead of widening the field type. ## Quick Start Ask the agent to review or edit TypeScript code in this repository and apply the ns-typescript conventions before running the validation gates.

Frequently Asked Questions about ns-typescript

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

FAQPage Schema
How do I handle optional properties with exactOptionalPropertyTypes in TypeScript?

Use conditional object spread to omit the key entirely when the value is undefined, such as ...(value === undefined ? {} : { key: value }). Under exactOptionalPropertyTypes, assigning undefined explicitly is not equivalent to omitting the key.

What is the difference between foo?: T and foo: T | undefined in TypeScript?

foo?: T means omission is the state and a present key always holds a real T. foo: T | undefined means the key is part of the shape but its value may be unavailable. Choose based on whether consumers expect the key to exist.

Should I use # subpath imports or relative imports in a pnpm workspace?

This project uses relative .ts imports within a package and curated workspace subpath exports across packages. The # imports alternative is documented but deferred because the repo runs TypeScript source directly with noEmit, so migration would add churn without runtime benefit.

What validation commands should run before finishing TypeScript work?

Run the full gate sequence: just ts-deps-check, ts-format-check, ts-lint, ts-check, ts-test, ts-test-integration, ts-test-isolated, ts-test-sanity, and ts-test-typescript-style-guard. These cover dependencies, formatting, linting, typechecking, and all test lanes.

When should ExplicitUndefined be used instead of optional properties?

ExplicitUndefined<Reason, T> is reserved for permanent API, compatibility, or external contracts such as env maps, abort-signal seams, and schema mirrors. It is not a convenience escape hatch for ordinary object construction sites.