conventions

Enforce Valibot schema-first typing for runtime-validated TypeScript boundaries.

1|Updated Jul 22, 2025
One-click install
npx skills add https://github.com/niconiahi/ethernauta --skill conventions-niconiahi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: conventions
Source: https://github.com/niconiahi/ethernauta/tree/main/skills/conventions
Command: npx skills add https://github.com/niconiahi/ethernauta --skill conventions-niconiahi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents type drift by requiring that every value-bearing boundary be defined with a Valibot schema first, then typed via InferOutput, ensuring the runtime contract and compile-time contract always agree.

Core Features & Use Cases

  • Schema-first typing for all parameters, returns, wire formats, storage records, and cross-context messages.
  • Consistent naming rules (Schema lowerCamelCase + Schema suffix; derived types PascalCase without suffix) to make the codebase predictable.
  • Eliminates unsafe patterns by forbidding hand-written interfaces/types, bypassing casts, and swallowing parse errors.

Quick Start

Ask the AI to follow the monorepo rule by defining a Valibot schema for any new boundary value, deriving the TypeScript type from it, and parsing the value at function entry before using it.

Frequently Asked Questions about conventions

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

FAQPage Schema
How do I enforce schema-first typing in a TypeScript monorepo?

Schema-first typing is enforced by declaring Valibot schemas for every runtime-validated boundary and deriving TypeScript types via v.InferOutput. This ensures the runtime contract and compile-time contract always agree without hand-written interfaces.

How do I type JSON-RPC envelopes and Chrome runtime messaging safely?

Type JSON-RPC envelopes and Chrome runtime messaging by defining Valibot schemas for each payload structure, then parsing the values at function entry before use. This guarantees accurate TypeScript types for cross-context messages.

What's the best way to prevent type drift in TypeScript monorepos?

Prevent type drift by requiring every value-bearing boundary—function inputs, outputs, storage records, and window postMessage payloads—to be defined with a Valibot schema first, then typed via InferOutput to eliminate unsafe casting.

Do I need Valibot to enforce schema-first typing in a TypeScript monorepo?

Yes, Valibot is required to enforce schema-first typing in this workflow. You must declare Valibot schemas with parse at boundaries and derive types via v.InferOutput, forbidding hand-written interfaces and bypassing casts.

Why does my TypeScript type not match my runtime JSON-RPC payload?

Your TypeScript type may not match your runtime JSON-RPC payload because hand-written interfaces lack runtime validation. Defining a Valibot schema first and deriving the type via InferOutput ensures both contracts agree.

Can I use hand-written interfaces for storage records in a schema-first monorepo?

No, hand-written interfaces for storage records are forbidden in a schema-first monorepo. You must declare Valibot schemas with parse at boundaries and derive types via v.InferOutput to ensure runtime and compile-time contracts match.