bootstrap

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Bootstrap Prompt Generator

Bootstrap Prompt生成器

Generate a detailed context prompt that enables seamless continuation of work in a fresh Claude Code session.
生成详细的上下文prompt,以便在全新的Claude Code会话中无缝续接工作。

Purpose

用途

Sessions accumulate valuable context: task understanding, decisions made, patterns discovered, gotchas encountered, and progress achieved. When starting fresh, this knowledge is lost. A bootstrap prompt preserves the essential context needed to continue effectively.
会话会积累有价值的上下文信息:任务理解、已做的决策、发现的模式、遇到的陷阱以及取得的进展。当开启新会话时,这些知识会丢失。Bootstrap prompt可以保留有效续接工作所需的关键上下文。

Core Principle: Intelligent Context Selection

核心原则:智能上下文筛选

Do NOT mechanically dump everything. Analyze what actually matters for continuation:
  • What would confuse a fresh Claude? Include it.
  • What decisions took deliberation? Document the reasoning.
  • What gotchas caused wasted time? Warn about them.
  • What's the critical path forward? Clarify it.
Omit: routine operations, obvious context, resolved dead-ends, standard patterns.
不要机械地复制所有内容。分析哪些信息对于续接工作真正重要:
  • 哪些内容会让新的Claude感到困惑? 包含这些信息。
  • 哪些决策经过了深思熟虑? 记录其背后的推理过程。
  • 哪些陷阱导致了时间浪费? 对此发出警告。
  • 当前的关键推进路径是什么? 明确这一点。
省略:常规操作、显而易见的上下文、已解决的死胡同、标准模式。

Analysis Process

分析流程

1. Assess Session Significance

1. 评估会话重要性

Determine what kind of work occurred:
  • Exploration: Learning codebase, investigating options
  • Implementation: Building features, fixing bugs
  • Debugging: Tracking down issues, testing hypotheses
  • Planning: Designing architecture, making decisions
Each type has different handoff needs.
判断当前会话的工作类型:
  • 探索性工作:学习代码库、调研可选方案
  • 实现工作:开发功能、修复Bug
  • 调试工作:排查问题、验证假设
  • 规划工作:设计架构、制定决策
不同类型的工作有不同的交接需求。

2. Identify Essential Context

2. 识别关键上下文

Project State
  • Working directory and project identity
  • Tech stack if non-obvious
  • Branch and git state (use
    scripts/gather-git-state.sh
    )
Task Context
  • Original objective (what the user asked for)
  • Current interpretation (what we understood it to mean)
  • Scope decisions (what's in/out)
Progress Assessment
  • What's completed and working
  • What's in progress and current state
  • What's remaining (check todo list)
  • What's blocked and why
Critical Knowledge
  • Architectural decisions and their rationale
  • Patterns established in this session
  • Gotchas and workarounds discovered
  • Files that are central to the work
Next Actions
  • Immediate next step
  • Remaining work outline
  • Known unknowns to investigate
项目状态
  • 工作目录和项目标识
  • 非显而易见的技术栈
  • 分支和Git状态(使用
    scripts/gather-git-state.sh
    获取)
任务上下文
  • 原始目标(用户的初始需求)
  • 当前的理解(我们对需求的解读)
  • 范围决策(包含/排除的内容)
进度评估
  • 已完成且可正常运行的内容
  • 进行中的工作及其当前状态
  • 剩余工作(查看待办事项列表)
  • 受阻的工作及其原因
关键知识
  • 架构决策及其理由
  • 本次会话中确立的模式
  • 发现的陷阱与解决方法
  • 工作核心相关的文件
下一步行动
  • 立即要执行的步骤
  • 剩余工作的大纲
  • 需要调研的未知事项

3. Determine Depth

3. 确定详细程度

Scale detail to session complexity:
Light session (quick task, simple fix): Brief summary, next step Medium session (feature work, debugging): Key decisions, progress, gotchas Deep session (architecture, complex debug): Full context with reasoning
根据会话的复杂程度调整内容细节:
轻量会话(快速任务、简单修复):简短摘要+下一步步骤 中等会话(功能开发、调试工作):关键决策、进度、陷阱 深度会话(架构设计、复杂调试):包含推理过程的完整上下文

Output Format

输出格式

Generate a markdown document structured as a prompt for a fresh session:
markdown
undefined
生成符合以下结构的Markdown文档,作为新会话的引导prompt:
markdown
undefined

Bootstrap: [Brief Task Description]

Bootstrap: [简短任务描述]

Generated: [timestamp] Project: [project path] Branch: [branch name]
生成时间: [时间戳] 项目: [项目路径] 分支: [分支名称]

Context

上下文

[2-4 sentences on what this project/task is about]
[2-4句话说明项目/任务的基本情况]

Session Summary

会话摘要

[What happened in the session - decisions, progress, discoveries]
[会话中完成的工作 - 决策、进度、发现]

Current State

当前状态

[Where things stand right now - what works, what's in progress]
[当前工作进展 - 可运行内容、进行中内容]

Key Files

核心文件

[List of files central to the work with brief descriptions]
[与工作核心相关的文件列表及简短说明]

Decisions Made

已做决策

[Important choices with brief rationale - only if non-obvious]
[重要决策及简短理由 - 仅针对非显而易见的内容]

Gotchas & Warnings

陷阱与警告

[Things that caused problems or need careful handling]
[曾引发问题或需要谨慎处理的事项]

Next Steps

下一步步骤

[Prioritized list of what to do next]
[按优先级排序的后续工作列表]

Resume Instructions

续接说明

[Specific guidance on how to continue - commands to run, files to open, etc.]

Omit sections that aren't relevant. A simple task might only need Context, Current State, and Next Steps.
[具体的续接指导 - 要运行的命令、要打开的文件等]

省略无关的章节。简单任务可能只需要上下文、当前状态和下一步步骤这几个部分。

Execution Steps

执行步骤

  1. Analyze the session - Review conversation, understand what happened
  2. Run git state script - Execute
    scripts/gather-git-state.sh
    to capture repository state
  3. Check todo list - Review current todos for progress context
  4. Identify key files - Determine which files are central to the work
  5. Draft bootstrap prompt - Write the document following the format above
  6. Determine output path - Use
    .claude/handoffs/{project-name}-{YYYYMMDD-HHMMSS}.md
  7. Save the file - Write the bootstrap prompt to the handoffs directory
  8. Copy to clipboard - Execute
    scripts/copy-to-clipboard.sh {filepath}
    to copy contents
  1. 分析会话 - 回顾对话内容,了解会话中完成的工作
  2. 运行Git状态脚本 - 执行
    scripts/gather-git-state.sh
    以捕获仓库状态
  3. 检查待办事项 - 查看当前待办事项以获取进度上下文
  4. 识别核心文件 - 确定与工作核心相关的文件
  5. 起草引导prompt - 按照上述格式编写文档
  6. 确定输出路径 - 使用
    .claude/handoffs/{project-name}-{YYYYMMDD-HHMMSS}.md
  7. 保存文件 - 将引导prompt写入交接目录
  8. 复制到剪贴板 - 执行
    scripts/copy-to-clipboard.sh {filepath}
    复制内容

File Locations

文件位置

  • Output directory:
    .claude/handoffs/
    (create if doesn't exist)
  • Filename pattern:
    {project-name}-{YYYYMMDD-HHMMSS}.md
  • Project name: Derive from git remote, directory name, or package.json
  • 输出目录:
    .claude/handoffs/
    (不存在则创建)
  • 文件名格式:
    {project-name}-{YYYYMMDD-HHMMSS}.md
  • 项目名称: 从Git远程仓库、目录名或package.json中提取

Scripts

脚本说明

scripts/gather-git-state.sh

scripts/gather-git-state.sh

Collects repository state: branch, recent commits, uncommitted changes, modified files. Run this first to include accurate git context in the bootstrap prompt.
收集仓库状态:分支、近期提交、未提交更改、已修改文件。 需先运行此脚本,以便在引导prompt中包含准确的Git上下文。

scripts/copy-to-clipboard.sh

scripts/copy-to-clipboard.sh

Copies file contents to system clipboard (macOS
pbcopy
). Run after saving the bootstrap prompt file.
将文件内容复制到系统剪贴板(macOS使用
pbcopy
)。 保存引导prompt文件后运行此脚本。

Quality Checklist

质量检查清单

Before finalizing, verify:
  • Fresh Claude could understand the task without prior context
  • Decisions include enough rationale to avoid re-litigating
  • Gotchas are specific enough to be actionable
  • Next steps are concrete and prioritized
  • No unnecessary detail that obscures the important parts
最终确定前,验证以下内容:
  • 新的Claude无需上下文即可理解任务
  • 决策包含足够的理由,避免重复讨论
  • 陷阱描述足够具体,具备可操作性
  • 下一步步骤具体且按优先级排序
  • 没有无关细节干扰重要信息

Example Bootstrap Prompts

引导prompt示例

Light Session Example

轻量会话示例

markdown
undefined
markdown
undefined

Bootstrap: Fix API rate limiting bug

Bootstrap: 修复API限流Bug

Generated: 2025-01-15 14:30 Project: /Users/dev/acme-api Branch: fix/rate-limiter
生成时间: 2025-01-15 14:30 项目: /Users/dev/acme-api 分支: fix/rate-limiter

Context

上下文

Fixing a bug where rate limiting wasn't being applied to the
/search
endpoint.
修复
/search
端点未应用限流的Bug。

Current State

当前状态

Found the issue - the rate limiter middleware was added after the route registration. Fix is ready but untested.
已找到问题 - 限流中间件在路由注册后才添加。修复方案已准备但未测试。

Next Steps

下一步步骤

  1. Run test suite:
    npm test
  2. If passing, commit with message "Fix rate limiter middleware order for /search"
undefined
  1. 运行测试套件:
    npm test
  2. 测试通过后,提交并附带信息"Fix rate limiter middleware order for /search"
undefined

Deep Session Example

深度会话示例

See
references/deep-session-example.md
for a complex multi-day project handoff.
复杂多日项目交接示例请查看
references/deep-session-example.md