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

v0.3.0

Published

One config to rule them all — generate AI coding rules for every agent.

Downloads

282

Readme

rulegen

One config to rule them all.

Generate AI coding rules for 16 agents — Claude, Cursor, Copilot, Windsurf, Gemini, Cline, and more — from a single config file.

npm version npm downloads license


The Problem

You use Claude Code and Cursor and Copilot. Each needs its own config file. They drift out of sync. You waste time maintaining CLAUDE.md, .cursorrules, and copilot-instructions.md separately.

The Solution

npx rulegen   # That's it. Zero-arg mode does everything.

One config → 16 agent files, always in sync.

Supported Agents

| Agent | Config File | Format | |-------|-------------|--------| | Claude Code | CLAUDE.md | Markdown | | Cursor | .cursorrules | Markdown | | GitHub Copilot | .github/copilot-instructions.md | Markdown | | Windsurf | .windsurfrules | Markdown | | Aider | .aider.conf.yml + CONVENTIONS.md | YAML + Markdown | | Codex | codex.md | Markdown | | Gemini CLI | GEMINI.md | Markdown | | Cline | .clinerules/project.md | Markdown | | OpenCode | .opencode/rules.md | Markdown | | Roo Code | .roo/rules.md | Markdown | | Junie | .junie/guidelines.md | Markdown | | Continue.dev | .continue/rules.md | Markdown | | Sourcegraph Cody | .vscode/cody.json | JSON | | AGENTS.md | AGENTS.md | Markdown | | Goose | .goose/config.yaml | YAML | | Amp | .amp/rules.md | Markdown |

Features

  • AI-Powered Rulesrulegen ai analyzes your codebase and generates optimal rules automatically
  • Zero-Config Setupnpx rulegen one command does everything
  • Smart Detection — Auto-scans your project for language, framework, dependencies
  • 16 Agents — Every major AI coding tool supported
  • Agent-Optimized — Each file uses the format best for that tool (Markdown, JSON, YAML)
  • Import Existingrulegen import reads your existing agent files into a config
  • Stay in Sync — One source of truth. Change config, regenerate all files instantly
  • Fully Customizable — Custom rules, per-agent overrides, do/don't instructions

Quick Start

# Zero-arg mode: auto-detect → generate
npx rulegen

# Or step by step:
npx rulegen init        # Interactive project setup
npx rulegen generate    # Generate all agent files
npx rulegen doctor      # Verify everything is in sync

Import existing config files

Already have .cursorrules or CLAUDE.md? Import them:

npx rulegen import                     # Auto-detect all agent files
npx rulegen import --from claude       # Import from specific agent
npx rulegen import --from cursor,copilot  # Multiple agents

AI-Powered Rule Generation

Why write rules manually when AI can analyze your codebase?

Setup

# Option 1: Environment variable
export ANTHROPIC_API_KEY=sk-ant-xxx
npx rulegen ai

# Option 2: Config command
npx rulegen config set provider claude
npx rulegen config set api-key sk-ant-xxx
npx rulegen ai

# Option 3: Use OpenAI or Gemini
OPENAI_API_KEY=sk-xxx npx rulegen ai --provider openai
GEMINI_API_KEY=xxx npx rulegen ai --provider gemini

What it does

  1. Scans your codebase (language, framework, dependencies)
  2. Analyzes code patterns (style, naming, architecture)
  3. AI generates optimal rules tailored to YOUR project
  4. Creates config files for all 16 AI coding agents

One command, zero config

ANTHROPIC_API_KEY=xxx npx rulegen ai

That's it. AI analyzes your project and generates everything.

CLI Commands

| Command | Description | |---------|-------------| | rulegen | Zero-arg: init (if no config) or generate (if config exists) | | rulegen init | Interactive project setup and config generation | | rulegen generate | Generate agent config files from config | | rulegen import | Import existing agent files into rulegen.config.json | | rulegen ai | AI-powered rule generation from codebase analysis | | rulegen config | Manage global config (API keys, provider) | | rulegen sync | Sync files (use --watch for auto-sync) | | rulegen doctor | Validate config and check file status |

Common options

rulegen generate --target claude,cursor  # Specific agents only
rulegen generate --dry-run               # Preview without writing
rulegen generate --force                 # Overwrite without asking
rulegen generate --diff                  # Show changes
rulegen generate --output ./out/         # Custom output directory
rulegen ai --provider openai             # Use specific AI provider
rulegen ai --dry-run                     # Generate config only
rulegen ai --explain                     # Show reasoning for each rule
rulegen sync --watch                     # Auto-regenerate on config change

Configuration

{
  "version": "1",
  "project": {
    "name": "my-app",
    "description": "A modern web application",
    "type": "web-app",
    "language": "typescript",
    "framework": "next.js",
    "runtime": "node",
    "packageManager": "pnpm"
  },
  "rules": {
    "style": {
      "indentation": "spaces",
      "indentSize": 2,
      "quotes": "single",
      "semicolons": false,
      "maxLineLength": 100,
      "trailingComma": "all"
    },
    "naming": {
      "files": "kebab-case",
      "components": "PascalCase",
      "functions": "camelCase",
      "constants": "UPPER_SNAKE_CASE",
      "types": "PascalCase"
    },
    "patterns": {
      "server-components": "Use server components by default"
    }
  },
  "structure": {
    "src/app": "Next.js App Router pages",
    "src/components": "Reusable React components",
    "src/lib": "Utility functions and shared logic"
  },
  "instructions": {
    "do": [
      "Use TypeScript strict mode",
      "Write unit tests for all functions"
    ],
    "dont": [
      "Use 'any' type",
      "Use class components"
    ],
    "guidelines": [
      "Prefer composition over inheritance"
    ]
  },
  "targets": ["claude", "cursor", "copilot", "windsurf", "gemini", "cline"],
  "overrides": {
    "claude": {
      "extraInstructions": ["Always run tests before committing"]
    }
  }
}

Key sections

  • project — Name, language, framework, runtime
  • rules — Code style, naming conventions, patterns
  • structure — Directory descriptions for AI context
  • instructions — Do/Don't/Guidelines for AI behavior
  • targets — Which agent files to generate
  • overrides — Per-agent customizations

How It Works

┌─────────────────┐     ┌──────────┐     ┌───────────────┐
│  Your Project    │────▶│ Scanner  │────▶│    Config      │
│  (auto-detect)   │     │          │     │  .json file    │
└─────────────────┘     └──────────┘     └───────┬───────┘
                                                  │
              ┌───────────────────────────────────┼───────────────────┐
              ▼         ▼         ▼         ▼     ▼     ▼            ▼
         CLAUDE.md .cursorrules copilot GEMINI.md cody.json  ... 16 agents

Why rulegen?

  • Zero-config: npx rulegen — one command does everything
  • AI-powered: rulegen ai analyzes your code and generates rules automatically
  • Import existing: Already have agent files? Import them, don't start over
  • 16 agents: The most comprehensive agent support available

rulegen vs rulesync

| Feature | rulegen | rulesync | |---------|---------|----------| | AI-powered rule generation | Yes | No | | Zero-config setup | Yes (npx rulegen) | No (manual .md files) | | Agents supported | 16 | 21 | | Import existing configs | Yes | Yes | | One-command setup | Yes | No | | API key required | Only for AI mode | N/A |

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

MIT