typescript-standards
Skill311 starsChanged 9 days agoApache-2.0View on GitHub
TypeScript coding standards. Use when writing TypeScript, reviewing code, or refactoring. Enforces named exports, no dynamic imports, discriminated unions, proper type safety.
- Reads credentials
- Installs packages
13 other projects use a version of this; 2 new projects in the last 4 weeks, against 0 the 4 before.
Adopted by
Surging: 2 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Most recently taken up by
- obsessiondb/rudelword for word, first seen Nov 30, 2026
- evrendom/opalineword for word, first seen Nov 22, 2026
- Sequela02/canastatheir own version, first seen Nov 15, 2026
- gerardbalaoro/skillstheir own version, first seen Nov 1, 2026
- sapientsai/panel-mcp-servertheir own version, first seen Nov 1, 2026
- alexander-zuev/agent-skillstheir own version, first seen Oct 13, 2026
Used with
Projects with it also use rust-standards.
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.
motola10Skillrust-standards
Best-practice coding standards for Rust code (manifest: Cargo.toml). Self-contained — covers toolchain/edition, ownership & borrowing, type design, error handling (Result/?, thiserror/anyhow), unsafe, async/concurrency (tokio), security, logging (tracing), clippy/rustfmt, testing, plus a lean axum HTTP service section. Used by the review agents on Rust projects. Do NOT use for other languages.
Also in 3 projects that use this
Other versions13 projects use a version of this.
Word for word · 2
- evrendom/opaline★ 311100% same
- obsessiondb/rudel★ 311100% same
Edited · 0
None found.
Wrote their own version · 11
- BTMuli/TeyvatGuide★ 438same name
- TangleML/tangle-ui★ 104same name
- AlemTuzlak/skills★ 45same name
- LiorCohen/sdd★ 43same name
- jackleekopij/claude-skills★ 3same name
- motola10/claude-code-base★ 1same name
- rkdxodud-tyk/SKILLS★ 1same name
- sapientsai/panel-mcp-server★ 1same name
- alexander-zuev/agent-skills★ 0same name
- gerardbalaoro/skills★ 0same name
1 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 repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/skills/clickhouse-architecture-advisor/AGENTS.mdAGENTS.md
- .claude/skills/clickhouse-best-practices/AGENTS.mdAGENTS.md
- api-testingSkill
- clickhouse-architecture-advisorSkill
- clickhouse-best-practicesSkill
- clickhouse-js-node-codingSkill
- clickhouse-js-node-troubleshootingSkill
- clickhouse-querySkill
- code-architectureSkill
- environment-variablesSkill
- library-docsSkill
- opaline-designSkill
- pr-creationSkill
- testing-bunSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. 0 are common, 8 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
8
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
- Distinctive: line 20
Only export what other packages actually consume:
- Distinctive: line 34
Before adding exports, check what's actually imported by consumer packages.
- Very specific: line 39
Always use static imports at the top of the file.
- Distinctive: line 44
Never use dynamic imports just to import something mid-function when a static import would work.
- Very specific: line 68
When a Zod schema exists, always derive the TypeScript type from it using z.infer.
- Distinctive: line 87
If the type needs fields beyond the schema, extend the inferred type rather than redefining it.
- Very specific: line 90
Never use as or as unknown as type assertions.
- Distinctive: line 105
If you encounter code that seems to require a cast:
- Distinctive: line 108
If copying from existing code with casts, note it needs cleanup
- Very specific: line 128
Use sparingly. Prefer T | undefined over T?
- Very specific: line 146
Use as const objects instead:
- Distinctive: line 157
Never rely on training data for versions.
- Very specific: line 163
Use Promise.all for parallel operations:
- Distinctive: line 171
Create new objects instead of mutating
“Common” is measured: kept by at least 6 in 10 of the 11 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 Standards
Named Exports Only
// ❌ Bad
export default function myFunction() {}
// ✅ Good
export function myFunction() {}Package Exports (Monorepo)
Only export what other packages actually consume:
// ❌ Bad - Exports everything including internal types
export * from "./digest";
// ✅ Good - Explicit public interface
export {
fetchCompoundDigest,
buildCompoundDigestBlocks,
type CompoundDigestEnv,
} from "./digest";Before adding exports, check what's actually imported by consumer packages.
Import Patterns
Prefer Static Imports
Always use static imports at the top of the file. Only use dynamic imports (await import()) when:
- Conditional loading is required (feature flags, environment checks)
- Code splitting is intentional for performance
- Circular dependency breaking is necessary
Never use dynamic imports just to import something mid-function when a static import would work.
Type-Only Imports
For values used only as types, use explicit type-only imports:
// ❌ Bad - Imports value but only uses type
import { MyClass } from './my-class'
type Instance = MyClass
// ✅ Good - Clear intent, no runtime import
import { type MyClass } from './my-class'
type Instance = MyClassNaming Conventions
- Files: kebab-case (
my-component.ts) - Variables/functions: camelCase (
myVariable,myFunction()) - Classes/types/interfaces: PascalCase (
MyClass,MyInterface) - Constants/enum values: ALL_CAPS (
MAX_COUNT) - Generic type parameters: Prefix with
T(TKey,TValue)
Type Safety Rules
Derive Types from Zod Schemas
When a Zod schema exists, always derive the TypeScript type from it using z.infer. Never define a separate interface that duplicates the schema's shape:
// ❌ Bad - Manually duplicates the Zod schema, drifts over time
export interface User {
id: string
name: string
email: string
}
// ✅ Good - Single source of truth
import { type User } from "@rudel/api-routes"
// ✅ Good - Extend when the service needs extra internal fields
import { type User as UserBase } from "@rudel/api-routes"
export interface User extends UserBase {
session_count: number
}If the type needs fields beyond the schema, extend the inferred type rather than redefining it.
No Type Casts
Never use as or as unknown as type assertions. They hide type incompatibilities:
// ❌ Bad - Hides the real problem
const env = context.env as unknown as ExecutorEnv
// ✅ Good - Fix the underlying type mismatch
// Option 1: Properly type the source
const env: ExecutorEnv = context.env
// Option 2: Use type guards for runtime checking
function isExecutorEnv(env: unknown): env is ExecutorEnv {
return typeof env === 'object' && env !== null && 'DB' in env
}If you encounter code that seems to require a cast:
- Investigate why the types don't match
- Fix the source type definitions
- If copying from existing code with casts, note it needs cleanup
Prefer Discriminated Unions
// ✅ Good - Prevents impossible states
type FetchingState<TData> =
| { status: 'idle' }
| { status: 'loading' }
| { status: 'success'; data: TData }
| { status: 'error'; error: Error }
// Handle with switch
switch (state.status) {
case 'success':
console.log(state.data)
break
}Optional Properties
Use sparingly. Prefer T | undefined over T? to force explicit passing:
// ✅ Good
type AuthOptions = {
userId: string | undefined
}Prefer Interfaces for Extending
// ❌ Bad - & operator has terrible performance
type C = A & B
// ✅ Good
interface C extends A, B {}Don't Use Enums
Use as const objects instead:
const sizes = {
xs: 'EXTRA_SMALL',
sm: 'SMALL',
} as const
type Size = keyof typeof sizesInstalling Libraries
Never rely on training data for versions. Always install latest:
pnpm add -D @typescript-eslint/eslint-pluginAsync Operations
Use Promise.all for parallel operations:
const [users, posts] = await Promise.all([fetchUsers(), fetchPosts()])Immutability
- Use readonly arrays
- Use const assertions
- Create new objects instead of mutating
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.

