typespec
Skill1 starsChanged 31 days agoMITView on GitHub
TypeSpec 1.x: design APIs in the TypeSpec language and emit OpenAPI 3.0, 3.1 or 3.2 with the @typespec/openapi3 emitter. Use when writing or reviewing .tsp files or tspconfig.yaml, modeling REST APIs with @typespec/http (@route, @get, @post, @path, @query, @header, @body, @bodyRoot, @statusCode, @error, @useAuth with OAuth2, API key, bearer or OpenID Connect), choosing the openapi-versions emitter option, setting operationId, tags, extensions or external docs with @typespec/openapi, versioning an API with @versioned, @added, @removed, @renamedFrom and @madeOptional, converting an existing OpenAPI 3 file to TypeSpec with tsp-openapi3, or running tsp compile, tsp init and tsp format. Triggers: TypeSpec, tsp, main.tsp, tspconfig.yaml, @typespec/compiler, @typespec/http, @typespec/openapi3, @typespec/versioning, design-first API, API-first, OpenAPI generation.
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 43
Model the data: Use models, scalars, enums, unions, templates and doc comments.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TypeSpec
TypeSpec is a language and toolset, developed by Microsoft, for defining data models and service APIs and generating artifacts such as OpenAPI from them. With this skill the agent writes TypeSpec for HTTP APIs, configures the OpenAPI 3 emitter, versions the API, and checks the emitted OpenAPI.
Follow the workflow below step by step. Every rule here comes from a source in Sources. TypeSpec documentation has no numbered sections, so rules cite the documentation page and heading (for example "HTTP Operations, Implicit body resolution"). When a rule and the pinned source disagree, the source wins; when the packages have moved past the pin, follow the refresh steps.
Inputs (fill in, or ask before starting)
- Role: API designer (writes TypeSpec), emitter user (configures output), or reviewer.
- Target OpenAPI version or versions:
3.0.0,3.1.0or3.2.0. The emitter's default is3.0.0only. - Whether the API is versioned, and the list of versions.
- Revision: compiler, http, openapi and openapi3 at 1.16.0, and versioning at 0.86.0, unless the project pins others. Use the project's
package.jsonversions when they differ. - Sources: when refreshing this skill or when a rule looks out of date, re-read every URL in Sources, check npm for newer
@typespec/*releases, read the changelogs since the pin, and update the pins.
Invariants
- Declaration names are unique within a scope, even across kinds: a model and a namespace cannot share a name (Language basics, Declarations).
- The service is a namespace marked
@service, with@serverfor each endpoint; libraries are brought in withimportandusing(Getting started, Defining a REST Service). - Without
@body, everything not marked@header,@queryor@pathis the request body, and every response property not marked@headeror@statusCodeis the response body (HTTP Operations, Implicit body resolution). @bodydefines the body exactly;@bodyRootallows metadata properties inside it (HTTP Operations,@bodyvs@bodyRoot).- A response marked
@erroris the error response:4xx,5xxby default, emitted as the OpenAPIdefaultresponse (HTTP Operations, Status codes; OpenAPI v3 emitter, Error Responses). @useAuthon a child replaces the parent's schemes; a tuple means all of them, a union means one of them (HTTP Authentication, Application hierarchy).- Set
openapi-versionsexplicitly. It accepts3.0.0,3.1.0and3.2.0and defaults to["3.0.0"](openapi3 emitter options). - Versioned TypeSpec describes the current state of the API; versioning decorators record the version where each change happened and the previous value (Versioning guide).
- Unions emit
anyOfunless the named union has@oneOf, andextendsemitsallOfwhile spread andiscopy properties (OpenAPI v3 emitter, Model Composition). tsp initwith an external template URL can run untrusted packages; use only templates you trust (CLI usage).
Workflow
- Set up the project. Node.js 22 or later,
@typespec/compiler, amain.tsp, and atspconfig.yamlthat emits@typespec/openapi3. ->references/project.md✓tsp compile .succeeds and writes totsp-output/. - Model the data. Use models, scalars, enums, unions, templates and doc comments.
->
references/language.md✓ Invariant 1 holds, and every public type has a doc comment. - Describe the HTTP surface. Routes, verbs, parameters, bodies, status codes, errors and authentication.
->
references/http.md✓ Invariants 3 to 6 hold, and every operation returns its error type in a union. - Configure the OpenAPI emitter. Choose
openapi-versions, the output file,operation-id-strategyand other options, and add@typespec/openapidecorators where needed. ->references/openapi3-emitter.md✓ Invariant 7 holds, and features that exist only in 3.2 are not expected in 3.0 output. - Version the API (only when it is versioned). Add
@versioned, the versions enum, and change decorators. ->references/versioning.md✓ Invariant 8 holds, and one OpenAPI file is emitted per version. - Check the output. Compile with warnings as errors, then validate each emitted file against the official OpenAPI JSON Schema for its version.
->
references/openapi3-emitter.md✓ No warnings, and every emitted file validates.
Verify before done
tsp compile . --warn-as-errorexits with code zero (Configuration,warn-as-error).tsp formatleaves the.tspfiles unchanged (CLI usage).- Each emitted OpenAPI file validates against the official OAS JSON Schema for its
openapiversion; theopenapiskill lists the schemas. - Every versioned output (
openapi.v1.yaml,openapi.v2.yaml, ...) reflects the right shape for that version (Versioning guide). - Operation IDs are stable and unique; set
@operationIdwhere the default would change on refactoring (OpenAPI v3 emitter, Operation ID). - Authentication appears as
securitySchemesand security requirements in the output (OpenAPI v3 emitter, Security Definitions).
Reference index
references/project.md: installation,tspconfig.yaml, thetspCLI and linting. Load for steps 1 and 6.references/language.md: language basics with examples. Load for step 2.references/http.md:@typespec/httpdecorators, body and status code rules, files, visibility and authentication. Load for step 3.references/openapi3-emitter.md: emitter options, OpenAPI version support, the TypeSpec to OpenAPI mapping,@typespec/openapidecorators andtsp-openapi3. Load for steps 4 and 6.references/versioning.md:@typespec/versioningdecorators and patterns. Load for step 5.
Related skills
openapifor the OpenAPI documents TypeSpec emits, their versions and validation:npx skills add ScaleDockHQ/scaledock-skills --skill openapi.openapi-overlayfor changes to emitted OpenAPI that should stay outside the TypeSpec source:npx skills add ScaleDockHQ/scaledock-skills --skill openapi-overlay.
Sources
Status uses the publishing body's own maturity term. Checked is the date the source was last read.
- TypeSpec documentation: Living documentation for the latest release, as published, checked 2026-10-02.
- Language basics overview: Living documentation, as published, checked 2026-10-02.
- Getting started with TypeSpec for REST APIs: Living documentation, as published, checked 2026-10-02.
- CLI usage: Living documentation, as published, checked 2026-10-02.
- Configuration: Living documentation, as published, checked 2026-10-02.
- HTTP Operations: Living documentation, as published, checked 2026-10-02.
- HTTP Authentication: Living documentation, as published, checked 2026-10-02.
- HTTP decorators reference: Living documentation, as published, checked 2026-10-02.
- @typespec/http 1.16.0 auth.tsp: Released, 1.16.0 (2026-09-09), checked 2026-10-02.
- OpenAPI v3 emitter guide: Living documentation, as published, checked 2026-10-02.
- @typespec/openapi3 emitter options: Living documentation, as published, checked 2026-10-02.
- @typespec/openapi3 1.16.0 README: Released, 1.16.0 (2026-09-09), checked 2026-10-02.
- @typespec/openapi3 1.16.0 package.json: Released, 1.16.0 (2026-09-09), checked 2026-10-02.
- @typespec/openapi3 1.16.0 emitter options schema: Released, 1.16.0 (2026-09-09), checked 2026-10-02.
- @typespec/openapi3 1.16.0 emitter source: Released, 1.16.0 (2026-09-09), checked 2026-10-02.
- @typespec/openapi3 changelog: Changelog, commit 843c089 (2026-10-02), entries through 1.16.0, checked 2026-10-02.
- @typespec/compiler changelog: Changelog, commit 843c089 (2026-10-02), entries through 1.16.0, checked 2026-10-02.
- OpenAPI3 to TypeSpec: Living documentation, as published, checked 2026-10-02.
- @typespec/openapi decorators: Living documentation, as published, checked 2026-10-02.
- Versioning guide: Living documentation, as published, checked 2026-10-02.
- Versioning decorators reference: Living documentation, as published, checked 2026-10-02.
- @typespec/versioning 0.86.0 package: Released, 0.86.0 (2026-09-09), pre-1.0, draft posture: build, checked 2026-10-02.
In this repository40 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- find-skillsSkill
- a2aSkill
- ag-uiSkill
- ap2Skill
- asyncapiSkill
- authzenSkill
- cedarSkill
- cloudeventsSkill
- eu-ai-actSkill
- fapiSkill
- gnapSkill
- jwtSkill
- mcp-authorizationSkill
- oauthSkill
- ocsfSkill
- openapi-arazzoSkill
- openapi-overlaySkill
- openapiSkill
- openfeatureSkill
- openid4vcSkill
- openid-connectSkill
- openid-federationSkill
- openidSkill
- opentelemetry-genaiSkill
- owasp-agenticSkill
- problem-detailsSkill
- ratelimit-headersSkill
- scaledock-agent-permissionsSkill
- scaledock-enterprise-identitySkill
- scaledock-http-apiSkill
- scaledock-mcp-serverSkill
- scaledock-repo-standardSkill
- scimSkill
- shared-signalsSkill
- spiffeSkill
- standard-schemaSkill
- web-bot-authSkill
- webmcpSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

