with one click
spec-context-resume
恢复功能的开发上下文。 加载最近会话完整内容 + 历史摘要。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
恢复功能的开发上下文。 加载最近会话完整内容 + 历史摘要。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
保存当前窗口的所有对话记录。保存后建议新开窗口 Resume。 触发时机:用户请求保存、重要节点、长对话。
Extract and persist project knowledge from spec-workflow conversations. Scans user-AI dialogues for coding conventions, architecture decisions, and project patterns, then writes them back to steering documents or conventions directory. Use when (1) a spec-workflow phase completes and new learnings are detected, (2) the user wants to update project conventions, (3) the user says "remember" to persist a specific convention, or (4) the user wants to review and consolidate knowledge from recent features. Triggers include "spec-reflect", "learn conventions", "update conventions", "remember:", "学习规范", "更新规范", "总结回写", "记住这个约定".
Perform comprehensive code review for features developed through the spec-workflow process. Use when all implementation tasks are completed and the user wants to review code quality before generating unit tests or merging. Triggers include "code review for {feature}", "review code", "检查代码", "代码审查", "spec review", or when spec-run's All Tasks Complete Flow offers the code review option. Also use when the user asks to fix review issues, re-review after fixes, or wants to understand the quality of their spec-workflow implementation. This skill integrates with spec-workflow as a post-implementation quality gate — think of it as having a senior engineer review your feature branch before it goes anywhere.
This skill provides a spec-driven development workflow for systematic feature implementation with validation at each stage. Use when the user wants to (1) initialize a project with steering documents, (2) create feature specifications (requirements, design, tasks), (3) validate specification documents (requirements, design, tasks), (4) execute implementation tasks, (5) generate unit tests for a completed feature, (6) review code for a completed feature, (7) create/analyze/fix/verify bugs, (8) asks about spec-driven development workflow, (9) extract and persist project knowledge from conversations, (10) save/checkpoint conversation context for a feature, or (11) resume/restore conversation context for a feature. Triggers include "create spec", "create requirements/design/tasks", "initialize project", "initialize module", "validate requirements/design/tasks", "execute task", "generate tests", "create unit tests", "code review", "review code", "检查代码", "代码审查", "spec-reflect", "learn conventions", "update conventi
| name | spec-context-resume |
| description | 恢复功能的开发上下文。 加载最近会话完整内容 + 历史摘要。 |
从用户请求识别功能名称:
确认清单文件存在(使用工作空间相对路径):
<工作空间>/.claude/spec-workflow/specs/{功能名}/.context/manifest.json
⚠️ 路径规则
- 必须使用相对于工作空间的路径,不要使用绝对路径
- 每个用户的工作空间目录可能不同,但相对路径结构一致
- 示例:如果功能名是
block-user-personal-chat,则路径为:.claude/spec-workflow/specs/block-user-personal-chat/.context/manifest.json
manifest = read_json(f".claude/spec-workflow/specs/{功能名}/.context/manifest.json")
info = {
"feature": manifest["specId"],
"total_turns": manifest["turnWatermark"]["lastSessionEndTurn"],
"last_chunked": manifest["turnWatermark"]["lastChunkedTurn"],
"chunks": manifest.get("semanticChunks", []),
"sessions": manifest.get("recentSessions", [])
}
# 找最近的会话
recent = sorted(manifest["recentSessions"],
key=lambda s: s["globalRange"][1],
reverse=True)[0]
session_dir = f".claude/spec-workflow/specs/{功能名}/.context/conversations/sessions/{recent['sessionId']}"
metadata = read_json(f"{session_dir}/metadata.json")
# 加载对话文件(最多 12 轮)
turn_files = sorted(glob(f"{session_dir}/turn-*.md"))[-12:]
for f in turn_files:
content = read_file(f)
# 加入上下文
for chunk in manifest.get("semanticChunks", []):
chunk_path = f".claude/spec-workflow/specs/{功能名}/.context/conversations/{chunk['file']}"
chunk_content = read_file(chunk_path)
# 加入上下文
docs = ["requirements.md", "design.md", "tasks.md"]
for doc in docs:
path = f".claude/spec-workflow/specs/{功能名}/{doc}"
if exists(path):
# 读取前 30 行作为预览
preview = read_lines(path, 1, 30)
# 恢复: {功能名}
## 📊 状态概览
| 项目 | 值 |
|------|-----|
| 功能 | block-user-personal-chat |
| 总对话轮数 | 30 |
| 当前阶段 | 设计 |
| 最近会话 | session-003 (第23-30轮) |
---
## 📝 最近对话 (会话-003)
### 第25轮
**用户**: API 的错误码怎么设计?
**助手**: 建议使用以下错误码结构:
```json
{
"code": "BLOCK_001",
"message": "用户已被屏蔽"
}
...
用户: 加个批量接口
助手: 好的,添加批量屏蔽接口:
POST /api/v1/block/batch
...
需求分析阶段,确定了用户屏蔽功能的基本需求。
设计阶段,完成了 API 和数据库设计。
| 文档 | 状态 |
|---|---|
| requirements.md | ✅ 3 个用户故事 |
| design.md | ✅ API + 数据库设计 |
| tasks.md | ✅ 12 个任务,完成 8 个 |
上下文已加载,请继续之前的工作。
如需查看完整文档,请说:
---
## 按需加载
### 查看文档
**用户**:"查看 design.md"
**AI**:读取并展示完整文档内容
### 查看特定摘要
**用户**:"查看摘要-001详情"
**AI**:读取并展示摘要完整内容
---
## 目录结构
<工作空间>/ └── .claude/ └── spec-workflow/ └── specs/ └── {功能名}/ ├── requirements.md ← 文档索引 ├── design.md ├── tasks.md └── .context/ ├── manifest.json ← 首先读取 └── conversations/ ├── semantic-chunks/ │ ├── chunk-001.md ← 加载摘要 │ └── chunk-002.md └── sessions/ └── session-003/ ← 完整加载 ├── metadata.json └── turn-*.md
> 📌 **注意**:所有路径都是相对于工作空间根目录,确保跨环境一致性。
---
## 错误处理
### 清单文件不存在
```markdown
❌ **无法恢复**
功能 `{名称}` 没有保存的上下文。
请检查:
1. 功能名称是否正确
2. 是否执行过保存
⚠️ **部分加载**
部分文件无法读取,已加载可用内容。
建议重新执行保存。