skills/contract-typebox/SKILL.md
TypeBox schema patterns for API contracts and validation
npx skillsauth add MileniumTick/skills contract-typeboxInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
TypeBox provides compile-time type definitions that work at runtime for validation. All API schemas live in packages/shared/contracts.
import { Type, Static } from '@sinclair/typebox'
// Define schema
const UserSchema = Type.Object({
id: Type.String({ format: 'uuid' }),
email: Type.String({ format: 'email' }),
name: Type.String({ minLength: 1, maxLength: 100 }),
role: Type.Union([Type.Literal('admin'), Type.Literal('user')]),
createdAt: Type.String({ format: 'date-time' })
})
// Extract TypeScript type
type User = Static<typeof UserSchema>
import { Elysia, t } from 'elysia'
app.post('/users', ({ body }) => {
// body is typed as User
return createUser(body)
}, {
body: UserSchema
})
import { validate } from 'shared/contracts'
import { UserSchema } from 'shared/contracts/users'
const formData = { ... }
const [errors, data] = validate(UserSchema, formData)
if (errors) showErrors(errors)
const UpdateUserSchema = Type.Partial(UserSchema)
const AddressSchema = Type.Object({
street: Type.String(),
city: Type.String(),
country: Type.String()
})
const UserWithAddressSchema = Type.Object({
...UserSchema.properties,
address: AddressSchema
})
const UserListSchema = Type.Array(UserSchema)
const PaginationSchema = Type.Object({
page: Type.Integer({ minimum: 1, default: 1 }),
limit: Type.Integer({ minimum: 1, maximum: 100, default: 20 }),
sort: Type.Optional(Type.String())
})
packages/shared/src/
├── contracts/
│ ├── index.ts # Export all
│ ├── users.ts # User schemas
│ ├── auth.ts # Auth schemas
│ └── pagination.ts # Common patterns
└── index.ts # Re-export from contracts
error field for custom messagesversion field to schemas for API evolutionType.Transform for computed fieldsdevelopment
Writes, reviews, and debugs idiomatic Rust code with memory safety and zero-cost abstractions. Implements ownership patterns, manages lifetimes, designs trait hierarchies, builds async applications with tokio, and structures error handling with Result/Option. Use when building Rust applications, solving ownership or borrowing issues, designing trait-based APIs, implementing async/await concurrency, creating FFI bindings, or optimizing for performance and memory safety. Invoke for Rust, Cargo, ownership, borrowing, lifetimes, async Rust, tokio, zero-cost abstractions, memory safety, systems programming.
development
Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook. Use this skill when: (1) writing new Rust code or functions, (2) reviewing or refactoring existing Rust code, (3) deciding between borrowing vs cloning or ownership patterns, (4) implementing error handling with Result types, (5) optimizing Rust code for performance, (6) writing tests or documentation for Rust projects.
development
Master Rust async programming with Tokio, async traits, error handling, and concurrent patterns. Use when building async Rust applications, implementing concurrent systems, or debugging async code.
tools
When the user wants help with revenue operations, lead lifecycle management, or marketing-to-sales handoff processes. Also use when the user mentions 'RevOps,' 'revenue operations,' 'lead scoring,' 'lead routing,' 'MQL,' 'SQL,' 'pipeline stages,' 'deal desk,' 'CRM automation,' 'marketing-to-sales handoff,' 'data hygiene,' 'leads aren't getting to sales,' 'pipeline management,' 'lead qualification,' or 'when should marketing hand off to sales.' Use this for anything involving the systems and processes that connect marketing to revenue. For cold outreach emails, see cold-email. For email drip campaigns, see email-sequence. For pricing decisions, see pricing-strategy.