TypeSpec
$ tsp Official Low RiskTypeSpec (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.
npm install -g @typespec/compiler Compiling and validating .tsp models locally with tsp compile --no-emit or --dry-run is fast, deterministic, and strictly local.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Explicit --no-emit, --dry-run, tsp format, tsp info, and deterministic compiler exit codes; compiler diagnostics are formatted text rather than JSON.
- Native
--no-emitand--dry-runflags ontsp compile - Zero prompts during compilation and formatting
--no-emit and --dry-run enforce zero filesystem writes during validation; normal builds emit cleanly to tsp-output.
- Dedicated
--no-emitand--dry-runsafety flags
Cross-platform Node.js CLI via npm install -g @typespec/compiler or npx.
- Official npm package
@typespec/compiler
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)
Official Microsoft project (microsoft/typespec) actively developed under MIT.
- Official Microsoft TypeSpec organization
Excellent official handbook and CLI reference at typespec.io/docs/handbook/cli/.
- Official docs at typespec.io/docs/handbook/cli/
Security, Auth & Guardrails
None required; operates purely on local .tsp sources and tspconfig.yaml.
100% free, offline, and MIT open-source.
# 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
tsp compile main.tsp --no-emit
Parses, type-checks, and lints main.tsp read-only with zero emitter disk writes.
tsp compile . --dry-run
Runs emitters in dry-run mode to validate output generation without writing files to disk.
Controlled Writes & Previews
tsp compile . --output-dir ./tsp-output
Compiles the project into ./tsp-output using emitters configured in tspconfig.yaml.
Strengths for Agents
- + Native
--no-emitand--dry-runflags make validation completely safe before emitting artifacts. - + Concise TypeScript-like syntax compiles to OpenAPI 3, JSON Schema, and Protobuf simultaneously.
- + Includes built-in
tsp formatandtsp infoutilities.
Caveats & Pitfalls
- ! Compiler diagnostics are printed as formatted text rather than
--json. - ! Passing
--watchblocks continuously;--dry-runrelies on individual emitters honoring dry-run mode.