Scan any codebase, generate CONVENTIONS.md, expose conventions as MCP tools for AI agents.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
Mine your codebase. Generate CONVENTIONS.md. Stop AI agents from making up your style.
Every team that uses AI coding assistants hits the same wall: Claude writes getUserById in a codebase that uses get_user_by_id. Cursor creates components/userCard.tsx in a project that uses user-card.tsx. The agent invented a response shape that doesn't match the rest of the API.
You write a CLAUDE.md manually. It goes stale in two weeks. You write it again.
patchwork automates this. It scans your actual source code using AST analysis and detects what your team really does β not what you think you do.
| Category | What's mined |
|---|---|
| Naming | Functions, classes, variables, constants, files β with confidence score and real examples |
| Imports | Absolute vs relative, path aliases (@/, src/), barrel files, destructuring style |
| Structure | Source root, test layout, feature vs layer organisation, monorepo detection |
| Error Handling | try/except vs Result types, logging framework, custom exception naming, propagation style |
| Testing | Framework, assertion style, mocking library, coverage tool, fixture patterns |
| API Patterns | Response shape, route param style, ORM, async pattern, GraphQL/gRPC presence |
| Git Workflow | Commit message style, branch naming, co-change file pairs |
| Tech Stack | Frameworks, package manager, linters, formatters, type checker, build tool, scripts |
That's it. You'll get a CONVENTIONS.md like this:
| Feature | patchwork | argus | sourcebook |
|---|---|---|---|
| AST-based naming analysis | β tree-sitter | β filesystem only | β not done |
| Confidence scores | β per-category | β | β |
| Real examples from your code | β | β | β |
| Counter-examples (inconsistencies) | β | β | β |
| Error handling pattern mining | β | β | β |
| API response shape detection | β | β | β |
| Co-change file pairs | β | β | β |
Convention checking (check cmd) | β | β | β |
| MCP server with 8 tools | β | β | β (4 tools) |
| Watch mode | β | β
(sync) | β |
| Zero LLM required | β | β | β (layer A) |
| Open source / MIT | β | β | β BSL |
Claude Code β add to ~/.claude.json (or run claude mcp add interactively):
Claude Desktop β add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
Cursor β add to .cursor/mcp.json in your project root:
Then your AI agent can use 8 on-demand tools:
| Tool | When to use |
|---|---|
patchwork_scan | Get complete conventions overview |
patchwork_naming | Before writing new identifiers |
patchwork_structure | Before creating new files/directories |
patchwork_stack | When choosing libraries or commands |
patchwork_errors | Before writing error handling |
patchwork_testing | Before writing test files |
patchwork_git | Before writing commit messages |
patchwork_check | Validate a proposed name |
Copy SKILL.md from this repo to ~/.claude/skills/patchwork/SKILL.md to get /patchwork slash commands.
| Language | AST (tree-sitter) | Fallback regex |
|---|---|---|
| Python | β full | β |
| TypeScript | β full | β |
| JavaScript | β full | β |
| Go | β
(with full extra) | β |
| Rust | β
(with full extra) | β |
| Java | β
(with full extra) | β |
| Ruby, PHP, C#, C++ | β | β regex only |
Install full language support:
All analysis is 100% local β no API calls, no telemetry, no data leaves your machine.
On a 1,000-file TypeScript monorepo:
On a 500-file Python project:
Results are deterministic β same codebase always produces the same output.
Pull requests welcome. See CONTRIBUTING.md.
MIT β free for personal and commercial use.
claude-code Β· agent-skills Β· mcp Β· context-engineering Β· hallucination-detection Β· code-conventions Β· static-analysis Β· tree-sitter Β· developer-tools Β· ai-coding
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/patchwork-codebase-conventions-for-ai-agents)<a href="https://allmcps.com/mcp/patchwork-codebase-conventions-for-ai-agents"><img src="https://allmcps.com/api/badge/patchwork-codebase-conventions-for-ai-agents?style=directory" alt="Patchwork β Codebase Conventions for AI Agents on AllMCPs" /></a>