npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

apilens

v0.1.0

Published

CLI for AI agents to discover TypeScript library APIs

Readme

apilens

Teach AI agents to use npm libraries. Installs packages and generates skill files so agents read TypeScript types and execute code in a sandbox.

Quick Start

# Install globally
npm install -g apilens

# Create a config in your project
cat > .apilens.yaml << 'EOF'
libraries:
  - name: "@kubernetes/client-node"
    title: "Kubernetes API client"
  - name: "pg"
    title: "Typescript library to interact with a Postgresql database"
EOF

# Install libraries and generate agent skill files
apilens setup

That single command:

  1. Installs the configured libraries into your project's node_modules/
  2. Generates skill files with per-library references, symlinked for Claude Code, Codex, and Gemini CLI

Start your AI coding agent — it will auto-discover the skill and use apilens to find APIs before writing code.

CLI Reference

apilens <command> [options]

COMMANDS:
  setup                Install libraries and generate agent skill files
  exec <file.ts>       Execute TypeScript in a sandboxed environment (file or stdin)

SETUP OPTIONS:
  --config <path>      Path to config file (default: APILENS_CONFIG env var,
                       or .apilens.{yaml,yml,json} walking upward from CWD)
  --dir <path>         Output directory for skill files (default: .claude/skills/apilens)

EXEC OPTIONS:
  --timeout <ms>       Execution timeout in milliseconds (default: 30000)

GLOBAL OPTIONS:
  --verbose            Debug output on stderr
  -q, --quiet          Suppress stderr
  -h, --help           Show help
  -v, --version        Show version

Configuration

Config file format

libraries:
  - name: "@kubernetes/client-node"
    title: "Kubernetes API client"
  - name: "pg"
    title: "Typescript library to interact with a Postgresql database"
    description: >-
      PostgreSQL client for Node.js. Connect to the PostgreSQL server running in the cluster.
      Quick start: `const { Client } = require("pg"); const client = new Client({ host: "postgresql.prodisco.svc.cluster.local", port: 5432, user: "prodisco", password: "prodisco", database: "prodisco" }); await client.connect();`
      Queries: `const res = await client.query("SELECT * FROM my_table");` returns `{ rows, rowCount, fields }`.
      Parameterized: `await client.query("INSERT INTO users(name, age) VALUES($1, $2)", ["alice", 30]);`
      Always call `await client.end();` when done.
      IMPORTANT: Before querying or modifying any table, ALWAYS discover the schema first. List tables with
      `SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'` and inspect columns with
      `SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'my_table'`.
      Never assume column names or types exist — verify them first.

Each library requires:

  • name — the npm package name
  • title — a one-line description used in the SKILL.md description (helps the agent decide when to invoke the skill)

The optional description field provides detailed context that goes into the per-library reference files. Use it to give the agent quick-start instructions: connection strings, common queries, important caveats, and workflow patterns. Multi-line descriptions (using YAML >- or |) are passed through to the generated reference files.

Sandbox Modules

The set of npm packages available inside the sandbox is determined by:

  1. APILENS_ALLOWED_LIST env var — comma-separated package names (e.g., APILENS_ALLOWED_LIST=pg,lodash)
  2. Nearest node_modules/ — if the env var is not set, all packages in the nearest node_modules/ directory are allowed

Agent Integration

apilens setup generates a skill file at .claude/skills/apilens/SKILL.md and symlinks it to .agents/skills/apilens/ so Claude Code, Codex, and Gemini CLI all discover it automatically. The generated skill:

  • Lists all configured libraries in the skill description (always in the agent's context)
  • Creates per-library reference files in references/ (loaded on demand)
  • Grants Bash(apilens:*), Bash(npx tsx:*), and Write tool permissions
  • Instructs the agent to browse APIs → write script → execute (not just explain APIs)

Use --dir to write skill files to a custom directory instead of the default .claude/skills/apilens/:

# Write to a custom location
apilens setup --dir container/skills/apilens

# Absolute path (apilens/ is appended automatically if not present)
apilens setup --dir /path/to/skills

When --dir is used, the .agents/skills/ symlink is skipped since it only applies to the default layout.

Development

# Install dependencies
npm install

# Run in development
npx tsx src/cli.ts setup

# Build
npm run build

# Test
npm test

License

MIT