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

rulegen-ai

v1.1.1

Published

Generate AI coding rules from your codebase using Google Gemini. Zero dependencies. Supports Cursor, Claude Code, Copilot, Windsurf.

Downloads

345

Readme

rule-gen

npm version npm downloads license contributions welcome

Generate AI coding rules from your codebase, powered by Google Gemini.

Most rule generators read your package.json and spit out generic templates. rule-gen feeds your actual source code into Gemini's 1M token context window and generates rules based on patterns it finds in your codebase.

Quick Start

export GEMINI_API_KEY=your-key-here
npx rulegen-ai

Get a free API key at aistudio.google.com/apikey.

What It Does

$ npx rulegen-ai ./my-express-api

Scanning ./my-express-api...
  Found 47 files
  Selected 32 files for analysis
  Estimated tokens: ~89,200

Generating rules with gemini-2.5-flash-lite...
  API usage: 91,043 input, 2,180 output tokens
  Generated 7 rules

Written 7 files:
  ✓ .cursor/rules/zod-validation-before-handlers.mdc
  ✓ .cursor/rules/prisma-singleton-import.mdc
  ✓ .cursor/rules/consistent-error-response-shape.mdc
  ✓ .cursor/rules/route-file-structure.mdc
  ✓ .cursor/rules/barrel-exports-from-src.mdc
  ✓ .cursor/rules/test-naming-convention.mdc
  ✓ .cursor/rules/middleware-ordering.mdc

These aren't generic rules. They're specific to your project:

  • "Import prisma from ../db — never instantiate PrismaClient directly"
  • "Route files validate with Zod schemas before handlers, return { data } or { error } shapes"
  • "Tests live in __tests__/ and mirror the src/ directory structure"

Output Formats

| Format | Flag | Output | |--------|------|--------| | Cursor | --format cursor (default) | .cursor/rules/*.mdc | | Claude Code | --format claude-md | CLAUDE.md | | Claude Agents | --format agents-md | AGENTS.md | | GitHub Copilot | --format copilot | .github/copilot-instructions.md | | Windsurf | --format windsurf | .windsurfrules |

How It Works

  1. Scan — Walks your project tree, respects .gitignore, skips node_modules/dist/binaries
  2. Budget — Prioritizes config files, entry points, routes, and pattern-rich files to fit Gemini's context window
  3. Generate — Sends code to Gemini with a prompt engineered to reject generic advice and produce project-specific rules
  4. Write — Outputs valid rule files in your chosen format

Why Gemini

Gemini's 1M token context window lets rule-gen send your entire codebase in a single request. No chunking, no summarization, no lost context. The model sees all your files at once and identifies patterns that span across modules.

Options

--format <format>   Output format: cursor, claude-md, agents-md, copilot, windsurf
--model <model>     Gemini model (default: gemini-2.5-flash-lite)
--dry-run           Preview rules without writing files
--verbose           Show which files are sent to Gemini
--max-files <n>     Max source files to include (default: 50)
--api-key <key>     Gemini API key (or set GEMINI_API_KEY env var)
-v, --version       Show version
-h, --help          Show help

Zero Dependencies

Built with Node.js built-in modules only (node:https, node:fs, node:path). No SDK, no node_modules.

Requirements

Part of the nedcodes ecosystem

| Tool | What it does | |------|-------------| | rule-gen | Generate rules from your codebase ← you are here | | cursor-doctor | Validate and fix your rules | | rule-porter | Convert rules between formats |

Generate → Validate → Convert. One pipeline, three tools.

License

MIT