@monishk/patternmatch
v0.1.2
Published
Zero-config CLI that learns your codebase patterns and catches AI-generated code that breaks them
Maintainers
Readme
patternmatch
Your codebase has patterns. AI ignores them. patternmatch doesn't.
AI tools like Claude Code, Cursor, and Copilot write code fast — but they don't know your project. They produce components named user-profile-widget.jsx when your whole codebase uses UserProfileWidget.tsx. Auth helpers dropped in src/utils/ when you always put them in src/lib/. Relative imports everywhere when you use @ aliases.
patternmatch learns how you write code and tells you when AI-generated code breaks your rules.
No config files. No rules to write. Zero setup.
Install
npm install -g patternmatchUsage
Step 1 — teach it your codebase
cd your-project
patternmatch learn✔ Scanned 247 files
📐 Naming
Files PascalCase
Components PascalCase
Hooks use* prefix enforced
Examples UserCard, ProductList, useAuth
📁 Structure
Components src/components
Hooks src/hooks
Utils src/lib
📦 Imports
Aliases "@" alias in useStep 2 — check AI-generated code
patternmatch check src/components/user-profile-widget.jsx✗ src/components/user-profile-widget.jsx
error "user-profile-widget.jsx" is kebab-case but your project uses PascalCase
→ Rename to UserProfileWidget.jsx
[naming/file-case]
warn 3 relative "../" imports found but your project uses "@" aliases
→ Replace relative paths with @/ aliases
[imports/use-alias]
✗ 2 violation(s) across 1 fileCheck an entire folder
patternmatch check src/Add to CI — checks every PR automatically
# .github/workflows/patternmatch.yml already included
# copy it to your project and you're doneHow it works
patternmatch reads your existing source files and extracts:
| Pattern | What it detects | |---|---| | Naming | File casing, component casing, hook prefixes | | Structure | Where components, hooks, utils, types live | | Imports | Alias usage, relative path depth |
No machine learning. No cloud. No config. Pure AST analysis — fast, deterministic, private.
Roadmap
- [ ] Python / Go / Rust support
- [ ] VS Code extension
- [ ]
patternmatch diff— check only git-changed files - [ ] Semantic pattern matching (v2)
- [ ] MCP server for Claude Code / Cursor
Contributing
See CONTRIBUTING.md — good first issues are labeled and ready.
License
MIT © Monish Kandanuru
