Skir is a declarative language for defining data types, constants, and APIs that generates idiomatic, type-safe code across multiple programming languages.
Skir is a declarative language for defining data types, constants, and APIs that aims to improve upon Protocol Buffers by generating idiomatic, type-safe code across multiple programming languages. The tool allows developers to write a schema once in a .skir file and generate code in TypeScript, Python, Java, C++, and more.
The core concept behind Skir is providing a single source of truth for data types. Developers define their data structures in Skir's declarative language, and the tool handles generating appropriate code for each target language. This approach eliminates the need to manually maintain type definitions across different parts of a system.
A key feature of Skir is its focus on type safety and idiomatic code generation. The generated code feels native to each language, making it easy for developers to work with. The workflow is designed to be simple - one YAML file and one command handle the entire code generation process. Skir also includes a watch mode that automatically recompiles when changes are detected.
Serialization is a critical aspect of Skir's design. The tool supports serialization to dense JSON for web APIs and databases, readable JSON for debugging, or binary format for raw performance. This flexibility allows developers to choose the most appropriate format for their specific use case.
One of Skir's standout features is its built-in package manager. Instead of copying files between projects, developers can import types directly from any GitHub repository. This enables sharing common data structures across projects and teams, reducing duplication and ensuring consistency.
The tool also provides first-class developer experience through a powerful VS Code extension. This extension includes real-time validation, code completion, and automatic code formatting, making the development process smoother and more efficient.
Skir supports RPCs (Remote Procedure Calls) with end-to-end type safety. Developers can define API methods in Skir and invoke them like local functions, similar to gRPC. This approach eliminates API contract mismatches between frontend and backend or across microservices, ensuring that client and server are always in sync.
The language includes built-in checks and guidelines for safely evolving schemas in long-lived or distributed systems. This feature addresses a common pain point in distributed systems where modifying schemas can be risky and potentially break clients or make it impossible to deserialize old data.
Skir's current supported languages include TypeScript, Python, C++, Java, Kotlin, and Dart. The tool is positioned as production-ready for these languages, with the goal of providing consistent development experience across different technology stacks.
For developers interested in trying Skir, the project offers a quick start option using npx skir init to set up a new project. The entire project configuration can be managed from a single YAML file, simplifying the setup process.
The project is actively developed and maintained, with documentation available on their website and the source code hosted on GitHub. Skir represents an evolution in schema definition languages, focusing on developer experience, type safety, and cross-language compatibility.
Comments
Please log in or register to join the discussion