Typescript Advanced Types
rolling-scopes/rsschool-app
Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.
Guide for when to use and when not to use return validators in Convex functions.
$ npx skills add waynesutton/markdown-site --skill convex-return-validators -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install waynesutton/markdown-site convex-return-validators --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/waynesutton/markdown-site.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.cursor/skills/convex-return-validators .claude/skills/convex-return-validators && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "convex-return-validators" agent skill from https://github.com/waynesutton/markdown-site/tree/main/.cursor/skills/convex-return-validators into .claude/skills/convex-return-validators/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "convex-return-validators", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/waynesutton/markdown-site/tree/main/.cursor/skills/convex-return-validatorsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add waynesutton/markdown-site --skill convex-return-validators -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install waynesutton/markdown-site convex-return-validators --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/waynesutton/markdown-site.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.cursor/skills/convex-return-validators .agents/skills/convex-return-validators && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "convex-return-validators" agent skill from https://github.com/waynesutton/markdown-site/tree/main/.cursor/skills/convex-return-validators into .agents/skills/convex-return-validators/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "convex-return-validators", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add waynesutton/markdown-site --skill convex-return-validators -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install waynesutton/markdown-site convex-return-validators --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/waynesutton/markdown-site.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.cursor/skills/convex-return-validators .cursor/skills/convex-return-validators && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "convex-return-validators" agent skill from https://github.com/waynesutton/markdown-site/tree/main/.cursor/skills/convex-return-validators into .cursor/skills/convex-return-validators/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "convex-return-validators", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/waynesutton/markdown-site.git --path .cursor/skills/convex-return-validators--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add waynesutton/markdown-site --skill convex-return-validators -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install waynesutton/markdown-site convex-return-validators --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/waynesutton/markdown-site.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.cursor/skills/convex-return-validators .gemini/skills/convex-return-validators && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "convex-return-validators" agent skill from https://github.com/waynesutton/markdown-site/tree/main/.cursor/skills/convex-return-validators into .gemini/skills/convex-return-validators/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "convex-return-validators", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install waynesutton/markdown-site convex-return-validatorsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add waynesutton/markdown-site --skill convex-return-validators -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/waynesutton/markdown-site.git skills-src && mkdir -p .github/skills && cp -r skills-src/.cursor/skills/convex-return-validators .github/skills/convex-return-validators && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "convex-return-validators" agent skill from https://github.com/waynesutton/markdown-site/tree/main/.cursor/skills/convex-return-validators into .github/skills/convex-return-validators/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "convex-return-validators", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add waynesutton/markdown-site --skill convex-return-validators -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install waynesutton/markdown-site convex-return-validators --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/waynesutton/markdown-site.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.cursor/skills/convex-return-validators .opencode/skills/convex-return-validators && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "convex-return-validators" agent skill from https://github.com/waynesutton/markdown-site/tree/main/.cursor/skills/convex-return-validators into .opencode/skills/convex-return-validators/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "convex-return-validators", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
convex-return-validatorsGuide for when to use and when not to use return validators in Convex functions.
Convex Return Validators is an agent skill from waynesutton/markdown-site. Guide for when to use and when not to use return validators in Convex functions. Use this skill whenever the user is writing Convex queries, mutations, or actions and needs guidance on return value validation. Also trigger when the user asks about Convex type safety, runtime validation, AI-generated Convex code, Convex AI rules, Convex security best practices, or when they're debugging return type issues in Convex functions. Trigger this skill when users mention "validators", "returns", "return type", or "exact…
Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/ai-rules-guidance.md` and `references/quick-reference.md`).
It sits in Development, covering Type safety. The repository describes itself as: An open-source publishing framework built for AI agents and developers to ship websites, docs, or blogs. Write markdown, sync from the terminal. Your content is instantly… The licence is MIT.
Read from SKILL.md and the folder at commit 3872c59. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).
From the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
docs.convex.devgithub.comstack.convex.devFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Convex Return Validators loads about 2.4k tokens when it runs, and up to ~3.8k if it reads all its reference files. Until then it costs about 174 tokens; SKILL.md has 1,006 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from waynesutton/markdown-site at commit 3872c59, republished under its MIT licence (© waynesutton). 1,006 words, ~2,423 tokens.
.claude/skills/convex-return-validators/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.Convex recently updated its guidance on return validators. The old rule was "always add a returns validator." The new guidance is: prefer simple TypeScript types and inference by default. Use returns: when you actually want Convex to enforce an exact runtime contract.
Return validators aren't bad. The word "always" was doing damage.
Convex lets you validate arguments coming into a function using args and return values going out using returns. A return validator declares the return shape, and Convex checks it at runtime.
import { query } from "./_generated/server";
import { v } from "convex/values";
export const getUserPreview = query({
args: { userId: v.id("users") },
returns: v.object({
name: v.string(),
}),
handler: async (ctx, { userId }) => {
const user = await ctx.db.get(userId);
if (!user) throw new Error("User not found");
return { name: user.name };
},
});If the returned value doesn't match, you get a runtime error instead of silently returning unexpected data. Object validators don't allow extra properties — returning extra fields will fail validation at runtime.
The original motivation was more about TypeScript pain than runtime correctness. Convex projects can hit circular type problems because functions reference generated api or internal objects, and those references become part of the generated types. Types reference types reference types until TypeScript gives up.
The thinking: if the model always declared return validators, it would reduce reliance on inferred return types and break the cycle. In practice, it only helps in specific circumstances.
In real codebases, and especially in agentic AI workflows, the "always" rule creates predictable failure modes:
LLMs don't reuse validators. They copy-paste shapes inline. You end up with return validators like this on every function:
export const listByProject = query({
args: { projectId: v.id("projects") },
returns: v.array(
v.object({
_id: v.id("activityLog"),
_creationTime: v.number(),
action: v.string(),
userId: v.id("users"),
userName: v.string(),
projectId: v.id("projects"),
entityType: v.string(),
entityId: v.string(),
metadata: v.optional(v.string()),
}),
),
handler: async (ctx, args) => {
// ...
},
});It works, but once that shape is copy-pasted across multiple functions, a schema change stops being a "change one place" job. You update a field, chase compile errors, chase runtime validation errors, then update a bunch of validators that are almost-the-same-but-not-quite.
Every extra hundred tokens matters when the model is trying to keep the codebase in working memory and plan multi-step changes. Verbosity translates into slower iterations and more "oops, I forgot a field" cycles.
Asking a model to reproduce a schema as a validator increases the chance it invents fields, misses fields, or picks the wrong validator type. TypeScript catches a lot of this, but catching things later is still slower than not introducing the problem.
Unless you're using helper utilities, return validators drag you into re-declaring _id and _creationTime over and over. If you want heavy validator usage, look at the validator utilities in convex-helpers.
Convex already provides ergonomic type helpers like Doc<> and WithoutSystemFields, so a lot of the time you can keep code tidier by leaning on normal TypeScript types and inference.
TypeScript is structurally typed, which means it doesn't have true exact types. A function can claim it returns a User but still accidentally return extra fields.
This becomes more likely once any gets involved, or when consuming untyped external API data:
// WITHOUT return validator — extra field leaks silently
export const getUser = query({
args: {},
handler: async (ctx): Promise<User> => {
return {
id: "123",
name: "Alice",
email: "alice@example.com", // Extra field — no error!
} as any;
},
});
// WITH return validator — Convex catches extra field at runtime
export const getUser = query({
args: {},
returns: v.object({
id: v.string(),
name: v.string(),
}),
handler: async (ctx) => {
return {
id: "123",
name: "Alice",
email: "alice@example.com", // Runtime error!
} as any;
},
});That guarantee is real and valuable. It's just not needed everywhere, and using it everywhere comes with costs.
Return validators are useful when you need runtime enforcement of an exact contract, not just TypeScript typechecking.
There are cases where inference isn't available and the validator becomes the contract.
With static codegen, functions don't have return type inference and will default to v.any() if they don't have a returns validator.
You often want the server to enforce the contract you're generating client types from. Missing validators get treated as any, which makes the resulting spec less useful.
any or unvalidated external data is involvedIf there's a realistic chance you'll accidentally return data you didn't intend to expose, return validators catch that. For external API calls, it's usually better to validate the data at the boundary (inside an action right after the fetch). But belt-and-braces is fair too.
If your handler's return type is already well-typed via inference or explicit TypeScript annotations, the return validator adds verbosity without meaningful safety.
This is counterintuitive, but the "always" rule was actively harming AI code quality. LLMs produce better Convex code when they can lean on TypeScript inference instead of reproducing schema shapes as validators. Fewer tokens, fewer hallucinations, faster iteration.
When the return shape is still changing, return validators slow you down. Add them once the shape stabilizes and you need the runtime contract.
Functions using internalQuery, internalMutation, or internalAction aren't exposed to clients. TypeScript inference is usually sufficient.
If you're writing Convex AI rules (for Claude, Cursor, Copilot, or any agentic tool), update the guidance:
Old rule: "Always add a returns validator to queries and mutations."
New rule: "Prefer simple TypeScript types and inference by default. Use returns: when you actually want Convex to enforce an exact runtime contract — such as components codegen, static codegen, OpenAPI generation, or when handling any/unvalidated external data."
When AI does use return validators, encourage it to:
.pick(), .omit(), .extend() on object validators to derive return typesDoc<"tableName"> and WithoutSystemFields for TypeScript types when validators aren't neededconvex-helpers to reduce system field duplication| Scenario | Use returns:? | Why |
|---|---|---|
| Components codegen | Yes | Inference not available, validator is the contract |
| Static codegen | Yes | Functions default to v.any() without it |
| OpenAPI generation | Yes | Missing validators become any in the spec |
any or unvalidated external data | Yes | Catches accidental data leakage at runtime |
| Standard queries with good TS types | No | TypeScript inference is sufficient |
| AI/LLM-generated code (default) | No | Reduces verbosity, tokens, and hallucination risk |
| Internal functions | No | Not client-facing, inference is fine |
| Rapid prototyping | No | Add later when shape stabilizes |
© waynesutton, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 2 other files (references) in .cursor/skills/convex-return-validators of waynesutton/markdown-site.
Open the folder on GitHubat commit 3872c59
Convex Return Validators next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Convex Return Validators this skillwaynesutton/markdown-site | 628 | — | ~2.4k | Automated safety check: Pass | MIT | |
| Typescript Advanced Typesrolling-scopes/rsschool-app | 10k | 24 repos | ~4.2k | Automated safety check: Pass | MPL-2.0 | |
| RTK Rust Design Patternsrtk-ai/rtk | 83k | — | ~1.9k | Automated safety check: Pass | Apache-2.0 | |
| Kedro Babysitkedro-org/kedro | 11k | — | ~4k | Automated safety check: Pass | Custom licence | |
| Dignified Python Standardsdocling-project/docling | 68k | — | ~1.5k | Automated safety check: Pass | Apache-2.0 | |
| Wagmi Feature Developmentwevm/wagmi | 6.8k | — | ~3.8k | Automated safety check: Pass | MIT |
rolling-scopes/rsschool-app
Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.
rtk-ai/rtk
Describes seven Rust design patterns for the RTK CLI filter modules, with when to use each, RTK examples, and notes on when a pattern is overkill.
kedro-org/kedro
Run Kedro's local lint / format / type-check / tests on changed files (uses the project's pre-commit hooks, ruff, mypy, pytest, lint-imports, detect-secrets, Make targets — in the right venv), or…
docling-project/docling
Applies opinionated production Python conventions chosen by the project's Python version: modern type syntax, pathlib, explicit checks and interface guidance.
wevm/wagmi
Walks through adding a Wagmi feature across its layers: a Viem-based core action, TanStack Query options, and React and Vue bindings.
openinterpreter/openinterpreter
Rules for choosing Rust types for filesystem paths in new Codex code, covering protocol types, internal use and model tool arguments.
waynesutton/markdown-site
Integrate Convex static self hosting into existing apps using the latest upstream instructions from get-convex/self-hosting every time.
waynesutton/markdown-site
Integrate and maintain Robelest Convex Auth in apps by always checking upstream before implementation.
waynesutton/markdown-site
Plan and execute Convex schema migrations safely, including adding fields, creating tables, and data transformations.
waynesutton/markdown-site
Run convex-doctor static analysis, interpret findings, and fix issues across security, performance, correctness, schema, and architecture categories.
waynesutton/markdown-site
Initialize a new Convex project from scratch or add Convex to an existing app.
waynesutton/markdown-site
Set up Convex authentication with proper user management, identity mapping, and access control patterns.
Categories
Guide for when to use and when not to use return validators in Convex functions. Convex Return Validators is an agent skill from waynesutton/markdown-site. Guide for when to use and when not to use return validators in Convex functions.
Convex Return Validators fits situations like: the user is writing Convex queries; actions and needs guidance on return value validation; the user asks about Convex type safety; runtime validation.
Run `npx skills add waynesutton/markdown-site --skill convex-return-validators -a claude-code`. Or copy the skill folder (.cursor/skills/convex-return-validators in waynesutton/markdown-site) into .claude/skills/convex-return-validators in your project. Claude Code loads it when a task matches its description.
Run `npx skills add waynesutton/markdown-site --skill convex-return-validators -a codex`. Or copy the skill folder (.cursor/skills/convex-return-validators in waynesutton/markdown-site) into .agents/skills/convex-return-validators in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add waynesutton/markdown-site --skill convex-return-validators -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/convex-return-validators, .gemini/skills/convex-return-validators, .github/skills/convex-return-validators and .opencode/skills/convex-return-validators in your project.
SKILL.md names no scripts, command-line tools or credentials: Convex Return Validators is instructions for the agent only.
SKILL.md names 3 domains. As links in the text: docs.convex.dev, github.com and stack.convex.dev. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Convex Return Validators is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.4k tokens (SKILL.md is roughly 9.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.3k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Convex Return Validators: Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars), RTK Rust Design Patterns (rtk-ai/rtk, 83k stars), Kedro Babysit (kedro-org/kedro, 11k stars) and Dignified Python Standards (docling-project/docling, 68k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
waynesutton (a GitHub user) maintains it in waynesutton/markdown-site, which has 628 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on May 20, 2026.
Source: waynesutton/markdown-site on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.