Open source CapCut alternative.
TypeScript
docs: add the engineering doc style guide and require it for docs work
David Le7260b13585e4
diff --git a/AGENTS.md b/AGENTS.mdindex 2f577d69..46153bf5 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -34,12 +34,13 @@ Before changing `site/` UI, routes, API handlers, or data access patterns:- Ask before creating any new plan document.- Manage plans deliberately: move a plan to `plans/done/` when its work is complete, and create or keep plans only for work that remains.- Over time, prefer shrinking active `plans/` by completing work and moving finished plans to `plans/done/`.+- When writing or editing any engineering doc under `docs/`, follow `docs/guides/eng-doc-style.md`.- Update guides in `docs/guides/` only for major features or durable supported-behavior changes. Do not update guide docs for small styling tweaks, layout adjustments, copy changes, or implementation-only refactors.- When work completes a master-plan slice, update the master plan's supported/current-boundary language and next steps in the same change.- Keep guides explanatory. They should teach what the system is, how it works, and which boundaries matter; do not turn guides into feature inventories, implementation logs, duplicated code, or long file lists.- Optimize guides for readability: use plain language, short sections, and only the detail a maintainer needs to understand the supported boundary. Prefer trimming outdated or repetitive detail over adding more paragraphs.- Keep guide source entrypoints short and readable. Do not write exhaustive file inventories. Prefer a small maintainer map by subsystem or one to seven high-signal paths, and link to a source path only when it gives someone a clear place to start.-- When asked to commit, group the working changes into logical commits by concern rather than one catch-all commit. Branch off `main` first (never commit directly to `main`), make the commits there, then merge the branch back into `main` with `--no-ff` and delete the branch. Do not push unless asked.+- When asked to commit, group the working changes into logical commits by concern rather than one catch-all commit. Commit directly on `main` (no feature branch, no merge commit). Write messages as `type(scope): summary`, where `type` is a Conventional Commits kind (`feat`, `fix`, `docs`, `refactor`, `chore`, etc.) and `scope` is the area touched (e.g. `feat(site)`, `fix(app)`, `refactor(site)`); `scope` may be omitted when an area does not apply, as in `docs:`. Do not push unless asked.- Build forward by default. Prefer updating callers and contracts to the new supported shape instead of preserving old compatibility paths; ask before adding or keeping backwards-compatibility shims.- This is an open source project. Stay alert for security concerns, and never commit PII, API keys, tokens, credentials, private config, or other secrets.- Keep this file stable and lightweight.diff --git a/CLAUDE.md b/CLAUDE.mdindex 2876965e..46153bf5 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -34,6 +34,7 @@ Before changing `site/` UI, routes, API handlers, or data access patterns:- Ask before creating any new plan document.- Manage plans deliberately: move a plan to `plans/done/` when its work is complete, and create or keep plans only for work that remains.- Over time, prefer shrinking active `plans/` by completing work and moving finished plans to `plans/done/`.+- When writing or editing any engineering doc under `docs/`, follow `docs/guides/eng-doc-style.md`.- Update guides in `docs/guides/` only for major features or durable supported-behavior changes. Do not update guide docs for small styling tweaks, layout adjustments, copy changes, or implementation-only refactors.- When work completes a master-plan slice, update the master plan's supported/current-boundary language and next steps in the same change.- Keep guides explanatory. They should teach what the system is, how it works, and which boundaries matter; do not turn guides into feature inventories, implementation logs, duplicated code, or long file lists.diff --git a/docs/README.md b/docs/README.mdindex 96714841..70185d30 100644--- a/docs/README.md+++ b/docs/README.md@@ -15,6 +15,8 @@ Supported product and engineering guides live in `docs/guides/`.Add or update a guide there when behavior becomes supported. Do not maintain duplicate guide indexes in subdirectories or app folders; use descriptive filenames and link directly from related docs only when the relationship helps a maintainer.+Write and edit docs following `docs/guides/eng-doc-style.md`. It defines the required structure, sentence-level rules, and the post-writing test for every engineering doc.+## Navigation Rules- Treat `plans/done/` as background only; do not use archived plans as active implementation instructions.diff --git a/docs/guides/eng-doc-style.md b/docs/guides/eng-doc-style.mdnew file mode 100644index 00000000..ac7909dd--- /dev/null+++ b/docs/guides/eng-doc-style.md@@ -0,0 +1,105 @@+# Engineering Doc Style Guide++For internal architecture docs, runtime specs, and contributor guides — anything+a teammate (or a coding agent) will read once and then follow precisely.++## Core Principles++**1. Lead with the point.**+The first paragraph answers "what is this and why does it exist" in plain+words. No throat-clearing, no history. If the doc has one governing rule,+state it by the second paragraph and label it (`**The one rule:**`). Readers+should be able to stop after the intro and still behave correctly.++**2. Say each thing exactly once.**+One canonical explanation per concept, in the place readers will look for it.+Everything else references it ("see the loop above") instead of restating it.+If you find the same idea in two sections, one of them is the home and the+other becomes a pointer.++**3. Diagrams are the source of truth, prose is the commentary.**+A loop, pipeline, or lifecycle gets one ASCII diagram — numbered steps if order+matters. Prose around it explains *why*, never re-narrates *what*. Never draw+the same flow twice.++**4. Name the division of labor in one sentence.**+When two components share responsibility, compress it to a contrast:+"The model decides *what*; Swift decides *whether and how*." A reader who+remembers only that sentence still makes correct decisions.++**5. Rules become tables; stories stay prose.**+Anything that is a lookup — states and their outcomes, risk tiers and their+behaviors, modules and what they own — goes in a table. Prose is for reasoning+and intent; tables are for facts you check against.++**6. State invariants as numbered, named rules.**+Don't smear a constraint across four paragraphs. Extract it:++> 1. **Every input is guarded.** …+> 2. **Done means evidence.** …++Bold name first, consequence after. The bold name becomes the vocabulary the+team uses in review comments.++**7. Show the negative example.**+The fastest way to make a rule concrete is to show the violation:+"If you're tempted to write `if command.contains(\"music\")`, the logic belongs+in a skill." One forbidden snippet teaches more than a paragraph of abstraction.++**8. Prefer the concrete word.**+"Typed fields — tool names, app ids, file paths" beats "structured semantic+representations." When a generalization is needed, follow it immediately with+two or three real examples in code font.++## Sentence-Level Rules++- **Imperative or declarative, never hedged.** "Adapters never hold task+ state," not "adapters should generally avoid holding task state."+- **Short sentences carry rules; longer sentences carry rationale.** A rule+ over ~20 words is probably two rules.+- **Active voice with a named actor.** "The planner picks the tool," not "the+ tool is selected."+- **Bold sparingly, and only for rule names and key contrasts.** If half a+ paragraph is bold, nothing is.+- **Italics only for word-level contrast** (*what* vs *whether*), never for+ emphasis-shouting.+- **Code font for anything that exists in the codebase**: tool names, states+ (`waitingForPermission`), commands, paths. If a reader could grep for it, set+ it in backticks.++## Structure Template++```text+# Title++What this is + why it exists (2–4 sentences).+**The one rule:** the governing constraint, with a negative example.++## How It Works — the canonical diagram + the division-of-labor sentence+## [Core nouns] — one section per major concept (state, boundaries, tools)+## [Hard constraints] — invariants as numbered named rules, lookups as tables+## Source Map — table of module → what it owns, plus how to test+```++Sections are nouns ("Task State," "Model Boundary"), not gerunds ("Managing+Task State"). Order by what a new reader needs first, ending with the source+map so the doc lands on "where to go next."++## What to Cut++- Restatements ("as mentioned above," "in other words")+- Adjectives that don't change behavior ("robust," "powerful," "seamless")+- Anticipatory caveats for situations no reader is in+- Meta-commentary about the doc itself ("this section describes…")+- Anything a table header already says++## The Test++After writing, ask three questions:++1. Could a reader stop at the end of the intro and still avoid the worst+ mistakes? (If no — the governing rule is buried.)+2. Is any concept explained twice? (If yes — pick the home, delete the rest.)+3. Could a coding agent follow this doc without asking clarifying questions?+ (If no — a rule is hedged, an example is missing, or a lookup isn't a+ table.)