skills/writing-design-docs/SKILL.md
Use when rough engineering or product context needs to become a concise design doc, RFC, technical proposal, architecture decision, or design review artifact. Triggers on feature requests, bug reports, defined issues, vague ideas, architecture questions, approach comparisons, scoping, goals/non-goals, current-code research, comparable-product research, or written recommendations for a design decision. Not for implementation-only tasks.
npx skillsauth add boojack/skills writing-design-docsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Turn rough engineering context into a concise, decision-ready design doc. Do not write implementation code, task plans, PRs, or execution steps.
CLARIFY THE PROBLEM BEFORE WRITING THE DESIGN
RESEARCH CURRENT CODE AND MAINSTREAM DESIGNS BEFORE PROPOSING
| Phase | Do not move on until | | --- | --- | | Understand | The product/system problem, actors, workflow, and known facts are clear. | | Clarify | Remaining unknowns either have answers or explicit conservative defaults. | | Research | Relevant current code/docs and comparable designs have been inspected. | | Compare | Viable approaches and tradeoffs are fairly represented, unless one local fix is clearly enough. | | Write | The doc shape matches the scope and avoids execution planning. | | Review | Claims trace back to evidence, goals, constraints, or stated assumptions. |
For rough or ambiguous requests, use a direct question loop before researching deeply:
With scope settled, research only what materially affects the design:
Do not proceed to design until you can answer:
Then summarize before designing:
If this summary is likely controversial or high-impact, ask the user to confirm it before writing the design doc.
Include 2-3 viable approaches unless the design is clearly small and local.
For each approach, capture:
Lead with a recommendation only after comparing the options. Do not include strawman options just to reach three; when one option is clearly worse, say why briefly and keep the comparison honest.
Save to docs/design-docs/YYYY-MM-DD-<slug>.md unless the user requests another path.
Use this structure by default:
# <Short Descriptive Title>
Status: Draft
Authors: <name or team>
Reviewers: <names, teams, or TBD>
Last Updated: <date>
## TL;DR
## Background
## Problem Statement
## Goals & Non-Goals
## Current State
## Design
## Impact
## Open Questions
Section requirements:
| Section | Requirement |
| --- | --- |
| Title | Plain noun phrase, under 80 characters. |
| Metadata | Keep status, authors, reviewers, and date short. Use TBD only for reviewers when genuinely unknown. |
| TL;DR | 3-5 sentences: problem, recommendation, main tradeoff, expected outcome. |
| Background | Objective context, user workflow, related issues, research summary, prior work, and why this matters. Keep it succinct. |
| Problem Statement | One precise paragraph. Describe the broken behavior or gap, not the fix. |
| Goals & Non-Goals | Short bullets. Non-goals are plausible goals explicitly excluded, not negated goals. |
| Current State | Current behavior and relevant code/data/API facts. Include file paths, source docs, and local patterns when useful. |
| Design | Start with the proposal, then add only the details needed to understand decisions and tradeoffs. |
| Impact | Explain affected API, frontend, data model, users, compatibility, rollout, or operational behavior. Omit irrelevant surfaces. |
| Open Questions | Carry unresolved questions with recommended defaults. |
For small or incremental changes, write a mini design doc with only:
# <Short Descriptive Title>
## TL;DR
## Background
## Problem Statement
## Goals & Non-Goals
## Design
## Impact And Open Questions
Use the full default structure when the design crosses teams, changes APIs/data models, introduces meaningful migration risk, or needs current-state evidence to be reviewed.
Add these optional sections only when the doc needs them:
| Optional section | Use when | | --- | --- | | Critical User Journeys | Product/UX flow matters, especially when multiple roles or entry points are involved. | | Industry / Product Research | External patterns materially affect the design. | | Approaches | There are 2-3 viable solutions that deserve fair comparison. | | Comparison | A table makes tradeoffs clearer than prose. | | Recommendation | The doc compares approaches and needs a clear final choice. | | Risks & Cross-Cutting Concerns | Security, privacy, observability, reliability, migration, or support risks are material. | | Release Plan / Rollout | Phasing, compatibility, or migration order matters. | | Future Work | Useful follow-ups are explicitly out of scope. | | References | The doc relies on external sources, prior PRs, or linked artifacts. |
In Design, use short subsections only when they clarify the design:
### Current Behavior
### Proposed Change
### Key Decisions
### API / Interface
### Data Model
### UX / User Flow
### System Flow
### Ownership And Boundaries
Skip subsections that would be empty or ceremonial. Do not paste complete schemas, API definitions, or code unless the detail is necessary to explain a tradeoff.
Use this option format in Approaches:
### Option A: <name>
<One-sentence summary.>
- Pros: <1-3 concise bullets>
- Cons: <1-3 concise bullets>
- Fit: <how it meets or misses the goals>
When the answer is a direct local fix and alternatives would be artificial, skip Approaches and put the reasoning under Design > Key Decisions.
Before finishing, revise the doc against this checklist:
This shows the target altitude: grounded in real code, recommendation visible, tradeoffs explicit, no implementation steps.
# Debounce Autosave In The Note Editor
## TL;DR
The note editor saves on every keystroke, producing heavy write traffic and
occasional lost updates when requests race. We recommend debouncing autosave to
800ms after the last edit, with a forced flush on blur and navigation, and an
edit sequence number to discard out-of-order responses. This cuts write volume
sharply and removes the race without changing the "saves automatically" UX.
## Background
`NoteEditor` calls `saveNote()` from its `onChange` handler
(`web/src/editor/NoteEditor.tsx:142`), so a 200-character paragraph issues ~200
PUTs. Support has logged three reports of notes reverting mid-edit; server logs
show overlapping PUTs completing out of order.
## Problem Statement
Per-keystroke saving generates redundant write load and lets concurrent in-flight
requests complete out of order, occasionally persisting stale content over newer
edits.
## Goals & Non-Goals
- Goal: Reduce autosave write volume during active typing.
- Goal: Prevent stale overwrites from out-of-order responses.
- Non-goal: Offline editing or local draft persistence.
- Non-goal: Adding a manual Save button or changing the autosave UX.
## Design
Debounce `saveNote()` to fire 800ms after the last edit, and force an immediate
flush on blur, route change, and `visibilitychange`. Tag each request with a
monotonically increasing `editSeq`; the client discards any response whose
`editSeq` is older than the latest sent, closing the race with no server change.
800ms balances perceived responsiveness against write reduction and stays
configurable if support data argues otherwise.
## Impact And Open Questions
Affects only the editor's save path; the `PUT /notes/:id` contract, data model,
and migrations are unchanged. Open: should a "Saving…/Saved" indicator accompany
the delay? (default: yes, reuse the existing `SaveStatus` badge.)
The Self-Review checklist covers the positive rules; these are the tempting traps to watch for.
testing
Syncs issue artifacts (definition, design, plan, execution) to Linear. Creates or updates a Linear issue with a summarized title and structured description, and uploads full artifacts as linked documents. Use after any pipeline stage to push current state to Linear. Also triggers on: "sync to linear", "push to linear", "create linear issue", "update the ticket", "track this in linear". Reads artifacts produced by defining-issues and executing-tasks.
development
Plans and executes implementation from a defined issue. Reads definition.md (and design.md if present), breaks work into tasks, then executes each task with validation. Use when a definition exists in docs/plans/ and implementation work should begin. Also triggers on: "build it", "implement this", "execute the plan", "start implementing", "do the work", "plan and execute", "break this into tasks and build it". Requires definition.md from defining-issues. For L-scope, also requires design.md. For syncing results to Linear, see syncing-linear.
development
Converts vague requests into precise issue definitions grounded in the codebase, then researches and designs a solution for complex tasks. Produces definition.md (always) and design.md (for L-scope). Use when an issue needs to be clarified, scoped, or prepared before implementation — such as unclear requirements, vague feature requests, ambiguous bug reports, or undefined scope boundaries. Also triggers on: "what should we build", "scope this", "write up an issue", "define the problem", "clarify requirements", "design this", "how should we build this", "research solutions", "design doc". For implementation after definition, see executing-tasks.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.