模块 1: 基础1.6: 项目记忆

1.6: 项目记忆

  • 完成时间: 20-25 分钟
  • 前提要求: 完成模块 1.1-1.5

在 Claude Code 中启动这个模块: 运行 /start-1-6 来开始互动体验。

📖 概述

CLAUDE.md 是 Claude 为你的项目提供的永久记忆。写一次,Claude 就会在每次对话中知道你的产品上下文 - 无需重新解释。

关键要点: CLAUDE.md 是你项目的宪法 - 不可变的规则,覆盖临时提示。虽然提示是灵活的请求,但 CLAUDE.md 建立了你项目的最高法则。

🏛️ What Is CLAUDE.md?

The Core Concept

CLAUDE.md is a markdown file in your project directory containing permanent context about your product, team, and preferences. Claude automatically reads it at session start and applies everything in it.

Three key properties:

  • Automatic loading: Claude reads it at session start automatically
  • Persistent memory: Carries across ALL conversations in that directory
  • Team-shareable: Commit to git, entire team gets same context

The Constitution vs Legislation Hierarchy

Understanding this hierarchy is crucial:

AspectCLAUDE.md (Constitution)User Prompts (Legislation)
PrioritySupreme - always winsSecondary - must comply
PermanenceStays foreverTemporary per request
ScopeApplies to all sessionsApplies to current task
PurposeImmutable project rulesFlexible specific requests
ExampleAlways call it WorkspaceCreate a PRD for dark mode

If there’s a conflict, CLAUDE.md ALWAYS wins.

Example: Terminology Override

CLAUDE.md says:

在 SingTech 文档中始终使用 Workspace 而不是 Project。

You prompt:

Write a PRD for the new Project dashboard feature

Claude does:

Writes the PRD using "Workspace dashboard" because CLAUDE.md overrides
your casual prompt wording

# The Power of the # Symbol

Dynamic Session Rules

Add temporary rules to your current session using # at the start of a line:

# Always use bullet points instead of numbered lists in this session

Claude treats this as a rule for the rest of your conversation (but not future sessions).

# vs CLAUDE.md

Feature# SymbolCLAUDE.md
DurationCurrent session onlyForever
ScopeThis conversationAll conversations
Use caseExperimenting with preferencesPermanent project rules

Workflow: Use # to experiment, then add to CLAUDE.md when you want it permanent.

📝 What to Put in CLAUDE.md

✅ GOOD for CLAUDE.md

1. Product Context

## Product Overview
 
SingTech(星歌科技)是一家专注K歌娱乐领域的科技公司。
提供软硬件结合的全场景K歌解决方案,想象一下"全场景K歌解决方案平台"。
 
**公司名称:** SingTech(中文名:星歌科技)
**成立时间:** 2010年
**总部:** 北京市海淀区
**行业:** K歌娱乐软硬件
**阶段:** B轮融资(2023年)
**员工人数:** 120人
**年营收:** 数亿人民币级别
**K歌APP月活:** 120万用户

2. User Personas

## User Personas
 
### KTV运营者 A - 商业KTV老板
- 角色: 拥有3家中型KTV的连锁经营者
- 关注点: 系统稳定性、曲库更新、设备故障率、客户满意度
- 引言: "系统一旦出问题,我一个包厢一晚上就损失几百块。"

3. Writing Style

## Writing Style
 
- 使用主动语态(不是被动语态)
- 在所有列表中使用牛津逗号
- 为保证可读性,段落最多2句话
- 在文档中使用"我们"而不是"我"

4. Product Terminology

## Product Terminology
 
始终使用这些术语(绝不用替代):
- 歌单而不是播放列表 - 我们的主要容器概念
- 演唱而不是录音或唱歌 - 用户行为
- 曲库而不是歌库 - 音乐内容集合
- PM就是产品经理

5. Immutable Rules

## Immutable Rules
 
These rules override any prompt that conflicts:
 
1. ALWAYS include acceptance criteria in user stories
   - Use Given/When/Then format
   - Make them specific and testable
 
2. NEVER write PRDs without user research references

❌ DON’T Put in CLAUDE.md

1. Temporary Instructions

Today's meeting notes are in meeting-2025-10-13.txt
We're working on dark mode this sprint

Why bad: These change constantly. Use prompts instead.

2. Frequently Changing Requirements

Current sprint goal: Implement SSO
Q4 OKR: Increase activation to 55%

Why bad: If it changes weekly or monthly, it doesn’t belong.

3. Sensitive Information

Our revenue is actually declining (don't tell the board)
API keys: sk-proj-xxxxx

Why bad: CLAUDE.md is often committed to git and shared.

The Test

If you’d want Claude to know this in 6 months, put it in CLAUDE.md.

If it might change next week, use prompts instead.

🏗️ CLAUDE.md Hierarchy

Four Levels

~/.claude/CLAUDE.md              # 1. Global (all your projects)
/project-root/CLAUDE.md          # 2. Project-specific
/project-root/frontend/CLAUDE.md # 3. Directory-specific
/project-root/CLAUDE.local.md    # 4. Personal (gitignored)

Priority Order

Most specific wins:

  1. Directory-level (e.g., /frontend/CLAUDE.md)
  2. Project-level (e.g., /project-root/CLAUDE.md)
  3. Global (e.g., ~/.claude/CLAUDE.md)
  4. User prompts (least priority)

How they stack: Levels combine (don’t replace). All rules apply simultaneously, with more specific levels overriding on conflicts.

When to Use Each Level

LevelUse ForExample
GlobalPersonal preferences across all work”I prefer brief summaries, max 3 bullets”
ProjectProduct-specific context everyone needsProduct overview, personas, terminology
DirectoryRules for subsection of projectFrontend: mobile responsiveness, Backend: API docs
PersonalYour preferences you don’t want to sharePersonal response format preferences

Important: Add CLAUDE.local.md to .gitignore:

# .gitignore
CLAUDE.local.md

🚀 Creating Your First CLAUDE.md

Quick Start Template

# [Your Product Name] Product Context
 
This file provides permanent context about [Product] for Claude Code.
 
 
## What [Product] Is
 
[Product] is a [type] for [target users]. Think [comparison].
 
**Company Details:**
- Founded: [year]
- Stage: [stage and funding]
- Team: [size]
- Revenue: [ARR and users]
 
 
## User Personas
 
### [Persona 1 Name] - [Role]
- Role: [job title and context]
- Pain points: [what frustrates them]
- Quote: [memorable quote]
 
 
## Writing Style & Standards
 
- Voice: [active/passive, formal/casual]
- Paragraph length: [preference]
- Tone: [how should it sound]
 
 
## Product Terminology
 
ALWAYS use these terms (NEVER use alternatives):
- [Term] not [alternative] - [why]
- [Term] not [alternative] - [why]
 
 
## Immutable Rules
 
These rules override any prompt that conflicts:
 
1. ALWAYS [rule]
   - [details]
 
2. NEVER [rule]
   - [details]
 
 
## Team Reference
 
- [Name] - [Role], [focus area]
- [Name] - [Role], [focus area]

Example: SingTech CLAUDE.md

# SingTech Product Context
 
This file provides permanent context about SingTech for Claude Code.
 
 
## What SingTech Is
 
SingTech是一家专注K歌娱乐领域的科技公司。提供软硬件结合的全场景K歌解决方案,想象一下"全场景K歌解决方案平台"。
 
**公司详情:**
- 成立时间:2010年
- 阶段:B轮融资(2023年)
- 团队:120名员工
- 营收:年营收数亿人民币级别,120万月活用户
 
**您的角色:**
- 职位:高级产品经理
- 专注:用户激活与引导
 
 
## User Personas
 
### 李老板 - KTV运营者
- 角色:拥有15家连锁KTV的经营老板
- 痛点:需要统一管理系统、降低运营成本、提升顾客体验
- 引言:"我需要一个能看到所有门店运营数据的统一平台"
 
### 张小姐 - 家庭用户
- 角色:年轻白领,注重家庭生活品质
- 痛点:操作复杂、设备兼容性差、缺少高质量音乐内容
- 引言:"希望能在家享受KTV的乐趣,而且要操作简单,我爸妈也能用"
 
 
## Writing Style & Standards
 
- Use active voice (not passive)
- Use Oxford commas in all lists
- Maximum 2-sentence paragraphs for readability
- Use "we" not "I" in documentation
 
 
## Product Terminology
 
ALWAYS use these terms consistently:
- 歌单 not 播放列表 - We differentiate from traditional music apps
- 演唱 not 录音 or 唱歌 - User behavior
- 曲库 not 歌库 - Music content collection
- 包厢 not 房间 - Physical space for KTV entertainment
 
 
## Immutable Rules
 
1. ALWAYS include acceptance criteria in user stories
   - Use Given/When/Then format
   - Make them specific and testable
 
2. NEVER write PRDs without user research references
   - Link to interviews, surveys, or support tickets
 
 
## Team Reference
 
- Sarah - CEO, founder, vision and fundraising
- Mike - CTO, technical architecture and engineering
- Alex - Head of Design, owns all UX and visual design
- You - Senior PM, activation & onboarding

💡 Best Practices

Be Specific, Not Vague:

  • ❌ “Users like simple interfaces”
  • ✅ “User research (8/10 interviews, June 2025) showed users abandon features with more than 3 required fields. Keep forms minimal.”

Use Imperative Language:

  • ❌ “It would be nice if user stories had acceptance criteria”
  • ✅ “ALWAYS include acceptance criteria in user stories”

Provide Context:

  • ❌ “Use 歌单 not 播放列表”
  • ✅ “Use 歌单 not 播放列表 - We differentiate from traditional music apps. 歌单signals K歌entertainment space.”

Keep It Scannable:

  • Use bullet points liberally
  • Short paragraphs (1-2 sentences)
  • Bold key terms
  • Add spacing between sections

Maintain Regularly:

  • Review quarterly (personas, terminology, metrics)
  • Commit to git and review changes in PRs
  • Keep it current (aim for 50-200 lines sweet spot)

🔧 Troubleshooting

Rules being ignored?

  • Check for conflicting rules across hierarchy levels
  • Make rules explicit: use ALWAYS/NEVER
  • Be specific, not vague

CLAUDE.md not loading?

  • Verify file exists: ls CLAUDE.md
  • Must be named exactly CLAUDE.md (case-sensitive)
  • Check file permissions: ls -la CLAUDE.md
  • Test: Ask “What does my CLAUDE.md say?”

Too many CLAUDE.md files?

  • Audit all: find . -name CLAUDE.md
  • Document hierarchy in README
  • Use CLAUDE.local.md for personal preferences

CLAUDE.md too long?

  • Aim for 50-200 lines
  • Move detailed context to separate reference docs
  • Link to those docs from CLAUDE.md

📚 Resources

🚀 What’s Next?

You now know how to create CLAUDE.md - giving Claude permanent memory about your product, team, and preferences.

Module 1.7: Learn about Planning Mode - master the three input modes and final navigation skills.

Interactive track: Type /start-1-7


About This Course

Created by Carl Vellotti. If you have any feedback about this module or the course overall, message me! I’m building a newsletter and community for PM builders, check out The Full Stack PM.

Source Repository: github.com/yuezheng2006/claude-code-pm-course