Agent skill

Type Optimizer

by romeerez in romeerez/orchid-orm

A skill your agent uses when need to optimize TypeScript types.

MITAuto-check passedDatabases

Install Type Optimizer

skills CLI
$ npx skills add romeerez/orchid-orm --skill type-optimizer -a claude-code

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

GitHub CLI
$ gh skill install romeerez/orchid-orm type-optimizer --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/romeerez/orchid-orm.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/type-optimizer .claude/skills/type-optimizer && 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
type-optimizer
GitHub stars
543
Token cost
~798 tokens
SKILL.md length
342 words
Files
6
Skills in repo
13
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when need to optimize TypeScript types.

  • Need to optimize TypeScript types
  • SKILL.md covers Workflow, Optimization Example Style and Adding Optimizations
  • Runs JavaScript scripts from its folder; calls node
  • Tasks that involve Type safety

What it does

Type Optimizer is an agent skill from romeerez/orchid-orm. Use when need to optimize TypeScript types.

Its SKILL.md is about 800 tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files (for example `top-type-optims.js`, `top-type-optims.test.js` and `type-optim.md`).

It sits in Databases, covering Type safety and ORMs and data access. The licence is MIT.

When your agent uses it

  • Need to optimize TypeScript types
  • Tasks that involve Type safety
  • Tasks that involve ORMs and data access

Example prompts

  • “/type-optimizer”

Requirements

  • Node.js

What it can do on your machine

Read from SKILL.md and the folder at commit 7d4927a. 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

    Ships script files (JavaScript), which the agent can run.

    Shell commands in SKILL.md call:

    • node

    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

Type Optimizer loads about 798 tokens when it runs. Until then it costs about 15 tokens; SKILL.md has 342 words of instructions outside code blocks.

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

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 romeerez/orchid-orm at commit 7d4927a, republished under its MIT licence (© romeerez). 342 words, ~798 tokens.

Download SKILL.mdSave it as .claude/skills/type-optimizer/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
type-optimizer
description
Use when need to optimize TypeScript types.

Type Optimizer

Workflow

Optimize from the code in front of you. Start with proven ideas from type-optim.md, but treat each one as a candidate that must fit the current code.

  • Record a baseline with --extendedDiagnostics.
  • Run node .agents/skills/type-optimizer/top-type-optims.js to get the optimization list sorted by historical mean Instantiations savings.
  • Read .agents/skills/type-optimizer/type-optim.md.
  • Try one optimization at a time in the sorted order.
  • Skip an optimization when the current code does not have the matching shape.
  • Re-run types --extendedDiagnostics after each idea.
  • Submit every measured attempt immediately with node .agents/skills/type-optimizer/update-type-optim-stats.js <optimization-number> <instantiations-diff>.
  • Use previous Instantiations - new Instantiations for <instantiations-diff>: positive means the attempt improved, negative means it regressed.
  • Keep only changes that pass and reduce Instantiations.
  • After submitting a negative diff, revert that attempted change before trying the next idea.
  • Undo neutral or worse changes unless they improve clarity enough for the user to explicitly accept.
  • Preserve public API behavior unless the user explicitly allows changing it.
  • Prefer type-only edits. Do not change runtime code unless the task explicitly asks for it.

The saved list is not a blind checklist: while trying it, judge every candidate against the code in front of you. After the list ends, stop using it as guidance and focus solely on the code at hand to find new optimization ideas.

Optimization Example Style

Examples in type-optim.md must be abstract and obvious. They should teach the type-system shape, not the project feature where the idea was first found.

  • Use plain names like Obj, Key, Value, Item, Input, Output.
  • Avoid domain names like relations, columns, tables, endpoints, scopes, migrations, or validation.
  • Keep only the type machinery needed to show why the bad shape costs more and why the good shape is cheaper.
  • Put bad before good, so the reader sees the problem before the transformation.

bad:

ts
interface TargetRef<Id extends string, Keys extends string[]> {
  id: Id;
  keys: Keys;
}

use<
  Id extends string,
  Shape extends Record<string, unknown>,
  Keys extends (keyof Shape & string)[],
>(fn: () => FullEndpoint<Id, Shape, Keys>): Ref<Id, Keys>;

good:

ts
interface Needed<A, B> {
  first: A;
  second: B;
}

use<A, B>(fn: () => Needed<A, B>): Output<A, B>;

Adding Optimizations

When the documented list is exhausted, try creative undocumented type optimization attempts. If a new idea reduces Instantiations by more than 1000 and passes checks, append it to type-optim.md, then call update-type-optim-stats.js with the new number and measured diff.

Use this template:

md
### <next-number>. <Imperative Title>

**stats**: {}

**when**: <code situation where it applies>

**how**: <concise transformation>

**bad**:

```ts
<costly abstract shape>
```

**good**:

```ts
<optimized abstract shape>
```

© romeerez, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files in .agents/skills/type-optimizer of romeerez/orchid-orm.

  • SKILL.md
  • top-type-optims.js
  • top-type-optims.test.js
  • type-optim.md
  • update-type-optim-stats.js
  • update-type-optim-stats.test.js

Open the folder on GitHubat commit 7d4927a

Compare with similar skills

Type Optimizer 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.

Type Optimizer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Type Optimizer this skillromeerez/orchid-orm543—~798Automated safety check: PassMIT
Prisma Helpershepherdjerred/monorepo112—~3.6kAutomated safety check: PassGPL-3.0
Typescriptericrisco/rsc-harness156—~2.8kAutomated safety check: PassMIT
PSL Syntax Tree Layersprisma/orm48k—~2.3kAutomated safety check: PassApache-2.0
Mastering Python SkillSpillwaveSolutions/agent-brain120—~1.4kAutomated safety check: NotesMIT
Drizzle Ormgrowupanand/ConvoForm1011 repos~2.7kAutomated safety check: PassApache-2.0

Similar skills

  • Prisma Helper

    shepherdjerred/monorepo

    Prisma ORM for type-safe database access - schema design, migrations, queries, relations, and connection management When user works with Prisma, database schemas, migrations, Prisma Client queries…

    112 GitHub stars~3.6k tokensUpdated today
    DatabasesAuto-check passed
  • Typescript

    ericrisco/rsc-harness

    A skill your agent uses when writing or fixing TypeScript type code (.ts/.tsx/.d.ts), modeling data with generics/unions/branded types, diagnosing narrowing failures, or configuring tsconfig and the…

    156 GitHub stars~2.8k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Official

    Explains which of the three PSL syntax tree layers to use with Prisma's parser output, and how to move between them without hand-written walks.

    48k GitHub stars~2.3k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Mastering Python Skill

    SpillwaveSolutions/agent-brain

    Modern Python coaching covering language foundations through advanced production patterns.

    120 GitHub stars~1.4k tokensUpdated 18 days ago
    DevelopmentAuto-check: notes
  • Drizzle Orm

    growupanand/ConvoForm

    Type-safe SQL ORM for TypeScript with zero runtime overhead. An agent skill from growupanand/ConvoForm.

    101 GitHub starsUsed in 1 repo~2.7k tokens
    DatabasesAuto-check passed
  • Drizzle Orm Expert

    davila7/claude-code-templates

    Expert in Drizzle ORM for TypeScript — schema design, relational queries, migrations, and serverless database integration.

    32k GitHub starsUsed in 3 repos~2.6k tokens
    DatabasesAuto-check passed

More from romeerez/orchid-orm

All 13 skills in this repo
  • Spec

    romeerez/orchid-orm

    A skill your agent uses when the user prompts "write spec" or "make spec".

    543 GitHub stars~2k tokensUpdated today
    Auto-check passed
  • Task List

    romeerez/orchid-orm

    A skill your agent uses when user asks to write a task list, not to do a task

    543 GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • Code Doc

    romeerez/orchid-orm

    A skill your agent uses when the user prompts "code doc" to create or update internal Orchid ORM code documentation from changes/ specs, short-code feature folders, or existing implementation code.

    543 GitHub stars~2.2k tokensUpdated today
    Auto-check passed
  • Ideas

    romeerez/orchid-orm

    A skill your agent uses when the user prompts "write ideas" or "make ideas".

    543 GitHub stars~2.4k tokensUpdated today
    Auto-check passed
  • Implemenation Note

    romeerez/orchid-orm

    A skill your agent uses when the user prompts "implementation note" for an existing change idea.

    543 GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • Refine

    romeerez/orchid-orm

    A skill your agent uses when the user prompts "refine design".

    543 GitHub stars~2.2k tokensUpdated today
    Auto-check passed

Questions about Type Optimizer

What does Type Optimizer do?

A skill your agent uses when need to optimize TypeScript types. Type Optimizer is an agent skill from romeerez/orchid-orm. Use when need to optimize TypeScript types.

When should I use Type Optimizer?

Type Optimizer fits situations like: need to optimize TypeScript types; tasks that involve Type safety; tasks that involve ORMs and data access.

How do I install Type Optimizer in Claude Code?

Run `npx skills add romeerez/orchid-orm --skill type-optimizer -a claude-code`. Or copy the skill folder (.agents/skills/type-optimizer in romeerez/orchid-orm) into .claude/skills/type-optimizer in your project. Claude Code loads it when a task matches its description.

How do I install Type Optimizer in Codex?

Run `npx skills add romeerez/orchid-orm --skill type-optimizer -a codex`. Or copy the skill folder (.agents/skills/type-optimizer in romeerez/orchid-orm) into .agents/skills/type-optimizer in your project. Codex loads it when a task matches its description.

Can I use Type Optimizer 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 romeerez/orchid-orm --skill type-optimizer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/type-optimizer, .gemini/skills/type-optimizer, .github/skills/type-optimizer and .opencode/skills/type-optimizer in your project.

What does Type Optimizer need to run?

Going by SKILL.md and its folder, Type Optimizer needs JavaScript for the scripts in its folder and the command-line tools its instructions call (node). Our summary lists: Node.js.

Does Type Optimizer 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 Type Optimizer 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 Type Optimizer use?

Type Optimizer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Type Optimizer use?

About 798 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 Type Optimizer?

Skills that share tags, products or a category with Type Optimizer: Prisma Helper (shepherdjerred/monorepo, 112 stars), Typescript (ericrisco/rsc-harness, 156 stars), PSL Syntax Tree Layers (prisma/orm, 48k stars) and Mastering Python Skill (SpillwaveSolutions/agent-brain, 120 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Type Optimizer?

romeerez (a GitHub user) maintains it in romeerez/orchid-orm, which has 543 GitHub stars. The repository holds 13 skills in this directory. The repository was last updated on October 7, 2026.

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