Agent skill

Type Namespace Pattern

by paralleldrive in paralleldrive/aidd

Sets a folder and file layout for TypeScript types so each type has one import surface, one file per exported function or constant, and tree-shakeable consumers.

MITAuto-check passedDevelopment

Install Type Namespace Pattern

skills CLI
$ npx skills add paralleldrive/aidd --skill aidd-namespace -a claude-code

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

GitHub CLI
$ gh skill install paralleldrive/aidd aidd-namespace --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/paralleldrive/aidd.git skills-src && mkdir -p .claude/skills && cp -r skills-src/ai/skills/aidd-namespace .claude/skills/aidd-namespace && 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
aidd-namespace
GitHub stars
384
Token cost
~1.1k tokens
SKILL.md length
218 words
Files
2
Skills in repo
35
Repo updated
First seen
Licence
MIT

At a glance

Sets a folder and file layout for TypeScript types so each type has one import surface, one file per exported function or constant, and tree-shakeable consumers.

  • Creating a new type with helper functions and constants
  • SKILL.md covers File naming (utilities and…, Constant types, Constraints and Consumers, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Refactoring a types folder into one folder per type

What it does

The skill sets a convention where every type lives in its own folder in the types layer, with one public import surface: a file named after the type that exports a single type alias and a namespace re-export. Functions and constants in that folder each get their own file named after the export, with no type prefix, so under `types/point/` the files `length.ts`, `add.ts` and `normalize.ts` each export the like-named function.

Other rules say that code outside a namespace folder must not import from `public.js`, that helpers for external types such as String go in an extension namespace named `StringX`, and that schema-backed types are either derived with `Schema.ToType` or kept as a hand-written alias checked against the schema at compile time. The skill takes precedence over older files that do not follow it: new work and changes must conform, and legacy structure is not to be copied.

When your agent uses it

  • Creating a new type with helper functions and constants
  • Refactoring a types folder into one folder per type
  • Defining a type whose source of truth is a schema
  • Reviewing imports to catch consumers reaching into a type's internals

Example prompts

  • “Add a Money type with add and subtract helpers, following the namespace pattern.”
  • “Refactor src/types/ so that every type has a single import surface.”
  • “Derive the PlayerMark type from its schema and keep the namespace layout.”

What it can do on your machine

Read from SKILL.md and the folder at commit 9a7c8e3. 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 sudolang and typescript).

    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 Namespace Pattern loads about 1.1k tokens when it runs. Until then it costs about 72 tokens; SKILL.md has 218 words of instructions outside code blocks.

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

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 paralleldrive/aidd at commit 9a7c8e3, republished under its MIT licence (© paralleldrive). 218 words, ~1,126 tokens.

Download SKILL.mdSave it as .claude/skills/aidd-namespace/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
aidd-namespace
description
Ensures types and related functions are authored and consumed in a modular, discoverable, tree-shakeable pattern. Use when creating types, refactoring type folders, defining schemas, importing types, or when the user mentions type namespaces, constants, or Schema.ToType.

Type namespace pattern

Single import surface per type: <type-name>/<type-name>.ts. Each constant or function lives in <exported-name>.ts; namespace re-export from public.js. Types live in the types/ layer per structure.

Precedence: This skill defines the canonical pattern. Existing files may not yet follow it; all new work and changes must conform. Do not copy legacy structure when adding or editing code.

File naming (utilities and constants)

Inside a type folder, name each file after the single export it provides. The folder already identifies the type, so no type prefix in the filename.

sudolang
NamespaceFileNaming {
  typeEntry: "<type-name>.ts — type alias and namespace re-export"
  utilityOrConstant: "<exported-name>.ts — one file per exported function or constant; filename = export name"
}

Constraints {
  Do not use <type-name>-<exported-name>.ts for children; <exported-name>.ts is sufficient
}

Example: under types/point/, files length.ts, add.ts, and normalize.ts each export the like-named function.

Constant types

sudolang
ConstantVisibility {
  private: "Single-file only, not exported"
  exported: "Sole export from eponymous file"
  public: "Re-exported from public.ts"
  internal: "Exported, not in public.ts"
}

Constraints

sudolang
Constraints {
  "<type-name>/<type-name>.ts" is the only public import surface
  Export a single type alias: "export type <type-name> = <type>"
  Export namespace: "export * as <type-name> from \"./public.js\""
  In public.ts re-export every public constant file
  Child files: <exported-name>.ts (one export per file; filename matches export)
}

Consumers

sudolang
Consumers {
  never: [
    "Import from public.js outside the type namespace folder",
    "Import from any child file (e.g. schema.js, length.js) outside the type namespace folder"
  ]
  do: [
    "import from <type-name>.ts only; e.g. Volume from \"../../types/volume/volume.js\"",
    "Access constants via the namespace: TypeName.length, etc."
  ]
}

Extending external types

When authoring helper functions for external types (e.g. String), use StringX as the discoverable extension namespace name.

Type derived from schema

Only for types whose source of truth is a schema. Most types do not; use a normal type alias. When the type is schema-backed, either derive it from the schema or keep a hand-written alias (e.g. for better JSDoc) and assert it matches the schema at compile time.

Option A — derive from schema:

src/types/player-mark/schema.ts

ts
export const schema = { enum: ["X", "O"] } as const;

src/types/player-mark/public.ts

ts
export { schema } from "./schema.js";

src/types/player-mark/player-mark.ts

ts
import { Schema } from "@adobe/data/schema";
import { schema } from "./schema.js";
export type PlayerMark = Schema.ToType<typeof schema>;
export * as PlayerMark from "./public.js";

Option B — hand-written object type with compile-time assertion: Use when you want property-level JSDoc. From @adobe/data/types, use Assert<Equal<YourType, Schema.ToType<typeof schema>>> so the type stays in sync with the schema.

ts
import { Assert, Equal } from "@adobe/data/types";
import { Schema } from "@adobe/data/schema";
import { schema } from "./schema.js";

export type Bounds = {
  /** Left edge in world units. */
  x: number;
  /** Top edge in world units. */
  y: number;
  /** Width in world units. */
  width: number;
  /** Height in world units. */
  height: number;
};

type _CheckSameType = Assert<Equal<Bounds, Schema.ToType<typeof schema>>>;

export * as Bounds from "./public.js";

Testing

sudolang
Constraints {
  Give each function file its own <same-name>.test.ts unit test
}

Execute

sudolang
fn whenRefactoringToNamespace() {
  Constraints {
    Identify constants in the current file
    Extract them into the standard pattern
    Identify all consumers of public namespaces
    Check each consumer: imports use <type-name>.ts only, never public.js or individual child files
    Ensure unit tests exist per function file, splitting as needed
  }
}

© paralleldrive, 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 1 other file in ai/skills/aidd-namespace of paralleldrive/aidd.

  • SKILL.md
  • README.md

Open the folder on GitHubat commit 9a7c8e3

Compare with similar skills

Type Namespace Pattern 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 Namespace Pattern compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Type Namespace Pattern this skillparalleldrive/aidd384—~1.1kAutomated safety check: PassMIT
RTK Rust Design Patternsrtk-ai/rtk83k—~1.9kAutomated safety check: PassApache-2.0
Dignified Python Standardsdocling-project/docling68k—~1.5kAutomated safety check: PassApache-2.0
Effect Client WrapperUsefulSoftwareCo/executor4.1k1 repos~1.4kAutomated safety check: PassMIT
GitVersion .NET DevelopmentGitTools/GitVersion3.1k—~1.7kAutomated safety check: PassMIT
AST Visitor Pattern for Unionsprisma/orm48k—~830Automated safety check: PassApache-2.0

Similar skills

  • Describes seven Rust design patterns for the RTK CLI filter modules, with when to use each, RTK examples, and notes on when a pattern is overkill.

    83k GitHub stars~1.9k tokensUpdated today
    DevelopmentAuto-check passed
  • Dignified Python Standards

    docling-project/docling

    Applies opinionated production Python conventions chosen by the project's Python version: modern type syntax, pathlib, explicit checks and interface guidance.

    68k GitHub stars~1.5k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Effect Client Wrapper

    UsefulSoftwareCo/executor

    Pattern for wrapping third-party SDK clients (Stripe, Resend, AWS, etc.) with Effect.

    4.1k GitHub starsUsed in 1 repo~1.4k tokens
    DevelopmentAuto-check passed
  • GitVersion .NET Development

    GitTools/GitVersion

    Gives repository-specific .NET guidance for GitVersion: build and test commands, central package management, project layout and coding conventions.

    3.1k GitHub stars~1.7k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Official

    Replaces a plain TypeScript union plus switch statements with frozen subclasses and a visitor interface when several places dispatch on the same variants.

    48k GitHub stars~830 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Coding Best Practices

    KartikLabhshetwar/better-shot

    Reviews macOS Swift 6+ code for modern idioms, SOLID principles, SwiftData patterns, and concurrency best practices.

    2.4k GitHub starsUsed in 2 repos~1.8k tokens
    DevelopmentAuto-check passed

More from paralleldrive/aidd

All 35 skills in this repo
  • AIDD Skill Authoring Guide

    paralleldrive/aidd

    Guides creating, reviewing or refactoring AI-Driven Development skills so each one stays minimal, composable and named around a single clear function.

    384 GitHub stars~1.1k tokensUpdated 3 mo ago
    Auto-check passed
  • AIDD UI Layout Patterns

    paralleldrive/aidd

    Enforces a split of UI components into terminal and layout types, with layout components composing others through standard layout tokens, for cleaner structure and fewer re-renders.

    384 GitHub stars~562 tokensUpdated 3 mo ago
    Auto-check passed
  • Adobe Data ECS Plugin Rules

    paralleldrive/aidd

    Enforces @adobe/data/ecs practices when writing Database.Plugin definitions, including property order, plugin composition, services, components, resources and archetypes.

    384 GitHub stars~1.9k tokensUpdated 3 mo ago
    Auto-check passed
  • Error Causes Handling

    paralleldrive/aidd

    Has your agent throw and catch JavaScript and TypeScript errors with the error-causes library, using named causes, preserved originals and routed handlers.

    384 GitHub stars~1.1k tokensUpdated 3 mo ago
    Auto-check passed
  • Teaches the saga pattern with call and put so network requests and side effects stay out of the logic and sagas can be tested without mocks.

    384 GitHub stars~587 tokensUpdated 3 mo ago
    Auto-check passed
  • Lit Element Authoring

    paralleldrive/aidd

    Rules for writing Lit elements in an AIDD project: binding elements on DatabaseElement, observed values, presentation components and action-style callbacks.

    384 GitHub stars~1.2k tokensUpdated 3 mo ago
    Auto-check passed

Categories

Questions about Type Namespace Pattern

What does Type Namespace Pattern do?

Sets a folder and file layout for TypeScript types so each type has one import surface, one file per exported function or constant, and tree-shakeable consumers. The skill sets a convention where every type lives in its own folder in the types layer, with one public import surface: a file named after the type that exports a single type alias and a namespace re-export.ts` each export the like-named function.

When should I use Type Namespace Pattern?

Type Namespace Pattern fits situations like: creating a new type with helper functions and constants; refactoring a types folder into one folder per type; defining a type whose source of truth is a schema; reviewing imports to catch consumers reaching into a type's internals.

How do I install Type Namespace Pattern in Claude Code?

Run `npx skills add paralleldrive/aidd --skill aidd-namespace -a claude-code`. Or copy the skill folder (ai/skills/aidd-namespace in paralleldrive/aidd) into .claude/skills/aidd-namespace in your project. Claude Code loads it when a task matches its description.

How do I install Type Namespace Pattern in Codex?

Run `npx skills add paralleldrive/aidd --skill aidd-namespace -a codex`. Or copy the skill folder (ai/skills/aidd-namespace in paralleldrive/aidd) into .agents/skills/aidd-namespace in your project. Codex loads it when a task matches its description.

Can I use Type Namespace Pattern 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 paralleldrive/aidd --skill aidd-namespace -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/aidd-namespace, .gemini/skills/aidd-namespace, .github/skills/aidd-namespace and .opencode/skills/aidd-namespace in your project.

What does Type Namespace Pattern need to run?

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

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

Type Namespace Pattern 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 Namespace Pattern use?

About 1.1k tokens (SKILL.md is roughly 4.5k 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 Namespace Pattern?

Skills that share tags, products or a category with Type Namespace Pattern: RTK Rust Design Patterns (rtk-ai/rtk, 83k stars), Dignified Python Standards (docling-project/docling, 68k stars), Effect Client Wrapper (UsefulSoftwareCo/executor, 4.1k stars) and GitVersion .NET Development (GitTools/GitVersion, 3.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Type Namespace Pattern?

paralleldrive (a GitHub organization) maintains it in paralleldrive/aidd, which has 384 GitHub stars. The repository holds 35 skills in this directory. The repository was last updated on June 12, 2026.

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