--- name: write-docs description: "Write or update documentation for the Inkeep docs site (agents-docs package). Use when: creating new docs, modifying existing docs, introducing features that need documentation, touching MDX files in agents-docs/content/. Triggers on: docs, documentation, MDX, agents-docs, write docs, update docs, add page, new tutorial, API reference, integration guide." argument-hint: "[page-type] [topic] (e.g., 'tutorial MCP servers' or 'reference model config')" --- # Write Docs Create clear, consistent documentation for the Inkeep docs site following established patterns and structure. --- ## Use when - Any customer-facing feature, API, SDK, CLI, UI, config, or behavior change needs documenting - Creating or updating pages in `agents-docs/content/`, snippets, or public-facing READMEs or reference artifacts (like .env.example files) - Restructuring or reorganizing docs (moves, renames, redirects) ## Do NOT use when - Writing code comments or inline documentation (not MDX docs) - Working on internal-only changes with no customer-facing surface area - Updating internal tooling docs (e.g. `AGENTS.md`, `.agents/skills/`, `.agents/rules/`, `CONTRIBUTING.md`, `.github/workflows/`) --- ## Philosophy **Every feature must be documented fully** across all surfaces: how it's used, interacted with, depended on, or perceived by end-users. Documentation is the audited source of truth for the product. - **Every Surface Area Needs Documentation**: Anything that an engineering change touches that involves a customer-facing change in any product surface area[s] need to be documented. - **Keep docs current**: Documentation is a living artifact. When code changes, existing docs must be updated in the same change. Stale docs are misleading docs. - **Accuracy over speed**: Incorrect documentation erodes trust faster than missing documentation. Cross-reference source code to verify that types, parameter names, and described behavior match the actual implementation. - **Consistency**: Use the same terminology, structure, and formatting patterns across all docs. If we call it a "project" in one place, don't call it a "workspace" in another. - **For the right audience**: Tailor voice, depth, and framing to who will read the page. A developer integrating an SDK needs different context than an admin configuring a project. - **Good information architecture**: The right audiences find the right content. - **Clarity over assumption**: Don't assume prior knowledge. Be explicit about prerequisites and context. - **Direct and practical**: Get to the point. Documentation exists to help users accomplish goals, not to showcase everything we know. - **Progressive disclosure**: Build up concepts before diving into details. - **Scoped and targeted**: Each doc has a clear outcome. Provide the context needed—nothing more, nothing less. - **Right detail, right place**: Avoid duplication. If something is explained elsewhere, link to it or reuse it in some way as appropriate. --- ## Workflow 1. **Understand context** - Fully map out the scope of what needs to be changed. **Consider all procuct surface areas plausibly affected**, and identify existing documentation or documentation sections that may need updating or new articles. 2. **Identify documentation type** — Determine if this is reference, tutorial, integration, or overview content (see Step 1) 3. **Write frontmatter** — Add required `title` and optional fields like `sidebarTitle`, `description`, `keywords` (see Step 2) 4. **Structure content** — Use the appropriate pattern template for your doc type (see Step 3) 5. **Use components correctly** — Apply ``, ``, ``, callouts as needed (see Step 4) 6. **Write code examples** — Ensure examples are runnable with language tags and realistic values (see Step 5) 7. **Handle navigation** — Update `meta.json` if needed; add redirects for moves/renames (see File Organization) 8. **Verify** — Check against the verification checklist before completing ## Step 0: Identify Relevant Surface Areas Before writing anything, map out which surface areas the change touches. Review the engineering or product changes (staged files, PR diff, or task description) and ask: 1. **What changed?** — Identify the modified packages, APIs, schemas, or UI components 2. **Who is affected?** — Determine which user-facing surfaces consume or expose this change. For example (not exhaustive!): - SDK/CLI users (types, builder APIs, commands) - Dashboard users (UI forms, views, workflows) - API consumers (endpoints, request/response shapes, streaming formats) - Widget/chat users (runtime behavior, rendering) - Self-hosting users (env vars, deployment config) 3. **What docs already exist?** — Search `agents-docs/content/` for pages that reference the affected feature; these may need updates 4. **What's new vs. changed?** — New surface areas need new pages; changed behavior needs existing page updates If a change touches multiple surface areas, create or update a doc for each. Don't bundle unrelated surfaces into one page unless it's a natural fit with the existing document or similar analogous docs. --- ## Step 1: Identify Documentation Type | Pattern | When to use | Focus | Title style | |---------|-------------|-------|-------------| | **Overview** | Conceptual explanation ("what is X?") | Mental models, "why", terminology, key definitions, relationships | Noun | | **Reference** | New SDK feature, API, or configuration options | Exhaustive, scannable, precise specs | Noun | | **Tutorial** | Step-by-step instructions to accomplish something | Goal-oriented, sequential, minimal tangents | Verb | | **Integration** | Connecting a third-party service | Installation-focused, platform-aware | Verb | --- ## Step 2: Write Frontmatter Every `.mdx` file **must** have frontmatter with at least a `title`. ### Required ```yaml --- title: Full Descriptive Title with Context --- ``` ### Optional (add when relevant) ```yaml --- title: Add Chat Button to Next.js sidebarTitle: Chat Button description: Integrate Inkeep's chat button into your Next.js application. icon: LuMessageSquare keywords: Next.js integration, chat button, React --- ``` ### When to add each field | Field | Add when | |-------|----------| | `sidebarTitle` | Title is long/sentence-like, or breadcrumb provides context so sidebar can be short | | `description` | Page is important for SEO or is a top-level entry point | | `keywords` | Page targets common search intents ("authentication", "vercel", "docker") | | `icon` | Landing/overview page or frequently linked in cards | ### Title rules - Sentence case: capitalize first word + proper nouns (e.g., "Deploy to Vercel") - Use breadcrumb context—don't repeat the section name in the title - Include the action for how-to content: "Configure authentication" not "Authentication" - Use **verbs/phrases** for task pages; **nouns** for references/concepts ### SidebarTitle rules - 1-3 words when possible - Leverage parent context (don't repeat parent name) - Action words for how-to content: "Install", "Configure", "Setup" ### Examples ✅ **Good: descriptive title + short sidebarTitle** ```yaml --- title: Live Debugger, Traces, and OTEL Telemetry sidebarTitle: Traces --- ``` ❌ **Avoid: redundant title repeating breadcrumb** ```yaml --- # Breadcrumb already includes "TypeScript SDK" title: TypeScript SDK Model Configuration --- ``` ❌ **Avoid: sidebarTitle repeating parent context** ```yaml # Parent folder: "Slack Integration" title: Set up Inkeep in Slack sidebarTitle: Set up Inkeep in Slack # BAD ``` ✅ **Good: context-aware sidebarTitle** ```yaml # Parent folder: "Slack Integration" title: Set up Inkeep in Slack sidebarTitle: Installation # Parent provides context ``` --- ## Step 3: Structure Content These templates are **examples**. Mix and match as appropriate for your use case. ### Reference Pattern (APIs, SDKs, Configuration) ```markdown # Feature Name Brief one-sentence description of what this feature does. ## Quick Start (recommended) Minimal working example (< 10 lines). ## Parameters / Options (recommended) | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `apiKey` | string | Yes | Your API key | ## Examples ### Basic Usage [code example] ### Advanced Usage [code example with options] ## Related - [Link to related feature] ``` ### Tutorial Pattern (How-to Guides) ```markdown # How to [Accomplish Task] Brief description of what you'll build/achieve. ## Prerequisites - Requirement 1 - Requirement 2 ## Steps ### Step Title Explanation and code. ### Next Step More explanation. ## What's Next - [Link to next tutorial] - [Link to reference docs] ``` ### Integration Pattern (Third-party Services) ```markdown # [Service Name] Integration Brief description of what this integration enables. ## Prerequisites - Service account - API key from service ## Installation Install the package ```bash pnpm add @inkeep/[package] ``` Configure credentials [code] ## Configuration Options | Option | Description | Default | |--------|-------------|---------| | `option1` | What it does | `value` | ## Platform-Specific Notes [Next.js specific instructions] [Node.js specific instructions] ``` ### Overview Pattern (Conceptual Docs) ```markdown # [Concept Name] Opening paragraph explaining what this is and why it matters. ## Key Features - Feature 1: Brief explanation - Feature 2: Brief explanation ## How It Works Conceptual explanation, optionally with diagram. ## Use Cases When to use this: - Use case 1 - Use case 2 ## Getting Started Get up and running in 5 minutes Detailed API documentation ``` --- ## Step 4: Use Components Correctly ### Component Selection ``` What are you presenting? │ ├─ Multiple code variants (languages, frameworks)? │ └─ Use │ ├─ Sequential instructions? │ └─ Use │ ├─ Navigation to other docs? │ └─ Use │ ├─ Content that's helpful but not essential? │ └─ Use │ ├─ Important callout? │ ├─ Helpful tip → │ ├─ Important note → │ └─ Critical warning → │ └─ Regular content └─ Use plain markdown ``` ### Component Syntax Reference **Tabs** (multi-language/multi-framework): ````mdx ```typescript const config = { apiKey: 'key' }; ``` ```javascript const config = { apiKey: 'key' }; ``` ```` **Steps** (sequential instructions): ```mdx First step with explanation Second step ``` **Cards** (navigation): ```mdx Brief description ``` **Callouts** (important information): ```mdx Helpful best practice Important information Critical warning - user might break something ``` **Accordions** (collapsible detail): ```mdx Detailed content here ``` ### Additional Global Components These are registered for all docs pages (no `import` needed): | Component | Use for | |-----------|---------| | `...` | Consistent image styling (full-width + rounded) | | `