scrolls-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSetting up docs/.scrolls/
搭建docs/.scrolls/
docs/.scrolls/CLAUDE.mddocs/.scrolls/STARTER.mdThis skill's own directory holds the source templates — copy from there, never edit those files in place.
assets/templates/docs/.scrolls/CLAUDE.mddocs/.scrolls/STARTER.md本工具的目录存放着源模板文件——请从该目录复制模板,切勿直接编辑其中的文件。
assets/templates/Cross-platform
跨平台支持
Unlike the other four scrolls skills, this one has no bundled / script to choose between — nothing here needed porting. File creation happens through your own Read/Write/Edit tools (not raw shell commands), and the one external command this skill relies on () behaves identically whether invoked from bash or PowerShell — both support the same command-substitution syntax used throughout this file. Works the same on macOS, Linux, and Windows without any environment-specific branching.
.sh.ps1git rev-parse --show-toplevel$(...)与其他四个scrolls工具不同,本工具无需捆绑/脚本进行选择——这里没有需要移植的内容。文件创建通过你自身的读写编辑工具完成(而非原生Shell命令),本工具依赖的唯一外部命令在bash和PowerShell中的表现完全一致——两者均支持本文档中使用的命令替换语法。在macOS、Linux和Windows环境下的运行效果完全相同,无需针对不同环境做分支处理。
.sh.ps1git rev-parse --show-toplevel$(...)Options
选项参数
The user may pass these after as plain text, in any order — there's no real argv parser here, so read the invocation text yourself and pull out:
/scrolls-setup- /
-p <path>/--path=<path>— a custom docs folder, relative to the current working directory unless given as an absolute path (starts with--path <path>). Use this for monorepos or non-standard layouts, e.g./puts the scrolls at--path=packages/api/docs. This is the one option where you're naming the docs folder directly rather than picking a base directory — see the CLAUDE.md placement note in step 4 for the tradeoff that comes with going deep.packages/api/docs/.scrolls - /
-t— pin everything to the git repository's top level (--reporoot), regardless of which subdirectory you actually invoked this from. Fails with a clear message if the current directory isn't inside a git repository — there's no repo root to find.$(git rev-parse --show-toplevel) - /
-l— pin everything to the current working directory explicitly. This is what happens by default anyway when none of--local/-p/-tare given — the flag exists so you (or the user) can say so on purpose, e.g. to skip the mismatch check in step 1.-l - /
-r— before creating anything, scan recursively under--recursefor a scrolls folder that already exists somewhere nearby (same bounded, pruned,BASE_DIR-guarded searchSTARTER.md//scrolls-hideuse), so a duplicate isn't created by accident. Doesn't change where the new scrolls folder goes if you proceed — see step 1./scrolls-unhide - /
-u— name the scrolls folder--unhideinstead of the defaultscrolls, so it isn't dotfile-hidden. Omit for the default (hidden)..scrolls
-p-t-ldocs-r用户可在后以纯文本形式传递以下参数,顺序不限——此处没有真正的argv解析器,需自行读取调用文本并提取参数:
/scrolls-setup- /
-p <path>/--path=<path>—— 指定自定义docs文件夹路径,若未给出绝对路径(以--path <path>开头)则相对于当前工作目录。适用于单体仓库或非标准目录结构,例如/会将scrolls系统放置在--path=packages/api/docs。这是唯一直接指定docs文件夹的选项,而非选择基础目录——请查看步骤4中关于CLAUDE.md放置位置的说明,了解深层路径带来的权衡。packages/api/docs/.scrolls - /
-t—— 将所有内容固定到Git仓库顶层目录(--reporoot),无论实际调用时处于哪个子目录。如果当前目录不在Git仓库内,会给出明确错误提示——此处没有可固定的仓库根目录;建议使用$(git rev-parse --show-toplevel)替代。--path - /
-l—— 明确将所有内容固定到当前工作目录。当未指定--local/-p/-t时,默认就是此行为——该标志的存在是为了让你(或用户)可以明确指定,例如跳过步骤1中的路径不匹配检查。-l - /
-r—— 在创建任何内容前,递归扫描--recurse下是否已存在scrolls文件夹(使用与BASE_DIR//scrolls-hide相同的有限制、可修剪、由STARTER.md保护的搜索逻辑),避免意外创建重复系统。即使找到现有文件夹,也不会改变新scrolls文件夹的创建位置——请查看步骤1。/scrolls-unhide - /
-u—— 将scrolls文件夹命名为--unhide而非默认的scrolls,使其不再作为隐藏文件。不指定该参数则使用默认的隐藏文件夹。.scrolls
-p-t-l-rSteps
操作步骤
1. Resolve BASE_DIR and don't clobber existing work
1. 解析BASE_DIR,避免覆盖现有工作内容
Compute — the directory that will contain both the folder and :
BASE_DIRdocsCLAUDE.md- /
-tgiven:--reporoot. If that command fails (not inside a git repository), stop and tell the user — there's no repo root to pin to here; suggestBASE_DIR = $(git rev-parse --show-toplevel)instead.--path - /
-lgiven, or--local/-pgiven: skip straight to computing--pathbelow —DOCS_BASEuses-landBASE_DIR = $(pwd)bypasses-pentirely (see the note underBASE_DIR).DOCS_BASE - Nothing given (the common case): . But first, if the current directory is inside a git repository, run
BASE_DIR = $(pwd)and compare it togit rev-parse --show-toplevel. If they're the same, or this isn't a git repo, there's nothing to flag. If they differ, tell the user plainly: running from here will create the scrolls at$(pwd), separate from anything that might already exist at the repository root ($(pwd)/docs/.scrolls), and ask whether that's what they want — the current directory (the default; proceed with it if there's no strong preference either way) or the repo root instead (equivalent to re-running with<repo-root>). Don't block indefinitely on this — cwd wins if it's a toss-up, since that's this skill's documented default.-t
If / was given, do this scan next, before touching the filesystem: search recursively under (skip this if was given — a custom is an explicit, deliberate location, not something to second-guess) for any directory named or containing a , pruning the same heavy/vendor directories / prune (, , , , , , , , , , ), bounded to a reasonable depth (8 is what the other scrolls skills use). If this finds an existing scrolls folder anywhere under other than the exact you're about to create, surface it and ask whether the user meant to run against that one instead of creating a new, separate one here — proceed with creation only if they confirm that's what they want (e.g. a deliberately separate scrolls system for a sub-project).
-r--recurseBASE_DIR-p--path.scrollsscrollsSTARTER.md/scrolls-hide/scrolls-unhidenode_modules.gitvendordistbuild.venvvenv__pycache__target.next.cacheBASE_DIRSCROLLS_PATH/scrolls-updateThen:
DOCS_BASE = the --path value if -p was given, else "${BASE_DIR}/docs"
SCROLLS_DIR = "scrolls" if --unhide/-u was passed, else ".scrolls"
SCROLLS_PATH = "${DOCS_BASE}/${SCROLLS_DIR}"SCROLLS_PATHdocs/.scrolls.scrolls/scrolls-unhideIf already exists with files in it, stop and ask the user whether they want you to fill in only the missing files or leave it alone — never overwrite an existing scroll file silently, since //etc. may hold real accumulated state. The same caution applies to : never blow away existing content. If was passed but a folder already exists there (or vice versa), don't create a second, parallel scrolls folder — tell the user and point at instead.
SCROLLS_PATHHANDOFF.mdPLAN.mdCLAUDE.md--unhide.scrolls/scrolls-unhide计算——即包含文件夹和的目录:
BASE_DIRdocsCLAUDE.md- 指定了/
-t:--reporoot。如果该命令执行失败(当前目录不在Git仓库内),停止操作并告知用户——此处没有可固定的仓库根目录;建议使用BASE_DIR = $(git rev-parse --show-toplevel)替代。--path - 指定了/
-l,或指定了--local/-p:直接跳至下文计算--path——DOCS_BASE使用-l,BASE_DIR = $(pwd)则完全绕过-p(请查看BASE_DIR下的说明)。DOCS_BASE - 未指定任何参数(常见情况):。但首先,如果当前目录在Git仓库内,执行
BASE_DIR = $(pwd)并与git rev-parse --show-toplevel对比。如果两者相同,或当前目录不在Git仓库内,则无需提示。如果两者不同,需明确告知用户:在此处运行会在$(pwd)创建scrolls系统,与仓库根目录($(pwd)/docs/.scrolls)下可能已存在的系统相互独立,并询问用户是否确定如此——当前目录为默认选项;若用户无明确偏好,则使用当前目录继续操作,这是本工具文档中规定的默认行为。<repo-root>
如果指定了/,则在操作文件系统前执行以下扫描:递归搜索下是否存在名为或且包含的目录(跳过与/相同的大型/供应商目录:、、、、、、、、、、),搜索深度限制在合理范围内(其他scrolls工具使用的深度为8)。如果在下除了即将创建的之外的位置找到现有scrolls文件夹,需告知用户并询问是否要针对该现有系统运行,而非在此处创建新的独立系统——仅当用户确认需要创建新系统时(例如为子项目创建独立的scrolls系统),才继续执行创建操作。
-r--recurseBASE_DIR.scrollsscrollsSTARTER.md/scrolls-hide/scrolls-unhidenode_modules.gitvendordistbuild.venvvenv__pycache__target.next.cacheBASE_DIRSCROLLS_PATH/scrolls-update然后:
DOCS_BASE = 若指定了-p则为其路径值,否则为"${BASE_DIR}/docs"
SCROLLS_DIR = 若指定了--unhide/-u则为"scrolls",否则为".scrolls"
SCROLLS_PATH = "${DOCS_BASE}/${SCROLLS_DIR}"SCROLLS_PATHdocs/.scrolls.scrolls/scrolls-unhide如果已存在且包含文件,需停止操作并询问用户是仅填充缺失文件还是保留现有内容——切勿静默覆盖现有scroll文件,因为/等文件可能包含真实的累积状态。对也需同样谨慎:切勿删除现有内容。如果指定了但该位置已存在文件夹(反之亦然),请勿创建第二个并行的scrolls文件夹——告知用户并引导其使用。
SCROLLS_PATHHANDOFF.mdPLAN.mdCLAUDE.md--unhide.scrolls/scrolls-unhide2. Gather just enough project context
2. 收集必要的项目上下文
Don't interview the user at length — a minimal setup should be fast. Infer what you can in a few seconds:
- Project name: from 's
package.json,name'spyproject.toml,[project].name, or failing that the directory's basename.Cargo.toml - One-line tagline: from the same manifest's field, or the first line of an existing
description, or omit it — it's optional flavor text, not load-bearing.README.md - Quick orientation: one short paragraph on the project's actual shape — main entry point(s), the one or two files/directories that matter most, and the primary language/stack. Get this by a quick look at the repo root and manifest files, not a deep audit. If the project is genuinely empty (brand new, no code yet), say so plainly rather than inventing structure.
If any of this is ambiguous (e.g. a monorepo with several s), a single clarifying question is fine — but default to acting rather than blocking on questions the repo already answers.
package.json无需对用户进行冗长访谈——最小化搭建应快速完成。在几秒内尽可能推断以下信息:
- 项目名称:来自的
package.json字段、name的pyproject.toml字段、[project].name,若均无法获取则使用目录名称。Cargo.toml - 一行标语:来自同一配置文件的字段,或现有
description的第一行,若无法获取则省略——这是可选的修饰文本,非必需内容。README.md - 快速介绍:关于项目实际结构的简短段落——主入口文件、最重要的一两个文件/目录,以及主要语言/技术栈。通过快速查看仓库根目录和配置文件获取,无需深度审计。如果项目完全为空(全新项目,无代码),则直接说明,无需虚构结构。
如果某些信息不明确(例如单体仓库包含多个),可提出一个澄清问题——但优先执行操作,而非因仓库已能回答的问题而停滞。
package.json3. Create the seven files
3. 创建七个文件
Copy each file from into on disk, substituting the , , , and placeholders with what you gathered in step 2 and computed above. is an absolute filesystem path when it came from //the default (all resolve through , which is always absolute) — that's fine for the actual file writes, but the text you substitute for inside the templates is not the same string:
assets/templates/SCROLLS_PATH{{PROJECT_NAME}}{{PROJECT_TAGLINE}}{{QUICK_ORIENTATION}}{{SCROLLS_PATH}}SCROLLS_PATH-t-lBASE_DIR{{SCROLLS_PATH}}- /
-t/default (-l-derived): substitute the short form,BASE_DIR(e.g.docs/${SCROLLS_DIR}) — never the absolutedocs/.scrolls. This is what keeps the files portable:SCROLLS_PATHalways ends up living atCLAUDE.mdtoo (step 4), so a reference relative toBASE_DIRis correct regardless of whetherBASE_DIRwasBASE_DIRor the git root, and regardless of which machine or clone reads it later. Baking in an absolute path here would break the moment the repo is cloned somewhere else.$(pwd) - /
-p: substitute the full--path-basedDOCS_BASEas given, unchanged from before (e.g.SCROLLS_PATH) — this path is already relative, and wherepackages/api/docs/.scrollsends up for this case is judgment-dependent (see step 4), so keep the existing behavior rather than guessing at a shorter form.CLAUDE.md
| Template | → | Purpose |
|---|---|---|
| | Reading order + when-to-update table. The entry point every session reads first. |
| | Feature list, filled in as features ship. |
| | Snapshot of current state — overwritten each session, not appended. |
| | What's known-missing or partial. |
| | Why each gap exists (deliberate cut vs. oversight vs. blocker). |
| | Prioritized, ticketed backlog. |
| | Constraints / Traps / Ditches / Wisdom sections. |
This is the minimal set — exactly the six files walks through, plus itself. Don't invent extra scroll files (security reviews, architecture-decision records, subsystem deep-dives) up front; those get added later, organically, by whoever's doing that specific work, following the pattern 's own last section describes. Leave blank (drop the placeholder entirely, don't leave literal text) if you found nothing worth using — it reads fine as with no tagline clause.
STARTER.mdSTARTER.mdSTARTER.md{{PROJECT_TAGLINE}}{{...}}You're picking up work on **Foo**.STARTER.mdCLAUDE_MD_BLOCK.md{{SCROLLS_PATH}}-t-lSCROLLS_PATH-pTemplates are intentionally close to empty (placeholder bullets like "(none tracked yet)") — resist the urge to pre-populate with a guessed feature list or with invented tickets. A minimal scaffold's job is to hold the shape; the content accumulates from real sessions. The one exception is 's "Quick orientation" section, which is worth getting right since it's the one piece of static context every session leans on immediately.
SPEC.mdPLAN.mdSTARTER.md将中的每个文件复制到磁盘上的,并将、、和占位符替换为步骤2收集的信息和上文计算的路径。当来自//默认设置(均通过解析,始终为绝对路径)时,文件写入使用绝对路径没问题,但模板中替换的文本并非同一字符串:
assets/templates/SCROLLS_PATH{{PROJECT_NAME}}{{PROJECT_TAGLINE}}{{QUICK_ORIENTATION}}{{SCROLLS_PATH}}SCROLLS_PATH-t-lBASE_DIR{{SCROLLS_PATH}}- /
-t/默认设置(基于BASE_DIR):替换为短格式-l(例如docs/${SCROLLS_DIR})——切勿使用绝对路径docs/.scrolls。这样可保持文件的可移植性:SCROLLS_PATH也会存放在CLAUDE.md(步骤4),因此相对于BASE_DIR的引用始终正确,无论BASE_DIR是BASE_DIR还是Git根目录,也无论后续在哪个机器或克隆版本中读取。在此处写入绝对路径会导致仓库克隆到其他位置时失效。$(pwd) - /
-p:直接使用之前计算的基于--path的完整DOCS_BASE(例如SCROLLS_PATH)——该路径已为相对路径,且此情况下packages/api/docs/.scrolls的存放位置需根据实际情况判断(请查看步骤4),因此保持现有行为,而非猜测更短的路径格式。CLAUDE.md
| 模板文件 | → | 目标文件 | 用途 |
|---|---|---|---|
| | 阅读顺序及更新时机表。每个会话首先读取的入口文件。 | |
| | 功能列表,随功能交付逐步填充。 | |
| | 当前状态快照——每次会话覆盖更新,而非追加。 | |
| | 已知缺失或未完成的内容。 | |
| | 每个缺失内容存在的原因(故意删减、疏忽或阻塞)。 | |
| | 已排序、带工单的待办事项列表。 | |
| | 约束条件/陷阱/误区/经验总结部分。 |
这是最小化的文件集合——恰好是中提及的六个文件,外加本身。请勿预先创建额外的scroll文件(安全审查、架构决策记录、子系统深度分析等);这些文件后续可由相关人员根据最后一节描述的模式有机添加。如果未找到合适的,则留空(直接删除占位符,不要保留字面的文本)——即使没有标语,这样的表述也完全通顺。
STARTER.mdSTARTER.mdSTARTER.md{{PROJECT_TAGLINE}}{{...}}You're picking up work on **Foo**.只有和模板包含——需按照上述规则替换(//默认设置使用短格式,使用完整),而非保留占位符字符串,且两个文件需使用相同的替换内容。
STARTER.mdCLAUDE_MD_BLOCK.md{{SCROLLS_PATH}}-t-l-pSCROLLS_PATH模板文件故意设计为接近空白(例如占位符项目符号"(none tracked yet)")——请勿预先填充的猜测功能列表或的虚构工单。最小化框架的作用是提供结构;内容需从真实会话中逐步积累。唯一例外是的“快速介绍”部分,值得准确填写,因为这是每个会话立即依赖的静态上下文。
SPEC.mdPLAN.mdSTARTER.md4. Point CLAUDE.md at STARTER.md
4. 配置CLAUDE.md指向STARTER.md
Read and substitute in it the same way as — that's the block to install.
assets/templates/CLAUDE_MD_BLOCK.md{{SCROLLS_PATH}}STARTER.md- /
-t/default (-l-derived):BASE_DIRgoes atCLAUDE.md— the same directory that now containsBASE_DIR. This is fixed and unambiguous:docsis exactly whatBASE_DIR/-t/the mismatch check in step 1 resolved, so there's no separate "project root" judgment call to make here anymore.-l - /
-p: where--pathbelongs is genuinely judgment-dependent, since a customCLAUDE.mdmight point at an independent monorepo package (its own--path, short local references — closer to whatCLAUDE.mdwould produce if you'd-led into that package first) or be one piece of a larger repo meant to stay under a single rootcdreferencing the full path. Use whateverCLAUDE.mdlocation the project's other tooling already expects; if genuinely unclear, ask rather than guessing — this is the one case where a wrong guess is expensive (a broken reference baked into checked-in docs).CLAUDE.md
Once you know where goes:
CLAUDE.md- No there yet: create one containing exactly that block.
CLAUDE.md - exists but has no scrolls-path reference: insert the block near the top of the file (before other instructions, since "read this first" only works if it's read first), separated by blank lines from surrounding content. If the file already opens with its own top-level heading, add the block's heading as a subsection instead of a second top-level
CLAUDE.md— match the existing file's heading structure rather than fighting it.# Project instructions - already references
CLAUDE.md(or the short form, if that's what applies here): leave it alone; note this to the user instead of duplicating the block.SCROLLS_PATH/STARTER.md
读取并按照与相同的规则替换——这就是需要添加的内容块。
assets/templates/CLAUDE_MD_BLOCK.mdSTARTER.md{{SCROLLS_PATH}}- /
-t/默认设置(基于BASE_DIR):-l存放在CLAUDE.md——即现在包含BASE_DIR的目录。这是固定且明确的:docs已由BASE_DIR/-t/步骤1中的路径不匹配检查解析完成,因此无需再判断“项目根目录”。-l - /
-p:--path的存放位置需根据实际情况判断,因为自定义CLAUDE.md可能指向独立的单体仓库包(需单独的--path和短本地引用——类似于进入该包后使用CLAUDE.md的效果),或作为大型仓库的一部分,需保留在单一根目录-l中并引用完整路径。使用项目其他工具已采用的CLAUDE.md存放位置;若确实不明确,需询问用户而非猜测——此情况下错误猜测的代价较高(会将无效引用写入已提交的文档)。CLAUDE.md
确定的存放位置后:
CLAUDE.md- 该位置尚无CLAUDE.md:创建文件并写入上述内容块。
- CLAUDE.md已存在但未引用scrolls路径:将内容块插入文件顶部附近(在其他说明之前,因为“优先阅读”只有在最前面才有效),与周围内容用空行分隔。如果文件已以一级标题开头,则将内容块的标题作为子标题,而非添加第二个一级标题——匹配现有文件的标题结构,而非强行修改。
# Project instructions - CLAUDE.md已引用(或适用的短格式):保留现有内容;告知用户无需重复添加内容块。
SCROLLS_PATH/STARTER.md
5. Report back
5. 反馈结果
Summarize what was created vs. what already existed and was left untouched, and name the two or three things most worth the user's attention next: filling in 's quick-orientation paragraph if you had to guess at it, and writing the first real entry once something ships.
STARTER.mdSPEC.md总结已创建的内容与已存在且未修改的内容,并指出用户接下来最值得关注的两三个事项:如果之前猜测了的快速介绍段落,需完善该内容;当有功能交付时,写入第一条真实的条目。
STARTER.mdSPEC.md