add-a-lib

add-a-lib is a skill for Claude Code, Codex from lonormaly/builders-stack. It costs 81 tokens per session (717 once invoked), scanned A, original, MIT.

A scaffold for adding a shared TypeScript library to the `libs/` folder of a monorepo, a repository that holds multiple apps or services. It sets up the package files and a single public entry point for code used in at least two places.

In plain words
What is it for?
Use it when extracting shared code into a package such as `@stack/ui`, `@stack/db`, or `@stack/auth`. It creates the package configuration, TypeScript settings, public entry file, and consumer wiring.
Why use it?
It prevents the same helper, type, component, or client from being copied into several apps. The shared library becomes one source of truth that other packages can import.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is "scripts": { "typecheck": "bash ../../scripts/typecheck-native.sh --noEmit" }.

Good fit Use it when extracting shared code into a package such as @stack/ui, @stack/db, or @stack/auth. It creates the package configuration, TypeScript settings, public entry file, and consumer wiring.

Compare 6 skills 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/lonormaly/builders-stack
agentmods
npx agentmods add skills/lonormaly/builders-stack/add-a-lib

Made for: Claude Code, Codex.

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 add-a-lib

README.md
[![agentmods](https://agentmods.dev/badge/skills/lonormaly/builders-stack/add-a-lib/github.svg)](https://agentmods.dev/skills/lonormaly/builders-stack/add-a-lib)
Your own site
<a href="https://agentmods.dev/skills/lonormaly/builders-stack/add-a-lib"><img src="https://agentmods.dev/badge/skills/lonormaly/builders-stack/add-a-lib/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for add-a-lib

Your own site · 80×15
<a href="https://agentmods.dev/skills/lonormaly/builders-stack/add-a-lib"><img src="https://agentmods.dev/badge/skills/lonormaly/builders-stack/add-a-lib.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 81 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 717 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00081 $0.00717
Opus 5.5 $0.00032 $0.00287
Sonnet 5.5 $0.00016 $0.00143
Haiku 4.5 $0.00008 $0.00072

Measured 1mo ago against content hash 154f9cd760d7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

add-a-lib 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 1mo 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.

agents/skills/add-a-lib/SKILL.md · 73 lines

How it starts

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

Add a lib

A libs/* package is shared code that is never served — other packages consume it, it consumes nobody upward. Reach for this when the same helper/type/component is about to exist in two places.

When to use

  • A util, type, component, or client is needed by 2+ apps/services → extract it into a lib.
  • Not when it's used in exactly one place — leave it there (YAGNI). A lib for one consumer is premature.

Steps

  1. Pick the name. libs/<name>, package @stack/<name>. Keep it a role, not a feature (ui, db, auth, ai, analytics).

  2. Create the folder + files:

    libs/<name>/
    ├── package.json
    ├── tsconfig.json
    └── src/
        └── index.ts        # the ONE public door
    
  3. package.json — name it @stack/<name>, point exports at the barrel:

    {
      "name": "@stack/<name>",
      "private": true,
      "type": "module",
      "exports": { ".": "./src/index.ts" },
      "scripts": { "typecheck": "bash ../../scripts/typecheck-native.sh --noEmit" }
    }
    
  4. tsconfig.json — extend the root base, never fork options:

    { "extends": "../../tsconfig.base.json", "include": ["src"] }
    
  5. src/index.ts — this is the only thing consumers may import. Re-export the public surface; keep everything else internal:

    export { thing } from "./thing";
    export type { ThingOptions } from "./thing";
    
  6. Install so the workspace links it: bun install (root). The @stack/<name> name now resolves across the workspace.

    bun run check:typescript enforces the shared stable TypeScript 7 checker for every workspace.

  7. Consume it from an app/service by package name only:

    import { thing } from "@stack/<name>"; // ✅
    import { thing } from "@stack/<name>/src/internal/thing"; // ❌ deep import — forbidden
    

Rules to respect

  • No upward import: the lib must not import from apps/ or services/. If it needs to, the boundary is wrong — the caller should pass the dependency in.
  • One public door: anything not exported from src/index.ts is private. Don't let consumers reach into internals.
  • No Tiltfile change — libs aren't served, so they get no Tilt resource.

Read the full file on GitHub · 73 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. 1mo ago First seen · 73 lines · 81 tokens per session scan A 154f9cd760d7

Subscribe to this mod's changes

add-a-lib is a skill published in the GitHub repository lonormaly/builders-stack (42 stars, last pushed 20d ago), licensed MIT. It adds 81 tokens to every session and 717 once invoked, about $0.0003 per session on Opus 5.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-08-30.