typescript-strict
Skill0 starsChanged 5 months agoMITView on GitHub
Type-first TypeScript with no-any, exhaustive switches, and parse-don't-validate discipline at boundaries.
13 other projects use a version of this.
Adopted by
Most recently taken up by
- microsoft/typescript-skillstheir own version, first seen Nov 8, 2026
- conjurer-rich/skillstheir own version, first seen Oct 25, 2026
- Greg-Klein/ai-rules-skillstheir own version, first seen Oct 15, 2026
- SkillMedev/engineering-workflowtheir own version, first seen Oct 5, 2026
- aprameyak/coding-skillstheir own version, first seen Oct 2, 2026
- Sagargupta16/claude-code-recipestheir own version, first seen Sep 6, 2026
Used with
Projects with it also use react-patterns, api-design and 1 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
xenitV1Skillreact-patterns
Modern React patterns and principles. Hooks, composition, performance, TypeScript best practices.
Also in 3 projects that use this
MicrosoftSkillapi-design
Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.
Also in 5 projects that use this
Microsoft AzureSkillgit-workflow
Squad branching model: dev-first workflow with insiders preview channel
Also in 3 projects that use this
Other versions13 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 13
- Sagargupta16/claude-code-recipes★ 8same name
- 0xMassi/claude-skills★ 7same name
- kevinaimonster/skill-hub★ 4same name
- halflength-ampleness75/claude-code-recipes★ 2same name
- aprameyak/coding-skills★ 1same name
- conjurer-rich/skills★ 1same name
- microsoft/typescript-skills★ 1same name
- NaviAndrei/AgentFlow-Studio★ 1same name
- theseus-run/theseus★ 1same name
- Greg-Klein/ai-rules-skills★ 0same name
3 more not listed
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 repository10 other files it gives its agents.
- accessibility-a11ySkill
- ask-first-promptsSkill
- business-stress-testSkill
- code-reviewSkill
- commit-conventionsSkill
- feynman-explainerSkill
- prompt-writes-promptSkill
- security-reviewSkill
- sparring-partnerSkill
- tdd-workflowSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 13 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Treat the type system as the primary correctness tool.
- Very specific: line 48
Use a never exhaustiveness check on discriminated unions so adding a new variant fails the build:
- Very specific: line 71
Use brands so you can't accidentally pass a UserId where an OrderId is expected:
“Common” is measured: kept by at least 6 in 10 of the 13 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
TypeScript Strict
Treat the type system as the primary correctness tool. Tests verify behaviour; types prevent entire categories of bug from existing.
Hard rules
tsconfig.jsonmust have"strict": trueand"noUncheckedIndexedAccess": true. Don't merge without these.- No
anyin application code.unknownfor external input, then narrow. Generics where the type depends on the caller. - No type assertions (
as Foo) unless paired with a runtime check that proves the assertion. Prefersatisfies. - No
enumunless required for interop with a non-TS consumer. Use string-literal unions:type Role = 'admin' | 'member'. - No
React.FCfor components — use a typed props parameter.FCmakes children implicit which causes confusion.
Patterns
Parse, don't validate
Convert untrusted data to a typed value at the system boundary, then trust the type everywhere downstream:
import { z } from "zod";
const UserSchema = z.object({
email: z.string().email(),
age: z.number().int().min(0).max(150),
});
type User = z.infer<typeof UserSchema>;
export function parseUser(raw: unknown): User {
return UserSchema.parse(raw); // throws on invalid
}Once you have a User, no other code needs to validate it again.
Exhaustive switches
Use a never exhaustiveness check on discriminated unions so adding a new variant fails the build:
type Event =
| { kind: "created"; id: string }
| { kind: "updated"; id: string; patch: Partial<User> }
| { kind: "deleted"; id: string };
function describe(e: Event): string {
switch (e.kind) {
case "created": return `created ${e.id}`;
case "updated": return `updated ${e.id}`;
case "deleted": return `deleted ${e.id}`;
default: {
const _exhaustive: never = e;
throw new Error(`unhandled event ${JSON.stringify(_exhaustive)}`);
}
}
}Branded types for IDs
Use brands so you can't accidentally pass a UserId where an OrderId is expected:
type Brand<T, B> = T & { readonly __brand: B };
type UserId = Brand<string, "UserId">;
type OrderId = Brand<string, "OrderId">;
function userId(s: string): UserId { return s as UserId; }
function orderId(s: string): OrderId { return s as OrderId; }Immutable updates
Mutation is forbidden. Always return new values:
// WRONG
function rename(user: User, name: string): User {
user.name = name; // mutation!
return user;
}
// RIGHT
function rename(user: Readonly<User>, name: string): User {
return { ...user, name };
}Errors as values for expected failures
Throwing is for bugs and unrecoverable states. For expected failures (validation, not-found, network), return a discriminated result:
type Result<T, E> = { ok: true; value: T } | { ok: false; error: E };What to flag in review
anyanywhere except in// @ts-expect-error: <reason>comments.ascasts without a runtime guard.- Throwing inside a function whose signature claims it always returns.
- Using
.theninstead ofawait(mixed styles in one function). - A
MaporSettyped with<any, any>. - A discriminated-union switch without a
neverdefault.
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.

