orpc-next-js-adapter
- Repo stars 0
- Author updated Live
- Author repo skills-registry
- Domain
- Engineering
- Compatible agents
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- Trust score
- 88 / 100 · community maintained
- Author / version / license
- @tomevault-io · no license declared
- Token usage
- Lean
- Setup complexity
- Plug-and-play
- External API key
- Not required
- Operating systems
- macOS · Linux · Windows
- Runtime requirements
- Node.js
- Permissions
-
- Read-only
- Write / modify
- Network behavior
- External requests
- Install commands
- 26 variants
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: orpc-next-js-adapter
description: Use oRPC inside a Next.js project (App Router and Pages Router). Use when this capability is nee…
category: engineering
runtime: Node.js
---
# orpc-next-js-adapter output preview
## PART A: Task fit
- Use case: Use oRPC inside a Next.js project (App Router and Pages Router). Use when this capability is needed. Next.js integration. Works with App Router and Pages Router. // app/rpc/[[...rest]]/route.ts makes outbound network calls; runs on Node.js. Works with Claude Code, Cursor, Cline and 23 more..
- Inputs: target material, constraints, expected output, and acceptance criteria.
- Evidence boundary: follow “Server / Pages Router Support / Client” and do not present inference as author intent.
## PART B: Execution result
- **01** The card summarizes the use case; runtime output centers on “Use oRPC inside a Next.js project (App Router and Pages Router). Use when this capability is needed. Next.js integration. Works with App Router and Pages Router. // app/rpc/[[...rest]]/route.ts makes outbound network calls; runs on Node.js. Works with Claude Code, Cursor, Cline and 23 more.”.
- **02** When the source has headings, the agent prioritizes “Server / Pages Router Support / Client” so the result follows the author’s structure.
- **03** Typical output includes task judgment, concrete steps, required commands or file edits, validation, and follow-up options.
- **04** Risk context follows the fingerprint: read files, write/modify files; may access external network resources; usually needs no extra API key.
## Running Rules
- read files, write/modify files; may access external network resources; usually needs no extra API key.
- Validate with a small sample before expanding scope.
- Return the result, validation criteria, and next iteration options. The source does not require a stable slash command. After installation, invoke the skill by name and describe the task.
Name target files or source material, expected output, forbidden changes, and whether network or shell access is allowed. Permission fingerprint: read files, write/modify files.
Start with a small task and check whether the result follows “Server / Pages Router Support / Client”. Inspect diffs, logs, previews, or tests before expanding scope.
Confirm the final output includes a concrete result, evidence, and next action. If it stays generic, tighten inputs, boundaries, and acceptance criteria.
---
name: orpc-next-js-adapter
description: Use oRPC inside a Next.js project (App Router and Pages Router). Use when this capability is nee…
category: engineering
source: tomevault-io/skills-registry
---
# orpc-next-js-adapter
## When to use
- Use oRPC inside a Next.js project (App Router and Pages Router). Use when this capability is needed. Next.js integrati…
- Use it when the task has clear inputs, repeatable steps, and validation criteria.
## What to provide
- Target material, scope, expected result, and forbidden changes.
- Whether network, commands, file writes, or external services are allowed.
## Execution rules
- Organize steps around “Server / Pages Router Support / Client” and keep inference separate from source facts.
- read files, write/modify files; may access external network resources; usually needs no extra API key.
- Validate with a small sample before expanding the task.
## Output requirements
- Return the deliverable, key evidence, validation method, and next action.
- Mark missing information as unknown; do not invent commands, platforms, or dependencies. The author source anchors workflow facts; repository files anchor sources and commands; Fluxly only adds fit, limitations, and quality judgment.
skill "orpc-next-js-adapter" {
input -> user goal + target files + boundaries + acceptance criteria
context -> Server / Pages Router Support / Client
rules -> SKILL.md triggers / order / output contract
runtime -> Node.js | read files, write/modify files | may access external network resources
guardrails -> usually needs no extra API key + small-sample validation + diff/log review
output -> copyable result + checklist + next iteration
} Next.js Adapter
Next.js integration. Works with App Router and Pages Router.
oRPC also supports Server Action out of the box.
Server
// app/rpc/[[...rest]]/route.ts
import { RPCHandler } from '@orpc/server/fetch'
import { onError } from '@orpc/server'
const handler = new RPCHandler(router, {
interceptors: [onError(e => console.error(e))],
})
async function handleRequest(request: Request) {
const { response } = await handler.handle(request, {
prefix: '/rpc',
context: {},
})
return response ?? new Response('Not found', { status: 404 })
}
export const HEAD = handleRequest
export const GET = handleRequest
export const POST = handleRequest
export const PUT = handleRequest
export const PATCH = handleRequest
export const DELETE = handleRequest
Pages Router Support
// pages/api/rpc/[[...rest]].ts
import { RPCHandler } from '@orpc/server/node'
const handler = new RPCHandler(router)
export const config = {
api: { bodyParser: false },
}
export default async (req, res) => {
const { matched } = await handler.handle(req, res, {
prefix: '/api/rpc',
context: {},
})
if (matched) return
res.statusCode = 404
res.end('Not found')
}
Disable the body parser to fully utilize oRPC features like Bracket Notation.
Client
// lib/orpc.ts
import { RPCLink } from '@orpc/client/fetch'
const link = new RPCLink({
url: `${typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3000'}/rpc`,
headers: async () => {
if (typeof window !== 'undefined') return {}
const { headers } = await import('next/headers')
return await headers()
},
})
Optimize SSR
// lib/orpc.ts
import type { RouterClient } from '@orpc/server'
import { RPCLink } from '@orpc/client/fetch'
import { createORPCClient } from '@orpc/client'
declare global {
var $client: RouterClient<typeof router> | undefined
}
const link = new RPCLink({
url: () => {
if (typeof window === 'undefined') {
throw new Error('RPCLink is not allowed on server')
}
return `${window.location.origin}/rpc`
},
})
export const client: RouterClient<typeof router> = globalThis.$client ?? createORPCClient(link)
// lib/orpc.server.ts
import 'server-only'
import { headers } from 'next/headers'
import { createRouterClient } from '@orpc/server'
globalThis.$client = createRouterClient(router, {
context: async () => ({ headers: await headers() }),
})
// instrumentation.ts
export async function register() {
await import('./lib/orpc.server')
}
Source: ali-master/skills — distributed by TomeVault.
Decide Fit First
Design Intent
How To Use It
Boundaries And Review