Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Deukpack?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/joygram-deukpack)
---
name: deukpack
description: One IDL to typed objects and serializers for TS, JS, Python, C#, C++, Rust. Binary, protobuf, Thrift.
---
# DeukPack
- Use when: a schema shared across languages, a compact binary wire, protobuf or Thrift bytes
- Use when: existing pydantic models read and written without JSON
- Use when: types or JSON data already exist and need a schema (`deukpack schema`)
- One IDL → objects + codecs per language. Formats: `dppack` `xpb` `xtbinary` `xtcompact` `dpjson` `dpcsv`
## Install
```bash
npm i -g deukpack # CLI: deukpack, and this skill is registered
deukpack --version
```
- Node.js 18 or later
- Generated code needs no DeukPack package: each output carries its own runtime
## Write the IDL
```deuk
namespace shop
enum Grade {
Bronze = 0
Silver = 1
}
struct Item {
1> required string name
2> optional int32 price
3> int32 count = 1
4> Grade grade = Grade.Silver
5> required list<string> tags
6> required map<string, Item> parts
}
```
- Field = `<id>> [required | optional] <type> <name> [= default]`
- `required` = must be set. `optional` = can be absent. Neither = implicit, the default stands for absent
- Scalars: `bool`, `sbyte`..`int64`, `byte`..`uint64`, `float`, `double`, `string`, `binary`
- Collections and references: `list<T>`, `set<T>`, `map<K, V>`, other records and enums
- Field ids are the wire identity: never reuse or renumber one
- Full grammar: `docs/public/IDL.md` in the repository
## Schema from what already exists
```bash
deukpack schema src/types.ts --out schema/app.deuk --namespace app # interface, type, enum
deukpack schema api.schema.json --out schema/api.deuk # JSON Schema
deukpack schema samples/*.json events.jsonl --out schema/events.deuk # JSON samples
deukpack schema app.models:Order --out schema/order.deuk --python .venv/bin/python # pydantic v2
```
- Several sources → one file; a name defined twice differently = error
- Read every `// infer:` line: integer widths, TS `number`, literal unions, renamed keys
- Then `deukpack gen`, and read real data back through `dpjson` to confirm
- Stops on what .deuk cannot hold (unions, mixed sample types): fix the source or split the field
- C#, C++, Rust, Java, Go and other code: no extractor. Write the .deuk yourself:
- one `struct` per class or struct, one `enum` per enum, fields in declaration order = ids 1..n
- nullable or `Option` = `optional`; collections carry no presence
- integer width as declared (`int` in C# = `int32`, `long` = `int64`)
- keep source field names when existing JSON uses them; dpjson keys = field names
- `deukpack gen` must pass; then compare one real object packed by old and new code
## Generate
```bash
deukpack gen shop.deuk --lang typescript,python,rust --out gen
```
- PowerShell: quote the list, `--lang "typescript,python"`
- Project config: `deukpack init --idl shop.deuk --lang python=gen/py`, then `deukpack gen`
- `--no-serializer` = objects only
## Use the codecs
| Language | Pack | Unpack |
|---|---|---|
| TypeScript, JavaScript | `ItemCodec.pack(item, 'dppack')` | `ItemCodec.unpack(bytes, 'dppack')` |
| Python | `ItemCodec.pack(item, 'dppack')` | `ItemCodec.unpack(data, 'dppack')` |
| C# | `ItemCodec.Pack(item, "dppack")` | `ItemCodec.Unpack(bytes, "dppack")` |
| C++ | `shop::DpPack(item, "dppack")` | `shop::DpUnpack(item, bytes, "dppack")` |
| Rust | `item.dp_pack("dppack")?` | `Item::dp_unpack(bytes, "dppack")?` |
- Files are named by namespace, not by IDL file: `namespace MyGame.Dto` → `my_game_dto`
- `<ns>.codec.*` codecs, `<ns>.*` objects. Python: `<ns>_codec.py`, `<ns>.py`
- C# namespace is PascalCase (`shop` → `Shop`)
- C++: compile `dp_serializer.cpp` and `<ns>.codec.cpp` with the app
- Rust: `mod dp_serializer; mod dp_model; mod dp_codec;` in the crate root
## Existing pydantic models
`deukpack.json`, when the app already has pydantic models of the same shape:
```json
{
"idl": "schema.deuk",
"languages": { "python": "gen/py" },
"python": { "models": ["app.models"], "native": true }
}
```
- `python.models`: codecs read and write those models; no object module is generated
- `python.scalarChoice`: records whose Python form is one `bool | int | float | str` value
- `python.native`: adds a pyo3 crate in `gen/py/native/`; build it with cargo where Python runs
- `"python": { "native": true }` with no `models`: only the crate is generated (module `dp_native_obj`); records are classes over the Rust records (`Point(x=1)`, `p.pack()`, `Point.unpack(data)`), no pydantic
## Pick a format
| Need | Format |
|---|---|
| Smallest and fastest between DeukPack apps | `dppack` |
| Bytes a protobuf reader understands | `xpb` |
| Bytes a Thrift reader understands | `xtbinary`, `xtcompact` |
| Readable text | `dpjson` |
| Spreadsheet rows | `dpcsv` |
## Rules that bite
- `xpb` only for records proto3 can express: no collection directly inside a collection
- `xpb` enums must have 0 as their first member
- `dpcsv` only for flat records
- Collections carry no presence: an empty `optional` list is not written and reads back empty
- An enum field without a default starts at the first member the enum declares
- Regenerate after every IDL change; never edit generated files