cognitedata avatar

Integrate File Viewer

Drops a production-ready CogniteFileViewer component into Flows apps with zero manual wiring. Handles PDFs (with page nav and zoom), images, Office docs (via CDF's conversion API), and text files. The real value is in what you don't have to touch: it configures the PDF.js worker, sets up Vite's optimizeDeps exclusion, and wires react-pdf at the correct version without you hunting down compatibility issues. Diagram annotations work automatically if you pass instanceId sources instead of raw file IDs. The skill copies eight library files into your project and walks through Vite config, dependency install, and component usage. Saves an hour of PDF viewer debugging.

skills.sh installs
1.9K
GitHub stars
6
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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:

Sponsors

Details

Repository
github.com/cognitedata/builder-skills
Categories
Frontend Development, Backend & APIs, Office & Documents
First seen
Jun 3, 2026

More from cognitedata/builder-skills

All 26
1buildgreatproducts avatardesign-systembuildgreatproducts/builder-osTranslates an image (or a set of image references — screenshots, mockups, Figma URLs, live websites) into two mirrored design-system artifacts: `docs/design.md`1.9Kskills.sh installs
2tanstack-skills avatartanstack-storetanstack-skills/tanstack-skillsFramework-agnostic, immutable reactive data store with framework adapters for React, Vue, Solid, Angular, and Svelte.1.8Kskills.sh installs
3jezweb avatarresponsiveness-checkjezweb/claude-skillsTest website responsiveness across viewport widths using browser automation. Resizes a single session through breakpoints, screenshots each width, and detects l1.8Kskills.sh installs
4mblode avatarmulti-tenant-architecturemblode/agent-skillsProvides architecture guidance for multi-tenant SaaS platforms on Cloudflare or Vercel. Covers platform choice, domain strategy, tenant identification and isola1.8Kskills.sh installs
5tencentcloudbase avatarweb-developmenttencentcloudbase/skillsUse when users need to implement, integrate, debug, build, deploy, or validate a Web frontend after the product direction is already clear, especially for React1.8Kskills.sh installs
6civitai avatarquick-mockupscivitai/civitaiCreate multiple UI design mockups in parallel. Use when asked to create mockups, wireframes, or design variations for a feature. Creates HTML files using Mantin1.7Kskills.sh installs