typescript-rules
Skill71 starsChanged 9 months agoMITView on GitHub
TypeScript coding conventions
2 other projects use a version of this.
Adopted by
Most recently taken up by
- shinpr/ai-coding-project-boilerplatetheir own version, first seen Oct 3, 2026
- shinpr/claude-code-workflowstheir own version, first seen Mar 23, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- shinpr/claude-code-workflows★ 688same name
- shinpr/ai-coding-project-boilerplate★ 231same 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 repository17 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- analyze-skillsSkill
- dashboardSkill
- featureSkill
- fix-ciSkill
- fix-issueSkill
- investigateSkill
- open-issueSkill
- playwright-cliSkill
- quality-checkSkill
- react-rulesSkill
- reviewSkill
- sdlcSkill
- shipSkill
- tanstack-startSkill
- testingSkill
- uiuxSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 3 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Never use any — use unknown with type guards or explicit types
- Very specific: line 11
Prefer interface for object shapes, type for unions/intersections
- Very specific: line 13
Use satisfies for type-safe object literals: const x = { ...
- Very specific: line 16
Use @/ path alias for imports from apps/web/src/
- Very specific: line 18
Use type imports for type-only: import type { Foo } from './types'
- Very specific: line 24
No cross-slice imports — shared code goes in src/lib/
- Very specific: line 31
Test files: *.test.ts(x) co-located with source
- Very specific: line 35
Use discriminated unions for result types: { ok: true.
- Distinctive: line 39
Prefer named function declarations over arrow functions for top-level exports
- Distinctive: line 40
Use explicit return types on exported functions
- Distinctive: line 41
Keep functions small — max ~50 lines
- Very specific: line 46
Use z.infer<typeof schema> for derived types
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TypeScript Rules
Types
- Never use
any— useunknownwith type guards or explicit types - Prefer
interfacefor object shapes,typefor unions/intersections - Export types alongside their functions, not from barrel files
- Use
satisfiesfor type-safe object literals:const x = { ... } satisfies Config
Imports
- Use
@/path alias for imports fromapps/web/src/ - Group imports: external libs →
@/lib/→ relative slice imports - Use
typeimports for type-only:import type { Foo } from './types'
Architecture Boundaries
Vertical slice structure (src/features/<slice>/)
- Each slice owns its own server functions, queries, components, and types
- No cross-slice imports — shared code goes in
src/lib/ src/lib/modules must NOT import fromsrc/features/
File naming
- Server function files:
*.server.ts - Query/hooks files:
*.queries.ts - Component files: PascalCase (e.g.,
SessionCard.tsx) - Test files:
*.test.ts(x)co-located with source
Error Handling
- Throw typed errors, not strings:
throw new Error('message') - Use discriminated unions for result types:
{ ok: true; data: T } | { ok: false; error: string } - Catch
unknown, narrow withinstanceof
Functions
- Prefer named function declarations over arrow functions for top-level exports
- Use explicit return types on exported functions
- Keep functions small — max ~50 lines
Zod
- Validate all external input (API responses, form data, URL params) with Zod
- Co-locate schemas with server functions, not in separate schema files
- Use
z.infer<typeof schema>for derived types
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.

