graph-viewer
Skill6 starsChanged 8 days agoApache-2.0View on GitHub
Integrate the reusable CDF graph viewer (useGraphViewer) into a Flows app by copying the local code bundle. Use when embedding a graph visualization, adding a knowledge graph, or showing CDF data model relationships and instances.
- Installs packages
In this repository34 other files it gives its agents.
- aura-reviewSkill
- call-cognite-functionSkill
- code-qualitySkill
- connect-atlas-mcpSkill
- correctness-and-error-handlingSkill
- create-agentSkill
- create-client-toolSkill
- dependencies-auditSkill
- designSkill
- dm-graph-traversalSkill
- dm-limits-and-best-practicesSkill
- flows-app-briefSkill
- flows-code-reviewSkill
- flows-design-reviewSkill
- flows-external-app-submitSkill
- flows-review-checksSkill
- handle-startup-stateSkill
- hide-show-shellSkill
- integrate-atlas-chatSkill
- integrate-file-viewerSkill
- integrate-fusion-agentSkill
- integrate-todo-listSkill
- migrate-app-to-flowsSkill
- performanceSkill
- pull-changes-resolve-conflictsSkill
- reveal-3dSkill
- securitySkill
- setup-flows-authSkill
- setup-python-toolsSkill
- skill-creatorSkill
- start-flows-appSkill
- test-coverageSkill
- tygenSkill
- use-topbarSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Do not use this skill for static diagrams, pure dataflow visualizations, or non-CDF graphs.
- Distinctive: line 22
Follow these steps in order.
- Very specific: line 24
Inspect the target app: Read package.json and look at the existing folder structure (e.g.
- Distinctive: line 32
If the repo already has a different feature/components layout or alias, mirror it.
- Very specific: line 84
Only declare coreReverseQueries for relations the app must surface.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Graph Viewer
Use This When
The user wants to embed an interactive graph of a CDF data model — nodes, direct relations, edges, and reverse relations — inside a Flows app.
Do not use this skill for static diagrams, pure dataflow visualizations, or non-CDF graphs.
Prerequisites
- The app is wrapped in
@cognite/dune's<DuneProvider>souseDune()returns an authenticated SDK. - The target data model exists in CDF and you know its
space,externalId, andversion. - The app uses React 18+ and TypeScript.
Integration Workflow
Follow these steps in order. Adapt to the target repo's conventions instead of inventing new ones.
- Inspect the target app. Read
package.jsonand look at the existing folder structure (e.g.src/features/*,src/components/*, path aliases like@/*). - Install missing dependencies with the app's package manager (
npm,pnpm,yarn, …). See the Dependencies table below for purposes and suggested versions. Reuse the React version already pinned by the app rather than upgrading it, and prefer any versions the repo already pins over the suggestions here. Copy the bundle into the app. Copy every file from
skills/graph-viewer/code/into an app-local feature folder, for example:src/features/graph-viewer/If the repo already has a different feature/components layout or alias, mirror it.
Import from the local folder, never from
@skills/.... With a typical@/*alias:import { useGraphViewer } from "@/features/graph-viewer";- Render
GraphCanvasinside a container with explicit dimensions (height is required — see the minimal example below). - Run typecheck and build (
tsc --noEmit,npm run build, etc.) and fix any path or type issues introduced by the copy.
Minimal Example
import { useGraphViewer } from "@/features/graph-viewer";
export function GraphPanel() {
const { GraphCanvas, isLoading, error } = useGraphViewer({
dataModel: { space: "my-space", externalId: "my-data-model", version: "1" },
instance: { space: "my-instance-space", externalId: "pump-001" },
});
if (isLoading) return <div>Loading graph…</div>;
if (error) return <div>Error: {error}</div>;
return <GraphCanvas className="h-[600px] w-full" />;
}Dependencies
Suggested versions reflect the latest published majors at the time of writing. They are starting points — if the target app already pins different versions, defer to the app.
| Package | Suggested version | Purpose |
react | ^18.2.0 | UI framework (peer; reuse the app's version) |
@cognite/sdk | ^10.10.0 | CDF API client (instances, data models) |
@cognite/dune | ^2.1.0 | Provides the authenticated SDK via useDune() |
reagraph | ^4.30.8 | WebGL graph rendering engine |
lucide-react | ^1.14.0 | Icon set used by the node-type legend |
Example install (npm; adapt to the app's package manager):
npm install @cognite/sdk@^10.10.0 @cognite/dune@^2.1.0 reagraph@^4.30.8 lucide-react@^1.14.0CDF Cost & Performance
Graph expansion can issue many CDF requests, especially with reverse relations. For large or unfamiliar data models, be conservative:
- Set
whitelistedRelationPropsto the few properties the app actually needs to traverse. - Lower
initialConnectionLimit(it is a hard maximum of connections fetched per expansion). - Lower
maxNodesto bound the in-memory LRU buffer. - Only declare
coreReverseQueriesfor relations the app must surface; each entry adds an extra query per expansion.
Tuples in coreReverseQueries are version-aware:
[space, viewExternalId, viewVersion, propertyName, isList].
Advanced Reference
For full configuration tables, return-value docs, layouts, theming, and richer examples, read code/README.md.
For implementation details, inspect the source files under code/.
Verification Checklist
- The app is wrapped in
<DuneProvider>. - All files from
skills/graph-viewer/code/were copied into an app-local folder. - Imports point to the app-local folder (e.g.
@/features/graph-viewer), not@skills/.... @cognite/dune,@cognite/sdk,reagraph, andlucide-reactare present inpackage.json.- The container that renders
<GraphCanvas>has an explicit height. tsc --noEmitand the app's build both pass.- No references to
dune-industrial-componentswere introduced.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

