/alemtuzlak-skills:typescript-standardsfrom alemtuzlak-skills
Enforces TypeScript coding standards for app/library code: no generic type arguments at call sites, no overloads, prefer inference, avoid type assertions. Use when writing or reviewing TypeScript.
Ships in alemtuzlak-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Public APIs must feel like JavaScript. Callers write JS. You hide the type work. App or library does not change this.
This skill does not decide where a helper file lives. It does not add debug flags. It does not load other skills.
Load when writing or reviewing TypeScript (.ts, .tsx). App code and library code both use these rules.
Skip test-only files, docs, and CSS.
<T>. If they must, the signature is wrong. Generic definitions are fine.as any, as unknown as X, or cast chains. If you need as, the types are usually wrong.as const only to stop widening (e.g. "open" staying "open", not string). Not a habit.: Foo after ).T | undefined and return early. Do not accept the property.A needs B, C that calls A takes B. Do not take a looser type in C and cast inside C.Design signatures so TypeScript infers from arguments and returned values.
createStore({ count: 0 })
not
createStore<{ count: number }>({ count: 0 })
Do not write the return type on the function. Infer it from return.
type or interface, search the current package and neighbors. Use or extend the one that is the same shape. Do not grep the whole monorepo for a one-file type.typeof / extra unions. function f(b: string) not function f(b: string | undefined) { if (typeof b === "string") ... }.arr.map(a => ...) infers a. Do not write arr.map((a: Foo): Bar => ...).filter / narrow with a type predicate: (value): value is X. Do not leave the array as a loose union after a filter that is meant to narrow.fn(url, true)) or when there is more than one extra. add(a, b) stays two values.X | null, return X | null. Do not return X | undefined and then x ?? null. Pick null or undefined for that path and keep it.const isOpenGold = order.status === "open" && order.tier === "gold"
if (isOpenGold) { /* ... */ }
Do not dump a long && / || chain into if (...).
if over nested else. For several missing values, one if with ||:if (a === null || a === undefined || b === null) return
Then use a and b as defined. Do not write if (a !== null || a !== undefined) (that check is always true).
switch. Use a never default (or no default with a union the compiler checks). Do not write a ladder of if / else if.const values = getValues(input)
for (const value of values) { /* ... */ }
Do not call getValues in the for header.
{ ...a, b: { ...c } }. Do not convert fields in the spread (c.x === undefined ? null : c). If every call site converts format A to format B, the data model failed. Convert once at a boundary, or change the types so both sides match.Banned: as any, as unknown as X, double casts, (x as any).code.
Allowed:
as const only when a literal widens (string/number/array) and you need the literal type.return x as T only when TypeScript cannot infer a generic return (e.g. JSON.parse into T). Still do not write : T on the function.Custom Error subclasses only at a boundary callers catch (exported function, SDK, route handler). Internal helpers can throw new Error(...). Document on that boundary (TSDoc) what can throw and which class to catch.
No export *. Inside the repo, import from the real file. The package public entry (index.ts behind exports) can re-export named symbols only.
return. No overloads. No call-site <T>. No return annotation.B, this function takes B.as const only for widening. Do not add return type annotations.for. Keep spreads simple. Match null vs undefined to the caller.export *.instanceof a specific error, use a custom class.new Error is enough..ts / .tsx → this skill.typeof / early return because it is missing → Hard gate 6. Make it required, or do not take it.as needed → Casts. If not an allowed case, fix the types.debug / logger on config → not this skill.| Signal | What it means | Do instead |
|---|---|---|
fn<Foo>(...) at the call site | Signature does not infer | Change the definition so args carry the type. |
function fn(...): A plus two more function fn | Overloads | One signature, conditional return. |
function fn(): Order | Return type annotated | Drop : Order. Infer from return. |
as unknown as X inside a wrapper to call A | Types not piped | The wrapper takes the same type A takes. |
as unknown as X | Types were abandoned | Fix the types. |
"open" as const on every string | Habit | Use as const only when the type is otherwise string. |
fn(url, true) | Magic boolean | fn(url, { retry: true }). |
add({ b: 2 }) for two numbers | Options object overused | add(a, b). |
if (a.x === "a" && a.y === 2 || z) | Unnamed condition | const isReady = ... then if (isReady). |
b: string | undefined then typeof b === "string" | Runtime used as a type | b: string. |
id?: string then if (!id) return because the body needs id | Optional that cannot be optional | Required id: string. |
return x ?? null after X | undefined | Nullish mismatch | Return X | null from the start (or undefined if that is the contract). |
for (const x of getValues(a)) | Work hidden in the header | const values = getValues(a) then for. |
arr.map((a: Foo): Bar => | Types forced on the callback | Constrain arr. Let a infer. |
filter that still leaves T | undefined | No predicate | function isDefined<T>(v: T | undefined): v is T. |
Spread with === undefined ? null inside | Conversion in the spread | Spread as-is, or one mapper at a boundary. |
Three if (status === in a row | Missing exhaustive switch | switch (status) over the union. |
export * from './foo' | Barrel | Direct import, or named re-export at package entry. |
| Public export with no TSDoc | Users cannot read the contract | What it does, args, how to call it. |
| Custom class for an internal throw | Extra type | throw new Error(...). |
Creating packages/shared from this skill | Placement | Not this skill. |
Adding debug?: boolean to every config | Old rule | Not this skill. |
| Fixing casts in a file you did not open | Drive-by | Procedure 2, this file only. |
parse<T> / JSON.parse): return result as T is the allowed exception. Do not write : T on the function. Do not add as any on the way there.null, this function returns undefined: change this function’s return. Do not patch with ?? at every call site.See patterns.md for before/after code.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (alemtuzlak/skills) — no native marketplace selected
npx claudepluginhub p/alemtuzlak-alemtuzlak-skills41 skills in this plugin
/accessible-htmlUse whenever writing, editing, or reviewing markup or UI code — HTML, JSX/TSX, Vue/Svelte/Angular templates, web components, email HTML, or CSS that affects text size, color, focus, motion, layout order, or hit area. Also use when adding a button, link, form, input, modal, dropdown, menu, tabs, tooltip, toast, icon, image, iframe, table, list, keyboard shortcut, drag interaction, or any click handler; when a design has to become code; and when the user says "accessibility", "a11y", "WCAG", "screen reader", "keyboard navigation", "focus", "aria", "contrast", "alt text", or "axe"./amazing-videoUse only when the user runs /amazing-video or names the amazing-video skill. The text after the command is the video topic, such as a PR, a feature, or an API./Other plugins' skills for the same job