AddThisFeature

Document Import

Turn an uploaded document into editable content instead of a dead attachment.

involved Documents & Files

What it adds

An import path that converts an uploaded word-processor or rich-text document into the app's own editable content.

What your agent is told to do

5
  1. 1

    Start from the app's existing File Upload rather than opening a second route with looser rules. A file that is about to be parsed and rendered back as editable content needs the size ceiling and the malware scan more than an ordinary attachment does, not less.

  2. 2

    Map the imported document onto the content model the app's editor already uses. Anything the editor cannot represent must be dropped deliberately and reported, not smuggled in as raw markup.

  3. 3

    Run parsing as background work with a visible status, because a large document will exceed a request timeout and the user needs to know whether it is working or stuck.

  4. 4

    Show the converted result for review before it becomes a saved record, and let the user cancel without leaving a half-imported draft behind.

  5. 5

    Do not accept the document's own styling wholesale. Inline fonts, colours, and class names from a word processor will fight the app's design and can carry active content.

Edge cases it handles

8
  • Flattening everything to plain text destroys the structure that made the document worth importing. Preserve headings, ordered and unordered lists, tables, and emphasis, and map each to the app's equivalent rather than to approximate visual spacing.
  • Images embedded in the document will be referenced by internal paths that mean nothing once the file is discarded. Extract each one, store it through the app's normal media path with its size and type checks, and rewrite the references.
  • Pasted styles, tracked changes, comments, revision markup, and hidden text will otherwise arrive as visible clutter or invisible payload. Strip markup to an allowlist and decide explicitly whether accepted revisions or the original text is imported.
  • Committing straight to a saved record means a bad conversion overwrites good content with no way back. Show a preview with a clear count of what was converted and what was dropped, and require confirmation.
  • Some files are corrupt, password protected, or simply too large to parse, and a job that hangs forever looks identical to one that is slow. Set a time limit, fail with a specific reason, and keep the original upload available for download.
  • A document containing external links and remote images must not silently fetch from third-party servers when the imported content is later viewed.
  • Very large documents can produce a single record too big for the editor to open. Warn at a threshold and offer to split or truncate rather than creating an unopenable page.
  • The uploaded original should have a stated fate: kept as an attachment, or deleted after successful import. Leaving it in storage indefinitely is a retention decision made by accident.

Definition of done

9
  • Uploading a document produces editable content in the app's existing editor.
  • Headings, lists, tables, and emphasis survive the conversion.
  • Embedded images are extracted, rehosted through the app's media path, and referenced correctly.
  • Incoming markup is reduced to an allowlist, with tracked changes and comments handled explicitly.
  • The user reviews a preview, with dropped content reported, before anything is saved.
  • Unparseable and oversized files time out with a specific message and the original stays downloadable.
  • Import runs in the background with visible status and can be cancelled.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.