typescript

Installation
SKILL.md

Purpose

This skill defines how to write and structure TypeScript so that code is type-safe, readable, and consistent across Alpha's projects.

General Principles

  • Braces for every conditional body: Always write if, else if, and else bodies as multiline { ... } blocks, even for a single call, assignment, or early return. This applies inside callbacks and nested functions too; an enclosing arrow-function block does not replace the conditional's own braces.
  • Statement spacing: Separate an entire if/else if/else chain from adjacent statements with a blank line before and after it. Separate awaited statements (including declarations initialized with await) from adjacent non-awaited statements with a blank line; consecutive awaited statements may remain together. Do not add padding at the start or end of a containing block. See Statement Spacing.
  • Arrow return style: Use a concise arrow body (implicit return) only when it is both simple and short. If it is complex or too long, use a block body with an explicit return. Judge length using the whole containing statement, including indentation and surrounding call syntax. Object/array literals and multiline expressions require explicit returns. See Arrow Function Returns.
  • Multiline objects: Write every non-empty object literal with one property per line and a trailing comma, including objects passed as function or method arguments. This applies even to a single shorthand property: findOne({ id }) and delete({ id }) are violations; put id, on its own line. It also applies to options objects passed to third-party or framework APIs, nested objects, and objects inside chained calls or schema definitions: .references(() => series.id, { onDelete: 'cascade' }) is a violation; put onDelete: 'cascade', on its own line. Formatters preserve expanded objects but never expand inline ones, so this must be applied by hand. See Style and Formatting.
  • @alphacifer/tsconfig is required. Every project must extend it; do not override or loosen options—fix code instead unless the project documents an exception.
  • @alphacifer/biome is required when Biome is used. If a project has Biome configured, it must extend Alpha's Biome config instead of maintaining unrelated local lint or format rules.
  • Prefer types over any: Use precise types, generics, and inference; use unknown and narrow when the type is dynamic.
  • Explicit over implicit: Prefer explicit return types on public APIs and exports; rely on inference for locals and private helpers.
  • Small, focused modules: Prefer small files and single responsibility; use barrel exports only when they clearly simplify the public API.
  • Semantic property ordering: In interfaces, object-shaped types, and object literals (including function arguments), order properties by identifiers, core domain data, system/metadata fields, timestamps, then optional/extension fields. Keep related fields adjacent within each group, place all optional properties last, and do not sort by key length or alphabetically at the expense of meaning. Keep property blocks continuous without blank lines between groups. See Style and Formatting for details and examples.
  • Public parameter objects: Project-owned exported functions and public instance methods with inputs take one named interface parameter object. Keep zero-argument APIs parameterless. Preserve signatures required by framework or third-party contracts, including CQRS handlers, rather than wrapping their arguments or changing the contract. Destructure first-level properties in the signature when using individual properties; keep the object intact when it must be passed onward or its identity or behavior matters. Keep private helpers simple.

Required Workflow

Installs
41
Repository
zgid123/skills
First Seen
Mar 15, 2026