abi-codegen

Convert JSON ABI files into typed TypeScript const exports.

3|2|Updated Jun 10, 2025
One-click install
npx skills add https://github.com/sablier-labs/sdk --skill abi-codegen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: abi-codegen
Source: https://github.com/sablier-labs/sdk/tree/main/.claude/skills/abi-codegen
Command: npx skills add https://github.com/sablier-labs/sdk --skill abi-codegen

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This skill streamlines the process of turning JSON ABIs into strongly typed TypeScript exports, enabling safer and faster contract integration within the Sablier SDK.

Core Features & Use Cases

  • Automatic ABI to TS conversion: Reads JSON ABI files and generates corresponding TypeScript constants with precise typing.
  • Consistent naming and typing: Uses camelCase export names with an Abi suffix and preserves the JSON data structure via as const.
  • Use Case: Add a new contract ABI under src/evm/abi/{protocol}/{version}, run the conversion script, and commit the generated TS in src/evm/releases/{protocol}/{version}/abi/.

Quick Start

bun .claude/skills/abi-codegen/scripts/codegen.ts src/evm/abi/lockup/v3.0/SablierLockup.json

Frequently Asked Questions about abi-codegen

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert JSON ABIs to typed TypeScript exports?

Formatting JSON ABIs to typed TypeScript exports involves reading JSON arrays and generating camelCase export names with an Abi suffix. The resulting TypeScript files use `as const` to preserve the original JSON data structure for type safety.

What's the best way to generate type-safe TypeScript from smart contract ABIs?

Generating type-safe TypeScript from smart contract ABIs is best handled by a conversion script that processes JSON ABI files and outputs TypeScript constants. It applies consistent naming conventions like camelCase exports with an Abi suffix and formats results using Biome.

Can I use Biome to format TypeScript files generated from ABIs?

Yes, you can use Biome to format TypeScript files generated from ABIs. The conversion process natively integrates Biome formatting to ensure the generated TypeScript const exports maintain consistent code style and structure after being written to the output directory.

Does codegen for ABIs preserve the original JSON data structure in TypeScript?

Codegen for ABIs preserves the original JSON data structure in TypeScript by utilizing the `as const` assertion. This ensures the generated TypeScript exports maintain exact literal types rather than widening to general types, enabling strict type safety for contract interactions.

How do I add a new contract ABI to an SDK project?

Adding a new contract ABI to an SDK project involves placing the JSON file under `src/evm/abi/{protocol}/{version}` and running a codegen script. The script generates the corresponding typed TypeScript file in `src/evm/releases/{protocol}/{version}/abi/`.