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

@rulesgen/rulesgen

v0.1.3

Published

Generate AI coding assistant rules files from your codebase

Readme

@rulesgen/rulesgen

Analyze any codebase and auto-generate optimized AI coding assistant rules files.

Supports CLAUDE.md, .cursorrules, copilot-instructions.md, and .windsurfrules — all from a single command.

Install

npm install -g @rulesgen/rulesgen

Or run directly:

npx @rulesgen/rulesgen

Quick Start

# Set your Anthropic API key
export ANTHROPIC_API_KEY=sk-ant-...

# Generate rules for all tools
rulesgen generate

# Generate for specific tools only
rulesgen generate --tools claude,cursor

# Preview without writing files
rulesgen preview

# Update existing rules (merge mode)
rulesgen update

What It Does

  1. Analyzes your codebase — detects frameworks, languages, dependencies, code patterns, project structure, and git history
  2. Builds a tailored prompt — sends the analysis to Claude to generate project-specific rules
  3. Writes optimized rules files — outputs files tuned for each AI coding tool
$ rulesgen generate --tools claude,cursor

  Analyzing project...

  Detected:
    Language    TypeScript (strict)
    Framework   Next.js 14, React 18, Tailwind CSS
    Database    PostgreSQL (Prisma)
    Testing     Vitest, React Testing Library
    Package Mgr pnpm

  Generating rules...

  ✓ CLAUDE.md          (1,247 tokens)
  ✓ .cursorrules       (892 tokens)

  Done in 8.2s

Commands

rulesgen generate [path]

Analyze a project and generate rules files. This is the default command.

| Flag | Description | Default | |------|-------------|---------| | --tools <list> | Comma-separated: claude, cursor, copilot, windsurf, all | all | | --output <dir> | Output directory | . | | --api-key <key> | Anthropic API key | $ANTHROPIC_API_KEY | | --model <model> | Claude model | claude-sonnet-4-5 | | --depth <level> | Analysis depth: quick, standard, deep | standard | | --focus <text> | Extra context to guide generation | — | | --force | Overwrite existing files without prompting | false | | --merge | Merge with existing rules files | false | | --preview | Print to stdout, don't write files | false | | --quiet | Suppress output except errors | false |

rulesgen update [path]

Re-analyze and merge updates into existing rules files. Same as generate --merge.

rulesgen preview [path]

Dry run — prints generated rules to stdout without writing any files.

rulesgen init

Create a .rulesgenrc.json config file in the current directory.

Configuration

Create a .rulesgenrc.json in your project root:

{
  "tools": ["claude", "cursor"],
  "depth": "standard",
  "focus": "This is a monorepo with shared packages",
  "ignore": ["node_modules", "dist", ".next"],
  "model": "claude-sonnet-4-5"
}

Also supports rulesgen.config.js, .rulesgenrc.yaml, and package.json "rulesgen" field via cosmiconfig.

Supported Languages & Frameworks

| Language | Detected From | |----------|---------------| | JavaScript/TypeScript | package.json — React, Next.js, Vue, Nuxt, Angular, Svelte, NestJS, Express, Fastify, Vite, Tailwind, Prisma, and 50+ more | | Go | go.mod — Gin, Echo, Fiber, GORM, sqlx, and more | | Python | requirements.txt, pyproject.toml — Django, FastAPI, Flask, SQLAlchemy, pytest, and more |

Also detects: Docker, Terraform, CDK, GitHub Actions, monorepo tools (Nx, Turborepo, Lerna).

Analysis Depth

| Level | What it analyzes | |-------|-----------------| | quick | Project structure, dependencies, frameworks | | standard | + code patterns (naming, imports, async style, tests) | | deep | + git history (recent commits, contributors, recently modified files) |

API Key

The API key is resolved in order:

  1. --api-key flag
  2. ANTHROPIC_API_KEY environment variable
  3. ~/.rulesgen/config.json

Output Files

| Tool | File | Location | |------|------|----------| | Claude Code | CLAUDE.md | Project root | | Cursor | .cursorrules | Project root | | GitHub Copilot | copilot-instructions.md | .github/ | | Windsurf | .windsurfrules | Project root |

License

MIT