Toolverse
All skills

orpc-contract-first

by langgenius

Guide for implementing oRPC contract-first API patterns in Dify frontend. Triggers when creating new API contracts, adding service endpoints, integrating TanStack Query with typed contracts, or migrating legacy service calls to oRPC. Use for all API layer work in web/contract

Installation

Pick a client and clone the repository into its skills directory.

Installation

Quick info

Category
Frontend
Views
60

About this skill

Guide for implementing oRPC contract-first API patterns in Dify frontend. Triggers when creating new API contracts, adding service endpoints, integrating TanStack Query with typed contracts, or migrating legacy service calls to oRPC. Use for all API layer work in web/contract and web/service directories.

How to use

  1. Utwórz nowy plik kontraktu w katalogu web/contract/console/{domena}.ts. Zaimportuj base z ../base oraz type z @orpc/contract, następnie zdefiniuj trasę zawierającą path, method, input i output zgodnie ze schematem {params, query?, body?}.

  2. Zarejestruj kontrakt w pliku web/contract/router.ts, importując go bezpośrednio z pliku domeny (bez barrel files). Zagnieżdż trasę pod odpowiednim prefixem API — na przykład wszystkie trasy /billing/* powinny znaleźć się w obiekcie billing: {}.

  3. Utwórz hook w pliku web/service/use-{domena}.ts, który będzie korzystać z consoleQuery.{grupa}.{kontrakt}.queryKey() do generowania kluczy zapytań oraz consoleClient.{grupa}.{kontrakt}() do wykonywania wywołań API.

  4. Dla parametrów ścieżki użyj notacji {paramName} w polu path i dopasuj je w obiekcie params. Upewnij się, że struktura wejścia zawsze odpowiada formatowi {params, query?, body?}.

  5. Importuj typy z @/types/ i używaj helpera type() do definiowania typów. Wyeksportuj typ ConsoleInputs z routera, aby zapewnić pełną typizację w całej aplikacji.

  6. Jeśli migrujesz stare wywołania serwisów, zastąp je nowymi hookami oRPC i upewnij się, że wszystkie trasy są zagnieżdżone w routerze zgodnie z prefixami API.

Related skills

mermaid-gen

by vladm3105

Generate syntactically correct Mermaid diagrams for technical documentation

Frontend
23124

react

by lobehub

React component development guide. Use when working with React components (.tsx files), creating UI, using @lobehub/ui components, implementing routing, or building frontend features. Triggers on React component creation, modification, layout implementation, or navigation tasks.

Frontend
2058

browser-automation

by browserbase

Automate web browser interactions using natural language via CLI commands. Use when the user asks to browse websites, navigate web pages, extract data from websites, take screenshots, fill forms, click buttons, or interact with web applications. Triggers include \

Frontend
21175

google-official-seo-guide

by littleben

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

Frontend
101196

senior-fullstack

by davila7

Comprehensive fullstack development skill for building complete web applications with React, Next.js, Node.js, GraphQL, and PostgreSQL. Includes project scaffolding, code quality analysis, architecture patterns, and complete tech stack guidance. Use when building new projects,

Frontend
2896

landing-page-guide-v2

by bear2u

Create distinctive, high-converting landing pages that combine proven conversion elements with exceptional design quality. Build beautiful, memorable landing pages using Next.js 14+ and ShadCN UI that avoid generic AI aesthetics while following the 11 essential elements

Frontend
3486