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

mirrorai

v0.3.0

Published

Codebase-aware AI rules generator — produce AGENTS.md, CLAUDE.md, slash commands, and plop scaffolding from your existing code, so AI assistants follow your project's real patterns

Downloads

214

Readme

mirrorai

npm version License: MIT Node

Codebase-aware AI rules generator for existing projects. Analyzes your repository and produces an AGENTS.md grounded in the patterns that already exist — so AI assistants follow your conventions instead of inventing their own — plus per-pattern slash commands and optional plop scaffolding so high-frequency skeletons cost zero tokens.

Built for mature codebases, where the conventions live in the code but nowhere else: large repositories are sampled rather than read file-by-file, and when generations of style coexist, git history decides which one is canonical — superseded styles are reported, not averaged in. Language- and stack-agnostic: Vue / React frontends, Go or Node backends, Python pipelines, Rust CLIs, Flutter apps, or any codebase with discoverable patterns.

Install

npx mirrorai install

Copies mirror-init.md into .claude/commands/ (and .cursor/commands/ when a .cursor/ directory exists) as a slash command. Re-run after upgrading mirrorai to update it. Everything else is produced by the AI on first run.

For other tools, paste the contents of .claude/commands/mirror-init.md as a prompt into Copilot Chat, Windsurf, Cline, or any AI tool — the workflow is identical.

Usage

Initialize

Run /mirror-init in your AI tool. One question — whether to also generate a plopfile for zero-token local scaffolding — then the AI analyzes the project and writes:

| Artifact | Purpose | |----------|---------| | AGENTS.md | Canonical rules file — the open standard read natively by Cursor, GitHub Copilot, Codex, Zed, and most AI tools | | CLAUDE.md | One line importing AGENTS.md for Claude Code | | .claude/commands/<pattern>.md | One slash command per high-value pattern | | plopfile.js + .mirrorai/templates/ | Local scaffolding via plop (opt-in) |

Rules content lives only in AGENTS.md — a single source of truth. Tools that still want their own rule file get a thin stub pointing at it, never a duplicate.

Everything is validated before it ships: every file path cited in AGENTS.md is checked to exist, and every plop generator passes a load check, trial run, output syntax check, and structural comparison against its seed file — broken generators are repaired or removed and reported.

<!-- mirrorai:generated -->
# Project Conventions

## Stack
Node.js 22, TypeScript 5 (strict), Express 5, Prisma 6 (PostgreSQL), Vitest, Zod.

## Layout
- `src/routes/` — one router per resource, registered in `src/app.ts`
- `src/services/` — business logic; the only layer that touches Prisma
- `src/middleware/` — auth, validation, error handler
- `tests/` — mirrors src/, *.test.ts

## Core Abstractions
- `src/lib/db.ts` exports the singleton PrismaClient — never instantiate another
- `src/lib/http.ts` exports ok()/fail() response envelopes — never res.json() directly
- `src/middleware/validate.ts` wraps Zod schemas — all input validation goes through it

## Prohibited
- No Prisma calls outside `src/services/` (route handlers stay thin — see `src/routes/users.ts`)
- No `any` — the repo compiles with strict: true and noImplicitAny

## Patterns

### new-resource (12 instances)
- Trigger: "add a <noun> endpoint / resource / CRUD"
- Reference: `src/routes/users.ts` + `src/services/user.service.ts` + `tests/users.test.ts`
- Side effects: register the router in `src/app.ts`; add a Zod schema in `src/schemas/`
- Scaffold first: npx mirrorai new new-resource <name>

Daily development

AGENTS.md contains a Patterns section with auto-apply rules. The AI matches your request to a pattern and follows it — reference file, constraints, side effects — without an explicit command.

Local scaffolding (zero tokens)

npx plop --help                       # list available generators
npx mirrorai new <pattern> <name>     # scaffold the skeleton; the AI fills in business logic

Keeping rules honest

Rules go stale as code evolves. check verifies — locally, zero tokens — that every path referenced in AGENTS.md and the generated slash commands still exists, and exits non-zero otherwise:

npx mirrorai check

Wire it into CI so a refactor that breaks the rules fails the build:

- run: npx mirrorai check

When it fails, re-run /mirror-init to refresh the rules.

How It Works

Detect language and framework from manifest files (package.json, go.mod, pyproject.toml, …)
   ↓
Scan business code; cluster files by unit type (sampled on large repositories)
   ↓
Qualify each cluster: ≥ 3 instances, ≥ 50 lines, ≥ 80% structural similarity → top 3–6 patterns
   (when styles coexist, git history picks the actively-maintained one as canonical)
   ↓
Emit:
   ├─ AGENTS.md + CLAUDE.md          — rules grounded in real code
   ├─ .claude/commands/<pattern>.md  — one slash command per pattern
   └─ plopfile + .hbs templates      — extracted from the canonical seed file (opt-in)

Analysis runs inside your AI tool on your existing subscription. No API key required.

Re-Running

/mirror-init is idempotent. Every file it writes carries a first-line marker (<!-- mirrorai:generated -->), so on re-run it can tell its own files from user-authored ones ([user-authored ⚠️]) and offers:

  • a. Refresh everything — regenerate all mirrorai-owned artifacts from a fresh analysis
  • b. Refresh selected patterns — regenerate only the named patterns' slash commands and generators; rules files untouched
  • c. Start over — re-ask the scaffolding question; remove artifacts no longer selected

User-authored files are never modified without an individual merge / overwrite / skip prompt.

Requirements

  • Node.js 20+ (for the CLI and plop)
  • Any AI coding tool subscription (Claude Code, Cursor, Copilot, …)
  • No language or framework requirements for the analyzed project

Releasing

npm run release

bumpp prompts for the next version, then commits, tags, pushes, and publishes to npm.

License

MIT