Skip to content

Commit 06181bf

Browse files
trangdoan982devin-ai-integration[bot]graphite-app[bot]
authored
[ENG-1502] Create Agent SKILLS to auto-update documentations once a feature is finished (#890)
* create skill * Update skills/update-docs.md Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> * format * address PR comments * update * Update skills/update-user-docs/references/navigation-mapping.md Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * format * Apply suggestion from @graphite-app[bot] Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * Update .gitignore Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> * DRY the contributing.md * remove files --------- Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
1 parent a3b2ef1 commit 06181bf

6 files changed

Lines changed: 240 additions & 9 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ local/*
4040
.cursor/debug.log
4141
apps/tldraw-sync-worker/tsconfig.tsbuildinfo
4242
apps/tldraw-sync-worker/.wrangler/*
43-
.claude/*
43+
.claude/*

CONTRIBUTING.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,11 @@ Blog posts are located in `/apps/website/app/(home)/blog/posts/`
4747

4848
### Plugin Documentation
4949

50-
Plugin documentation is organized in `/apps/website/app/(docs)/docs/` with separate folders:
50+
Detailed guidance for plugin docs lives next to the update-user-docs skill:
5151

52-
- `/obsidian/pages/` - Obsidian plugin documentation
53-
- `/roam/pages/` - Roam Research extension documentation
54-
- `/sharedPages/` - Documentation shared between platforms
55-
56-
1. **Create your documentation file**: Add a new `.md` file in the appropriate platform's `pages/` folder
57-
2. **Use standard Markdown**: No special frontmatter is required for documentation files
58-
3. **Update navigation**: You may need to update the corresponding `navigation.ts` file to include your new page in the sidebar
52+
- **[navigation-mapping.md](./skills/update-user-docs/references/navigation-mapping.md)** — where files live, `docMap.ts` (shared pages), and `navigation.ts` (every new page)
53+
- **[doc-conventions.md](./skills/update-user-docs/references/doc-conventions.md)** — filenames, frontmatter, screenshots, and cross-links
54+
- **[scope-detection.md](./skills/update-user-docs/references/scope-detection.md)** — how changed file paths map to Obsidian vs Roam vs shared docs (useful when unsure where a doc belongs)
5955

6056
### Documentation Images
6157

skills/update-user-docs/SKILL.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: update-user-docs
3+
description: Auto-update user-facing documentation when a feature or behavior change ships. Run when dev invokes manually so they can add the doc to a PR ready-for-review. Optionally pass a PR number for an already-merged PR.
4+
metadata:
5+
argument-hint: "[PR number]"
6+
---
7+
8+
# Update Docs
9+
10+
Auto-update user-facing documentation when a feature or behavior change ships.
11+
If `$ARGUMENTS` is provided, treat it as a GitHub PR number. Use `gh pr view $ARGUMENTS` to get the PR diff, changed files, and description. Use this instead of the current branch context.
12+
13+
If no argument is provided, use the current branch's diff against main, commit messages, and any linked Linear ticket to determine what changed.
14+
15+
## When to Run
16+
17+
On demand. Two modes:
18+
19+
- **Current branch** — Run while on a feature branch that's ready for PR or review.
20+
- **Merged PR** — Pass a PR number to generate docs for an already-merged PR that's missing documentation.
21+
22+
## Step 1: Gather Context
23+
24+
### If running for the current branch
25+
26+
Collect information from three sources:
27+
28+
1. **Changed files** — Run `git diff main...HEAD --name-only` to identify what changed. Use file paths to determine the affected platform (see [scope-detection.md](references/scope-detection.md) for mapping).
29+
2. **Commit messages** — Run `git log main...HEAD --oneline` for a summary of what was done.
30+
3. **Linear ticket** — If a Linear ticket is linked (branch name or PR description), pull the title, description, and acceptance criteria for additional context. Use Linear MCP if available. If it's not available, prompt the dev to install Linear MCP using these instructions: https://linear.app/docs/mcp
31+
32+
### If running for a merged PR
33+
34+
Use the PR number to gather context via `gh`:
35+
36+
1. **PR details** — Run `gh pr view <PR_NUMBER>` to get the title, description, and linked issues.
37+
2. **Changed files** — Run `gh pr diff <PR_NUMBER> --name-only` to identify what changed. Use file paths to determine the affected platform.
38+
3. **Linear ticket** — If a Linear ticket is referenced in the PR title, branch name, or description, pull additional context from it.
39+
40+
## Step 2: Determine If Docs Are Needed
41+
42+
Apply the scope detection heuristic. See [scope-detection.md](references/scope-detection.md) for the full yes/no lists and file path → platform mapping.
43+
44+
If no docs update is needed, inform the dev and stop.
45+
46+
## Step 3: New Page vs Update Existing
47+
48+
1. Search existing documentation for content related to the change. See [doc-conventions.md](references/doc-conventions.md) for file locations.
49+
2. **Ask the dev:** "I found these existing pages that might be related: [list]. Should I update one of these, or create a new page?"
50+
3. Defaults:
51+
- Completely new feature with no existing coverage → new page
52+
- Extending or modifying an already-documented feature → update existing page
53+
54+
## Step 4: Write or Update the Doc
55+
56+
Follow the formatting rules in [doc-conventions.md](references/doc-conventions.md) (frontmatter, filenames, screenshot placeholders, cross-link integrity, side observations).
57+
58+
If a **new page** is created, register it in navigation. See [navigation-mapping.md](references/navigation-mapping.md) for `docMap.ts` and `navigation.ts` patterns and examples.
59+
60+
## Step 5: Verification
61+
62+
1. Present the draft changes to the dev for review.
63+
2. List any screenshot placeholders that need filling.
64+
3. Flag any broken cross-links or stale content observed.
65+
4. **Leave all changes as unstaged modifications** — do not commit. The dev reviews and commits themselves.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Documentation Conventions
2+
3+
## File Locations
4+
5+
Platform-specific docs live in their respective directories:
6+
7+
- **Obsidian:** `apps/website/app/(docs)/docs/obsidian/pages/`
8+
- **Roam:** `apps/website/app/(docs)/docs/roam/pages/`
9+
- **Shared (cross-platform):** `apps/website/app/(docs)/docs/sharedPages/`
10+
11+
Only place docs in `sharedPages/` if the content applies identically to both platforms and is explicitly specified as shared.
12+
13+
## Filename Convention
14+
15+
Use **kebab-case** for all doc filenames (e.g., `creating-discourse-nodes.md`).
16+
17+
## Frontmatter
18+
19+
Every doc file **must** include this frontmatter block:
20+
21+
```yaml
22+
---
23+
title: "Page Title"
24+
date: "YYYY-MM-DD"
25+
author: ""
26+
published: true
27+
---
28+
```
29+
30+
## Screenshot Placeholders
31+
32+
For UI changes or new features with visual elements, insert a placeholder:
33+
34+
```markdown
35+
<!-- TODO: Add screenshot of [describe the UI element or feature] -->
36+
37+
![Screenshot placeholder](placeholder)
38+
```
39+
40+
Always inform the dev that there are screenshot placeholders to fill in.
41+
42+
## Cross-Link Integrity
43+
44+
- When adding or updating cross-links (e.g., `[text](./other-page)`), verify that the target page exists.
45+
- If a link target does not exist, flag it to the dev.
46+
47+
## Side Observations
48+
49+
If while editing an existing doc you notice stale or incorrect content unrelated to the current change, flag it as a side observation to the dev. Do not silently fix unrelated content.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Navigation Mapping
2+
3+
When a **new page** is created, it must be registered in two places: `docMap.ts` (for shared pages) and `navigation.ts` (for all new pages).
4+
5+
## docMap.ts — Slug-to-directory mapping
6+
7+
Maps page slugs to their content directories. Platform-specific pages use the `default` path automatically, so you only need to add entries here for **shared pages**.
8+
9+
### File locations
10+
11+
- Obsidian: `apps/website/app/(docs)/docs/obsidian/docMap.ts`
12+
- Roam: `apps/website/app/(docs)/docs/roam/docMap.ts`
13+
- Shared: `apps/website/app/(docs)/docs/shared/docMap.ts`
14+
15+
### How it works
16+
17+
Each platform's `docMap.ts` spreads in `sharedDocMap` from the shared module. Platform-specific pages resolve via the `default` key.
18+
19+
**Obsidian example:**
20+
21+
```ts
22+
import { DocMapType, sharedDocMap } from "~/(docs)/docs/shared/docMap";
23+
24+
const OBSIDIAN_DOCS = "app/(docs)/docs/obsidian/pages";
25+
26+
export const docMap: DocMapType = {
27+
default: OBSIDIAN_DOCS,
28+
...sharedDocMap,
29+
};
30+
```
31+
32+
**Shared docMap (`apps/website/app/(docs)/docs/shared/docMap.ts`):**
33+
34+
```ts
35+
export const SHARED_DOCS = "app/(docs)/docs/sharedPages";
36+
37+
export const sharedDocMap = {
38+
"what-is-a-discourse-graph": SHARED_DOCS,
39+
"base-grammar": SHARED_DOCS,
40+
"literature-reviewing": SHARED_DOCS,
41+
"research-roadmapping": SHARED_DOCS,
42+
"reading-clubs": SHARED_DOCS,
43+
"lab-notebooks": SHARED_DOCS,
44+
} as const;
45+
```
46+
47+
**When to update:** Only when adding a shared page. Add the slug → `SHARED_DOCS` mapping in `sharedDocMap`.
48+
49+
## navigation.ts — Sidebar navigation
50+
51+
Controls what appears in the docs sidebar. **Must be updated for every new page.**
52+
53+
### File locations
54+
55+
- Obsidian: `apps/website/app/(docs)/docs/obsidian/navigation.ts`
56+
- Roam: `apps/website/app/(docs)/docs/roam/navigation.ts`
57+
58+
### Structure
59+
60+
Navigation is an array of sections, each with a title and links:
61+
62+
```ts
63+
import { NavigationList } from "~/components/Navigation";
64+
65+
const ROOT = "/docs/obsidian";
66+
67+
export const navigation: NavigationList = [
68+
{
69+
title: "🏠 Getting started",
70+
links: [
71+
{ title: "Getting started", href: `${ROOT}/getting-started` },
72+
{ title: "Installation", href: `${ROOT}/installation` },
73+
],
74+
},
75+
{
76+
title: "⚙️ Configuration",
77+
links: [
78+
{ title: "Node types & templates", href: `${ROOT}/node-types-templates` },
79+
{ title: "Relationship types", href: `${ROOT}/relationship-types` },
80+
],
81+
},
82+
// ...more sections
83+
];
84+
```
85+
86+
**To add a new page:** Insert a ``{ title: "Page Title", href: `${ROOT}/slug` }`` entry in the appropriate section's `links` array.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Scope Detection
2+
3+
## Heuristic: "Would a user notice this change?"
4+
5+
Use this question to determine whether a code change requires a documentation update.
6+
7+
## Update docs for
8+
9+
- New user-facing feature
10+
- Changed behavior of an existing feature
11+
- Removed feature
12+
- New, changed, or removed settings/configuration
13+
- Changed setup or prerequisites
14+
- Deprecation of a feature (add a warning note, don't remove content)
15+
16+
## Do NOT update docs for
17+
18+
- Internal refactor with no user-visible change
19+
- Bug fix that restores already-documented behavior
20+
- Test-only changes
21+
- Dev tooling changes (CI, linting, build config)
22+
- Performance optimization with no user-facing behavior change
23+
24+
If no docs update is needed, inform the dev and stop.
25+
26+
## File Path to Platform Mapping
27+
28+
Use changed file paths to determine which platform's docs are affected:
29+
30+
| File path pattern | Platform | Doc directory |
31+
| ----------------- | -------- | --------------------------------------------------------------- |
32+
| `apps/obsidian/` | Obsidian | `apps/website/app/(docs)/docs/obsidian/pages/` |
33+
| `apps/roam/` | Roam | `apps/website/app/(docs)/docs/roam/pages/` |
34+
| `packages/` | Ask dev | Could affect either or both platforms |
35+
| `apps/website/` | Website | Usually not user-facing docs (unless it's the docs site itself) |

0 commit comments

Comments
 (0)