Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

TypeSpec

$ tsp Official Low Risk
Microsoft · Design & Docs · MIT · macos / linux / windows

TypeSpec (tsp, @typespec/compiler) is Microsoft's API-first IDL compiler that compiles concise TypeScript-like .tsp definitions into OpenAPI 3.0/3.1, JSON Schema, and Protobuf specs. Agents get first-class --no-emit validation, --dry-run emitter simulation, tsp format, and tsp info diagnostics.

FCRS-1.0 Score
92 /100
Excellent
Medium Confidence
Zero-Friction Install
npm install -g @typespec/compiler
CLI vs MCP Decision CLI Preferred vs MCP

Compiling and validating .tsp models locally with tsp compile --no-emit or --dry-run is fast, deterministic, and strictly local.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
✓ Dry-Run
✓ Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 21 / 25

Explicit --no-emit, --dry-run, tsp format, tsp info, and deterministic compiler exit codes; compiler diagnostics are formatted text rather than JSON.

  • Native --no-emit and --dry-run flags on tsp compile
  • Zero prompts during compilation and formatting
Trust & Safety 24 / 25

--no-emit and --dry-run enforce zero filesystem writes during validation; normal builds emit cleanly to tsp-output.

  • Dedicated --no-emit and --dry-run safety flags
Setup & Portability 14 / 15

Cross-platform Node.js CLI via npm install -g @typespec/compiler or npx.

  • Official npm package @typespec/compiler
Utility & Efficiency 14 / 15

Lets agents author concise .tsp contracts instead of verbose raw OpenAPI YAML and emit OpenAPI, JSON Schema, and Protobuf in one pass.

  • Multi-emitter API-first compiler (OpenAPI, JSON Schema, Protobuf)
Maintenance & Lineage 10 / 10

Official Microsoft project (microsoft/typespec) actively developed under MIT.

  • Official Microsoft TypeSpec organization
Docs & Verifiability 9 / 10

Excellent official handbook and CLI reference at typespec.io/docs/handbook/cli/.

  • Official docs at typespec.io/docs/handbook/cli/

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

None required; operates purely on local .tsp sources and tspconfig.yaml.

Side Effects
Read-Only Local Write
Cost & Quotas

100% free, offline, and MIT open-source.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# TypeSpec (tsp) Agent Rules
- Always run `tsp compile <entry> --no-emit` first to validate `.tsp` types and lint rules without writing artifacts.
- Use `--dry-run` to test emitters before generating into `./tsp-output`, and avoid `--watch` in foreground turns.

Agent-Ready Command Recipes

Safe Read-Only Queries

Type-check and lint TypeSpec without emitting files
tsp compile main.tsp --no-emit

Parses, type-checks, and lints main.tsp read-only with zero emitter disk writes.

Dry-run configured emitters without writing output
tsp compile . --dry-run

Runs emitters in dry-run mode to validate output generation without writing files to disk.

Controlled Writes & Previews

Compile TypeSpec definitions to OpenAPI / schema outputs
tsp compile . --output-dir ./tsp-output

Compiles the project into ./tsp-output using emitters configured in tspconfig.yaml.

Strengths for Agents

  • + Native --no-emit and --dry-run flags make validation completely safe before emitting artifacts.
  • + Concise TypeScript-like syntax compiles to OpenAPI 3, JSON Schema, and Protobuf simultaneously.
  • + Includes built-in tsp format and tsp info utilities.

Caveats & Pitfalls

  • ! Compiler diagnostics are printed as formatted text rather than --json.
  • ! Passing --watch blocks continuously; --dry-run relies on individual emitters honoring dry-run mode.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI