legacy-to-ai-ready
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLegacy to AI-Ready
从遗留项目到AI就绪
Transform legacy codebases into AI-ready projects by generating Claude Code configurations.
借助Claude Code配置将遗留代码库转换为AI就绪项目。
Quick Start (5-Minute Setup)
快速开始(5分钟设置)
For most projects, start with just CLAUDE.md:
- Analyze:
python scripts/analyze_codebase.py [path] - Create CLAUDE.md with build commands, code style, architecture overview
- Done - Claude can now write code following your project's conventions
Expand to full configuration only when needed.
对于大多数项目,只需从CLAUDE.md开始:
- 分析:
python scripts/analyze_codebase.py [path] - 创建CLAUDE.md,包含构建命令、代码风格、架构概述
- 完成 - Claude现在可以遵循你的项目约定编写代码
仅在需要时再扩展为完整配置。
Interactive Discovery
交互式探索
Before generating configs, ask these questions:
Project Scope:
- What is this project? (web app, API, CLI, library)
- Primary language and frameworks?
- Team size? (solo, small team, enterprise)
Pain Points:
- What mistakes do new developers commonly make?
- What patterns should always be followed?
- What operations are repeated frequently?
Integration Needs:
- External services used? (databases, APIs, cloud)
- CI/CD pipeline? (GitHub Actions, Jenkins)
- Code quality tools? (linters, formatters)
生成配置前,请先询问以下问题:
项目范围:
- 这是什么类型的项目?(Web应用、API、CLI、库)
- 主要语言和框架是什么?
- 团队规模?(单人、小型团队、企业)
痛点:
- 新开发人员通常会犯哪些错误?
- 哪些模式必须始终遵循?
- 哪些操作会重复执行?
集成需求:
- 使用了哪些外部服务?(数据库、API、云服务)
- 是否有CI/CD流水线?(GitHub Actions、Jenkins)
- 使用了哪些代码质量工具?(代码检查器、格式化工具)
Configuration Decision Tree
配置决策树
Start
│
├─ Small project / Solo dev
│ └─ CLAUDE.md only
│
├─ Team project
│ ├─ Multi-language? → Add .claude/rules/
│ ├─ Complex domain? → Add .claude/skills/
│ ├─ Code reviews? → Add .claude/agents/
│ └─ Repeated tasks? → Add .claude/commands/
│
└─ Enterprise / Large team
└─ All configurations + MCP servers + HooksStart
│
├─ Small project / Solo dev
│ └─ CLAUDE.md only
│
├─ Team project
│ ├─ Multi-language? → Add .claude/rules/
│ ├─ Complex domain? → Add .claude/skills/
│ ├─ Code reviews? → Add .claude/agents/
│ └─ Repeated tasks? → Add .claude/commands/
│
└─ Enterprise / Large team
└─ All configurations + MCP servers + HooksGenerated Configurations
生成的配置
| Config | Purpose | When to Create |
|---|---|---|
| CLAUDE.md | Project memory (shared) | Always (required) |
| CLAUDE.local.md | Personal preferences (git-ignored) | Individual customization |
| .claudeignore | Files Claude should not access | Sensitive files exist |
| .claude/rules/ | Path-specific rules | Multi-module projects |
| .claude/skills/ | Domain knowledge | Complex business logic |
| .claude/agents/ | Task specialists | Repeated review/debug tasks |
| .claude/commands/ | Quick prompts | Common workflows |
| .claude/settings.json | Hooks + permissions | Auto-formatting, security |
| MCP servers | External tools | Database/API integrations |
| 配置 | 用途 | 创建时机 |
|---|---|---|
| CLAUDE.md | 项目共享记忆 | 始终需要(必填) |
| CLAUDE.local.md | 个人偏好(Git忽略) | 个性化定制时 |
| .claudeignore | Claude不应访问的文件 | 存在敏感文件时 |
| .claude/rules/ | 路径特定规则 | 多模块项目时 |
| .claude/skills/ | 领域知识 | 存在复杂业务逻辑时 |
| .claude/agents/ | 任务专家 | 存在重复的评审/调试任务时 |
| .claude/commands/ | 快速提示 | 存在常见工作流时 |
| .claude/settings.json | 钩子与权限 | 需要自动格式化、安全控制时 |
| MCP servers | 外部工具集成 | 需要数据库/API集成时 |
Workflow
工作流
Phase 1: Automated Analysis
阶段1:自动化分析
bash
python scripts/analyze_codebase.py [project-path]The script detects:
- Languages and frameworks
- Directory structure patterns
- Development tools (linters, formatters)
- Git commit patterns
- Environment variables
- Code style indicators
- CI/CD configurations (GitHub Actions, etc.)
- Sensitive files (warns about .env, credentials)
Output includes:
- Recommendations for which configs to create
- Security warnings for sensitive files
- Suggested .claudeignore patterns
bash
python scripts/analyze_codebase.py [project-path]该脚本会检测:
- 语言和框架
- 目录结构模式
- 开发工具(代码检查器、格式化工具)
- Git提交模式
- 环境变量
- 代码风格指标
- CI/CD配置(如GitHub Actions)
- 敏感文件(会对.env、凭证文件发出警告)
输出内容包括:
- 建议创建的配置类型
- 敏感文件的安全警告
- 推荐的.claudeignore模式
Phase 2: Context Gathering
阶段2:上下文收集
Claude should read:
- 3-5 representative source files - understand naming, patterns
- Test files - understand testing approach
- Config files - package.json, tsconfig, etc.
- README/docs - project overview
- Recent commits - understand commit style
Claude应读取以下内容:
- 3-5个有代表性的源文件 - 理解命名规则和模式
- 测试文件 - 了解测试方法
- 配置文件 - package.json、tsconfig等
- README/文档 - 项目概述
- 近期提交记录 - 了解提交风格
Phase 2.5: Discover Existing Resources
阶段2.5:发现现有资源
Before creating custom configs, search for existing skills and MCP servers:
- Search skill marketplaces - SkillsMP, SkillHub.club, Claude Skills Hub
- Check GitHub repositories - awesome-claude-skills, themed skill collections
- Find relevant MCP servers - Glama, MCP Market, official registry
See references/resource-discovery.md for complete directory of sources.
Tip: Many common needs (git commit, code review, database patterns) already have well-maintained skills available.
创建自定义配置前,请先搜索现有的skills和MCP服务器:
- 搜索技能市场 - SkillsMP、SkillHub.club、Claude Skills Hub
- 查看GitHub仓库 - awesome-claude-skills、主题化技能集合
- 查找相关MCP服务器 - Glama、MCP Market、官方注册表
完整的资源目录请参见references/resource-discovery.md。
提示:许多常见需求(Git提交、代码评审、数据库模式)都已有维护良好的可用skills。
Phase 3: Generate Configurations
阶段3:生成配置
1. CLAUDE.md (Required)
1. CLAUDE.md(必填)
Create at project root with:
- Quick reference commands (build, test, lint)
- Naming conventions
- Architecture overview
- Testing guidelines
- Git workflow
See references/claude-md-patterns.md.
在项目根目录创建,包含:
- 快速参考命令(构建、测试、代码检查)
- 命名约定
- 架构概述
- 测试指南
- Git工作流
请参见references/claude-md-patterns.md。
2. Rules (If Multi-Module)
2. 规则(多模块项目时)
Create when:
.claude/rules/- Multiple languages need different conventions
- Modules have distinct patterns (frontend/backend)
- Path-specific requirements exist
See references/rules-patterns.md.
在以下情况创建:
.claude/rules/- 多种语言需要不同的约定
- 模块有不同的模式(前端/后端)
- 存在路径特定的要求
请参见references/rules-patterns.md。
3. Skills (If Complex Domain)
3. Skills(复杂领域时)
Create when:
.claude/skills/- Domain-specific workflows exist (database, API patterns)
- Team knowledge needs preservation
- Complex procedures are repeated
See references/skills-patterns.md.
在以下情况创建:
.claude/skills/- 存在领域特定工作流(数据库、API模式)
- 需要保留团队知识
- 存在重复的复杂流程
请参见references/skills-patterns.md。
4. Subagents (If Specialized Tasks)
4. 子代理(专业化任务时)
Create for:
.claude/agents/- Code review automation
- Debugging assistance
- Security auditing
- Documentation generation
See references/agents-patterns.md.
为以下场景创建:
.claude/agents/- 代码评审自动化
- 调试辅助
- 安全审计
- 文档生成
请参见references/agents-patterns.md。
5. Commands (If Common Operations)
5. 命令(常见操作时)
Create for:
.claude/commands/- Git commit workflow
- PR review process
- Deployment steps
- Test running
See references/commands-patterns.md.
为以下场景创建:
.claude/commands/- Git提交工作流
- PR评审流程
- 部署步骤
- 测试运行
请参见references/commands-patterns.md。
6. Hooks (If Auto-Formatting Needed)
6. 钩子(需要自动格式化时)
Configure for:
.claude/settings.json- Auto-format on file edit
- Protected files
- Command logging
See references/hooks-patterns.md.
配置用于:
.claude/settings.json- 文件编辑时自动格式化
- 受保护文件设置
- 命令日志
请参见references/hooks-patterns.md。
7. MCP Servers (If External Integrations)
7. MCP服务器(需要外部集成时)
Configure MCP for:
- Database access
- GitHub integration
- Slack notifications
- Custom internal tools
See references/mcp-patterns.md.
配置MCP用于:
- 数据库访问
- GitHub集成
- Slack通知
- 自定义内部工具
请参见references/mcp-patterns.md。
Phase 4: Validate
阶段4:验证
- Ask Claude to perform a typical task
- Verify it follows project conventions
- Iterate based on gaps discovered
- 让Claude执行一项典型任务
- 验证它是否遵循项目约定
- 根据发现的不足进行迭代
Output Structure
输出结构
Minimal (small projects):
project/
├── CLAUDE.md
└── [existing files]Standard (team projects):
project/
├── CLAUDE.md
├── .claude/
│ ├── rules/
│ │ └── code-style.md
│ └── commands/
│ └── commit.md
└── [existing files]Complete (enterprise):
project/
├── CLAUDE.md # Shared project memory
├── CLAUDE.local.md # Personal (git-ignored)
├── .claudeignore # Files to protect
├── .claude/
│ ├── settings.json # Hooks + permissions
│ ├── rules/
│ ├── skills/
│ ├── agents/
│ └── commands/
└── [existing files]最小配置(小型项目):
project/
├── CLAUDE.md
└── [existing files]标准配置(团队项目):
project/
├── CLAUDE.md
├── .claude/
│ ├── rules/
│ │ └── code-style.md
│ └── commands/
│ └── commit.md
└── [existing files]完整配置(企业级):
project/
├── CLAUDE.md # 共享项目记忆
├── CLAUDE.local.md # 个人配置(Git忽略)
├── .claudeignore # 受保护文件列表
├── .claude/
│ ├── settings.json # 钩子与权限
│ ├── rules/
│ ├── skills/
│ ├── agents/
│ └── commands/
└── [existing files]Reference Materials
参考资料
| Reference | When to Read |
|---|---|
| examples.md | Complete real-world examples |
| resource-discovery.md | Find existing skills & MCP servers |
| advanced-patterns.md | Migrations, team collab, monorepos |
| claude-md-patterns.md | Creating CLAUDE.md |
| rules-patterns.md | Module-specific rules |
| skills-patterns.md | Domain knowledge |
| agents-patterns.md | Task specialists |
| commands-patterns.md | Quick prompts |
| hooks-patterns.md | Auto-formatting |
| mcp-patterns.md | External tools |
| 参考文档 | 阅读时机 |
|---|---|
| examples.md | 完整的真实世界示例 |
| resource-discovery.md | 查找现有skills和MCP服务器 |
| advanced-patterns.md | 迁移、团队协作、单体仓库 |
| claude-md-patterns.md | 创建CLAUDE.md时 |
| rules-patterns.md | 配置模块特定规则时 |
| skills-patterns.md | 配置领域知识时 |
| agents-patterns.md | 配置任务专家时 |
| commands-patterns.md | 配置快速提示时 |
| hooks-patterns.md | 配置自动格式化时 |
| mcp-patterns.md | 配置外部工具集成时 |
Templates & Bundled Skills
模板与预打包Skills
Templates:
- - Project memory template
assets/CLAUDE.md.template - - Hooks configuration
assets/settings.json.template - - File ignore patterns
assets/claudeignore.template
Bundled skills to install in target project:
- - For creating new project-specific skills
assets/skill-creator/ - - For downloading additional skills
assets/skill-downloader/ - - For discovering existing skills & MCP servers
assets/resource-scout/
模板:
- - 项目记忆模板
assets/CLAUDE.md.template - - 钩子配置模板
assets/settings.json.template - - 文件忽略模式模板
assets/claudeignore.template
可安装到目标项目的预打包Skills:
- - 用于创建新的项目特定skills
assets/skill-creator/ - - 用于下载额外的skills
assets/skill-downloader/ - - 用于发现现有skills和MCP服务器
assets/resource-scout/
Installing Bundled Skills
安装预打包Skills
Copy these skills to the target project's directory:
.claude/skills/bash
cp -r assets/skill-creator [target-project]/.claude/skills/
cp -r assets/skill-downloader [target-project]/.claude/skills/
cp -r assets/resource-scout [target-project]/.claude/skills/This enables the target project to:
- resource-scout - Discover existing skills & MCP servers before building custom
- skill-downloader - Download and install skills from GitHub or archives
- skill-creator - Create custom skills tailored to their domain
将这些Skills复制到目标项目的目录:
.claude/skills/bash
cp -r assets/skill-creator [target-project]/.claude/skills/
cp -r assets/skill-downloader [target-project]/.claude/skills/
cp -r assets/resource-scout [target-project]/.claude/skills/这将使目标项目具备以下能力:
- resource-scout - 在构建自定义资源前发现现有skills和MCP服务器
- skill-downloader - 从GitHub或归档文件下载并安装skills
- skill-creator - 创建适合其领域的自定义skills
Language Quick Reference
语言快速参考
TypeScript/JavaScript
TypeScript/JavaScript
- Extract: eslint, prettier, tsconfig
- Hooks: prettier auto-format
- Skills: API patterns, component patterns
- 提取内容:eslint、prettier、tsconfig
- 钩子:prettier自动格式化
- Skills:API模式、组件模式
Python
Python
- Extract: black, ruff, mypy, pyproject.toml
- Hooks: black/ruff auto-format
- Skills: API patterns, ORM patterns
- 提取内容:black、ruff、mypy、pyproject.toml
- 钩子:black/ruff自动格式化
- Skills:API模式、ORM模式
Go
Go
- Extract: gofmt, golangci-lint
- Hooks: gofmt auto-format
- Skills: error handling patterns
- 提取内容:gofmt、golangci-lint
- 钩子:gofmt自动格式化
- Skills:错误处理模式
Rust
Rust
- Extract: rustfmt, clippy
- Hooks: rustfmt auto-format
- Skills: error handling, async patterns
- 提取内容:rustfmt、clippy
- 钩子:rustfmt自动格式化
- Skills:错误处理、异步模式