orpc-contract-first — agentic-ai orpc-contract-first, official, agentic-ai, ide skills, agentic-framework, agentic-workflow, gemini, low-code, nextjs, no-code, Claude Code

Verified
v1.0.0
GitHub

About this Skill

Ideal for Full Stack Agents requiring efficient API pattern implementation with oRPC contract-first development. Guide for implementing oRPC contract-first API patterns in Dify frontend. Trigger when creating or updating contracts in web/contract, wiring router composition, integrating TanStack Query with typed contracts, migrating legacy service calls to oRPC, or deciding whether to call queryOptions directly vs extracting a helper or use-* hook in web/service.

# Core Topics

langgenius langgenius
[131.2k]
[20437]
Updated: 3/5/2026

Agent Capability Analysis

The orpc-contract-first skill by langgenius is an open-source official AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance. Optimized for agentic-ai, agentic-framework, agentic-workflow.

Ideal Agent Persona

Ideal for Full Stack Agents requiring efficient API pattern implementation with oRPC contract-first development.

Core Value

Empowers agents to maintain a single source of truth in contracts using TypeScript, integrating TanStack Query for typed contracts and optimizing router composition with minimal abstractions, while deciding between direct queryOptions calls or extracting helper functions.

Capabilities Granted for orpc-contract-first

Implementing oRPC contract-first API patterns in frontend development
Migrating legacy service calls to oRPC for improved maintainability
Integrating TanStack Query with typed contracts for robust data fetching
Wiring router composition for efficient API routing

! Prerequisites & Limits

  • Requires TypeScript for inference and typing
  • Specific to oRPC contract-first development pattern
  • Needs integration with TanStack Query for full functionality
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

orpc-contract-first

Install orpc-contract-first, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

oRPC Contract-First Development

Intent

  • Keep contract as single source of truth in web/contract/*.
  • Default query usage: call-site useQuery(consoleQuery|marketplaceQuery.xxx.queryOptions(...)) when endpoint behavior maps 1:1 to the contract.
  • Keep abstractions minimal and preserve TypeScript inference.

Minimal Structure

text
1web/contract/ 2├── base.ts 3├── router.ts 4├── marketplace.ts 5└── console/ 6 ├── billing.ts 7 └── ...other domains 8web/service/client.ts

Core Workflow

  1. Define contract in web/contract/console/{domain}.ts or web/contract/marketplace.ts
    • Use base.route({...}).output(type<...>()) as baseline.
    • Add .input(type<...>()) only when request has params/query/body.
    • For GET without input, omit .input(...) (do not use .input(type<unknown>())).
  2. Register contract in web/contract/router.ts
    • Import directly from domain files and nest by API prefix.
  3. Consume from UI call sites via oRPC query utils.
typescript
1import { useQuery } from '@tanstack/react-query' 2import { consoleQuery } from '@/service/client' 3 4const invoiceQuery = useQuery(consoleQuery.billing.invoices.queryOptions({ 5 staleTime: 5 * 60 * 1000, 6 throwOnError: true, 7 select: invoice => invoice.url, 8}))

Query Usage Decision Rule

  1. Default: call site directly uses *.queryOptions(...).
  2. If 3+ call sites share the same extra options (for example retry: false), extract a small queryOptions helper, not a use-* passthrough hook.
  3. Create web/service/use-{domain}.ts only for orchestration:
    • Combine multiple queries/mutations.
    • Share domain-level derived state or invalidation helpers.
typescript
1const invoicesBaseQueryOptions = () => 2 consoleQuery.billing.invoices.queryOptions({ retry: false }) 3 4const invoiceQuery = useQuery({ 5 ...invoicesBaseQueryOptions(), 6 throwOnError: true, 7})

Mutation Usage Decision Rule

  1. Default: call mutation helpers from consoleQuery / marketplaceQuery, for example useMutation(consoleQuery.billing.bindPartnerStack.mutationOptions(...)).
  2. If mutation flow is heavily custom, use oRPC clients as mutationFn (for example consoleClient.xxx / marketplaceClient.xxx), instead of generic handwritten non-oRPC mutation logic.

Key API Guide (.key vs .queryKey vs .mutationKey)

  • .key(...):
    • Use for partial matching operations (recommended for invalidation/refetch/cancel patterns).
    • Example: queryClient.invalidateQueries({ queryKey: consoleQuery.billing.key() })
  • .queryKey(...):
    • Use for a specific query's full key (exact query identity / direct cache addressing).
  • .mutationKey(...):
    • Use for a specific mutation's full key.
    • Typical use cases: mutation defaults registration, mutation-status filtering (useIsMutating, queryClient.isMutating), or explicit devtools grouping.

Anti-Patterns

  • Do not wrap useQuery with options?: Partial<UseQueryOptions>.
  • Do not split local queryKey/queryFn when oRPC queryOptions already exists and fits the use case.
  • Do not create thin use-* passthrough hooks for a single endpoint.
  • Reason: these patterns can degrade inference (data may become unknown, especially around throwOnError/select) and add unnecessary indirection.

Contract Rules

  • Input structure: Always use { params, query?, body? } format
  • No-input GET: Omit .input(...); do not use .input(type<unknown>())
  • Path params: Use {paramName} in path, match in params object
  • Router nesting: Group by API prefix (e.g., /billing/* -> billing: {})
  • No barrel files: Import directly from specific files
  • Types: Import from @/types/, use type<T>() helper
  • Mutations: Prefer mutationOptions; use explicit mutationKey mainly for defaults/filtering/devtools

Type Export

typescript
1export type ConsoleInputs = InferContractRouterInputs<typeof consoleRouterContract>

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is orpc-contract-first?

Ideal for Full Stack Agents requiring efficient API pattern implementation with oRPC contract-first development. Guide for implementing oRPC contract-first API patterns in Dify frontend. Trigger when creating or updating contracts in web/contract, wiring router composition, integrating TanStack Query with typed contracts, migrating legacy service calls to oRPC, or deciding whether to call queryOptions directly vs extracting a helper or use-* hook in web/service.

How do I install orpc-contract-first?

Run the command: npx killer-skills add langgenius/dify/orpc-contract-first. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for orpc-contract-first?

Key use cases include: Implementing oRPC contract-first API patterns in frontend development, Migrating legacy service calls to oRPC for improved maintainability, Integrating TanStack Query with typed contracts for robust data fetching, Wiring router composition for efficient API routing.

Which IDEs are compatible with orpc-contract-first?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for orpc-contract-first?

Requires TypeScript for inference and typing. Specific to oRPC contract-first development pattern. Needs integration with TanStack Query for full functionality.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add langgenius/dify/orpc-contract-first. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use orpc-contract-first immediately in the current project.

Related Skills

Looking for an alternative to orpc-contract-first or another official skill for your workflow? Explore these related open-source skills.

View All

flags

Logo of facebook
facebook

Use when you need to check feature flag states, compare channels, or debug why a feature behaves differently across release channels.

243.6k
0
Developer

extract-errors

Logo of facebook
facebook

Use when adding new error messages to React, or seeing unknown error code warnings.

243.6k
0
Developer

fix

Logo of facebook
facebook

Use when you have lint errors, formatting issues, or before committing code to ensure it passes CI.

243.6k
0
Developer

flow

Logo of facebook
facebook

Use when you need to run Flow type checking, or when seeing Flow type errors in React code.

243.6k
0
Developer