Skip to content
cognitedata avatar

Integrate File Viewer

Drop-in CogniteFileViewer integration for Flows apps, handling react-pdf install, Vite config, and worker setup.

CCM score
64 of 100
skills.sh installs
1.9K
GitHub stars
6
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers the full wiring path: copy 9 library files into src/cognite-file-viewer/, install react-pdf@^9.1.1, and configure Vite
  • Includes a PDF, image, text, and Office-document preview component with zoom, pan, rotation, and annotation overlay support
  • Enforces a defined container height, and prefers instanceId sources so the diagram annotation overlay is enabled
  • Designed for Cognite Flows apps that need to preview CDF files without hand-wiring react-pdf or file resolution

Install

$ npx -y skills add cognitedata/builder-skills --skill integrate-file-viewer -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Integrate CogniteFileViewer

Add CogniteFileViewer to this Flows app to preview CDF files (PDF, image, text).

Dependencies

The file-viewer library files (copied in Step 2) require this npm package:

PackageVersion
react-pdf^9.1.1

pdfjs-dist ships as a dependency of react-pdf at the correct version — do not install it separately. react and @cognite/sdk are assumed to already be present in Flows apps.


Your job

Complete these steps in order. Read each file before modifying it.


Step 1 — Understand the app

Read these files before touching anything:

  • package.json — detect package manager (packageManager field or lock file) and existing deps
  • vite.config.ts — understand current Vite setup
  • The component where the viewer should be added

Step 2 — Copy the file-viewer source files

The file-viewer library lives in the code/ directory next to this skill file. Read and copy all files from there into src/cognite-file-viewer/ inside the app:

Details

Repository
github.com/cognitedata/builder-skills
Categories
Frontend & UI Code, Office Files & Slides
First seen
Jun 3, 2026

Questions

What does the integrate-file-viewer skill do?

integrate-file-viewer adds CogniteFileViewer to a Flows app so it can preview CDF files such as PDFs, images and text. It handles installing react-pdf, the Vite config, PDF.js worker setup and component usage, so you do not wire up react-pdf or file resolution by hand.

How do I install the integrate-file-viewer skill?

Run npx -y skills add cognitedata/builder-skills --skill integrate-file-viewer -y in your project. Once installed, integrate-file-viewer guides the agent through copying the file-viewer source files and adding the react-pdf dependency.

Which file types can the integrate-file-viewer skill preview?

integrate-file-viewer supports PDFs with page navigation and diagram annotation overlays, Office documents converted to PDF through the CDF Document Preview API, images such as JPEG, PNG and SVG, and plain text files. Other types fall back to an unsupported renderer.

Where does integrate-file-viewer stand in the Frontend and UI Code category?

integrate-file-viewer is listed under Frontend and UI Code on Claude Marketplaces. Skills such as vercel-react-best-practices and web-design-guidelines also appear in that category, and this skill covers CDF file previews rather than general frontend practice.

More from cognitedata/builder-skills

All 25

Similar to Integrate File Viewer

More Frontend & UI Code