create-new-package-in-monorepo

create-new-package-in-monorepo is a command for Claude Code from PackmindHub/packmind. It costs 3 tokens per session (1,001 once invoked), scanned A, original, Apache-2.0.

A setup recipe for adding a buildable TypeScript package to a monorepo, which is one repository containing multiple applications and shared packages. It uses Nx to create the package structure and development configuration.

In plain words
What is it for?
Use it to create shared utilities, domain packages, or reusable internal modules in the Packmind monorepo.
Why use it?
It avoids manually wiring the files and settings needed for a package that several applications can reuse.

Command for Claude Code

Written for Claude Code: installed under .claude/.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is baseUrl: '../../',.

Good fit Use it to create shared utilities, domain packages, or reusable internal modules in the Packmind monorepo.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/PackmindHub/packmind
agentmods
npx agentmods add commands/packmindhub/packmind/create-new-package-in-monorepo

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for create-new-package-in-monorepo

README.md
[![agentmods](https://agentmods.dev/badge/commands/packmindhub/packmind/create-new-package-in-monorepo.svg)](https://agentmods.dev/commands/packmindhub/packmind/create-new-package-in-monorepo)
Your own site
<a href="https://agentmods.dev/commands/packmindhub/packmind/create-new-package-in-monorepo"><img src="https://agentmods.dev/badge/commands/packmindhub/packmind/create-new-package-in-monorepo.svg" alt="Measured on agentmods" height="20"></a>
Per session 3 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,001 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00003 $0.01001
Opus 5 $0.00002 $0.00500
Sonnet 5 $0.00001 $0.00200
Haiku 4.5 $0.00000 $0.00100

Measured 4d ago against content hash 255ae7577533, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

create-new-package-in-monorepo scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packages/.claude/commands/create-new-package-in-monorepo.md · 142 lines

How it starts

The opening of the file, as written. The whole thing — 142 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Create New Package

Create a new buildable TypeScript package in the Packmind monorepo using Nx tools and configure it for use across applications.

When to Use

  • Creating a new shared library package for common utilities or domain logic
  • Setting up a domain-specific package following DDD architecture
  • Establishing internal dependencies for code reuse across apps and packages
  • Extracting common code into a reusable module

Context Validation Checkpoints

  • What is the package name and its primary responsibility?
  • Which packages or applications will consume this package?
  • Will the package be used by the API application (requires webpack config)?
  • What external dependencies does the package require (e.g., TypeORM, Winston)?
  • Are there any special build requirements (e.g., WASM files, assets)?

Recipe Steps

Step 1: Generate Package Scaffold with Nx

Run the Nx generator to create the package structure with TypeScript configs, Jest setup, ESLint config, and project.json.

nx generate @nx/js:library <package-name> \
  --directory=packages/<package-name> \
  --buildable \
  --publishable=false \
  --unitTestRunner=jest

Step 2: Configure Package Metadata

Update packages/<package-name>/package.json with the correct name and dependencies. Always use @packmind/ prefix and set "private": true for internal packages.

{
  "name": "@packmind/<package-name>",
  "version": "0.0.1",
  "private": true,
  "type": "commonjs",
  "main": "./src/index.js",
  "types": "./src/index.d.ts",
  "dependencies": {
    "tslib": "^2.3.0"
  }
}

Step 3: Update TypeScript Path Mappings

Add the path alias to tsconfig.base.json (Nx generates it without @packmind/ prefix - fix this). Then regenerate the effective TypeScript config by running node scripts/select-tsconfig.mjs.

{
  "compilerOptions": {
    "paths": {
      "@packmind/<package-name>": ["packages/<package-name>/src/index.ts"]
    }
  }
}

Read the full file on GitHub · 142 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 142 lines · 3 tokens per session scan A 255ae7577533

Subscribe to this mod's changes

create-new-package-in-monorepo is a command published in the GitHub repository PackmindHub/packmind (309 stars, last pushed today), licensed Apache-2.0. It adds 3 tokens to every session and 1,001 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.