explaingit

joygqz/mirrorai

1JavaScriptAudience · developerComplexity · 2/5ActiveLicenseSetup · easy

TLDR

CLI that scans an existing codebase, detects recurring patterns, and writes rules files (CLAUDE.md.cursorrules.windsurfrules, Copilot, Cline) so AI assistants follow your conventions.

Mindmap

mindmap
  root((mirrorai))
    Inputs
      Existing codebase
      Manifest files
      Tool selection
    Outputs
      CLAUDE.md
      cursorrules
      windsurfrules
      Copilot instructions
      Plopfile templates
    Use Cases
      Generate AI rules
      Local scaffolding
      Refresh rules on re-run
    Tech Stack
      Node
      npx
      Plop
      Handlebars

Things people build with this

USE CASE 1

Generate a CLAUDE.md and .cursorrules pair that match the actual patterns in your monorepo.

USE CASE 2

Emit per-pattern slash commands so Claude Code can scaffold new resources without prompting.

USE CASE 3

Produce a plopfile and Handlebars templates for zero-token local scaffolding of repeated file types.

USE CASE 4

Refresh existing rule files in place after a refactor without overwriting hand-edited sections.

Tech stack

NodeJavaScriptnpxPlopHandlebars

Getting it running

Difficulty · easy Time to first run · 5min

Requires Node 18 or newer and an existing subscription to Claude Code, Cursor, Windsurf, Copilot, or Cline.

MIT license. You can use, modify, and redistribute the code commercially with attribution.

In plain English

mirrorai is a command-line tool that reads your existing codebase and writes out instruction files for the popular AI coding assistants. The point is that the AI tool then follows the conventions already living in your code, rather than inventing its own style. The files it can produce include CLAUDE.md for Claude Code.cursorrules for Cursor.windsurfrules for Windsurf, a Copilot instructions file for GitHub Copilot, and .clinerules for Cline. The project is described as language and stack agnostic. The README mentions Vue and React frontends, Go and Node backends, Python pipelines, Rust command-line tools, and Flutter apps as examples of codebases it will work on, as long as there are discoverable patterns to extract. There is no API key required, because the analysis runs inside your AI tool of choice using your existing subscription. Installation is a single npx command, which copies a file called mirror-init.md into a .claude/commands/ folder as a Claude Code slash command. If you do not use Claude Code, you can paste the contents of that file into Cursor, Windsurf, Copilot Chat, Cline, or any other AI tool and run the same flow. When you invoke /mirror-init, you are asked which AI tools to target and whether to also emit a plopfile and Handlebars templates for local scaffolding. Under the hood, mirrorai detects the language and framework from manifest files such as package.json, go.mod, or pyproject.toml. It then scans the business code, groups files into clusters by type, and only keeps clusters that have at least three instances, at least 50 lines, and at least 80 percent structural similarity. From the matched clusters it can produce up to four kinds of artifact: the rule files for each selected tool, one slash command per pattern for Claude Code, an optional plopfile with one generator per pattern, and optional Handlebars templates extracted from a seed file. The generators are validated by syntax check, load check, trial run, and a semantic comparison against the seed, with broken ones auto-repaired or removed. The command is idempotent. On a re-run it detects existing files, marks each as either mirrorai-generated or user-authored, and offers three options: regenerate everything, refresh existing files in place, or regenerate only specific named patterns. User-authored files get a per-file merge, overwrite, or skip prompt. Node 18 or newer is required, and the project is MIT-licensed.

Copy-paste prompts

Prompt 1
Run npx mirrorai install in this repo, then walk me through the /mirror-init prompts and pick which AI tools to target.
Prompt 2
Use mirrorai to generate a CLAUDE.md.cursorrules, and Copilot instructions file for this Vue plus Go monorepo.
Prompt 3
After running /mirror-init, show me which file clusters mirrorai detected and which ones got rule files versus plop generators.
Prompt 4
Re-run /mirror-init with option c and regenerate only the new-resource and new-job patterns without touching the rule files.
Prompt 5
Add a mirrorai-generated plopfile to this Rust CLI project and create a generator for a new subcommand pattern.
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.