Agent skill

add-export

Add a new subpath export to the @cyanheads/mcp-ts-core package. Use when creating a new public API surface that consumers import from a dedicated subpath (e.g., @cyanheads/mcp-ts-core/newutil).

Stars 131
Forks 24

Install this agent skill to your Project

npx add-skill https://github.com/cyanheads/mcp-ts-core/tree/main/skills/add-export

Metadata

Additional technical details for this skill

type
reference
author
cyanheads
version
1.0
audience
internal

SKILL.md

Context

Subpath exports are defined in package.json under the exports field. Each subpath maps to a source entry point that gets compiled to dist/. The exports catalog in CLAUDE.md must stay in sync with package.json.

The build uses tsconfig.build.json (not tsconfig.json) with rootDir: ./src and include: ["src/**/*"]. This means every source file at src/foo/bar.ts compiles to dist/foo/bar.js — the dist/ paths in exports must mirror the source tree exactly, not flatten it.

Steps

  1. Create the entry point source file under src/ (e.g., src/utils/new-util.ts)

  2. Add the subpath to package.json exports, mirroring the source path:

    jsonc
    // source: src/utils/new-util.ts → dist: dist/utils/new-util.js
    "./newutil": {
      "types": "./dist/utils/new-util.d.ts",
      "import": "./dist/utils/new-util.js"
    }
    
  3. Update the exports catalog in CLAUDE.md — add a row to the table

  4. Build with bun run build to generate dist/ output

  5. Verify the export by inspecting the compiled output directly:

    bash
    # Confirm the compiled file exists at the expected dist path
    ls dist/utils/new-util.js
    
    # Confirm the declared exports resolve to real files
    bun -e "import('./dist/utils/new-util.js').then(m => console.log(Object.keys(m)))"
    
  6. Run bun run devcheck to verify

Naming conventions

Convention Rule
Subpath lowercase, no underscores (e.g., utils/errorHandler)
Source file kebab-case (e.g., error-handler.ts)
Export name camelCase for values, PascalCase for types

Checklist

  • Source entry point file created with JSDoc header
  • Subpath added to package.json exports with types and import conditions
  • Exports catalog in CLAUDE.md updated with new row
  • bun run build succeeds
  • Compiled file exists at expected dist/ path and exports the expected symbols
  • bun run devcheck passes

Expand your agent's capabilities with these related and highly-rated skills.

cyanheads/mcp-ts-core

add-resource

Scaffold a new MCP resource definition. Use when the user asks to add a resource, expose data via URI, or create a readable endpoint.

131 24
Explore
cyanheads/mcp-ts-core

field-test

Exercise tools, resources, and prompts with real-world inputs to verify behavior end-to-end. Use after adding or modifying definitions, or when the user asks to test, try out, or verify their MCP surface. Calls each definition with realistic and adversarial inputs and produces a report of issues, pain points, and recommendations.

131 24
Explore
cyanheads/mcp-ts-core

release

Verify release readiness and publish. The git wrapup protocol handles version bumps, changelog, README, commits, and tagging during the coding session. This skill verifies nothing was missed, runs final checks, and presents the irreversible publish commands.

131 24
Explore
cyanheads/mcp-ts-core

api-errors

McpError constructor, JsonRpcErrorCode reference, and error handling patterns for `@cyanheads/mcp-ts-core`. Use when looking up error codes, understanding where errors should be thrown vs. caught, or using ErrorHandler.tryCatch in services.

131 24
Explore
cyanheads/mcp-ts-core

api-utils

API reference for all utilities exported from `@cyanheads/mcp-ts-core/utils`. Use when looking up utility method signatures, options, peer dependencies, or usage patterns.

131 24
Explore
cyanheads/mcp-ts-core

add-tool

Scaffold a new MCP tool definition. Use when the user asks to add a tool, create a new tool, or implement a new capability for the server.

131 24
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results