Token导航 LogoToken导航

Agent Skill · 前端设计

web-data-fetching-trpc(网络数据获取 trpc)

用于辅助数据整理、表格处理、CSV/Excel 分析、指标计算和图表准备。它适合让 Agent 清洗字段、汇总数据、发现异常、生成统计口径或把分析结果转成可读说明。使用时需要确认数据来源、字段含义和时间范围,避免把样本数据当全量事实;涉及敏感数据、导出文件或批量写回时,应先确认权限和脱敏边界。

web-data-fetching-trpc 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 8,773。

总安装 261周安装 11GitHub Stars 5下载 92核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:web-data-fetching-trpc(网络数据获取 trpc)
来源仓库:https://github.com/agents-inc/skills
仓库路径:skills/web-data-fetching-trpc
安装命令:
npx skills add https://github.com/agents-inc/skills --skill web-data-fetching-trpc
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/agents-inc/skills --skill web-data-fetching-trpc

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

用于辅助数据整理、表格分析和指标计算。适合清洗字段、汇总数据或生成统计口径。可将分析结果转为可读说明或图表准备。web-data-fetching-trpc 属于前端设计类 Skill,可作为该场景下的辅助能力补充。通过 GitHub 仓库安装,支持主流 AI Agent 工具。涉及敏感数据时应先确认脱敏和导出权限。

来源仓库内路径:skills/web-data-fetching-trpc

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/agents-inc/skills --skill web-data-fetching-tr…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

web-data-fetching-trpc 怎么安装?

在终端执行 npx skills add https://github.com/agents-inc/skills --skill web-data-fetching-trpc。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

web-data-fetching-trpc 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

web-data-fetching-trpc 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

web-data-fetching-trpc 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

web-data-fetching-trpc 用的人多吗?

公开数据是累计安装 261 次,近一周安装 11 次,下载 92 次,GitHub 5 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

web-data-fetching-trpc 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
web-data-fetching-trpc

网络数据获取 trpc · 本页

2615需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

tRPC Type-Safe API Patterns

Quick Guide: tRPC provides end-to-end type safety by sharing TypeScript types directly from server to client -- no code generation, no schema files. Export AppRouter type from your router (this is the key bridge). Use Zod for input validation, TRPCError with proper codes for errors, and middleware for auth. v11 is the current stable version: transformer goes inside httpBatchLink(), subscriptions use async generators (not observable()), and @trpc/tanstack-react-query is the recommended React integration.

<critical_requirements>

CRITICAL: Before Using This Skill

(You MUST export AppRouter type from your tRPC router for client-side type inference)

(You MUST use TRPCError with appropriate error codes -- never throw raw Error objects)

(You MUST use Zod for input validation on ALL procedures accepting user input)

(You MUST place transformer inside httpBatchLink() in v11 -- NOT at client level)

</critical_requirements>


Auto-detection: tRPC router, initTRPC, createTRPCClient, createTRPCContext, @trpc/server, @trpc/client, @trpc/react-query, @trpc/tanstack-react-query, TRPCError, procedure, publicProcedure, protectedProcedure, query, mutation, subscription, httpBatchLink, queryOptions, mutationOptions, useTRPC

When to use:

  • Building APIs in TypeScript monorepos with shared types
  • End-to-end type safety without code generation
  • Full-stack TypeScript applications where both client and server are TypeScript
  • Projects where types should flow automatically from backend to frontend

When NOT to use:

  • Public APIs consumed by third parties (use OpenAPI/REST)
  • Non-TypeScript clients (mobile apps, other languages)
  • Need HTTP caching at CDN level (tRPC uses POST by default)
  • GraphQL requirements with partial queries

Key patterns covered:

  • Router and procedure definition (initTRPC, router, procedure)
  • Input validation with Zod schemas
  • Context and middleware for authentication
  • Error handling with TRPCError codes
  • React integration via @trpc/tanstack-react-query (recommended) or @trpc/react-query (classic)
  • Optimistic updates, infinite queries, subscriptions

Detailed Resources:


Philosophy

tRPC eliminates API layer friction by sharing types directly between server and client. No schemas to write, no code to generate -- export your router type and import it client-side for full autocompletion and type safety.

Core principles:

  • Zero schema duplication: Types flow from backend to frontend automatically
  • TypeScript-native: Leverages TypeScript's type inference, not code generation
  • Procedure-based: Queries read data, mutations write data -- clear separation
  • Composable middleware: Build reusable authentication and validation layers
  • Built on TanStack Query: Full caching, invalidation, and optimistic updates via React Query

Trade-offs:

  • Requires TypeScript on both ends (no polyglot support)
  • Best in monorepos where types can be shared directly
  • Not suitable for public APIs needing OpenAPI documentation
  • Uses POST by default -- no HTTP caching without configuration

Core Patterns

Pattern 1: tRPC Initialization and Router Setup

Initialize tRPC once per application. Export the router and procedure factories.

import { initTRPC, TRPCError } from "@trpc/server";
import { ZodError } from "zod";
import type { Context } from "./context";

const t = initTRPC.context<Context>().create({
  errorFormatter({ shape, error }) {
    return {
      ...shape,
      data: {
        ...shape.data,
        zodError:
          error.cause instanceof ZodError ? error.cause.flatten() : null,
      },
    };
  },
});

export const router = t.router;
export const publicProcedure = t.procedure;
export const middleware = t.middleware;

Why good: Single initialization point, error formatter provides structured Zod errors to client, exported factories enable composition across router files

See examples/core.md Pattern 1 for complete router and context factory.


Pattern 2: Procedures with Zod Input Validation

Zod schemas provide runtime validation AND TypeScript inference from a single source.

const createUserSchema = z.object({
  email: z.string().email(),
  name: z.string().min(1).max(100),
});

export const userRouter = router({
  create: protectedProcedure
    .input(createUserSchema)
    .mutation(async ({ input, ctx }) => {
      // input is typed: { email: string; name: string }
      return ctx.db.user.create({ data: input });
    }),
});
// BAD: No input validation -- input is 'unknown'
publicProcedure.mutation(async ({ input }) => {
  return ctx.db.user.create({ data: input as any }); // Dangerous!
});

Why bad: Without Zod validation, input is unknown type, no runtime validation, injection risks, as any defeats TypeScript

See examples/core.md Pattern 2 for complete CRUD router.


Pattern 3: Authentication Middleware

Middleware narrows context types -- ctx.user becomes non-nullable after auth middleware.

const isAuthenticated = middleware(async ({ ctx, next }) => {
  if (!ctx.session || !ctx.user) {
    throw new TRPCError({ code: "UNAUTHORIZED" });
  }
  return next({ ctx: { ...ctx, session: ctx.session, user: ctx.user } });
});

export const protectedProcedure = publicProcedure.use(isAuthenticated);

Why good: Auth enforced at procedure definition, TypeScript narrows ctx.user to non-nullable, eliminates duplicated if-checks in every handler

See examples/middleware.md for logging, rate limiting, and org-scoped access patterns.


Pattern 4: AppRouter Type Export

This is the KEY to tRPC's type safety. Export the router type for client-side inference.

export const appRouter = router({
  user: userRouter,
  post: postRouter,
});

// THIS IS ESSENTIAL -- without it, clients have no type inference
export type AppRouter = typeof appRouter;

Use inferRouterInputs/inferRouterOutputs for extracting procedure types:

import type { inferRouterInputs, inferRouterOutputs } from "@trpc/server";
type RouterInputs = inferRouterInputs<AppRouter>;
type RouterOutputs = inferRouterOutputs<AppRouter>;

// Extract specific type
type User = RouterOutputs["user"]["getById"];

See examples/core.md Pattern 4 for complete type inference utilities.


Pattern 5: React Integration (v11 Recommended)

v11 introduces @trpc/tanstack-react-query with queryOptions/mutationOptions factories that work directly with TanStack Query hooks.

// Setup: createTRPCContext provides typed hooks
import { createTRPCContext } from "@trpc/tanstack-react-query";
export const { TRPCProvider, useTRPC } = createTRPCContext<AppRouter>();

// Usage: standard TanStack Query hooks with tRPC type safety
const trpc = useTRPC();
const { data } = useQuery(trpc.user.getById.queryOptions({ id: userId }));

v11 CRITICAL: Transformer must be inside httpBatchLink(), NOT at createTRPCClient() level.

// BAD: v11 error
createTRPCClient({ transformer: superjson, links: [...] });

// GOOD: transformer inside the link
httpBatchLink({ url: "/api/trpc", transformer: superjson });

See examples/core.md Patterns 3 and 5 for complete provider and component setup.


Pattern 6: Error Handling with TRPCError

Use standardized error codes that map to HTTP status codes.

// Server: throw TRPCError with appropriate code
throw new TRPCError({
  code: "NOT_FOUND",
  message: "User not found",
});

throw new TRPCError({
  code: "INTERNAL_SERVER_ERROR",
  message: "Failed to delete",
  cause: error, // Preserves original stack trace
});
// Client: typed error handling
const trpc = useTRPC();
const deletePost = useMutation({
  ...trpc.post.delete.mutationOptions(),
  onError: (error) => {
    switch (error.data?.code) {
      case "NOT_FOUND":
        toast.error("Not found");
        break;
      case "FORBIDDEN":
        toast.error("Not allowed");
        break;
    }
  },
});

See reference.md for complete error code table with HTTP status mappings.


Pattern 7: Optimistic Updates

Cancel queries, snapshot state, optimistically update, rollback on error, invalidate on settle.

const trpc = useTRPC();
const queryClient = useQueryClient();

const toggleTodo = useMutation({
  ...trpc.todo.toggle.mutationOptions(),
  onMutate: async ({ id }) => {
    await queryClient.cancelQueries({ queryKey: trpc.todo.list.queryKey() });
    const previousTodos = queryClient.getQueryData(trpc.todo.list.queryKey());
    queryClient.setQueryData(trpc.todo.list.queryKey(), (old: any) =>
      old?.map((t: any) =>
        t.id === id ? { ...t, completed: !t.completed } : t,
      ),
    );
    return { previousTodos };
  },
  onError: (err, vars, context) => {
    if (context?.previousTodos)
      queryClient.setQueryData(
        trpc.todo.list.queryKey(),
        context.previousTodos,
      );
  },
  onSettled: () =>
    queryClient.invalidateQueries({ queryKey: trpc.todo.list.queryKey() }),
});

Why good: Immediate UI feedback, automatic rollback on failure, eventual consistency via invalidation

See examples/optimistic-updates.md for complete pattern with like button example.


<red_flags>

RED FLAGS

High Priority Issues:

  • Missing export type AppRouter -- clients have no type inference, defeats purpose of tRPC
  • Raw throw new Error() -- should use TRPCError with appropriate code for HTTP mapping
  • Procedures without .input() validation -- no runtime validation, type is unknown
  • Auth checks in procedure body -- should use middleware for protected procedures
  • Transformer at client level in v11 -- must be inside httpBatchLink(), not at createTRPCClient() level

Medium Priority Issues:

  • Missing SuperJSON transformer -- Date/Map/Set won't serialize correctly
  • No error formatter -- Zod errors should be formatted for better client DX
  • Optimistic updates without rollback -- must include onError handler to restore previous state
  • Using observable() for subscriptions -- v11 uses async generators; observable() is the v10 pattern
  • Using rawInput in middleware -- v11 changed to getRawInput() function

Gotchas & Edge Cases:

  • httpBatchLink combines requests -- all batched requests share the same HTTP status code
  • SuperJSON transformer must be configured on BOTH client and server
  • Context is created per-request -- don't store mutable state in context
  • Middleware runs in order -- auth middleware should come before rate limiting
  • Query keys are auto-generated -- use queryKey() method (v11) or getQueryKey() for manual access
  • Subscription reconnection with tracked() requires lastEventId in input schema
  • Don't retry mutations (retry: false) -- retrying writes can cause duplicates

</red_flags>


<critical_reminders>

CRITICAL REMINDERS

(You MUST export AppRouter type from your tRPC router for client-side type inference)

(You MUST use TRPCError with appropriate error codes -- never throw raw Error objects)

(You MUST use Zod for input validation on ALL procedures accepting user input)

(You MUST place transformer inside httpBatchLink() in v11 -- NOT at client level)

Failure to follow these rules will break type safety, cause runtime errors, and defeat the purpose of using tRPC.

</critical_reminders>

平台分布

Codex

37%
按下载量换算34

Claude

30.14%
按下载量换算28

Cursor

19.94%
按下载量换算18

Gemini CLI

9.49%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills