v1.0Like Protocol Buffer, but better

The single source of truth
for your data types

Skir is a declarative language for defining data types, constants, and APIs. Write your schema once in a .skir file and generate idiomatic, type-safe code in TypeScript, Python, Java, C++, and more.

Quick Start
npx skir init
Skir Quick Example showing VS Code editing and code generation

Code generation done right

One YAML file. One command. Watch mode recompiles automatically.
The generated code feels native to each language and is easy to use.
The workflow is dead simple.

.skir
// shapes.skir

struct Point {
  x: int32;
  y: int32;
  label: string;
}

struct Shape {
  points: [Point];
  /// A short string describing this shape.
  label: string;
}

const TOP_RIGHT_CORNER: Point = {
  x = 600,
  y = 400,
  label = "top-right corner",
};
// Import the module generated by Skir
import { Point } from "../skirout/shapes";

// Construct a frozen (immutable) Point
const point = Point.create({
  x: 3,
  y: 4,
  label: "P"
});

// Serialize to dense JSON: compact and allows schema evolution
const pointJson = Point.serializer.toJson(point);
console.log(pointJson);  // [3, 4, "P"]

// Deserialize from JSON
const restored = Point.serializer.fromJson(pointJson);
console.log(restored.label);  // "P"

Serialize now, deserialize in 100 years

Modifying schemas in a long-lived or distributed system is riskyβ€”one wrong move can break clients or make it impossible to deserialize old data.
Skir has simple guidelines and built-in checks to evolve your schema safely.

Schema Evolution showing breaking change detection

RPCs with end-to-end type safety

Define your RPC methods in Skir and invoke them like local functions a la gRPC. No more API contract mismatches between your frontend and backend or across microservices. Client and server are always in sync.

.skir
struct WhatToWearRequest {
  temperature_celsius: float32;
  raining: bool;
}

struct WhatToWearResponse {
  bottom_outfit: string;
  sunglasses: bool;
}

method WhatToWear(WhatToWearRequest):
    WhatToWearResponse  = 770862;
import { ServiceClient } from "skir-client";
import { WhatToWear, WhatToWearRequest, WhatToWearResponse }
    from "../skirout/outfit_picker";

const client = new ServiceClient("http://localhost:8080/api");

const response: WhatToWearResponse = await client.invokeRemote(
  WhatToWear,
  WhatToWearRequest.create({
    temperatureCelsius: 25,
    raining: false,
  }),
);

if (response.sunglasses) {
  console.log("Don't forget your sunglasses 😎");
}

More features

Serialization to JSON or binary

Choose between dense JSON for web APIs and databases, readable JSON for debugging, or binary for raw performance.

Built-in package manager

Stop copying files. Import types directly from any GitHub repository. Share common data structures across projects.

Developer experience delight

A powerful VS Code extension with all the features you need. Real-time validation, go to definition, automatic code formatting.

Supported languages

Generate production-ready code for all major programming languages.

Ready to get started?

Set up your first Skir project in minutes. Manage your entire project configuration from a single YAML file.