Index of every page on this site: llms.txt
All skills
harlan-zw avatar

/ts-design-patterns

@2a530d0
Run it yourself

Apply Harlan's Effect-inspired TypeScript design principles. Use for non-trivial state, errors, dependencies, module boundaries, or API design, and after a production error, where a guard at the failure site would leave the category open.

  • 1 file
  • 1.8 KB
  • MIT
  • Updated last month
  • GitHub
Use this Skill: https://skilld.dev/gh/harlan-zw/harlan-agent-kit/ts-design-patterns

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈65 tokens for metadata: the name and description. ≈376 when used: this file.

Description uses 3.2% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈259 characters, or 3.2%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

<!-- The six principles below are mirrored in agent-context/context.md. Run scripts/check-agent-context.sh after editing them. -->

TypeScript Design Patterns

Effect-inspired, without an Effect dependency.

  • Make illegal states unrepresentable. _tag discriminated unions, not optional-field + boolean soup.
  • Errors as values. Tagged Ok | Err for expected domain failures, so signatures show them. Unexpected and infra errors propagate; prefer .catch() over try/catch when handling is needed.
  • No silent catches. .catch(() => null) hides failures. Handle (log, surface, fallback with reason) or propagate. Swallow only genuinely ignorable failures, with a comment saying so.
  • Parse, don't validate. Parse untrusted input once at the boundary into a precise type; trust it inward.
  • Explicit dependencies. Pass clients, config, clock as args. No hidden singletons, no import-time side effects.
  • Pure core, effectful shell. Side effects at the edges, decision logic pure data-in/data-out.
  • Design out the bug. After a production error, find the design that kills the whole category. Prefer a type or structural change; guard at the failure site only when no design change exists.

As a review rubric

When reviewing TS, score against each principle and report only violations that change behaviour or block testing. A class that wraps state with no illegal-state risk is a style note, not a finding; a catch that swallows a network failure is a finding.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 2a530d0. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated last month

README badge

README badge for harlan-zw/harlan-agent-kit/ts-design-patterns