nitro-ui-typescript
Installation
SKILL.md
- Never use
as Typeor angle-bracket type assertions.as constis allowed. - Define values and APIs so the compiler checks their types from the start. Type annotations (
const value: Type = { ... }) andsatisfies(const value = { ... } satisfies Type) are equally acceptable. Contextual typing from function parameters or return types, generics, and other typing mechanisms are also valid. Choose whichever fits;satisfiesis optional. - Always spell out object property assignments, e.g.
{ spec: spec }rather than{ spec }. This applies to object literals, not destructuring. - Never use
any, explicitly or implicitly. Use concrete types or generics for known values andunknownfor data that has not been validated. - When parsing unknown data, validate it with
zodor an equivalent runtime schema validator and derive the type from the schema.satisfiesdoes not validate runtime data. - Never use non-null assertions (
value!) or definite-assignment assertions (field!: Type). Model optional values and initialization accurately, and narrow or handle missing values explicitly. - Use
.map,for (const value of values), or.forEachto work with elements directly. When an index is also needed, use.entries()or the callback's index parameter. Avoid index-based loops that require unchecked element lookups; when a lookup is necessary, check and handle a missing result. - Prefer a short ternary when both alternatives are simple literals, e.g.
const access = isFinal ? 'public final' : 'open'. For longer or more complex choices, declarelet value: Typewithout an initializer and assign it in explicitif/elsebranches. Do not initialize a fallback only to overwrite it in one branch. This applies to selecting alternatives, not accumulating or transforming a value.