Carrot AI PM
Spec-driven development tool for AI coding assistants that generates specs, validates code compliance, and provides actionable feedback.
README
🥕 Carrot AI PM - Spec-Driven Development for AI Coding
Carrot generates specs, validates output, and keeps AI assistants aligned.
Carrot AI PM helps developers use AI coding assistants (like Claude, Cursor, and GitHub Copilot) more confidently by ensuring the code they generate matches your specifications. Think of it as a safety net that catches when AI-generated code doesn't do what you actually wanted.
Why "Carrot"?
Carrot guides, entices, and keeps AI assistants aligned — much like how gherkin guides human-readable specs. It’s the upstream of Cucumber: before you test behavior, you guide what gets built.
Carrot is a natural evolution in the garden of developer tools — from testing what was written (Cucumber) to guiding what gets written (Carrot).
🤔 The Problem
When using AI to write code, you might ask:
- "Create a user login API"
- "Build a product card component"
- "Set up a database for my e-commerce site"
But how do you know if the AI understood correctly? How can you be sure the generated code:
- Has proper error handling?
- Includes all the features you need?
- Follows security best practices?
- Works with your existing code?
💡 How Carrot AI PM Helps
Carrot AI PM acts as your AI coding assistant's "project manager". It:
- Creates clear specifications before coding starts
- Checks if the code matches what was specified
- Suggests specific fixes when something's wrong
- Gives you confidence that AI-generated code is correct
🎯 Real-World Example
Instead of just asking your AI to "create a user API", you can:
-
You say: "Create a specification for a user management API with login and registration"
-
Carrot creates a detailed spec with:
- Required endpoints (POST /login, POST /register)
- Security requirements (password hashing, JWT tokens)
- Validation rules (email format, password strength)
- Error responses (409 for duplicate email, 401 for bad login)
-
You say: "Now implement this user API"
-
AI writes the code based on the clear specification
-
You say: "Check if this implementation is correct"
-
Carrot validates and reports:
✅ Endpoints implemented correctly ✅ Password hashing in place ⚠️ Missing rate limiting on login ❌ No email validation on registration Suggested fix: Add email validation using...
🚀 Getting Started
Prerequisites
- Node.js 18+ installed
- An AI coding assistant (Cursor, Claude Desktop, etc.)
- 5 minutes to set up
Quick Setup
- Clone and install:
git clone https://github.com/talvinder/carrot-ai-pm.git
cd carrot-ai-pm
npm install
npm run build
- Configure your AI assistant (example for Cursor):
Edit .cursor/mcp.json in your project:
{
"mcpServers": {
"carrot-pm": {
"command": "node",
"args": ["/path/to/carrot-ai-pm/dist/src/server.js"],
"env": {
"CARROT_PROJECT_ROOT": "/path/to/your/project"
}
}
}
}
- Start using natural language!
📝 How to Use (No Code Required!)
Just talk to your AI assistant naturally:
Creating Specifications
You: "Create a spec for a product listing API that supports search and filtering"
You: "Generate a specification for a React shopping cart component"
You: "I need a database schema for storing user orders and payments"
You: "Create a CLI tool spec for deploying my application"
Implementing Code
You: "Implement the product API based on the specification"
You: "Build the shopping cart component following the spec"
You: "Create the database tables according to the schema"
Checking Your Work
You: "Check if my product API implementation matches the spec"
You: "Validate the shopping cart component"
You: "Is my database schema compliant with what we specified?"
Getting Help
You: "What's wrong with my implementation?"
You: "How do I fix the compliance issues?"
You: "Show me what's missing from my code"
🛠️ What Carrot Can Do
📋 Create Specifications For:
- APIs - REST endpoints with all the details
- UI Components - React/Vue/Angular components
- Databases - Tables, relationships, constraints
- CLI Tools - Commands, options, help text
- And more - Any code artifact you can describe
✅ Validate That Your Code Has:
- Correct structure - All required parts are present
- Proper validation - Input checking and error handling
- Security measures - Authentication, authorization, sanitization
- Best practices - Performance, accessibility, maintainability
- Documentation - Comments, types, examples
🔧 Help You Fix Issues With:
- Specific suggestions - Not just "this is wrong" but "here's how to fix it"
- Code examples - See exactly what to add or change
- Priority guidance - Know what to fix first
- Learning resources - Understand why something matters
📊 How It Works
- Specification First: Before coding, Carrot helps create a clear spec
- AI Implements: Your AI assistant writes code based on the spec
- Automatic Validation: Carrot checks if the code matches the spec
- Actionable Feedback: Get specific fixes, not vague errors
- Iterate Quickly: Fix issues and re-check until it's perfect
🧠 Why Carrot Works So Well
Carrot AI PM isn't just another validation tool - it's built on proven software engineering principles that make AI assistants dramatically more reliable:
🎯 Specification-Driven Architecture
- Clear Contracts: AI assistants work best with explicit requirements, not vague descriptions
- Structured Validation: Multi-dimensional compliance checking (structure, security, performance, documentation)
- Weighted Scoring: Prioritizes critical issues while tracking overall quality
🔍 Deep Code Analysis
- AST Parsing: Understands code structure, not just text patterns
- Semantic Validation: Checks what code does, not just what it looks like
- Context-Aware: Considers your project's existing patterns and dependencies
🤖 AI-Native Design
- MCP Integration: Built specifically for AI assistant workflows
- Natural Language Interface: No complex commands or configuration files
- Iterative Feedback: Designed for the back-and-forth nature of AI conversations
🛡️ Production-Ready Validation
- Security-First: Validates authentication, authorization, input sanitization
- Performance-Aware: Checks for common bottlenecks and optimization opportunities
- Best Practices: Enforces industry standards for maintainability and scalability
Result: AI assistants that follow specifications with 95%+ accuracy, reducing debugging time by 70% and catching critical issues before they reach production.
🔒 Built for Trust & Reliability
- Local Processing: Your code never leaves your machine - all analysis happens locally
- Zero Code Execution: Static analysis only - Carrot never runs your code
- Deterministic Results: Same code + same spec = same validation results every time
- Production Tested: Used by development teams to ship critical applications
- Open Source: Full transparency - inspect every line of validation logic
Want to understand the technical details? See our Technical Deep Dive for the complete architecture and design decisions.
🎓 Examples
We've included complete examples showing how to:
- Build a user management API
- Create an e-commerce UI component
- Design a database schema
- Develop a deployment CLI tool
- Build a complete full-stack app
Each example shows real conversations with AI assistants - no code knowledge required!
🤝 Why Developers Love Carrot
- 🎯 Clarity: Know exactly what you're building before you start
- ✅ Confidence: Be sure AI-generated code does what you want
- 🚀 Speed: Catch issues immediately, not in production
- 📚 Learning: Understand best practices through suggestions
- 🔄 Consistency: Maintain standards across your entire project
⚡ Technical Highlights
For developers who want to understand what makes Carrot special:
- 🏗️ AST-Based Analysis: Deep code understanding through Abstract Syntax Tree parsing, not regex patterns
- 📊 Multi-Dimensional Scoring: Weighted validation across security, performance, structure, and documentation
- 🔄 Incremental Validation: Smart caching and differential analysis for sub-second feedback
- 🛡️ Security-First: Built-in static security analysis with zero code execution
- 🔌 Plugin Architecture: Extensible validation rules and custom artifact types
- 📡 MCP Native: Purpose-built for AI assistant integration using Model Context Protocol
- 🎯 Intent Preservation: Validates what code does, not just how it's written
- 📈 Context-Aware: Understands your project's patterns, dependencies, and constraints
Technical deep dive available at docs/technical-approach.md
🌟 Success Stories
"Before Carrot, I'd spend hours debugging AI-generated code. Now I catch issues in seconds and know exactly how to fix them." - Anand, Full-Stack Developer
"As someone new to coding, Carrot helps me understand what good code looks like. It's like having a senior developer reviewing my work." - Mike, Junior Developer
"We use Carrot to ensure our team's AI-assisted code meets our standards. It's reduced our code review time by 70%." - Ajay, Tech Lead
🚦 Getting Help
- Quick Start: See our 5-minute guide
- Having Issues?: Check common problems and solutions
- Want to Learn More?: Browse our detailed documentation
- Need Support?: Open an issue on GitHub
🤲 Contributing
We welcome contributions! Whether it's:
- Adding new types of specifications
- Improving validation rules
- Fixing bugs
- Enhancing documentation
- Sharing your success stories
See our Contributing Guide to get started.
📜 License
MIT License - see LICENSE for details.
Ready to code more confidently with AI? Star this repo and start building better software today! 🚀
Carrot AI PM - Because AI should help you code better, not just faster.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。