---
name: create-primary-schooler
description: "Create a primary schooler AI Skill that mimics a real student. Generates learning ability + personality models that evolve over time. | 创建一个小学生 AI Skill，模仿真实孩子的学习能力和性格特点，支持持续更新。"
argument-hint: "[student-name-or-slug]"
version: "1.0.0"
user-invocable: true
allowed-tools: Read, Write, Edit, Bash
---

> **Language / 语言**: This skill supports both English and Chinese. Detect the user's language from their first message and respond in the same language throughout. Below are instructions in both languages — follow the one matching the user's language.
>
> 本 Skill 支持中英文。根据用户第一条消息的语言，全程使用同一语言回复。下方提供了两种语言的指令，按用户语言选择对应版本执行。

# 小学生.skill 创建器（Claude Code 版）

## 触发条件

当用户说以下任意内容时启动：
- `/create-primary-schooler`
- "帮我创建一个小学生 skill"
- "我想蒸馏一个小学生"
- "新建小学生"
- "给我做一个 XX 的 skill"

当用户对已有小学生 Skill 说以下内容时，进入进化模式：
- "我有新文件" / "追加"
- "这不对" / "他不会这样" / "他应该是"
- `/update-primary-schooler {slug}`

当用户说 `/list-schoolers` 时列出所有已生成的小学生。

---

## 工具使用规则

本 Skill 运行在 Claude Code 环境，使用以下工具：

| 任务 | 使用工具 |
|------|---------|
| 读取 PDF 文档 | `Read` 工具（原生支持 PDF） |
| 读取图片截图 | `Read` 工具（原生支持图片） |
| 读取 MD/TXT 文件 | `Read` 工具 |
| 写入/更新 Skill 文件 | `Write` / `Edit` 工具 |
| 版本管理 | `Bash` → `python3 ${CLAUDE_SKILL_DIR}/tools/version_manager.py` |
| 列出已有 Skill | `Bash` → `python3 ${CLAUDE_SKILL_DIR}/tools/skill_writer.py --action list` |

**基础目录**：Skill 文件写入 `./schoolers/{slug}/`（相对于本项目目录）。

---

## 主流程：创建新小学生 Skill

### Step 1：基础信息录入（4个问题）

参考 `${CLAUDE_SKILL_DIR}/prompts/intake.md` 的问题序列，问 4 个问题：

1. **花名/代号**（必填）
2. **基本信息**（年级、性别、大致年龄）
   - 示例：`三年级 男 9岁`
3. **学习画像**（一句话：学科强弱、学习习惯、注意力特点）
   - 示例：`数学强语文弱 坐不住 爱问为什么`
4. **性格画像**（一句话：MBTI（可选）、性格标签、兴趣爱好）
   - 示例：`活泼好动 喜欢乐高 害怕失败 需要鼓励`

除姓名外都可以跳过。收集完后确认一下再进入下一步。

### Step 2：资料导入

询问用户提供资料，展示四种方式供选择：

```
原材料怎么提供？

  [A] 学校作业/试卷照片
      拍照上传孩子的作业、试卷、练习题

  [B] 日常聊天记录
      家长与孩子的微信/QQ对话截图

  [C] 老师评语/成绩单
      学校评语、成绩报告、家长群通知

  [D] 上传文件
      PDF / 图片 / 手写笔记照片

  [E] 直接粘贴内容
      把文字描述复制进来

可以混选，也可以跳过（只用手填的信息生成）。
```

#### 方式 A-D：上传文件

- **PDF / 图片**：`Read` 工具直接读取
- **作业/试卷照片**：分析字迹、错误模式、答题习惯
- **聊天记录**：分析沟通风格、表达方式
- **老师评语**：分析学习特点、性格表现

#### 方式 E：直接粘贴

用户粘贴的内容直接作为文本资料，无需调用任何工具。

---

如果用户说"没有文件"或"跳过"，只用 Step 1 手填的信息生成 Skill。

### Step 3：分析资料

把收集到的所有资料和用户填写的基础信息汇总，从以下两方面分析：

**线路 A（Ability Skill）**：
- 参考 `${CLAUDE_SKILL_DIR}/prompts/ability_analyzer.md` 中的提取维度
- 提取：学科能力、学习方法、思维模式、知识盲区、成长潜力
- 根据年级特点重点提取（低年级/中年级/高年级不同侧重）

**线路 B（Persona）**：
- 参考 `${CLAUDE_SKILL_DIR}/prompts/persona_analyzer.md` 中的提取维度
- 将用户填写的标签翻译为具体行为规则（参见标签翻译表）
- 从资料中提取：表达风格、情绪模式、人际互动、决策方式

### Step 4：生成并预览

参考 `${CLAUDE_SKILL_DIR}/prompts/ability_builder.md` 生成 Ability Skill 内容。
参考 `${CLAUDE_SKILL_DIR}/prompts/persona_builder.md` 生成 Persona 内容（6层结构）。

向用户展示摘要（各 5-8 行），询问：
```
Ability Skill 摘要：
  - 学科能力：{xxx}
  - 学习方法：{xxx}
  - 思维模式：{xxx}
  ...

Persona 摘要：
  - 核心性格：{xxx}
  - 表达风格：{xxx}
  - 情绪模式：{xxx}
  ...

确认生成？还是需要调整？
```

### Step 5：写入文件

用户确认后，执行以下写入操作：

**1. 创建目录结构**（用 Bash）：
```bash
mkdir -p schoolers/{slug}/versions
mkdir -p schoolers/{slug}/knowledge/homework
mkdir -p schoolers/{slug}/knowledge/reports
mkdir -p schoolers/{slug}/knowledge/photos
```

**2. 写入 ability.md**（用 Write 工具）：
路径：`schoolers/{slug}/ability.md`

**3. 写入 persona.md**（用 Write 工具）：
路径：`schoolers/{slug}/persona.md`

**4. 写入 meta.json**（用 Write 工具）：
路径：`schoolers/{slug}/meta.json`
内容：
```json
{
  "name": "{name}",
  "slug": "{slug}",
  "created_at": "{ISO时间}",
  "updated_at": "{ISO时间}",
  "version": "v1",
  "profile": {
    "grade": "{grade}",
    "age": {age},
    "gender": "{gender}"
  },
  "tags": {
    "strengths": [...],
    "weaknesses": [...],
    "personality": [...],
    "interests": [...]
  },
  "impression": "{impression}",
  "knowledge_sources": [...已导入的文件列表],
  "corrections_count": 0
}
```

**5. 生成完整 SKILL.md**（用 Write 工具）：
路径：`schoolers/{slug}/SKILL.md`

SKILL.md 结构：
```markdown
---
name: primary-schooler-{slug}
description: {name}，小学{grade}{gender}生
user-invocable: true
---

# {name}

小学{grade}{gender}生，{age}岁

---

## PART A：学习能力

{ability.md 全部内容}

---

## PART B：性格行为

{persona.md 全部内容}

---

## 运行规则

1. 先由 PART B 判断：用什么态度接收信息？
2. 再由 PART A 执行：用该学生的学习方式处理任务
3. 输出时始终保持 PART B 的表达风格
4. PART B Layer 0 的规则优先级最高，任何情况下不得违背
5. 保持儿童视角，用适龄的语言和认知水平回应
```

告诉用户：
```
✅ 小学生 Skill 创建好了！

文件位置：schoolers/{slug}/
指令：/{slug}（完整版）
      /{slug}-ability（只学习能力）
      /{slug}-persona（只性格行为）

如果用起来觉得哪里不对，直接说"他不会这样"，我来更新。
```

---

## 进化模式：追加文件

用户提供新文件或文本时：

1. 按 Step 2 的方式读取新内容
2. 用 `Read` 读取现有 `schoolers/{slug}/ability.md` 和 `persona.md`
3. 参考 `${CLAUDE_SKILL_DIR}/prompts/merger.md` 分析增量内容
4. 存档当前版本（用 Bash）：
   ```bash
   python3 ${CLAUDE_SKILL_DIR}/tools/version_manager.py --action backup --slug {slug} --base-dir ./schoolers
   ```
5. 用 `Edit` 工具追加增量内容到对应文件
6. 重新生成 `SKILL.md`（合并最新 ability.md + persona.md）
7. 更新 `meta.json` 的 version 和 updated_at

---

## 进化模式：对话纠正

用户说"不对"/"应该是"时：

1. 参考 `${CLAUDE_SKILL_DIR}/prompts/correction_handler.md` 识别纠正内容
2. 判断属于 Ability（学习能力）还是 Persona（性格行为）
3. 生成 correction 记录
4. 用 `Edit` 工具追加到对应文件的 `## Correction 记录` 节
5. 重新生成 `SKILL.md`

---

## 管理命令

`/list-schoolers`：
```bash
python3 ${CLAUDE_SKILL_DIR}/tools/skill_writer.py --action list --base-dir ./schoolers
```

`/schooler-rollback {slug} {version}`：
```bash
python3 ${CLAUDE_SKILL_DIR}/tools/version_manager.py --action rollback --slug {slug} --version {version} --base-dir ./schoolers
```

`/delete-schooler {slug}`：
确认后执行：
```bash
rm -rf schoolers/{slug}
```

---
---

# English Version

# Primary Schooler.skill Creator (Claude Code Edition)

## Trigger Conditions

Activate when the user says any of the following:
- `/create-primary-schooler`
- "Help me create a primary schooler skill"
- "I want to distill a student"
- "New student"
- "Make a skill for XX"

Enter evolution mode when the user says:
- "I have new files" / "append"
- "That's wrong" / "He wouldn't do that" / "He should be"
- `/update-primary-schooler {slug}`

List all generated students when the user says `/list-schoolers`.

---

## Tool Usage Rules

This Skill runs in the Claude Code environment with the following tools:

| Task | Tool |
|------|------|
| Read PDF documents | `Read` tool (native PDF support) |
| Read image screenshots | `Read` tool (native image support) |
| Read MD/TXT files | `Read` tool |
| Write/update Skill files | `Write` / `Edit` tool |
| Version management | `Bash` → `python3 ${CLAUDE_SKILL_DIR}/tools/version_manager.py` |
| List existing Skills | `Bash` → `python3 ${CLAUDE_SKILL_DIR}/tools/skill_writer.py --action list` |

**Base directory**: Skill files are written to `./schoolers/{slug}/` (relative to the project directory).

---

## Main Flow: Create a New Primary Schooler Skill

### Step 1: Basic Info Collection (4 questions)

Refer to `${CLAUDE_SKILL_DIR}/prompts/intake.md` for the question sequence. Ask 4 questions:

1. **Alias / Codename** (required)
2. **Basic info** (grade, gender, approximate age)
   - Example: `Grade 3 male 9 years old`
3. **Learning profile** (one sentence: subject strengths/weaknesses, study habits, attention traits)
   - Example: `Strong in math, weak in Chinese, can't sit still, loves asking why`
4. **Personality profile** (one sentence: MBTI (optional), personality tags, hobbies)
   - Example: `Active and energetic, loves LEGO, afraid of failure, needs encouragement`

Everything except the alias can be skipped. Summarize and confirm before moving to the next step.

### Step 2: Source Material Import

Ask the user how they'd like to provide materials:

```
How would you like to provide source materials?

  [A] Schoolwork/Exam Photos
      Upload photos of homework, exams, or practice sheets

  [B] Daily Chat Records
      Screenshots of WeChat/QQ conversations with the child

  [C] Teacher Comments/Report Cards
      School comments, grade reports, parent group notifications

  [D] Upload Files
      PDF / images / handwritten notes photos

  [E] Paste Text
      Copy-paste text descriptions directly

Can mix and match, or skip entirely (generate from manual info only).
```

#### Options A-D: Upload Files

- **PDF / Images**: `Read` tool directly
- **Homework/Exam Photos**: Analyze handwriting, error patterns, answering habits
- **Chat Records**: Analyze communication style, expression patterns
- **Teacher Comments**: Analyze learning characteristics, personality traits

#### Option E: Paste Text

User-pasted content is used directly as text material. No tools needed.

---

If the user says "no files" or "skip", generate Skill from Step 1 manual info only.

### Step 3: Analyze Source Material

Combine all collected materials and user-provided info, analyze along two tracks:

**Track A (Ability Skill)**:
- Refer to `${CLAUDE_SKILL_DIR}/prompts/ability_analyzer.md` for extraction dimensions
- Extract: subject abilities, learning methods, thinking patterns, knowledge gaps, growth potential
- Emphasize different aspects by grade level (lower/middle/upper primary)

**Track B (Persona)**:
- Refer to `${CLAUDE_SKILL_DIR}/prompts/persona_analyzer.md` for extraction dimensions
- Translate user-provided tags into concrete behavior rules (see tag translation table)
- Extract from materials: communication style, emotional patterns, interpersonal interactions, decision-making

### Step 4: Generate and Preview

Use `${CLAUDE_SKILL_DIR}/prompts/ability_builder.md` to generate Ability Skill content.
Use `${CLAUDE_SKILL_DIR}/prompts/persona_builder.md` to generate Persona content (6-layer structure).

Show the user a summary (5-8 lines each), ask:
```
Ability Skill Summary:
  - Subject abilities: {xxx}
  - Learning methods: {xxx}
  - Thinking patterns: {xxx}
  ...

Persona Summary:
  - Core personality: {xxx}
  - Expression style: {xxx}
  - Emotional patterns: {xxx}
  ...

Confirm generation? Or need adjustments?
```

### Step 5: Write Files

After user confirmation, execute the following:

**1. Create directory structure** (Bash):
```bash
mkdir -p schoolers/{slug}/versions
mkdir -p schoolers/{slug}/knowledge/homework
mkdir -p schoolers/{slug}/knowledge/reports
mkdir -p schoolers/{slug}/knowledge/photos
```

**2. Write ability.md** (Write tool):
Path: `schoolers/{slug}/ability.md`

**3. Write persona.md** (Write tool):
Path: `schoolers/{slug}/persona.md`

**4. Write meta.json** (Write tool):
Path: `schoolers/{slug}/meta.json`
Content:
```json
{
  "name": "{name}",
  "slug": "{slug}",
  "created_at": "{ISO_timestamp}",
  "updated_at": "{ISO_timestamp}",
  "version": "v1",
  "profile": {
    "grade": "{grade}",
    "age": {age},
    "gender": "{gender}"
  },
  "tags": {
    "strengths": [...],
    "weaknesses": [...],
    "personality": [...],
    "interests": [...]
  },
  "impression": "{impression}",
  "knowledge_sources": [...imported file list],
  "corrections_count": 0
}
```

**5. Generate full SKILL.md** (Write tool):
Path: `schoolers/{slug}/SKILL.md`

SKILL.md structure:
```markdown
---
name: primary-schooler-{slug}
description: {name}, {grade} grade {gender} student
user-invocable: true
---

# {name}

{grade} grade {gender} student, {age} years old

---

## PART A: Learning Ability

{full ability.md content}

---

## PART B: Personality & Behavior

{full persona.md content}

---

## Execution Rules

1. PART B decides first: what attitude to receive information?
2. PART A executes: process tasks using the student's learning style
3. Always maintain PART B's expression style in output
4. PART B Layer 0 rules have the highest priority and must never be violated
5. Maintain a child's perspective, respond with age-appropriate language and cognition
```

Inform user:
```
✅ Primary Schooler Skill created!

Location: schoolers/{slug}/
Commands: /{slug} (full version)
          /{slug}-ability (learning ability only)
          /{slug}-persona (personality only)

If something feels off, just say "he wouldn't do that" and I'll update it.
```

---

## Evolution Mode: Append Files

When user provides new files or text:

1. Read new content using Step 2 methods
2. `Read` existing `schoolers/{slug}/ability.md` and `persona.md`
3. Refer to `${CLAUDE_SKILL_DIR}/prompts/merger.md` for incremental analysis
4. Archive current version (Bash):
   ```bash
   python3 ${CLAUDE_SKILL_DIR}/tools/version_manager.py --action backup --slug {slug} --base-dir ./schoolers
   ```
5. Use `Edit` tool to append incremental content to relevant files
6. Regenerate `SKILL.md` (merge latest ability.md + persona.md)
7. Update `meta.json` version and updated_at

---

## Evolution Mode: Conversation Correction

When user expresses "that's wrong" / "he should be":

1. Refer to `${CLAUDE_SKILL_DIR}/prompts/correction_handler.md` to identify correction content
2. Determine if it belongs to Ability (learning) or Persona (personality/behavior)
3. Generate correction record
4. Use `Edit` tool to append to the `## Correction Log` section of the relevant file
5. Regenerate `SKILL.md`

---

## Management Commands

`/list-schoolers`:
```bash
python3 ${CLAUDE_SKILL_DIR}/tools/skill_writer.py --action list --base-dir ./schoolers
```

`/schooler-rollback {slug} {version}`:
```bash
python3 ${CLAUDE_SKILL_DIR}/tools/version_manager.py --action rollback --slug {slug} --version {version} --base-dir ./schoolers
```

`/delete-schooler {slug}`:
After confirmation:
```bash
rm -rf schoolers/{slug}
```
