一个模型,一组工具,以及运行这些工具的环境。模型不了解代码库,不知道如何查找文件,也不知道如何处理多任务,claude code是一种轻量级的代理,通过这种轻量
.claude/
├── settings.json # 团队共享配置
├── settings.local.json # 个人配置(不提交)
├── CLAUDE.md # 项目记忆
└── commands/ # 自定义斜杠命令
<aside> 💡
提供清晰的上下文,包括文件的位置,清楚描述你需要的功能和特性。
使用mcp,skills 扩展claude code 的功能
</aside>
简单指令是告诉模型“做什么”,而架构级 Prompt 模式是设计一个“让模型如何思考和工作”的系统。
模式一:测试驱动调试 (TDD)
场景:修复一个行为不明确的 Bug。
核心思想:不直接要求修复,而是要求先建立可验证的失败场景,再进行修复。
Prompt 模板 (Lesson 4)
The RAG chatbot returns 'query failed'. I need you to:
1. Write tests for the core components in @backend/search_tools.py, @backend/ai_generator.py, and the RAG system itself.
2. Save the tests in a `tests/` directory within @backend.
3. Run these tests to identify the failing component.
4. Propose a fix based on the test results.
Think.
模式二:关注点分离重构 (SoC Refactoring)
场景:整理一个逻辑混杂的单体脚本或 Notebook。
核心思想:明确定义目标模块结构和各自的职责,让 AI 执行代码的“搬迁”和“重组”。
Prompt 模板 (Lesson 7)
Refactor the @EDA.ipynb for e-commerce data analysis.
**Requirements:**
1. **Structure:** Organize into logical sections (Intro, Loading, Prep, Metrics, Summary) with proper markdown documentation.
2. **Code Quality:** Create reusable functions with docstrings and move core logic into separate Python modules: `business_metrics.py` and `data_loader.py`.
3. **Configurability:** Refactor the analysis to be configurable by date range.
**Deliverables:** A refactored notebook, two Python modules, and a `requirements.txt`.
模式三:“布局即 Prompt” 的 UI 生成
场景:将数据或逻辑产品化为可视化界面。
核心思想:用自然语言清晰地描述出 UI 的“线框图”和组件布局,为 AI 提供明确的视觉目标。
Prompt 模板 (Lesson 7)
Convert `@EDA_Refactored.ipynb` into a professional Streamlit dashboard with this exact layout:
## Layout Structure
- **Header**: Title + date range filter (applies globally)
- **KPI Row**: 4 cards (Total Revenue, Monthly Growth, Average Order Value, Total Orders)
- **Charts Grid**: 2x2 layout (Revenue trend, Top categories, Revenue by state, etc.)
## Key Requirements
- Use Plotly for all charts
- Filter update charts correctly
- Professional styling with trend arrows/colors
模式四:端到端“设计到代码” (Design-to-Code)
场景:从一个视觉设计稿(如 Figma)完整构建一个应用。
核心思想:分两步走,先利用 MCP 进行“视觉复刻”,再通过自主研究 API 实现“数据注入”,将设计、实现、验证、数据绑定全流程委托给 AI。
Prompt 模板 (Lesson 8)
Using the figma mockup link [paste link], use the figma dev MCP server to build the UI in this Next.js application. Use the recharts library for charts. Then, use the playwright MCP server to verify the implementation visually against the mockup.
后续指令:
Populate these charts with real-world data from the FRED API.
1 快速熟悉代码库
2,了解不熟悉的领域
5.三种模式:普通模式/自动编辑模式auto-accept edit on/计划模式plan mode on 快捷键shift+tab 6.提示词+think/think hard/think harder/ultra think 来让大模型进行深度思考 7.没有提示词时按esc键 可以回滚到你之前的某次对话
| 分类 | 命令 / 标志 | 描述 |
|---|---|---|
| 会话启动 | claude |
启动一个新的交互式会话。 |
claude -c, --continue |
继续上一次的会话。 | |
claude -r, --resume |
从历史会话列表中选择一个恢复。 | |
claude -p "prompt" |
在非交互模式下执行单个任务并打印结果。 | |
| 会话管理 | /clear |
完全清空当前对话历史,开始全新会话。 |
/compact [instr.] |
压缩对话历史,可选附加指令以保留关键信息。 | |
/model |
查看或切换当前会话使用的 AI 模型。 | |
ESC / ESC ESC |
ESC 中断当前任务,ESC ESC 回滚对话到上一个时间点。 |
|
| 上下文与记忆 | @path/to/file |
在 Prompt 中引用文件或目录,为其提供精准上下文。 |
/init |
扫描代码库,自动创建 CLAUDE.md 文件作为项目长期记忆。 |
|
/memory |
在编辑器中直接打开 CLAUDE.md 记忆文件。 |
|
# instruction |
在对话中快速添加一条记忆到 CLAUDE.md。 |
|
| 扩展与集成 | /mcp |
管理模型上下文协议(MCP)服务器连接。 |
/agents |
管理自定义的子智能体。 | |
/hooks |
配置 Hooks,定制 AI 工具执行生命周期中的行为。 | |
/install-github-app |
启动将 Claude Code 集成到 GitHub 仓库的流程。 | |
| 权限与安全 | /permissions |
查看和管理工具的使用权限。 |
--dangerously-skip-permissions |
[慎用] 在非交互模式下跳过所有权限提示。 | |
| 实用工具 | /config |
查看和修改本地配置。 |
/doctor |
检查 Claude Code 安装的健康状况。 | |
/cost |
[非订阅用户] 显示当前会话的 token 使用和成本。 |