跳到正文
cccskills
免费在 GitHub 公开

docs

Update or create DOCS.md files for Shift subsystems. Use this skill whenever the user asks to update docs, refresh documentation, create a DOCS.md, write module documentation, or says "update docs for X". Also trigger after completing a large feature when Claude.md says to update docs — check if any DOCS.md in the affected subsystem needs refreshing.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md7.4 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

/docs — Update or Create Module Documentation

The goal is documentation that helps agents and contributors understand constraints they cannot discover by reading source code.

Before writing

  1. Read docs/architecture/index.md to find the canonical doc for the subsystem
  2. Read the current DOCS.md if one exists
  3. Read the module's source code to understand what has actually changed
  4. If creating a new DOCS.md, confirm with the user first — this skill defaults to updating existing docs

DOCS.md section order

Every DOCS.md follows this structure. Omit empty sections but preserve the order.

# Module Name

One-sentence purpose.

## Architecture Invariants

## Codemap

## Key Types

## How it works

## Workflow recipes

## Gotchas

## Verification

## Related

Writing each section

Architecture Invariants

This is the most valuable section because it captures knowledge that is invisible in code. A contributor can read every line of source and still violate an invariant, because invariants describe absences, performance motivations, and semantic distinctions that only make sense with historical context.

Each invariant states a rule and explains why it exists:

Architecture Invariant: Rust is never touched during the draft preview hot path. SourceEditDraft.previewPositionPatch() applies a sparse patch to local reactive geometry only. Rust sees the final sparse patch once when commit() calls GlyphSource.commitPositionPatch(). This exists because round-tripping full glyph values for thousands of points per frame causes long frames and GC pressure.

Good invariants describe:

  • What never happens and why ("X never imports Y because Z")
  • Performance-motivated design choices ("uses flat arrays, never JSON, because Y")
  • Semantic distinctions invisible in types ("$glyph fires on identity changes, not data changes")

Bad invariants just restate what the code does ("X calls Y", "X extends Z"). If you can see it by reading the source, it does not belong here.

Use **CRITICAL**: labels sparingly — only for rules that will silently break things or waste hours if violated. These are not style preferences; they are landmines.

Codemap

A tree showing key files with one-line purposes. Skip test fixtures, generated files, and barrel re-exports. The point is orientation, not an exhaustive listing.

module/
├── Foo.ts         — one-line purpose
├── Bar.ts         — one-line purpose
└── types.ts       — one-line purpose

Key Types

Only types that matter for understanding the module's contract. Reference by symbol name (EditSession, BaseTool), not file path. Symbol names survive refactors; paths break.

How it works

Brief narrative explaining data flow and lifecycle. Focus on design rationale for non-obvious choices — "we do X because Y, not because Z." This is not an API dump listing every method signature.

Workflow recipes

Step-by-step instructions for common modifications. Include which symbols to touch and what verification to run. Be specific enough that someone unfamiliar with the module can follow along:

### Adding a new tool

1. Create a class extending `BaseTool` in `lib/tools/`
2. Define `behaviors` array — first `canHandle` match wins
3. Implement `activate()` to enter a reactive state (e.g. `"ready"`)
4. Register in `ToolRegistry`
5. Verify: `pnpm typecheck && pnpm test`

Gotchas

Things that have bitten people. Performance traps. Known edge cases. These are experiential — the kind of thing someone would tell a new teammate over coffee.

Verification

What to run after changing this module. Be specific about which commands and what they check.

Related

Other modules this one connects to, referenced by symbol name with a brief note on the relationship.

What not to write

These patterns weaken documentation and cause maintenance burden:

  • API dumps — listing every method with its signature. The code is the API reference; docs should explain what the code cannot.
  • Duplicating Claude.md — if a rule is in the root constitution, don't repeat it. A contributor who read Claude.md and then reads your DOCS.md shouldn't see the same rule twice.
  • Exhaustive file lists — listing every file in a directory rots immediately. The codemap should cover key files only.
  • Generic descriptions — "This module handles X" without explaining why it handles X this particular way. The interesting part is always the design choice, not the responsibility statement.
  • Cross-cutting architecture — narratives spanning multiple subsystems belong in docs/architecture/, not in one module's DOCS.md.

Review attestation

Every DOCS.md carries, within its first five lines:

<!-- reviewed: 2026-08-18 review-every: 90d -->

Bump the reviewed date ONLY after actually re-verifying the doc's claims against source — it is an attestation, not a timestamp. The checker flags docs whose review is overdue or whose source moved after the last review; committing the doc without bumping the date deliberately does NOT clear staleness.

Enforced invariants

When an invariant is structurally enforceable (dependency bans, import surfaces), prefer adding a rule to scripts/check-invariants.py and citing it from the doc: "Enforced by scripts/check-invariants.py (rule-id)". Prose stays for the WHY; the rule owns the WHAT. Unenforceable motivation (performance rationale, temporal claims) stays prose — don't fake precision.

Code fences

  • ts/typescript fences are type-checked in CI against the module's tsconfig (node scripts/check-docs-fences.mjs). Make examples self-contained: real imports plus declare const preambles for free variables. A deliberately non-compiling fragment opts out with ```typescript illustrative.
  • Codemap trees are validated path-by-path against the filesystem — every listed file must exist. python3 scripts/context-drift-check.py --codemap <doc> prints the module's real tree as ground truth to curate from (curate; don't paste it wholesale).
  • Command lines (pnpm/cargo/vitest, fenced or inline) are validated against real scripts, packages, and CLI flags.

After writing

  1. Verify backtick-quoted symbols still exist — grep for each PascalCase symbol in the doc
  2. Verify markdown links resolve to real files
  3. Run python3 scripts/context-drift-check.py to validate the full docs system (it auto-discovers every DOCS.md), plus node scripts/check-docs-fences.mjs if you touched ts fences and python3 scripts/check-invariants.py if you touched an enforced invariant
  4. Bump the doc's reviewed: date — you just verified it
  5. Prefer small, accurate updates over comprehensive rewrites. A doc with three correct invariants beats one with ten stale ones.

Scope boundaries

  • Do not modify Claude.md — it is manually curated
  • Do not create CONTEXT.md files — banned by Claude.md
  • Cross-cutting architecture docs go in docs/architecture/, not module DOCS.md
  • Do not create new DOCS.md files without an explicit request from the user

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

commit

免费

Canonical rules for writing git commits in the Shift codebase. Use whenever the user asks to commit, stage and commit, create a pull request that requires commits, or draft a commit message. Enforces Conventional Commits, release-note quality, concise subjects, and logical commit boundaries.

中文简介正在准备中。当前显示原文说明。

shift-editor/shift3592026年10月20日 更新

dead-code

免费

Find and remove dead code (unused files, exports, class members) using Knip as a candidate generator, then verify each candidate through AST-level analysis and interface tracing before removing anything. Use when the user asks to clean up unused code, find dead code, or reduce the codebase.

中文简介正在准备中。当前显示原文说明。

shift-editor/shift3592026年10月20日 更新

Adversarially fact-check DOCS.md files against the actual source code, verifying every concrete claim rather than trusting structure checks. Use when the user asks to audit docs, verify documentation accuracy, check whether docs are still true, or on a scheduled documentation review. This is the semantic layer the mechanical checkers cannot cover.

中文简介正在准备中。当前显示原文说明。

shift-editor/shift3592026年10月20日 更新

issue

免费

Canonical rules for finding, creating, and updating Shift GitHub issues. Use whenever the user asks to file, create, open, update, triage, or search for an issue, or when substantial work needs an issue before a pull request. Prevents duplicates and defines acceptance criteria and pull-request closure semantics.

中文简介正在准备中。当前显示原文说明。

shift-editor/shift3592026年10月20日 更新

jsdoc

免费

Add or revise source-level JSDoc for Shift APIs. Use this skill before writing or editing documentation comments for exported classes, methods, constructors, domain data structures, render frames, reactive state, or any API where caller intent, side effects, lifetime, ownership, or nullability are easy to misunderstand.

中文简介正在准备中。当前显示原文说明。

shift-editor/shift3592026年10月20日 更新

perf

免费

How to find and fix performance problems in Shift's desktop app. Use when something is slow, choppy, janky, or laggy (scrubbing, dragging, editing, undo, opening fonts), when profiling or measuring, when adding or reviewing perf tests, and before claiming a change made something faster.

中文简介正在准备中。当前显示原文说明。

shift-editor/shift3592026年10月20日 更新

查看 shift-editor 的全部技能

报告此技能的问题