trpc-typed-form-data
Type-safe file uploads through tRPC with @falcondev-oss/trpc-typed-form-data.
Skill by falcondev-oss
Chalk Labs
Need help deploying trpc-typed-form-data?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/falcondev-oss-trpc-typed-form-data
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: data
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/trpc-typed-form-data
What's inside
- Skill name
trpc-typed-form-data- Description
- Type-safe file uploads through tRPC with @falcondev-oss/trpc-typed-form-data. Use when uploading files / FormData through a tRPC procedure, or working with typedFormData(), createTypedFormData(), typedFormDataLink, createTypedFormDataPlugin, the file() validator / FileValue type (a stable alternative to z.file()), or ReactNativeFile / Expo file uploads over tRPC.
- License
- MIT
- Instructions
- 113 lines in SKILL.md · view on GitHub
Files (2)
- SKILL.md
- react-native.md · reference/
SKILL.md (first lines)
# @falcondev-oss/trpc-typed-form-data
tRPC can't type a `FormData` input: files must ride as multipart parts, everything else is untyped strings, and `input` arrives `undefined`. This package restores end-to-end type safety by carrying the non-file fields as a **serialized sidecar** — a JSON blob in one extra FormData field (`~data`) — while files stay as real multipart parts. Client, server, and schema each handle one half of that trick.
Four entry points:
| Import from | Gives you |
|---|---|
| `.../client` | `createTypedFormData`, `typedFormDataLink`, `ReactNativeFile` |
| `.../server` | `typedFormData`, `createTypedFormDataPlugin` |
| `.../zod` | zod-native `file()` validator (nest in `z.object`) |
| `.` (root) | `file` (Standard Schema), `isFile`, types — the framework-agnostic subset |
`file`, `isFile`, and the types (`FileValue`, `FileValidationOptions`, `TypedFormData`) are re-exported from `/client` and `/server` too, so import them from wherever you already are.
## Three touch points — all required
The sidecar only works if every piece is wired. Miss one and validation throws a message naming what's missing.
**1. Client link** — serializes the sidecar into the FormData. Place it *before* the terminating link:
```ts
import { typedFormDataLink } from '@falcondev-oss/trpc-typed-form-data/client'
import { createTRPCClient, httpLink } from '@trpc/client'
const trpc = createTRPCClient<AppRouter>({
links: [
typedFormDataLink(), // 👈 before httpLink
httpLink({ url: '/api/trpc' }),
],
})
```
**2. Server middleware** — deserializes the sidecar back onto the FormData. Build the plugin from your tRPC instance and `concat` its middleware onto the procedures that accept uploads:
```ts
import { createTypedFormDataPlugin } from '@falcondev-oss/trpc-typed-form-data/server'
const t = initTRPC.create()
const typedFormDataPlugin = createTypedFormDataPlugin(t)
export const uploadProcedure = t.procedure.concat(typedFormDataPlugin.middleware)
```
**3. Input schema wrapper** — wrap the input schema in `typedFormData()`. It reads the sidecar + the file parts and validates them together:
```ts
import { typedFormData } from '@falcondev-oss/trpc-typed-form-data/server'
import { z } from 'zod'
export const router = t.router({
upload: uploadProcedure
.input(
typedFormData(
z.object({
userId: z.string(),
file: z.instanceof(File),
}),
),
)
.mutation(({ input }) => {
// input is fully typed: { userId: string; file: File }
}),
})
```
**Calling it** — build the payload with `createTypedFormData` and pass it straight to `.mutate()`; the fields are type-checked against the schema:
```ts
import { createTypedFormData } from '@falcondev-oss/trpc-typed-form-data/client'
await trpc.upload.mutate(
createTypedFormData({
userId: '123',
file: new File(['contents'], 'example.txt'),
}),
)
```
Arrays of files work: pass `File[]` under a key — each file is appended under that key and read back with `getAll`.
## File validation — prefer `file()` over `z.file()`
Reach for this package's `file()` when the schema is shared with a React Native / Expo client. `z.file()`'s inferred type degrades to `any` in environments without a DOM `File` (React Native), silently dropping type-checking across the tRPC server→client boundary. `file()` infers a stable `FileValue` — a structural subset of the Web `File`/`Blob` API (`name`, `size`, `type`, `arrayBuffer`, `stream`, `slice`, `text`) — everywhere.
Two flavours, same options (`{ maxSize?, minSize?, mimeTypes? }`, all optional, byte limits inclusive):
```ts
// zod stack — nests inside z.object like z.file()
import { file } from '@falcondev-oss/trpc-typed-form-data/zod'
typedFormData(z.object({
avatar: file({ maxSize: 10_000_000, mimeTypes: ['image/png', 'image/jpeg'] }),
}))
// non-zod / any Standard Schema stack
import { file } from '@falcondev-oss/trpc-typed-form-data/server'
```
`isFile(value)` is a type guard narrowing `unknown` → `FileValue` for ad-hoc checks outside a schema. Annotate values that came out of these schemas (a procedure `input`, an upload helper) with `FileValue`, not `File`.
## Gotchas
- **All three touch points, or nothing.** Missing the link, the middleware, or the wrapper each produces a distinct validation error — read the message, it names the missing piece.
- **Transformer must match.** If your router uses a transformer (e.g. superjson), pass it to `typedFormDataLink({ transformer })` — the sidecar is serialized with the link's transformer and deserialized with the router's. A mismatch throws `BAD_REQUEST` on the server.
- **Custom transfer field.** The sidecar rides in a `~data` field by default. Override with `transferDataKey` — set the *same* value on both `typedFormDataLink({ transferDataKey })` and `createTypedFormDataPlugin(t, { transferDataKey })`.
- **FormData isn't batchable.** Terminate with `httpLink`, not `httpBatchLink`, on the upload path.
- **Middleware only fires for mutations** with no plain `input` (the FormData path). Queries and subscriptions pass through untouched.
## React Native / Expo
Uploading from an image/document picker needs `ReactNativeFile` — RN's `FormData` only sends parts with a `uri` and never reads a Blob's bytes. Read `reference/react-native.md` before wiring an Expo upload.From falcondev-oss/skills, MIT.
More from falcondev-oss/skills
- 0.598score
conventional-commits
falcondev-oss
Format commit messages, branch names, PR titles, and issue titles to the Conventional Commits 1.0.0 spec.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
workflow
falcondev-oss
Durable, type-safe queue workers with @falcondev-oss/workflow on Redis.
SkillAFreshness: A★ 2Claude Code +9 - 0.597score
babysit-pr
falcondev-oss
Monitor a pull request through review and CI.
SkillAFreshness: A★ 2Claude Code +9 - 0.597score
file-pr
falcondev-oss
File a PR from the current branch.
SkillAFreshness: A★ 2Claude Code +9 - 0.593score
bug-review
falcondev-oss
Cold review of a diff for merge-blocking bugs, each with a way to demonstrate the failure.
SkillAFreshness: A★ 2Claude Code +9 - 0.592score
review-local-changes
falcondev-oss
Review the local changes cold and report the findings to the user.
SkillAFreshness: A★ 2Claude Code +9 - 0.592score
implement-pr
falcondev-oss
Implement a change and deliver a green, review-ready pull request with explicit scope and evidence.
SkillAFreshness: A★ 2Claude Code +9 - 0.584score
quick-iteration
falcondev-oss
Enter a quick iteration session.
SkillAFreshness: A★ 2Claude Code +9 - 0.557score
falcondev-form
falcondev-oss
Building or editing forms with @falcondev-oss/form — the type-safe, reactive, schema-driven form library (packages form-core, form-react, form-vue) built on…
SkillBFreshness: B★ 2Claude Code +9 - 0.554score
shareflare
falcondev-oss
Share any local file through a public URL.
SkillBFreshness: B★ 2Claude Code +9
Signals
- Stars
- 2
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jul 21, 2026 (3 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/falcondev-oss/skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from falcondev-oss
- 0.598score
conventional-commits
falcondev-oss
Format commit messages, branch names, PR titles, and issue titles to the Conventional Commits 1.0.0 spec.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
workflow
falcondev-oss
Durable, type-safe queue workers with @falcondev-oss/workflow on Redis.
SkillAFreshness: A★ 2Claude Code +9 - 0.597score
babysit-pr
falcondev-oss
Monitor a pull request through review and CI.
SkillAFreshness: A★ 2Claude Code +9 - 0.597score
file-pr
falcondev-oss
File a PR from the current branch.
SkillAFreshness: A★ 2Claude Code +9 - 0.593score
bug-review
falcondev-oss
Cold review of a diff for merge-blocking bugs, each with a way to demonstrate the failure.
SkillAFreshness: A★ 2Claude Code +9 - 0.592score
review-local-changes
falcondev-oss
Review the local changes cold and report the findings to the user.
SkillAFreshness: A★ 2Claude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get trpc-typed-form-data running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
trpc-typed-form-data skill. Agent Mart. https://agentmart.dev/skills/falcondev-oss-trpc-typed-form-data (last updated 2026-10-24)