Document feature
Record durable design decisions for new features into the repo's docs/
directory. Documentation is organized as one file per topic, with each
feature appending a new section to the relevant topic file(s).
When to use this skill
Use it when a change introduces or meaningfully reshapes a feature, e.g.:
- A new route, page, or API endpoint
- A new shared component or component pattern
- New domain/business logic or a new data-loading strategy
- A new testing approach, auth flow, error-handling pattern, or build/deploy change
Do NOT use it for:
- Bugfixes
- Styling/CSS tweaks
- Renames, refactors with no behavioral change, dependency bumps
- Any small, self-contained task
If unsure whether something qualifies as a "feature", ask the user before
writing docs.
Topics and files
All docs live under docs/ at the repo root. There is exactly one file per
topic. Create the file the first time a topic is documented; otherwise append
to it.
| Topic |
File |
Scope |
| Testing |
docs/testing.md |
Unit, browser, and e2e testing strategy |
| API endpoints |
docs/api-endpoints.md |
+server.ts request handlers, contracts |
| Routes & navigation |
docs/routes.md |
Route structure, layouts, navigation |
| Data loading |
docs/data-loading.md |
load functions, SSR vs CSR, caching |
| Components |
docs/components.md |
Shared UI components and patterns |
| State management |
docs/state-management.md |
Stores, runes, shared/global state |
| Business logic |
docs/business-logic.md |
Domain rules and specific business logic |
| Forms & actions |
docs/forms-actions.md |
Form handling and server actions |
| Auth |
docs/auth.md |
Authentication and authorization |
| Error handling |
docs/error-handling.md |
Error pages, boundaries, logging |
| Build & deployment |
docs/build-deployment.md |
Config, adapters, CI/CD |
A single feature often spans multiple topics (e.g. a checkout feature touches
routes, data-loading, business-logic, and testing). Add a section to
each relevant file rather than cramming everything into one.
If a feature genuinely doesn't fit any topic above, ask the user whether to add
a new topic file rather than forcing it into an unrelated one.
Section format
Each documented feature is a single ## section appended to the topic file.
Use this exact structure:
## <Descriptive title>
**Approach:** <What we do — the concrete approach taken for this feature.>
**Why:** <Why this approach — tradeoffs, alternatives rejected, constraints.>
Rules:
- Title is required and descriptive — name the feature and what the section
covers (e.g.
## Cart checkout flow (multi-step server actions)), not just
## Checkout.
- Approach is required. Describe what we actually do: key files, patterns,
data flow, contracts. Reference real paths with
file_path and, where
useful, file_path:line_number.
- Why is optional. Include it only when there is a real decision or
tradeoff to capture (an alternative was rejected, a constraint forced the
choice, a non-obvious pattern was chosen deliberately). If the user did not
state a rationale and none is evident, omit the
**Why:** line entirely — do
not invent one and do not leave a placeholder.
Keep the contents as concise as possible without losing any context.
Workflow
- Confirm the change is a feature (not a bugfix/small task) or a meaningful change
to an existing one. If not, stop and tell the user no docs are needed.
- Identify which topic file(s) the feature touches.
- For each topic file:
- If it doesn't exist, create it with a top-level
# <Topic> heading, then
the new section.
- If it exists, append the new
## section at the end. Don't rewrite or
reorder existing sections.
- If documenting a meaningful change to an existing feature, update its
corresponding section without rewriting unrelated entries.
- Write a descriptive title and the Approach. Add Why only if a real
rationale exists.
- Keep entries concise and factual; link to code with paths instead of pasting
large code blocks.
- Show the user a summary of which files were created/updated.
New topic file template
When creating a topic file for the first time:
# <Topic name>
> Documentation of feature-level decisions for <topic>. Each section below
> records one feature: its approach and, where relevant, why.
## <First feature title>
**Approach:** ...
1---2name: document-feature3description: Use when the user asks for documentation. Use when a new feature has been built or significantly changed and its design/decisions should be recorded in the repo's docs/. Captures the approach (and optional rationale) into per-topic markdown files (testing, api-endpoints, routes, data-loading, components, state-management, business-logic, forms-actions, auth, error-handling, build-deployment). Do NOT use for bugfixes, style tweaks, or other small tasks.4---56# Document feature78Record durable design decisions for **new features** into the repo's `docs/`9directory. Documentation is organized as **one file per topic**, with each10feature appending a new section to the relevant topic file(s).1112## When to use this skill1314Use it when a change introduces or meaningfully reshapes a feature, e.g.:1516- A new route, page, or API endpoint17- A new shared component or component pattern18- New domain/business logic or a new data-loading strategy19- A new testing approach, auth flow, error-handling pattern, or build/deploy change2021**Do NOT use it for:**2223- Bugfixes24- Styling/CSS tweaks25- Renames, refactors with no behavioral change, dependency bumps26- Any small, self-contained task2728If unsure whether something qualifies as a "feature", ask the user before29writing docs.3031## Topics and files3233All docs live under `docs/` at the repo root. There is exactly one file per34topic. Create the file the first time a topic is documented; otherwise append35to it.3637| Topic | File | Scope |38| ------------------ | --------------------------- | -------------------------------------------------- |39| Testing | `docs/testing.md` | Unit, browser, and e2e testing strategy |40| API endpoints | `docs/api-endpoints.md` | `+server.ts` request handlers, contracts |41| Routes & navigation| `docs/routes.md` | Route structure, layouts, navigation |42| Data loading | `docs/data-loading.md` | `load` functions, SSR vs CSR, caching |43| Components | `docs/components.md` | Shared UI components and patterns |44| State management | `docs/state-management.md` | Stores, runes, shared/global state |45| Business logic | `docs/business-logic.md` | Domain rules and specific business logic |46| Forms & actions | `docs/forms-actions.md` | Form handling and server actions |47| Auth | `docs/auth.md` | Authentication and authorization |48| Error handling | `docs/error-handling.md` | Error pages, boundaries, logging |49| Build & deployment | `docs/build-deployment.md` | Config, adapters, CI/CD |5051A single feature often spans multiple topics (e.g. a checkout feature touches52`routes`, `data-loading`, `business-logic`, and `testing`). Add a section to53each relevant file rather than cramming everything into one.5455If a feature genuinely doesn't fit any topic above, ask the user whether to add56a new topic file rather than forcing it into an unrelated one.5758## Section format5960Each documented feature is a single `##` section appended to the topic file.61Use this exact structure:6263```markdown64## <Descriptive title>6566**Approach:** <What we do — the concrete approach taken for this feature.>6768**Why:** <Why this approach — tradeoffs, alternatives rejected, constraints.>69```7071Rules:7273- **Title** is required and descriptive — name the feature and what the section74 covers (e.g. `## Cart checkout flow (multi-step server actions)`), not just75 `## Checkout`.76- **Approach** is required. Describe what we actually do: key files, patterns,77 data flow, contracts. Reference real paths with `file_path` and, where78 useful, `file_path:line_number`.79- **Why** is **optional**. Include it only when there is a real decision or80 tradeoff to capture (an alternative was rejected, a constraint forced the81 choice, a non-obvious pattern was chosen deliberately). If the user did not82 state a rationale and none is evident, omit the `**Why:**` line entirely — do83 not invent one and do not leave a placeholder.8485Keep the contents as concise as possible without losing any context. 8687## Workflow88891. Confirm the change is a feature (not a bugfix/small task) or a meaningful change90 to an existing one. If not, stop and tell the user no docs are needed.912. Identify which topic file(s) the feature touches.923. For each topic file:93 - If it doesn't exist, create it with a top-level `# <Topic>` heading, then94 the new section.95 - If it exists, append the new `##` section at the end. Don't rewrite or96 reorder existing sections.97 - If documenting a meaningful change to an existing feature, update its98 corresponding section without rewriting unrelated entries.994. Write a descriptive title and the **Approach**. Add **Why** only if a real100 rationale exists.1015. Keep entries concise and factual; link to code with paths instead of pasting102 large code blocks.1036. Show the user a summary of which files were created/updated.104105## New topic file template106107When creating a topic file for the first time:108109```markdown110# <Topic name>111112> Documentation of feature-level decisions for <topic>. Each section below113> records one feature: its approach and, where relevant, why.114115## <First feature title>116117**Approach:** ...118```