agentleFS
laststancelaststance/skills/skills/type-expand/SKILL.md

type-expand

Skill1 starsChanged 56 days agoMITView on GitHub

Expand TS aliases to shapes

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When running this skill in Codex, translate Claude Code-only primitives before acting: AskUserQuestion -> chat/request_user_input, …

    line 9
  2. Distinctive:

    Use this skill to inspect the real shape of complex TypeScript types when IDE hover is not enough.

    line 18
  3. Distinctive:

    Use one of these:

    line 22
  4. Distinctive:

    Run the expander script:

    line 30
  5. Distinctive:

    If project root cannot be inferred, pass tsconfig path:

    line 38
  6. Distinctive:

    If part of the type cannot be fully resolved, keep best-effort expansion and annotate unresolved fragments inline.

    line 52
  7. Distinctive:

    Prefer concrete object property expansion over alias names.

    line 56
  8. Distinctive:

    Keep property names stable and readable.

    line 65
  9. Very specific:

    Use unknown for recursion/depth guard fallbacks.

    line 67

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Type Expand

Codex Compatibility

When running this skill in Codex, translate Claude Code-only primitives before acting: AskUserQuestion -> chat/request_user_input, TodoWrite -> update_plan, Task/TaskCreate/TeamCreate/SendMessage -> spawn_agent/send_input/wait_agent when available and allowed, and EnterPlanMode/ExitPlanMode -> a concise chat plan plus explicit approval. Resolve Read/Write/Edit/Bash/WebSearch/WebFetch to Codex file/shell/web tools, and map ~/.claude/... paths to ~/.agents/... or ~/.codex/... unless the task explicitly targets Claude Code.

Cursor Compatibility

When running this skill in Cursor Agent, translate Claude Code-only primitives before acting: AskUserQuestion -> AskQuestion; TodoWrite -> Cursor TodoWrite or an equivalent checklist; Task/TaskCreate/TeamCreate/SendMessage/multi-agent flows -> Cursor Task (subagents), parallel Tasks, or run_in_background when allowed (TeamCreate/SendMessage may have no exact match); EnterPlanMode/ExitPlanMode -> Plan mode (SwitchMode / CreatePlan) plus explicit user approval. Resolve Read/Write/Edit/StrReplace/Bash/web/search/MCP via Cursor Composer or Agent equivalents. MCP names written as mcp__server__tool typically map to call_mcp_tool with configured server identifiers. Map ~/.claude/... to ~/.cursor/skills/, .cursor/skills/, and .cursor/rules/ unless the task explicitly targets Claude Code.

Purpose

Use this skill to inspect the real shape of complex TypeScript types when IDE hover is not enough.

Inputs

Use one of these:

  • Selected code that includes a target type alias.
  • filePath + typeName.
  • A direct alias snippet (export type X = ...).

Workflow

  1. Identify target alias name and source file.
  2. Run the expander script:
pnpm exec tsx ~/.agents/skills/type-expand/scripts/expand-type.ts --file <filePath> --type <typeName>

(Claude Code: ~/.claude/skills/...、Cursor: ~/.cursor/skills/... または .cursor/skills/... に symlink される)

  1. If project root cannot be inferred, pass tsconfig path:
pnpm exec tsx ~/.agents/skills/type-expand/scripts/expand-type.ts --file <filePath> --type <typeName> --project <tsconfigPath>
  1. Return output in this format:
export type <TypeName> =
| <expanded object type>
| <expanded object type>
  1. If part of the type cannot be fully resolved, keep best-effort expansion and annotate unresolved fragments inline.

Expansion Policy

  • Prefer concrete object property expansion over alias names.
  • Recursively expand unions/intersections.
  • Expand instantiated generics where type arguments are known.
  • Resolve conditional types (extends) and infer-derived parts when checker provides concrete results.
  • Flatten common utility-type transformations when symbol/property info is available (Pick, Omit, Partial, Required, Readonly, Record, Exclude, Extract, NonNullable).
  • Enforce depth and cycle guards to prevent runaway expansion.

Output Style

  • Keep property names stable and readable.
  • Preserve optional (?) and readonly modifiers when detectable.
  • Use unknown for recursion/depth guard fallbacks.

Additional Resource

  • See reference.md for command examples and troubleshooting.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.