Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Solana development skill covering @solana/kit v5, Anchor programs, LiteSVM testing, and security patterns.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/idl-codegen.md
1---2title: IDL & Client Code Generation3description: Generate type-safe program clients from IDLs using Codama, eliminating hand-maintained serializers across languages.4---56# IDLs + client generation (Codama / Shank / Kinobi)78## Goal9Never hand-maintain multiple program clients by manually re-implementing serializers.10Prefer an IDL-driven, code-generated workflow.1112## Codama (preferred)13- Use Codama as the "single program description format" to generate:14- TypeScript clients (including Kit-friendly output)15- Rust clients (when available/needed)16- documentation artifacts1718## Anchor → Codama19If the program is Anchor:201) Produce Anchor IDL from the build212) Convert Anchor IDL to Codama nodes (nodes-from-anchor)223) Render a Kit-native TypeScript client (codama renderers)2324## Native Rust → Shank → Codama25If the program is native:261) Use Shank macros to extract a Shank IDL from annotated Rust272) Convert Shank IDL to Codama283) Generate clients via Codama renderers2930## Repository structure recommendation31- `programs/<name>/` (program source)32- `idl/<name>.json` (Anchor/Shank IDL)33- `codama/<name>.json` (Codama IDL)34- `clients/ts/<name>/` (generated TS client)35- `clients/rust/<name>/` (generated Rust client)3637## Generation guardrails38- Codegen outputs should be checked into git if:39- you need deterministic builds40- you want users to consume the client without running codegen41- Otherwise, keep codegen in CI and publish artifacts.4243## "Do not do this"44- Do not write IDLs by hand unless you have no alternative.45- Do not hand-write Borsh layouts for programs you own; use the IDL/codegen pipeline.46