typescript
Skill7 starsChanged 2 months agoMITView on GitHub
TypeScript best practices for this monorepo. Use this skill when: (1) writing new TypeScript code, (2) reviewing TypeScript code, (3) working with API responses, fetch calls, or JSON parsing, (4) adding or modifying types and interfaces.
33 other projects use a version of this.
Adopted by
Most recently taken up by
- Quad4-Software/skillstheir own version, first seen Oct 3, 2026
- lobehub/lobehubtheir own version, first seen Oct 1, 2026
- jscraik/Agent-Skillstheir own version, first seen Sep 27, 2026
- wolzey/agent-factorytheir own version, first seen Sep 23, 2026
- AvilaCarlosDev/openclaw-skillstheir own version, first seen Sep 19, 2026
- erikhoward/agent-toolstheir own version, first seen Sep 7, 2026
Used with
Projects with it also use python, react and 2 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.
rogue-dev-studioSkillpython
Python 3.13 with uv package manager via mise. Use when the project needs this capability or the user / team manifest asks for it. Use for specialized `python` work when listed in TEAM.yaml or explicitly requested.
Also in 9 projects that use this
VercelSkillreact
React renderer for json-render that turns JSON specs into React components. Use when working with @json-render/react, building React UIs from JSON, creating component catalogs, or rendering AI-generated specs.
Also in 6 projects that use this
0xSeroSkillsecurity
Also in 4 projects that use this
BlockSkilldebugging
Debugging guidelines and best practices
Also in 3 projects that use this
Other versions33 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 33
- lobehub/lobehub★ 83ksame name
- microsoft/fast★ 9.7ksame name
- alinaqi/maggy★ 707same name
- Mindrally/skills★ 266same name
- martinholovsky/claude-skills-generator★ 47same name
- nimadorostkar/Claude-Skills-collection★ 28same name
- siviter-xyz/dot-agent★ 22same name
- sordi-ai/skill-everything★ 20same name
- alexander-danilenko/cortex-ai-skills★ 16same name
- caidanw/skills★ 9same name
23 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 repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- website/AGENTS.mdAGENTS.md
- cosmosdb-mongodbSkill
- documentationSkill
- resilienceSkill
- rust-best-practicesSkill
- scope-apiSkill
- scope-cliSkill
- storybookSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 2 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 27 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 48
Create a local interface: if no shared type exists and the response shape is known
- Very specific: line 49
Use Zod
.parse(): when you need runtime validation (e.g., external APIs you don't control) - Very specific: line 80
Use unknown when the type is genuinely not known, then narrow with type guards
- Distinctive: line 81
Use generics when writing reusable utilities
- Very specific: line 82
If you must use any (e.g., third-party library boundaries), contain it — cast to a typed variable immediately
“Common” is measured: kept by at least 6 in 10 of the 27 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 Best Practices
Never Leave Values Untyped at any Boundaries
Whenever data crosses a boundary that erases type information (response.json(), JSON.parse(), external library returns, database query results, queue message payloads), immediately annotate or narrow the type:
// ❌ BAD — `any` leaks through, wrong property access compiles silently
const data = await response.json();
data.turns; // no error even if turns lives at data.run.turns
const parsed = JSON.parse(rawMessage);
parsed.requestId; // unverified assumption
// ✅ GOOD — type boundary is explicit, TypeScript verifies all access
import type { RequestDocument } from "shared";
const data: RequestDocument = await response.json();
data.run?.turns; // correct path, verified at compile time
const parsed: QueueMessagePayload = JSON.parse(rawMessage);
parsed.requestId; // known to existWhy This Matters
anypropagates silently — one untyped value infects everything it touches- Bugs from wrong property paths are invisible at compile time
- Tests may share the same wrong assumption as the code (mocks mirror the bug)
- Adding a type annotation is zero-cost at runtime but catches entire classes of bugs
Guidelines
- Import the shared type from
packages/sharedwhen one exists (e.g.,RequestDocument,RunState,ReportDocument) - Create a local interface if no shared type exists and the response shape is known
- Use Zod
.parse()when you need runtime validation (e.g., external APIs you don't control) - Use optional chaining (
?.) instead of|| {}fallbacks — it preserves type narrowing
Prefer Optional Chaining Over Fallback Objects
// ❌ BAD — `|| {}` erases type information, downstream access is untyped
const run = request.run || {};
run.turns; // type is `{}`, no autocomplete, no error checking
// ✅ GOOD — preserves the original type, TypeScript tracks nullability
const run = request.run;
run?.turns; // type is `ConversationTurn[] | undefined`Use Shared Types from packages/shared
This monorepo defines canonical types in packages/shared/src/types/. Always import from there rather than redeclaring shapes:
| Type | Use For |
RequestDocument | Full request document (includes run?: RunState) |
RunState | Per-attempt run state (status, turns, outcome) |
ConversationTurn | Individual iteration within a run |
ReportDocument | Report job state |
ReportTemplateDocument | Report template configuration |
LogEvent | Structured log entry |
Scenario | Task + criteria definition |
Avoid any in New Code
- Use
unknownwhen the type is genuinely not known, then narrow with type guards - Use generics when writing reusable utilities
- If you must use
any(e.g., third-party library boundaries), contain it — cast to a typed variable immediately
// ❌ BAD — any spreads and defeats type checking
function process(data: any) {
return data.items.map((i: any) => i.name);
}
// ✅ GOOD — typed boundary, any is contained
interface ApiResponse { items: Array<{ name: string }> }
function process(data: unknown): string[] {
const typed = data as ApiResponse;
return typed.items.map(i => i.name);
}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.

