---
title:
source: "https://gemini.google.com/app/50a826f2ddf64a78"
author:
  - "[[Gemini]]"
published:
created: 2026-01-13
description: "认识 Gemini：Google 旗下的 AI 助理。在写作、规划和开展头脑风暴等方面获得帮助。体验生成式 AI 的强大功能。"
tags:
  - "clippings"
---
## 1\. 核心理念 (Core Philosophy)

- **Human-Driven, AI-Executed:** 我是架构师和裁判，AI 是执行者。
- **TDD is Law:** 没有失败的测试用例，就不写实现代码。
- **Spec-First:** 想清楚（文档）再动手（代码）。
- **Plain English:** 用最简单、直接的英语沟通和注释，拒绝学术黑话。

---

## 2\. 项目基础设施 (Configuration)

每个新项目初始化时，必须包含以下核心文件。

### A. 项目宪法 (`CLAUDE.md`)

*放在项目根目录，作为 AI 的“入职手册”。*

Markdown

```
# Claude Code Guidelines & Rules

## 1. Core Workflow
- **TDD Strictly:** ALWAYS write or ask for a failing test case before implementing logic.
- **Spec-First:** Follow \`PLAN.md\` or \`SPEC.md\`. Do not guess requirements.
- **Plain English:** Explain logic in simple Subject-Verb-Object sentences.

## 2. Python Standards
- **Type Hints:** MANDATORY for all function arguments and returns.
- **Data Validation:** Use \`Pydantic\` models, not raw dictionaries.
- **Docstrings:** Google-style, concise.
- **No 'os.path':** Use \`pathlib\` for file handling.

## 3. Interaction Rules
- **No Hallucinations:** If unsure about a library, ask to check docs.
- **Context:** Do NOT read \`venv/\`, \`node_modules/\`, or large data files.
- **Security:** Never output API keys or secrets in the terminal.
  
## 4. Human-in-the-Loop Protocol (MANDATORY)

After generating any significant code (more than 20 lines or modifying core logic), you MUST automatically perform the following steps BEFORE asking me to proceed:

1.  **Self-Explanation:** Briefly explain *what* you changed and *why*, in Plain English.
2.  **Structural Check:** Did you introduce any new dependencies? Did you change any function signatures?
3.  **Risk Assessment:** What is the most likely thing to break with this change?
4.  **Verification Plan:** Tell me exactly which test command to run to verify this specific change.

## 5. 功能重叠领域只用Superpowers
- 设计/头脑风暴 → superpowers:brainstorming
- 编写/执行计划 → superpowers:writing-plans/executing-plans  
- TDD → superpowers:test-driven-development
- 代码审查 → superpowers:requesting-code-review
- 调试 → superpowers:systematic-debugging
- 验证 → superpowers:verification-before-completion

## 6. 特定技术审查用ECC
- Go代码审查 → everything-claude-code:go-review
- Python审查 → everything-claude-code:python-review
- 安全审计 → everything-claude-code:security-review
- 数据库审查 → everything-claude-code:database-review
```

### B. 任务自动化 (`justfile`)

*替代 Makefile，用于快速执行高频指令。*

Makefile

```
# Run all tests
test:
    pytest -v

# Clean up context to save tokens
clean:
    rm -rf __pycache__
    opencode /compact

# Resume work from last session
resume:
    opencode "Read WIP.md. Let's pick up where we left off."
```

---

## 3\. 标准作业程序 (SOP)

### Phase 1: 规划与定义 (Planning)

1. **新建/更新 `PLAN.md`：** 用自然语言写清楚要干什么。
2. **生成架构：** 让 AI 读取计划，生成项目结构（空文件）或伪代码。
	- *指令：* "Read PLAN.md. Create the file structure. Do not write code yet."
3. **防御性准备：** 如果是复杂逻辑，提供参考文件 (Reference File) 给 AI 模仿风格。

### Phase 2: 测试驱动开发循环 (The TDD Loop)

1. **Red (写测试)：** 编写一个**必然失败**的测试用例。
2. **Green (写实现)：**
	- *指令：* "Run `pytest tests/test_feature.py`. It fails. Implement logic in `src/feature.py` to make it pass. **Do NOT touch the test file.**"
3. **Refactor (重构)：** 测试通过后，要求 AI 优化代码结构或增加类型注解。

### Phase 3: 局部实现 (Comment Driven)

- 在代码中写下 `TODO` 注释，然后让 AI 填空。
	Python
	```
	# TODO: Implement get_crypto_price(ticker)
	# 1. Use requests to call CoinGecko.
	# 2. Return Pydantic model.
	# 3. Handle timeouts.
	```

### Phase 4: 审查与提交 (Review)

1. **清理上下文：** 执行 `/compact`。
2. **Team Leader 审查：**
	- *指令：* "Act as a strict Team Leader. Review changes for logic bugs, security risks, and Chinglish variable names."
3. **Plain English 解释：** 要求 AI 用简单英语解释核心逻辑（顺便学习英语）。
4. **Git 提交。**

---

## 4\. 高效与可持续性策略 (Power Habits)

### A. 断点续传协议 (Session Resume)

*专为碎片化时间设计。*

- **结束时：**
	- *指令：* "I'm stopping. Update `WIP.md`. List what is done, what is half-done, and the exact command to resume next time."
- **开始时：**
	- *指令：* "Read `WIP.md`. Let's resume."

### B. 上下文洁癖 (Context Hygiene)

- **禁止：** 永远不要用 `add .` (添加全量文件)。
- **精准投喂：** `/add src/current_file.py tests/test_current.py PLAN.md`。
- **定期清理：** 每个 Feature 做完提交后，必须 `/compact` 或重启 Session。

### C. 英语内化闭环 (English Loop)

- **Code-to-Concept:** 让 AI 找出代码注释中晦涩的词汇，改写为 Plain English。
- **词汇积累：** 将这些优化点记录到 `VOCABULARY.md`。

### D. 混合模型策略 (Hybrid Model)

- **OpenCode 优势：**
	- **架构/难点/Debug：** 切换使用 **Claude 3.5/3.7 Sonnet**。
	- **文档/补全/简单测试：** 切换使用 **DeepSeek-V3** 或 **Claude Haiku** (省钱且快)。

---

## 5\. 针对特定技术栈的备注

### Python / AI Agent 开发

- **Type Hints:** 必须覆盖所有函数。
- **Pydantic:** 只要涉及数据结构交换，必须定义 Model。

### Manim (数学动画)

- **视觉验收 (Visual Check):**
	- 不要试图自动化测试“画面好不好看”。
	- 让 AI 先生成 `SCENE_DESC.md` (场景文字描述)，你确认画面逻辑无误后，再生成代码。
	- 人工运行渲染 -> 观看视频 -> 反馈调整。