type-safety
Skill268 starsChanged 11 days agoMITView on GitHub
Use when creating or extending a Zod schema under fixtures/api/schemas/**, inferring a type from a schema, annotating a function signature, removing an `any` or a cast, or choosing `!` versus `??` on a `process.env` read. Not for env-variable declarations (see `config`) or spec-side consumption (see `api-testing`).
- Reads credentials
4 other projects use a version of this.
Adopted by
Most recently taken up by
- jars-demo/jars-skillstheir own version, first seen Oct 25, 2026
- Mushfiqur-Rahman-Robin/coding-rulestheir own version, first seen Oct 13, 2026
- hzblj/skillstheir own version, first seen Jul 15, 2026
- MANVENDRA-github/agentrytheir own version, first seen Jul 6, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- hzblj/skills★ 1same name
- jars-demo/jars-skills★ 0same name
- MANVENDRA-github/agentry★ 0same name
- Mushfiqur-Rahman-Robin/coding-rules★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository35 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ai-native-workflowSkill
- api-testingSkill
- common-tasksSkill
- configSkill
- data-strategySkill
- debuggingSkill
- enumsSkill
- fixturesSkill
- helpersSkill
- page-objectsSkill
- playwright-cliSkill
- pr-reviewerSkill
- refactor-valuesSkill
- selectorsSkill
- skill-creatorSkill
- test-standardsSkill
- ai-native-workflowSkill
- api-testingSkill
- common-tasksSkill
- configSkill
- data-strategySkill
- debuggingSkill
- enumsSkill
- fixturesSkill
- helpersSkill
- page-objectsSkill
- playwright-cliSkill
- pr-reviewerSkill
- refactor-valuesSkill
- selectorsSkill
- skill-creatorSkill
- test-standardsSkill
- type-safetySkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 0 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
NEVER: use any, @ts-ignore or @ts-expect-error: unknown at a boundary (network, file, user input), then Schema.parse(...).
- Very specific: line 11
Never as T or as unknown as T to cross a type boundary.
- Very specific: line 21
Every API schema is z.strictObject().
- Very specific: line 30
Import from zod/v4; top-level validators (z.uuid(), z.email(), z.url(), z.int(), z.enum(E)), not the chained z.string().uuid() forms.
- Very specific: line 39
Write the schema from the contract that api-testing step 1 sourced, one validator per field from references/zod-usage.md, the contract …
- Very specific: line 42
Run npx tsc --noEmit and npm run lint.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Type Safety
Critical
- NEVER use
any,@ts-ignoreor@ts-expect-error:unknownat a boundary (network, file, user input), thenSchema.parse(...); a Zod-inferred type everywhere else. Never
as Toras unknown as Tto cross a type boundary; parse instead.// CORRECT const raw: unknown = await response.json(); const user = UserResponseSchema.parse(raw); // WRONG const user = (await response.json()) as UserResponse;Every API schema is
z.strictObject();z.object()strips unknown keys and hides contract drift.// CORRECT export const UserSchema = z.strictObject({ id: z.uuid() }); // WRONG export const UserSchema = z.object({ id: z.uuid() });- Import from
zod/v4; top-level validators (z.uuid(),z.email(),z.url(),z.int(),z.enum(E)), not the chainedz.string().uuid()forms; types viazOutput<typeof Schema>, notz.infer. - A schema mirrors the documented contract field by field, envelope included, one per endpoint response, never a factory that builds envelopes. A shared per-domain
_envelope.tsonly once the same envelope appears in 3+ schemas (canonical threshold; other skills point here). - Export the type next to the schema:
export type User = zOutput<typeof UserSchema>;.zInputonly where a.default()or.transform()makes the pre-parse shape differ. - Explicit parameter and return types on every exported or public function (
Promise<void>,Locator,string);npm run lintfails without them. - Resolve
process.env.Xwhere it is read:process.env.X!whenenv/.env.exampledeclares it as required,process.env.X ?? fallbackwhen a default is safe. Never export or pass on astring | undefined.
Procedure
ls fixtures/api/schemas/resolves{area}; the file isfixtures/api/schemas/{area}/<name>Schema.ts; shared error bodies stay infixtures/api/schemas/util/errorResponseSchema.ts.- Write the schema from the contract that
api-testingstep 1 sourced, one validator per field fromreferences/zod-usage.md, the contract source in a comment at the top. - Export the type;
references/zod-usage.mddecideszInputversuszOutputand when to extract an envelope. - Hand it to the consumer: a spec asserts
expect(SchemaName.parse(body)).toBeTruthy();(api-testing); a factory returnsSchema.parse(merged)(data-strategy); fixture code bindsconst x = Schema.parse(body);. - Run
npx tsc --noEmitandnpm run lint. AZodErroragainst a documented contract is a bug handled perapi-testing, never by loosening the schema.
References
references/zod-usage.md: the validator per data type, Zod 4 idioms versus project conventions,zInputversuszOutput, envelope extraction.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

