Codehabits Documentation
Codehabits learns your team's coding conventions, anti-patterns, and domain knowledge from PR history, then delivers them to every AI coding tool automatically.
Codehabits is team intelligence for AI coding agents. It extracts conventions from GitHub PR history and delivers them via .codehabits/ files, Agent Skills, and an MCP server so Cursor, Copilot, and Claude Code write code the way your team actually ships.
What is Codehabits?
AI coding tools generate code that works but doesn't match your team's patterns. They don't know your naming conventions, your preferred error handling strategy, or which patterns get PRs rejected. Codehabits fixes this.
Codehabits analyzes your codebase structure, linter configs, git history, and PR review comments to extract team intelligence: a structured, confidence-ranked model of how your team writes code. This intelligence is delivered to AI tools via Agent Skills and the Model Context Protocol (MCP).
How it works
Codehabits operates in three stages:
1. Analysis
When you run npx @codehabits/cli enable in your repository, Codehabits performs a comprehensive analysis:
- Codebase scanning: file patterns, export styles, naming conventions, async patterns, error handling
- Config importing: ESLint, Prettier, TypeScript, EditorConfig rules as high-confidence conventions
- Git history: contributor expertise, file change frequency, co-change patterns
- PR analysis: review comments, rejected patterns, domain knowledge from discussions
- Documentation scanning: CONTRIBUTING.md, architecture docs, PR templates
2. Intelligence generation
The analysis data is sent to the Codehabits cloud pipeline, which combines statistical analysis with AI extraction to produce structured intelligence: conventions (ranked by confidence), anti-patterns (ranked by severity), a domain knowledge graph, reviewer expertise maps, and risk factors.
3. Delivery
Intelligence is written to your repository as split files under .codehabits/ and as an Agent Skill that compatible AI tools auto-discover. The MCP server provides real-time tool access for convention checks and knowledge lookup.
Architecture
CLI (local) Cloud (codehabits.dev) AI Tools
───────────── ────────────── ────────
codehabits enable ──────> /api/analyze ──────────> Pipeline
├── codebase scan ├── statistical analysis ├── DeepSeek (free)
├── config import ├── AI extraction └── Claude (paid)
├── git analysis └── merge + persist to DB
└── PR fetching (same merge as local .codehabits/)
│
▼
.codehabits/conventions.json <── Response
.codehabits/anti-patterns.json <── ·
.codehabits/knowledge.json <── ·
.codehabits/reviewers.json <── ·
.codehabits/meta.json <── ·
.cursor/skills/ <── Agent Skill
MCP server <── Real-time toolsKey features
- Zero config for teammates: Agent Skills are auto-discovered. Teammates clone and code.
- Confidence-ranked: every convention has a confidence score derived from real evidence.
- Incremental sync: only new PRs are analyzed on subsequent syncs. See CI auto-sync.
- Team workspaces: GitHub organization repos are enabled into a team for shared governance and billing.
- Works with every major AI tool: Cursor, Copilot, Claude Code, Codex, Windsurf, Gemini CLI, and any MCP client.
- Privacy first: intelligence files live in your repo. No source code is stored on Codehabits servers.
✦Ready to get started?