Document editor

From vellum-ai/vellum-assistant · View interactive version

Document editor is an AI agent skill from the GitHub repository vellum-ai/vellum-assistant. Use whenever the user wants to write or draft an article, blog post, essay, report, or any long-form content. Creates the content in a rich text editor instead of dumping it in chat, so it can be streamed, reviewed, edited, and exported.

How to use this skill

Skill file

Write and edit long-form documents using the built-in rich text editor. Documents open in workspace mode with chat docked to the side. When a request is about writing prose (an article, blog post, report, essay, story, or similar), create it here rather than writing it into the chat response.

Tools

Creating a new document

This is the default path when the user asks you to write something.

  1. Create the document: Call document_create with a title (inferred from the request). Call the tool immediately, not after conversational preamble. Anything you pass as initial_content is saved right then, so the first document_update must start with the next chunk rather than repeating it.
  2. Write content in Markdown: Use proper structure (# for titles, ## for sections), bold, _italic_, code blocks, tables, lists, blockquotes as appropriate.
  3. CRITICAL - Stream content in chunks: Call document_update MULTIPLE times, not just once. Break content into logical chunks (paragraphs, sections, or every 200-300 words). Call document_update with mode: "append" for EACH chunk separately. Each append carries ONLY that chunk: content already in the document is committed, and resending it would print it twice. When you are streaming into the document you just created, surface_id is optional: omit it and pass only content, and the update targets that document. The user experiences real-time content appearing as you write.

Recovering from a failed update

If a document_update call fails with an Invalid input error, do NOT call document_create again — that produces a duplicate for the user. The most common cause is a missing content field: resend the call with the chunk's Markdown in content. You can omit surface_id to target the document you are currently writing; pass it explicitly only when editing a different existing document.

Editing an existing document

When the user requests changes to a document:

  1. Find the surface_id from the <active_documents> context block.
  2. Use document_update with the existing surface_id — do NOT call document_create again.
  3. Choose the right editing tool:
  1. Do NOT use document_update with mode: "replace" for targeted edits. Rewriting the entire document to change a few words or rearrange sections is wasteful and error-prone.

Retrieving existing documents

When the user asks to see, open, or pull up a document:

  1. Check the <active_documents> block in your context — it lists all documents in this conversation with their surface_id and title.
  2. If the document is NOT in <active_documents>, call document_list with a query matching the document title. For guardian/local users, this searches across previous conversations and sessions.
  3. Once you have the surface_id, call document_open to open the editor panel. This surfaces the editor on the client and returns document metadata (surface_id, title, word_count) — not the full content. If you need the actual document text, follow up with document_read.

Never search the filesystem, conversation history, or archives to find a document. Always use document_list with a query.

If the user says they can't see a document you know exists (e.g. after switching from macOS to web, or after a page refresh), call document_open with the surface_id to re-surface the editor panel on their current client.

Find & Replace

Use document_find and document_replace_text for surgical edits that target specific text patterns without rewriting the entire document.

document_find

Search a document for literal text or regex patterns. Parameters:

Returns a list of matches with line numbers, line content, match positions, and matched text. Use this to preview what will be affected before making replacements.

document_replace_text

Targeted find-and-replace within a document. Parameters:

Returns the number of replacements made and whether the content changed.

Workflow

  1. Call document_find to preview matches and confirm the pattern is correct.
  2. Call document_replace_text to apply the changes.

Examples:

Comments

Users can leave inline comments on documents. Open comments are surfaced in a <document_comments> context block so you can see pending feedback.

Addressing comments workflow

  1. Read the <document_comments> block or call comment_list to see open comments.
  2. For each comment, edit the document to address the feedback.
  3. Call comment_resolve on comments you have addressed.
  4. If a comment is ambiguous, call comment_reply to ask for clarification instead of guessing.

Anti-Patterns

Usage Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.