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

codespec

v2.1.0

Published

Auto-generate AI assistant configs by deep-analyzing your codebase

Readme

codespec

Auto-generate AI coding assistant configs by deep-analyzing your codebase.

Stop writing CLAUDE.md, .cursorrules, and Copilot instructions by hand. Run one command and get config files with evidence-based rules from your actual code.

npx codespec init
  codespec v2 - AI config generator with deep code analysis
  -----------------------------------------

  Analysis complete

  Project:     my-app
  Language:    typescript
  Framework:   Next.js v15.2
  Styling:     Tailwind CSS
  ORM:         Prisma
  Testing:     Vitest

  Code Analysis:
  Functions:   143
  Classes:     8
  Avg Length:  18 lines
  Naming:      camelCase (92%)

  Generated:
    + CLAUDE.md
    + .cursorrules
    + .github/copilot-instructions.md

What's different?

Most config generators give you generic rules like "This is a Next.js project. Use App Router."

codespec actually reads your code and gives you evidence-based rules:

## Code Patterns (from analysis)

- Functions use **camelCase** naming (143 of 155 functions, 92%)
- Error handling: **try/catch (15 blocks) + 3 custom error classes**
- Async pattern: **47 async/await, 0 .then() callbacks**
- Average function length: **18 lines**
- Max cyclomatic complexity: **8**
- TypeScript types: 25 interfaces, 18 type aliases, **0 `any` usage**
- React hooks: useState (34x), useEffect (21x)

## Top Dependencies

- `@prisma/client` imported in 23 files
- `zod` imported in 18 files
- `next/navigation` imported in 12 files

Every rule comes with proof. Real numbers from your codebase, not guesses.

Why?

Every AI coding assistant works better with project context. But writing config files by hand is tedious and they go stale fast.

codespec reads your actual codebase — functions, classes, imports, error patterns, async usage, naming conventions — and generates configs that match what's really there.

No files leave your machine. Everything runs locally.

What it generates

| File | For | What it includes | |------|-----|-----------------| | CLAUDE.md | Claude Code | Project overview, code patterns with metrics, top dependencies, API routes, dev commands, evidence-based rules | | .cursorrules | Cursor | Role definition, code insights, coding standards, framework guidelines, error handling patterns | | .github/copilot-instructions.md | GitHub Copilot | Code generation instructions, test generation rules, review guidelines — all evidence-based |

Install

# Run directly (no install needed)
npx codespec init

# Or install globally
npm install -g codespec

Usage

# Generate all configs for current directory
codespec init

# Generate only specific configs
codespec init --claude
codespec init --cursor
codespec init --copilot

# Preview without writing files
codespec init --dry-run

# Show detailed code analysis
codespec init --verbose

# Scan a different directory
codespec init ./path/to/project

# Update existing configs (preserves your custom sections)
codespec update

# Show diff between existing and newly generated configs
codespec diff

What it detects

Project-level detection

| Category | Details | |----------|---------| | Languages | TypeScript, JavaScript, Python, Go, Rust, Java, Ruby, PHP, Swift, Kotlin, C# | | Frameworks | Next.js, React, Vue, Nuxt, Svelte, Angular, Remix, Astro, Express, Fastify, NestJS, Hono, Django, FastAPI, Flask, Rails, Laravel, Spring Boot, Gin, Echo, Fiber, Actix, Axum | | Package managers | npm, yarn, pnpm, bun, pip, poetry, cargo, go modules | | ORMs | Prisma, Drizzle, TypeORM, Sequelize, SQLAlchemy, Django ORM | | Styling | Tailwind CSS, styled-components, CSS Modules, Sass, Emotion | | State | Redux, Zustand, Jotai, MobX, Pinia, Vuex | | Testing | Jest, Vitest, Pytest, Playwright, Cypress | | Linting | ESLint, Biome, Prettier, Ruff, Black | | Infra | Docker, Vercel, Railway, Fly.io, Netlify |

Code-level analysis

| Metric | What it finds | |--------|--------------| | Functions | Count, names, line length, async/sync, exported or not | | Classes | Count, method names, exported or not | | Naming conventions | camelCase vs snake_case vs PascalCase with percentages | | Error handling | try/catch count, custom error classes | | Async patterns | async/await vs .then() vs new Promise | | Type usage | any count, unknown, interfaces, type aliases | | Complexity | Cyclomatic complexity per function | | React hooks | Which hooks are used and how often | | API routes | Next.js, Express, FastAPI, Flask, Django route detection | | Dependencies | Most imported packages ranked by frequency |

Commands

| Command | Description | |---------|-------------| | codespec init | Analyze codebase and generate config files | | codespec analyze | Analyze only (no file generation) | | codespec update | Update existing configs with fresh analysis (preserves custom sections) | | codespec diff | Show diff between existing and newly generated configs |

Flags

| Flag | Description | |------|-------------| | --claude | Generate only CLAUDE.md | | --cursor | Generate only .cursorrules | | --copilot | Generate only copilot-instructions.md | | --dry-run | Preview without writing files | | --verbose | Show detailed code analysis output |

Contributing

PRs welcome! Especially for:

  • New language support — add extraction patterns in src/parser/
  • Better code analysis — improve extractors in src/parser/extractors.ts
  • New framework detection — add patterns in src/analyzer/framework.ts
  • New AI tools — add generators for Windsurf, Cody, etc.

License

MIT