code-copilot
v1.0.0
Published
Progressive Spec Coding Framework — cross-platform AI coding collaboration
Maintainers
Readme
Code Copilot — Progressive Spec Coding Framework
中文
跨平台 AI 编码协作框架,基于 Spec 驱动的渐进式编码方法论。 支持 Claude Code、Cursor、Cline、Windsurf、OpenClaw、CoPaw、OpenCode、Aider 等工具。
一键安装
在你的项目根目录执行一条命令即可:
# Node.js 用户(推荐)
npx code-copilot init # 默认安装 Claude Code 适配
npx code-copilot init cursor # 安装 Cursor 适配
npx code-copilot init openclaw # 安装 OpenClaw 适配
npx code-copilot init all # 安装所有平台适配# Mac / Linux 用户(无需 Node.js)
curl -fsSL https://raw.githubusercontent.com/lawushanshan/code-copilot/main/install.sh | bash -s -- claude可选平台:claude、openclaw、copaw、cursor、cline、windsurf、opencode、aider、all
核心理念
在让 AI 写代码之前,先用结构化文档(Spec)把"要做什么、怎么做、有什么约束"说清楚,然后 AI 围绕这份文档编码。
三条铁律:
- No Spec, No Code — 没有文档,不准写代码
- Spec is Truth — 文档和代码冲突时,错的一定是代码
- Reverse Sync — 发现偏差,先修文档再修代码
渐进式复杂度:不同复杂度的需求暴露不同深度的流程 — 小改动直接改,中等需求走 Spec+Tasks,大需求走全流程。
目录结构
.
├── AGENTS.md # 通用适配入口(所有平台自动识别)
├── README.md # 本文件
├── core/ # 核心(平台无关)
│ ├── rules/ # 项目约束(始终加载)
│ │ ├── project-context.md # 工程结构和技术栈(/init 填充)
│ │ ├── coding-style.md # 编码规范
│ │ ├── security.md # 安全红线
│ │ └── domain-rules.md # 业务领域约束
│ ├── knowledge/ # 领域知识(按需加载)
│ │ └── index.md # 知识索引(知识飞轮输出)
│ ├── agents/ # Prompt 模板(核心资产)
│ │ ├── copilot-prompt.md # 主 Agent 完整指令
│ │ ├── spec-reviewer.md # Spec 合规审查
│ │ └── code-quality-reviewer.md # 代码质量审查
│ ├── templates/ # 文件模板
│ │ ├── spec.md # Spec 文档模板
│ │ ├── tasks.md # 任务拆分模板
│ │ ├── test-spec.md # 单测 Spec 模板
│ │ └── log.md # 变更日志模板
│ └── changes/ # 变更目录(运行时创建)
└── adapters/ # 平台适配层(薄壳)
├── claude-code/ # Claude Code(斜杠命令)
├── openclaw/ # OpenClaw(AGENTS.md + SOUL.md + IDENTITY.md)
├── copaw/ # CoPaw(Skills + config.yaml)
├── cursor/ # Cursor(.cursorrules)
├── cline/ # Cline(.clinerules)
├── windsurf/ # Windsurf(.windsurfrules)
├── opencode/ # OpenCode(opencode.json)
└── aider/ # Aider(.aider.conf.yml)快速开始
推荐使用一键安装(见上方),也可以手动复制:
git clone https://github.com/lawushanshan/code-copilot.git
# 然后将 AGENTS.md、core/ 和对应平台的适配文件复制到你的项目中初始化
安装完成后,让 AI 分析你的项目并填充工程上下文:
/init或非 Claude Code 平台:
请初始化项目上下文,分析工程结构并填充 project-context.md工作流概览
/init → /propose → /apply → /review → /fix(如需) → /archive
↗ ↓
直接改(小改动) /test(可选)| 阶段 | 角色分工 | 产出 |
|------|---------|------|
| /init | AI 全自动 | rules/project-context.md |
| /propose | 人主导,AI 辅助 | changes/<名>/spec.md + tasks.md + log.md |
| /apply | AI 主导,人审查 | 代码 + git commits |
| /review | AI 审查 | 合规报告 + 质量报告 |
| /fix | AI 执行,人审查 | 增量代码修正 |
| /archive | 人决定,AI 执行 | 知识沉淀到 knowledge/ |
自定义指南
| 想改什么 | 编辑哪个文件 |
|---------|------------|
| 编码规范 | core/rules/coding-style.md |
| 业务规则 | core/rules/domain-rules.md |
| 安全规则 | core/rules/security.md |
| 核心工作流 | core/agents/copilot-prompt.md |
| 文档模板 | core/templates/ 下对应文件 |
设计原则
- 核心逻辑在
core/,适配器只是薄壳 — 更新框架只需改 core - 纯 Markdown,零依赖 — 复制即用,无需安装
- 双触发模式 — 斜杠命令(Claude Code)+ 自然语言意图映射(所有平台)
- 知识飞轮 — 每次变更的经验自动沉淀,持续提升 AI 理解力
English
A cross-platform AI coding collaboration framework based on Spec-driven progressive coding methodology. Supports Claude Code, Cursor, Cline, Windsurf, OpenClaw, CoPaw, OpenCode, Aider, and more.
Core Philosophy
Before letting AI write code, use structured documentation (Spec) to clarify what to do, how to do it, and what constraints exist. Then AI codes around that document.
Three Iron Laws:
- No Spec, No Code — No documentation, no coding allowed
- Spec is Truth — When code conflicts with docs, code is wrong
- Reverse Sync — When deviations are found, fix docs first, then code
Progressive Complexity: Different requirement complexities expose different workflow depths — small changes go direct, medium needs go through Spec+Tasks, large needs use the full workflow.
Directory Structure
.
├── AGENTS.md # Universal adapter entry (auto-detected by all platforms)
├── README.md # This file
├── core/ # Core (platform-agnostic)
│ ├── rules/ # Project constraints (always loaded)
│ │ ├── project-context.md # Project structure & tech stack (filled by /init)
│ │ ├── coding-style.md # Coding conventions
│ │ ├── security.md # Security red lines
│ │ └── domain-rules.md # Business domain constraints
│ ├── knowledge/ # Domain knowledge (loaded on demand)
│ │ └── index.md # Knowledge index (knowledge flywheel output)
│ ├── agents/ # Prompt templates (core asset)
│ │ ├── copilot-prompt.md # Main Agent full instructions
│ │ ├── spec-reviewer.md # Spec compliance review
│ │ └── code-quality-reviewer.md # Code quality review
│ ├── templates/ # Document templates
│ │ ├── spec.md # Spec document template
│ │ ├── tasks.md # Task breakdown template
│ │ ├── test-spec.md # Unit test spec template
│ │ └── log.md # Change log template
│ └── changes/ # Changes directory (created at runtime)
└── adapters/ # Platform adapters (thin shells)
├── claude-code/ # Claude Code (slash commands)
├── openclaw/ # OpenClaw (AGENTS.md + SOUL.md + IDENTITY.md)
├── copaw/ # CoPaw (Skills + config.yaml)
├── cursor/ # Cursor (.cursorrules)
├── cline/ # Cline (.clinerules)
├── windsurf/ # Windsurf (.windsurfrules)
├── opencode/ # OpenCode (opencode.json)
└── aider/ # Aider (.aider.conf.yml)One-Line Install
Run one command in your project root:
# Node.js users (recommended)
npx code-copilot init # Claude Code (default)
npx code-copilot init cursor # Cursor
npx code-copilot init openclaw # OpenClaw
npx code-copilot init all # All adapters# Mac / Linux users (no Node.js required)
curl -fsSL https://raw.githubusercontent.com/lawushanshan/code-copilot/main/install.sh | bash -s -- claudeAvailable platforms: claude, openclaw, copaw, cursor, cline, windsurf, opencode, aider, all
Quick Start
One-line install is recommended (see above). You can also install manually:
git clone https://github.com/lawushanshan/code-copilot.git
# Then copy AGENTS.md, core/, and your platform's adapter files into your projectInitialize
After installation, let AI analyze your project and fill the engineering context:
/initOr for non-Claude Code platforms:
Please initialize the project context, analyze the project structure and fill project-context.mdWorkflow Overview
/init → /propose → /apply → /review → /fix (if needed) → /archive
↗ ↓
Direct fix /test (optional)
(small changes)| Phase | Role | Output |
|-------|------|--------|
| /init | AI fully automatic | rules/project-context.md |
| /propose | Human-led, AI-assisted | changes/<name>/spec.md + tasks.md + log.md |
| /apply | AI-led, human reviews | Code + git commits |
| /review | AI reviews | Compliance report + quality report |
| /fix | AI executes, human reviews | Incremental code fixes |
| /archive | Human decides, AI executes | Knowledge captured in knowledge/ |
Customization Guide
| What to customize | Which file to edit |
|-------------------|-------------------|
| Coding conventions | core/rules/coding-style.md |
| Business rules | core/rules/domain-rules.md |
| Security rules | core/rules/security.md |
| Core workflow | core/agents/copilot-prompt.md |
| Document templates | Corresponding file in core/templates/ |
Design Principles
- Core logic in
core/, adapters are thin shells — Update the framework by changing onlycore/ - Pure Markdown, zero dependencies — Copy and use, no installation needed
- Dual trigger mode — Slash commands (Claude Code) + natural language intent mapping (all platforms)
- Knowledge flywheel — Experience from each change is automatically captured, continuously improving AI understanding
License
MIT
