Agent skill

Typescript Patterns

by cohen-liel in cohen-liel/hivemind

TypeScript best practices and patterns. An agent skill from cohen-liel/hivemind.

Apache-2.0Auto-check passed

Install Typescript Patterns

skills CLI
$ npx skills add cohen-liel/hivemind --skill typescript-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install cohen-liel/hivemind typescript-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/cohen-liel/hivemind.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/typescript-patterns .claude/skills/typescript-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
typescript-patterns
GitHub stars
110
Token cost
~807 tokens
SKILL.md length
99 words
Files
1
Skills in repo
33
Repo updated
First seen
Licence
Apache-2.0

At a glance

TypeScript best practices and patterns. An agent skill from cohen-liel/hivemind.

  • Writing TypeScript code
  • SKILL.md covers Strict Config (tsconfig.json), Type Patterns and Rules
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Working with generics

What it does

Typescript Patterns is an agent skill from cohen-liel/hivemind. TypeScript best practices and patterns. Use when writing TypeScript code, defining types, working with generics, or converting JavaScript to TypeScript.

Its SKILL.md is about 810 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It works with TypeScript and JavaScript. The repository describes itself as: One prompt. A full AI engineering team. Go lie on the couch. 🧠. The licence is Apache-2.0.

When your agent uses it

  • Writing TypeScript code
  • Working with generics
  • Converting JavaScript to TypeScript

Example prompts

  • “/typescript-patterns”

What it can do on your machine

Read from SKILL.md and the folder at commit 918dd9b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript and json).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Typescript Patterns loads about 807 tokens when it runs. Until then it costs about 43 tokens; SKILL.md has 99 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~43
When it runs · the whole SKILL.md, loaded when a task matches
~807

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from cohen-liel/hivemind at commit 918dd9b, republished under its Apache-2.0 licence (© cohen-liel). 99 words, ~807 tokens.

Download SKILL.mdSave it as .claude/skills/typescript-patterns/SKILL.md (or your agent's skills folder).
name
typescript-patterns
description
TypeScript best practices and patterns. Use when writing TypeScript code, defining types, working with generics, or converting JavaScript to TypeScript.

TypeScript Patterns

Strict Config (tsconfig.json)

json
{
  "compilerOptions": {
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "noImplicitReturns": true,
    "exactOptionalPropertyTypes": true,
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "baseUrl": ".",
    "paths": { "@/*": ["src/*"] }
  }
}

Type Patterns

Discriminated Union (never use string + optional fields)
typescript
// BAD
type ApiResponse = { success: boolean; data?: User; error?: string }

// GOOD
type ApiResponse =
  | { success: true; data: User }
  | { success: false; error: string }

function handle(res: ApiResponse) {
  if (res.success) {
    console.log(res.data.email)  // TypeScript knows data exists
  } else {
    console.error(res.error)     // TypeScript knows error exists
  }
}
Generic Repository
typescript
interface Repository<T, ID> {
  findById(id: ID): Promise<T | null>
  findAll(): Promise<T[]>
  create(data: Omit<T, 'id' | 'createdAt'>): Promise<T>
  update(id: ID, data: Partial<T>): Promise<T>
  delete(id: ID): Promise<void>
}
Branded Types (prevent mixing IDs)
typescript
type UserId = number & { readonly _brand: 'UserId' }
type PostId = number & { readonly _brand: 'PostId' }

const userId = 123 as UserId
const postId = 456 as PostId

function getUser(id: UserId): Promise<User> { ... }
getUser(postId)  // TypeScript error! Can't pass PostId as UserId
Utility Types
typescript
// Pick only what you need
type UserSummary = Pick<User, 'id' | 'name' | 'email'>

// Make all optional for updates
type UserUpdate = Partial<Pick<User, 'name' | 'email'>>

// Require specific fields
type UserCreate = Required<Pick<User, 'email' | 'password'>> & Partial<Pick<User, 'name'>>

// Readonly for immutable data
type Config = Readonly<{ apiUrl: string; timeout: number }>

// Record for maps
const rolePermissions: Record<UserRole, Permission[]> = { ... }
Result Type (instead of throwing everywhere)
typescript
type Result<T, E = Error> =
  | { ok: true; value: T }
  | { ok: false; error: E }

async function safeParseJson<T>(text: string): Promise<Result<T>> {
  try {
    return { ok: true, value: JSON.parse(text) as T }
  } catch (e) {
    return { ok: false, error: e as Error }
  }
}
Type Guards
typescript
function isUser(obj: unknown): obj is User {
  return typeof obj === 'object' && obj !== null &&
    'id' in obj && 'email' in obj && typeof (obj as User).email === 'string'
}

Rules

  • Enable strict: true — never disable it for individual files
  • Never use any — use unknown and narrow with type guards
  • Prefer interface for object shapes, type for unions/intersections
  • Use discriminated unions over optional fields
  • Type return values of exported functions explicitly
  • Use as const for literal arrays/objects that shouldn't be widened
  • Avoid type assertions (as X) — use type guards instead
  • Prefer readonly properties for data that shouldn't change

© cohen-liel, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/typescript-patterns of cohen-liel/hivemind.

Open the folder on GitHubat commit 918dd9b

Compare with similar skills

Typescript Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Typescript Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Typescript Patterns this skillcohen-liel/hivemind110—~807Automated safety check: PassApache-2.0
Code Review ChecklistshareAI-lab/learn-claude-code78k5 repos~1.1kAutomated safety check: PassMIT
Install Anti-Slop Oxlint Rulesdmmulroy/anti-slop5.3k1 repos~2.2kAutomated safety check: PassMIT
Install Anti Sloptrycompai/crm11k1 repos~881Automated safety check: PassMIT
Bun DevelopmentGabrielMartinMoran/mind14812 repos~3.5kAutomated safety check: NotesMIT
Generate Release Notesteambit/bit18k—~2.2kAutomated safety check: PassCustom licence

Similar skills

  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 5 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Installs, updates or migrates the vendored anti-slop Oxlint plugin in a repository, keeping local rule changes and the plugin's license and provenance files.

    5.3k GitHub starsUsed in 1 repo~2.2k tokens
    DevelopmentAuto-check passed
  • Install Anti Slop

    trycompai/crm

    Install and configure the anti-slop Oxlint plugin in a local TypeScript or JavaScript repository.

    11k GitHub starsUsed in 1 repo~881 tokens
    Writing & ContentAuto-check passed
  • Bun Development

    GabrielMartinMoran/mind

    Modern JavaScript/TypeScript development with Bun runtime. An agent skill from GabrielMartinMoran/mind.

    148 GitHub starsUsed in 12 repos~3.5k tokens
    Auto-check: notes
  • Generate comprehensive release notes for Bit from git commits and pull requests.

    18k GitHub stars~2.2k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Hot Monitor

    liyupi/yupi-hot-monitor

    AI hotspot monitoring and trending topic discovery across multiple sources (Bing, Google, DuckDuckGo, HackerNews, Sogou, Bilibili, Weibo, Twitter).

    718 GitHub starsUsed in 1 repo~1.2k tokens
    DatabasesAuto-check passed

More from cohen-liel/hivemind

All 33 skills in this repo
  • API Design

    cohen-liel/hivemind

    REST API design principles and best practices. An agent skill from cohen-liel/hivemind.

    110 GitHub starsUsed in 1 repo~857 tokens
    Auto-check passed
  • Graphql API

    cohen-liel/hivemind

    GraphQL API design and implementation patterns. An agent skill from cohen-liel/hivemind.

    110 GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • Async Python

    cohen-liel/hivemind

    Python asyncio patterns for high-performance async code. An agent skill from cohen-liel/hivemind.

    110 GitHub stars~992 tokensUpdated 5 mo ago
    Auto-check passed
  • Celery Tasks

    cohen-liel/hivemind

    Celery background task patterns for Python apps. An agent skill from cohen-liel/hivemind.

    110 GitHub stars~1.1k tokensUpdated 5 mo ago
    Auto-check passed
  • Docker Deployment

    cohen-liel/hivemind

    Docker, docker-compose, and deployment configuration best practices.

    110 GitHub stars~674 tokensUpdated 5 mo ago
    Auto-check passed
  • E2E Testing

    cohen-liel/hivemind

    End-to-end testing patterns with Playwright. An agent skill from cohen-liel/hivemind.

    110 GitHub stars~1.2k tokensUpdated 5 mo ago
    Auto-check passed

Questions about Typescript Patterns

What does Typescript Patterns do?

TypeScript best practices and patterns. An agent skill from cohen-liel/hivemind. Typescript Patterns is an agent skill from cohen-liel/hivemind. TypeScript best practices and patterns.

When should I use Typescript Patterns?

Typescript Patterns fits situations like: writing TypeScript code; working with generics; converting JavaScript to TypeScript.

How do I install Typescript Patterns in Claude Code?

Run `npx skills add cohen-liel/hivemind --skill typescript-patterns -a claude-code`. Or copy the skill folder (.claude/skills/typescript-patterns in cohen-liel/hivemind) into .claude/skills/typescript-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Typescript Patterns in Codex?

Run `npx skills add cohen-liel/hivemind --skill typescript-patterns -a codex`. Or copy the skill folder (.claude/skills/typescript-patterns in cohen-liel/hivemind) into .agents/skills/typescript-patterns in your project. Codex loads it when a task matches its description.

Can I use Typescript Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add cohen-liel/hivemind --skill typescript-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/typescript-patterns, .gemini/skills/typescript-patterns, .github/skills/typescript-patterns and .opencode/skills/typescript-patterns in your project.

What does Typescript Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Typescript Patterns is instructions for the agent only.

Does Typescript Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Typescript Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Typescript Patterns use?

Typescript Patterns is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Typescript Patterns use?

About 807 tokens (SKILL.md is roughly 3.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Typescript Patterns?

Skills that share tags, products or a category with Typescript Patterns: Code Review Checklist (shareAI-lab/learn-claude-code, 78k stars), Install Anti-Slop Oxlint Rules (dmmulroy/anti-slop, 5.3k stars), Install Anti Slop (trycompai/crm, 11k stars) and Bun Development (GabrielMartinMoran/mind, 148 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Typescript Patterns?

cohen-liel (a GitHub user) maintains it in cohen-liel/hivemind, which has 110 GitHub stars. The repository holds 33 skills in this directory. The repository was last updated on April 18, 2026.

Source: cohen-liel/hivemind on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.