PluginWorks in Claude CodeCurrent
Fiftyone
Build high-quality datasets and computer vision models. Visualize datasets, analyze models, find duplicates, run inference, evaluate predictions, and develop custom plugins.
0
Try it
See what this would do for you. No sign-up needed.
Install in Claude Code
Run these in Claude Code, in order. The first adds the marketplace, the second installs the plugin.
Step 1
/plugin marketplace add anthropics/claude-plugins-official
Step 2
/plugin install fiftyone@claude-plugins-official
Review commands before running them. Promptu never runs code on your machine or pushes changes to your repo.
What's inside
18 skills
- fiftyone-app-playwright
- fiftyone-code-style
- fiftyone-create-notebook
- fiftyone-dataset-curation
- fiftyone-dataset-export
- fiftyone-dataset-import
- fiftyone-dataset-inference
- fiftyone-develop-plugin
- fiftyone-embeddings-visualization
- fiftyone-eval-plugin
- fiftyone-find-duplicates
- fiftyone-generate-data-lens-connector
- fiftyone-issue-triage
- fiftyone-model-evaluation
- fiftyone-sdk-guidance
- fiftyone-troubleshoot
- fiftyone-voodo-design
- fiftyone-zoo-remote-model
2 commands
- help
- quickstart
1 MCP server
Security scan
Flagged
Promptu's text scan flagged something in this plugin. Read its files before you install it.
pipe-to-shell in README.md:72; eval in skills/fiftyone-eval-plugin/SKILL.md:103; rm-rf in skills/fiftyone-troubleshoot/SKILL.md:317
Details
# FiftyOne Skills
<div align="center">
<p align="center">
<!-- prettier-ignore -->
<img src="https://user-images.githubusercontent.com/25985824/106288517-2422e000-6216-11eb-871d-26ad2e7b1e59.png" height="55px">
<img src="https://user-images.githubusercontent.com/25985824/106288518-24bb7680-6216-11eb-8f10-60052c519586.png" height="50px">
</p>
**Expert workflows for computer vision powered by AI assistants**
[](LICENSE)
[](https://github.com/voxel51/fiftyone)
[](https://github.com/voxel51/fiftyone-mcp-server)
[](https://github.com/voxel51/fiftyone-skills/actions/workflows/validate.yml)
[](https://discord.gg/fiftyone-community)
[](https://huggingface.co/Voxel51)
[](https://voxel51.com/blog)
[](https://share.hsforms.com/1zpJ60ggaQtOoVeBqIZdaaA2ykyk)
[](https://www.linkedin.com/company/voxel51)
[](https://x.com/voxel51)
[](https://medium.com/voxel51)
[Documentation](https://docs.voxel51.com) · [MCP Server](https://github.com/voxel51/fiftyone-mcp-server) · [FiftyOne Plugins](https://github.com/voxel51/fiftyone-plugins) · [Discord](https://discord.gg/fiftyone-community)
</div>
## What are Skills?
Skills are packaged workflows that teach AI assistants to perform complex computer vision tasks autonomously. Combined with the [FiftyOne MCP Server](https://github.com/voxel51/fiftyone-mcp-server), you can find duplicates, run inference, and explore datasets using natural language.
```
"Find and remove duplicate images from my dataset"
"Import this COCO dataset and run object detection"
"Visualize my embeddings and identify outliers"
```
Skills bridge the gap between natural language and FiftyOne's 80+ operators, providing step-by-step guidance that AI assistants follow to complete complex workflows.
## Available Skills
| Skill | Description | MCP |
|-------|-------------|-----|
| 📥 [**Dataset Import**](skills/fiftyone-dataset-import/SKILL.md) | Universal import for all media types, label formats, multimodal groups, MCAP recordings, LeRobot robot-learning episodes, and Hugging Face Hub | Yes |
| 📤 [**Dataset Export**](skills/fiftyone-dataset-export/SKILL.md) | Export datasets to COCO, YOLO, VOC, CVAT, CSV, Hugging Face Hub, and more | Yes |
| 🔍 [**Find Duplicates**](skills/fiftyone-find-duplicates/SKILL.md) | Find and remove duplicate images using brain similarity | Yes |
| 🤖 [**Dataset Inference**](skills/fiftyone-dataset-inference/SKILL.md) | Run Zoo models for detection, classification, segmentation, embeddings | Yes |
| 📈 [**Model Evaluation**](skills/fiftyone-model-evaluation/SKILL.md) | Compute mAP, precision, recall, confusion matrices, analyze TP/FP/FN | Yes |
| 📊 [**Embeddings Visualization**](skills/fiftyone-embeddings-visualization/SKILL.md) | Visualize datasets in 2D, find clusters, identify outliers | Yes |
| 🔌 [**Develop Plugin**](skills/fiftyone-develop-plugin/SKILL.md) | Create custom FiftyOne plugins (operators and panels) | — |
| 🎨 [**VOODO Design**](skills/fiftyone-voodo-design/SKILL.md) | Build UIs with VOODO React components and design tokens | — |
| 📝 [**Code Style**](skills/fiftyone-code-style/SKILL.md) | Write Python code following FiftyOne's official conventions | — |
| 📓 [**Create Notebook**](skills/fiftyone-create-notebook/SKILL.md) | Create Jupyter notebooks: getting-started guides, tutorials, recipes, ML pipelines | — |
| 🏷️ [**Issue Triage**](skills/fiftyone-issue-triage/SKILL.md) | Triage GitHub issues: validate status, categorize, generate responses | — |
| 🧹 [**Dataset Curation**](skills/fiftyone-dataset-curation/SKILL.md) | End-to-end curation: quality checks, annotation audit, duplicates, class distribution, splits | Yes |
| 🔧 [**Troubleshoot**](skills/fiftyone-troubleshoot/SKILL.md) | Fix common issues: dataset persistence, App connection, MongoDB errors, codecs, performance | — |
| 🛡️ [**Eval Plugin**](skills/fiftyone-eval-plugin/SKILL.md) | Evaluate plugins for quality, security, and agent-readiness. Produces a structured report | — |
| 🧩 [**Zoo Remote Model**](skills/fiftyone-zoo-remote-model/SKILL.md) | Build remote model zoo integrations that work with `register_zoo_model_source` and `dataset.apply_model` | — |
| 🔌 [**Generate Data Lens Connector**](skills/fiftyone-generate-data-lens-connector/SKILL.md) | Generate a Data Lens connector from an external database schema (PostgreSQL, BigQuery, MySQL, etc.) | — |
| 🎭 [**App Playwright**](skills/fiftyone-app-playwright/SKILL.md) | Drive the FiftyOne App via the Playwright MCP for operator/plugin verification, demos, and end-to-end UI automation | — |
| 📚 [**SDK Guidance**](skills/fiftyone-sdk-guidance/SKILL.md) | Answer FiftyOne SDK and docs questions with live documentation search, or provide the SDK path when no operator exists | — |
## Quick Start
### Step 1: Install Skills
**Universal Installer** (Recommended):
```bash
curl -sL skil.sh | sh -s -- voxel51/fiftyone-skills
```
Interactive prompts let you select skills, agents, and install scope (project or global).
Supported agents: Claude Code, Cursor, Codex, OpenCode, GitHub Copilot, Amp, Antigravity, Roo Code, Kilo Code, Goose
**Claude Code:**
```bash
# Register the skills marketplace
/plugin marketplace add voxel51/fiftyone-skills
# Install a skill
/plugin install fiftyone-find-duplicates@fiftyone-skills
```
**Gemini CLI:**
```bash
gemini extensions install https://github.com/voxel51/fiftyone-skills.git --consent
```
### Step 2: Use It
```
"Write a FiftyOne plugin that displays model confidence"
"Write Python code following FiftyOne conventions"
```
Your AI assistant will automatically load the skill instructions and execute the workflow.
### Step 3: Set Up MCP Server (Optional)
Skills marked with **MCP** in the [table above](#available-skills) require the [FiftyOne MCP Server](https://github.com/voxel51/fiftyone-mcp-server) to interact with datasets and run operators.
```bash
pip install fiftyone-mcp-server
```
> **⚠️ Important:** Make sure to use the same Python environment where you installed the MCP server when configuring your AI tool. If you installed it in a virtual environment or conda environment, you must activate that environment or specify the full path to the executable.
Then configure your AI tool:
<details>
<summary><b>Claude Code</b> (Recommended)</summary>
```bash
claude mcp add fiftyone -- fiftyone-mcp
```
</details>
<details>
<summary><b>Claude Desktop</b></summary>
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
```json
{
"mcpServers": {
"fiftyone": {
"command": "fiftyone-mcp"
}
}
}
```
</details>
<details>
<summary><b>Cursor</b></summary>
[](cursor://anysphere.cursor-deeplink/mcp/install?name=fiftyone&config=eyJjb21tYW5kIjoiZmlmdHlvbmUtbWNwIn0)
Add to `~/.cursor/mcp.json`:
```json
{
"mcpServers": {
"fiftyone": {
"command": "fiftyone-mcp"
}
}
}
```
</details>
<details>
<summary><b>VSCode</b></summary>
[](https://insiders.vscode.dev/redirect/mcp/install?name=fiftyone&config=%7B%22command%22%3A%22fiftyone-mcp%22%7D)
Add to `.vscode/mcp.json`:
```json
{
"servers": {
"fiftyone": {
"command": "fiftyone-mcp"
}
}
}
```
</details>
Once configured, you can use MCP-dependent skills:
```
"Find and remove duplicate images from my dataset"
"Import this COCO dataset and run object detection"
```
## Skill Structure
Each skill follows the [Agent Skills](https://agentskills.io) specification:
```
skills/
└── fiftyone-find-duplicates/
└── SKILL.md # Instructions for AI
```
**SKILL.md format:**
```markdown
---
name: skill-name
description: When to use this skill
---
# Overview
What this skill does
# Prerequisites
Required setup
# Key Directives
ALWAYS/NEVER rules for AI
# Workflow
Step-by-step instructions
# Troubleshooting
Common errors and solutions
```
## Contributing
We welcome contributions! Whether you want to add a new skill, improve an existing one, or help with integrations and tooling — there's a place for you here.
See **[CONTRIBUTING.md](CONTRIBUTING.md)** for the full guide, including skill structure requirements, the quality bar, and how to test your skill before submitting.
Looking for ideas? Browse issues labeled [`help wanted`](https://github.com/voxel51/fiftyone-skills/labels/help%20wanted) or [`good first issue`](https://github.com/voxel51/fiftyone-skills/labels/good%20first%20issue), or check the [project milestones](https://github.com/voxel51/fiftyone-skills/milestones) for planned work.
## Feedback
Help us improve FiftyOne Skills!
**Just ask your AI assistant:**
```
"Help me submit feedback about [your issue]"
```
The agent will automatically gather session context, environment info, and can submit directly via `gh` CLI or generate content to paste at **[Submit Feedback](https://github.com/voxel51/fiftyone-skills/issues/new?template=skill-feedback.yml)**
## Resources
| Resource | Description |
|----------|-------------|
| [FiftyOne Docs](https://docs.voxel51.com) | Official documentation |
| [FiftyOne MCP Server](https://github.com/voxel51/fiftyone-mcp-server) | MCP server for AI integration |
| [FiftyOne Plugins](https://github.com/voxel51/fiftyone-plugins) | Official plugin collection |
| [Agent Skills Spec](https://agentskills.io) | Skills format specification |
| [PyPI Package](https://pypi.org/project/fiftyone-mcp-server/) | MCP server on PyPI |
| [Discord Community](https://discord.gg/fiftyone-community) | Get help and share ideas |
## 🧡 Community
Join the FiftyOne community to get help, share your skills, and connect with other users:
- **Discord**: [FiftyOne Community](https://discord.gg/fiftyone-community)
- **GitHub Issues**: [Report bugs or request features](https://github.com/voxel51/fiftyone-skills/issues)
---
<div align="center">
Copyright 2017-2026, Voxel51, Inc. · [Apache 2.0 License](LICENSE)
</div>
## skills/fiftyone-app-playwright/SKILL.md
---
name: fiftyone-app-playwright
description: >
Use when driving the FiftyOne App via the Playwright MCP — plugin/operator verification,
demo or screencast recording, or any end-to-end UI automation against `fo.launch_app(...)`.
Covers the critical "do not navigate after reload_dataset" crash, launcher patterns
(remote=True, trigger-file IPC), MUI-specific input/dropdown gotchas, sidebar tag filtering,
`data-cy` selectors, dialog scrolling, session refresh strategies, and cleanup. Trigger on
mentions of "Playwright + FiftyOne", "automate FiftyOne App", "operator demo", "browser_navigate
crash", "reload_dataset", or any FiftyOne session that silently dies after a UI action.
compatibility: Requires the Playwright MCP server and a Python environment with `fiftyone` installed (drives a live `fo.launch_app(...)` session).
---
# FiftyOne + Playwright Automation
Session notes for driving the FiftyOne App via the Playwright MCP. The App is a React/MUI SPA backed by a Python `session` over a WebSocket — most pitfalls come from that lifecycle.
---
## 1. The #1 Rule: Never `browser_navigate` or `location.reload()` after an operator that calls `ctx.ops.reload_dataset()`
**Symptom.** The FiftyOne server dies silently (`curl localhost:5151` → HTTP 000; `ps` shows no PID). Dataset on disk is fine — the crash is session-layer. `nohup`/`disown` do NOT prevent it; the trigger is inside FiftyOne's own loop.
**Cause.** The navigate closes the active WebSocket while the remote session is mid-reload; `session.wait()` exits.
**Fixes — ranked by cost.**
### A. `session.refresh()` via trigger-file IPC (best)
Neither `session.refresh()` nor `dataset.reload()` closes the WebSocket. They require a live handle, so replace `session.wait()` with a watcher loop. The bundled [`scripts/launch_app.py`](scripts/launch_app.py) implements exactly this — clone a source dataset, launch `remote=True`, then poll a trigger file and `reload()` + `refresh()` whenever it appears:
```bash
nohup python scripts/launch_app.py \
--source quickstart --clone verify_clone --port 5151 \
> /tmp/fo_app.log 2>&1 &
```
The crux of the loop (see the script for the full version, including a guard that refuses to overwrite a *persistent* dataset sharing the clone name):
```python
while True:
if os.path.exists(TRIGGER):
os.remove(TRIGGER)
clone.reload() # refresh this process's view of MongoDB
session.refresh() # push refresh event over existing WebSocket
time.sleep(0.5)
```
Automation side: `touch /tmp/fo_refresh.trigger` (the script's default `--trigger` path). Refresh lands in ~0.5 s, no UI round-trip. Extend `watch()` in the script for other side effects (mutate samples, create views, etc.). More robust IPC variants: Unix socket / named pipe, Jupyter kernel, or `python -i` with the session kept in a background shell.
### B. "Reload the dataset" built-in operator via the backtick palette (no launcher changes)
```javascript
// 1. Open palette
await page.keyboard.press('`');
// 2. Search (use the React-controlled-input pattern below)
const sb = document.querySelector('input[placeholder="Search operations by name..."]');
setter.call(sb, 'reload the dataset');
sb.dispatchEvent(new Event('input', { bubbles: true }));
// 3. browser_click the "Reload the dataset" result
```
Slower (~2 s) but zero Python-side plumbing. Note: `Reload samples from the dataset` is a **different, weaker** operator — it does NOT refresh the sidebar tag index.
### Why not a sibling-process `dataset.reload()`?
`python -c "fo.load_dataset('clone').reload()"` only refreshes *that process's* copy. The launcher's `session` and the browser WebSocket are untouched. You still need `session.refresh()` on the launcher — back to option A.
---
## 2. Launcher patterns
- **Always `remote=True`.** Prevents a duplicate OS-browser tab on every navigate; launch Playwright and connect to `http://localhost:5151` separately.
- **Non-persistent clones with a pre-delete guard** (the bundled launcher does this). They do NOT auto-delete on ungraceful crash — they linger in MongoDB until the next run's guard removes them.
- Run detached: `nohup python scripts/launch_app.py --source <dataset> --clone <clone-name> --port 5151 > /tmp/fo_app.log 2>&1 &`. (`nohup` doesn't prevent the rule-1 crash; it just insulates from shell signal noise.)
- **Health check between phases:** `curl -s -o /dev/null -w "%{http_code}" localhost:5151` + `ps -p $PID` — detect silent crashes early.
- **Always `remote=True`**: Prevents a duplicate OS-browser tab on every navigate; drive the App through the Playwright MCP browser at `http://localhost:5151`.
- **If no window opens by itself tell the user where to watch**: After the health check passes, report the App URL so the user can open it in their own browser as a passive viewer (watch, don't click, while automation is running). Whether the Playwright MCP browser itself is visible is fixed at MCP-server startup (`@playwright/mcp` is headed unless started with `--headless`, default configuration is for 'headed' mode) — the skill works either way; don't attempt to change it mid-session.
---
## 3. MUI / React gotchas
### React-controlled inputs
`input.value = "foo"` does **not** update React state. The UI shows it briefly then reverts; `dynamic=True` forms won't re-evaluate. Use the native prototype setter:
```javascript
const setter = Object.getOwnPropertyDescriptor(
window.HTMLInputElement.prototype, 'value'
).set;
setter.call(inputEl, newValue);
inputEl.dispatchEvent(new Event('input', { bubbles: true }));
```
Applies to every text / number / textbox field in operator forms.
### MUI dropdowns (combobox, not `<select>`)
FiftyOne uses `<div role="combobox">`. `browser_select_option` fails with "Element is not a `<select>`". Options only exist in the DOM while the listbox is open.
```
1. browser_click on the combobox (ref from a FRESH snapshot)
2. Wait ~1s for the listbox to mount
3. browser_evaluate:
Array.from(document.querySelectorAll('[role="option"]'))
.find(o => o.textContent.includes('Target label'))
.click()
```
Use real `browser_click` (not a synthesized `.click()`) to OPEN the popover — MUI's state machine doesn't always accept synthesized events for that.
### Synthesized clicks
Most elements respond to `.click()`. For **SVG icons, MUI chip close buttons, some option rows**, dispatch a real MouseEvent:
```javascript
el.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }));
// Or for chips / drag handles: mousedown → mouseup → click
```
### Scrolling inside MUI dialogs
The dialog's outer container doesn't scroll — an inner div does, and `scrollIntoView()` on children is a no-op. Walk up to the scrollable ancestor and set `scrollTop`:
```javascript
() => {
const target = document.querySelector('img[src*="/media?filepath"]');
let el = target.parentElement;
while (el) {
const s = getComputedStyle(el);
if ((s.overflowY === 'auto' || s.overflowY === 'scroll')
&& el.scrollHeight > el.clientHeight) {
const t = target.getBoundingClientRect();
const e = el.getBoundingClientRect();
el.scrollTop += t.top - e.top - 60; // 60px top margin
return 'scrolled';
}
el = el.parentElement;
}
}
```
---
## 4. Finding elements
### Prefer `data-cy` attributes
FiftyOne ships extensive `data-cy` hooks for its own Cypress tests — stable across versions.
| `data-cy` | Element |
|---|---|
| `sidebar-field-container-tags` | "sample tags" sidebar row |
| `sidebar-field-arrow-enabled-tags` | Expand caret on that row |
| `checkbox-tags` | Group visibility toggle (NOT a filter) |
| `categorical-filter-tags` | Expanded filter area |
| `selector-sidebar-search-tags` | "+ filter by sample tag" input |
| `flashlight-section` | Main grid renderer |
| `looker` | Each sample card in the grid |
Grep the installed FiftyOne app bundle for more — locate it with `python -c "import os, fiftyone; print(os.path.join(os.path.dirname(fiftyone.__file__), 'app'))"`.
### Text-content matching — filter to leaves
Ancestor `<div>`s contain every descendant string. Filter:
```javascript
Array.from(document.querySelectorAll('*'))
.find(el => el.textContent.trim() === 'reviewed' && el.children.length === 0)
```
---
## 5. Sidebar tag filtering (non-obvious UX)
To filter the grid by a sample-tag value:
1. Expand "sample tags" via the **caret** (`sidebar-field-arrow-enabled-tags`) — NOT the checkbox (that toggles the whole group).
2. Click the filter input (`selector-sidebar-search-tags`, placeholder "+ filter by sample tag") to open its autocomplete.
3. Click the desired tag row. It becomes a chip; grid filters; click the chip again to clear.
Tag rows are a dynamic autocomplete — not pre-rendered checkboxes.
---
## 6. Stale UI state after an operator mutation
After an Execute that adds samples/tags: the grid count lags and the sidebar tag index is stale. Fix with the `reload_dataset` built-in (rule 1). `reload_samples` is NOT enough — it doesn't refresh the tag index.
---
## 7. Modal viewer navigation
- Click the "Click to expand" ref on a card (real `browser_click`, not a synthesized click on the canvas — that tends not to open the modal).
- `ArrowRight` / `ArrowLeft` cycle the view; `Escape` closes. URL gets `?id=<sample_id>`.
---
## 8. Pacing
- 1–2 s wait after any dialog closes (state-sync debounce).
- ~300–500 ms after input on `dynamic=True` forms before checking for Warnings/Notices.
- 1–2 s between `ArrowRight` presses for recording-grade pacing.
---
## 9. Recording tips
- **Split long demos at crash-prone boundaries.** Record pre-Execute and post-Done clips separately; splice in editor — cheaper than fighting session lifecycle.
- Use the **same operator params** across takes so clips stitch. Unseeded RNG varies per-sample but overall style stays consistent at matched intensities.
- Pre-configure deterministic state (clone, saved views, defaults) in the launcher so on-camera time is all creative action.
- Viewport: `browser_resize(width=2560, height=1440)` **before** `browser_navigate` — default 1440×900 is coarse on Retina.
---
## 10. Cleanup (run between attempts)
```bash
# Kill stale launcher (match the script you launched)
pgrep -f launch_app.py | xargs -r kill; sleep 1
# Drop the non-persistent clone (no-op if already gone). $CLONE = your clone name.
python -c "import sys, fiftyone as fo; fo.dataset_exists(sys.argv[1]) and fo.delete_dataset(sys.argv[1])" "$CLONE"
# Remove ONLY recent orphan output files this run produced — NEVER a broad name glob alone.
# $OUTPUT_GLOB = a pattern unique to YOUR outputs (e.g. "*_processed_*").
# $PREVIEW_FILE = any sidecar preview the operator wrote (e.g. ".fo_preview.jpg").
find "$MEDIA_DIR" -name "$OUTPUT_GLOB" -type f -mmin -30 -delete
find "$MEDIA_DIR" -name "$PREVIEW_FILE" -mmin -30 -delete
# Playwright snapshot scratch files
rm -f ./*-snap.md ./snap-*.md ./target-*.md ./sv-*.md 2>/dev/null
```
**Cleanup safety:** a bare `find -name "$OUTPUT_GLOB"` will match files from unrelated sessions you shouldn't touch. Always filter by `-mmin` or a session-specific prefix.
---
## Pre-flight checklist
- [ ] Launcher uses `remote=True` + trigger-file watcher (or `session.wait()` if rule 1 is acceptable)
- [ ] Clone is non-persistent, deterministic name, pre-delete guard
- [ ] Deterministic saved views / tags created by the launcher, not at demo time
- [ ] Viewport ≥ 2560×1440 before first navigate
- [ ] Never `browser_navigate` / `location.reload()` after an operator Execute
- [ ] Post-Execute refresh via `touch <trigger-file>` OR `reload_dataset` via backtick palette
- [ ] `data-cy` selectors first; leaf-text match as fallback
- [ ] MUI dropdowns: real click to open, JS click on `[role="option"]` to select
- [ ] React inputs: prototype setter + `input` event
- [ ] Dialog scrolling: walk to scrollable ancestor, set `scrollTop`
- [ ] Cleanup script scoped by `-mmin` / prefix, never bare name globs
- [ ] Health check (`curl` + `ps`) between phases
## skills/fiftyone-code-style/SKILL.md
---
name: fiftyone-code-style
description: Writes Python code following FiftyOne's official conventions. Use when contributing to FiftyOne, developing plugins, or writing code that integrates with FiftyOne's codebase.
---
# FiftyOne Code Style
## Module Template
```python
"""
Module description.
| Copyright 2017-2026, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
import logging
import os
import numpy as np
import eta.core.utils as etau
import fiftyone as fo
import fiftyone.core.fields as fof
import fiftyone.core.labels as fol
import fiftyone.core.utils as fou
logger = logging.getLogger(__name__)
def public_function(arg):
"""Public API function."""
return _helper(arg)
def _helper(arg):
"""Private helper."""
return arg
```
## Import Organization
Four groups, alphabetized within each, separated by blank lines:
| Group | Example |
|-------|---------|
| 1. Standard library | `import logging`, `import os` |
| 2. Third-party | `import numpy as np` |
| 3. eta packages | `import eta.core.utils as etau` |
| 4. FiftyOne | `import fiftyone.core.labels as fol` |
### FiftyOne Import Aliases
| Module | Alias |
|--------|-------|
| `fiftyone` | `fo` |
| `fiftyone.core.labels` | `fol` |
| `fiftyone.core.fields` | `fof` |
| `fiftyone.core.media` | `fom` |
| `fiftyone.core.storage` | `fos` |
| `fiftyone.core.utils` | `fou` |
| `fiftyone.utils.image` | `foui` |
| `fiftyone.utils.video` | `fouv` |
## Docstrings (Google-Style)
```python
def get_operator(operator_uri, enabled=True):
"""Gets the operator with the given URI.
Args:
operator_uri: the operator URI
enabled (True): whether to include only enabled operators (True) or
only disabled operators (False) or all operators ("all")
Returns:
an :class:`fiftyone.operators.Operator`
Raises:
ValueError: if the operator is not found
"""
```
**Key patterns:**
- Args with defaults: `param (default): description`
- Multi-line descriptions: indent continuation
- Cross-references: `:class:`fiftyone.module.Class``
## Lazy Imports
Use `fou.lazy_import()` for optional/heavy dependencies:
```python
o3d = fou.lazy_import("open3d", callback=lambda: fou.ensure_package("open3d"))
mask_utils = fou.lazy_import(
"pycocotools.mask", callback=lambda: fou.ensure_import("pycocotools")
)
```
## Guard Patterns
Use `hasattr()` for optional attributes:
```python
if hasattr(label, "confidence"):
if label.confidence is None or label.confidence < threshold:
label = label.__class__()
```
## Error Handling
Use `logger.warning()` for non-fatal errors:
```python
try:
result = process_data(data)
except Exception as e:
logger.warning("Failed to process data: %s", e)
```
## Avoid Redundant Code
Before writing new functions, search for existing implementations:
- Local: search the FiftyOne source if available in the environment
- Remote: search `https://github.com/voxel51/fiftyone`
- Check `fiftyone/core/utils.py` and `fiftyone/utils/*` first
## Common Utilities
| Module | Functions |
|--------|-----------|
| `fou` | `lazy_import()`, `ensure_package()`, `extract_kwargs_for_class()` |
| `etau` | `guess_mime_type()`, `ensure_dir()`, `make_temp_dir()` |
## Quick Reference
| Pattern | Convention |
|---------|------------|
| Module structure | Docstring → imports → logger → public → private |
| Private functions | `_prefix` |
| Docstrings | Google-style with Args/Returns/Raises |
| Error handling | `logger.warning()` for non-fatal |
| Lazy imports | `fou.lazy_import()` for optional deps |
| Guard patterns | `hasattr()` checks |
| Import aliases | `fo`, `fol`, `fof`, `fom`, `fos`, `fou` |
## skills/fiftyone-create-notebook/SKILL.md
---
name: fiftyone-create-notebook
description: Creates Jupyter notebooks for FiftyOne workflows including getting-started guides, tutorials, recipes, and full ML pipelines. Use when creating notebooks, writing tutorials, building demos, or generating FiftyOne walkthroughs covering data loading, exploration, inference, evaluation, and export.
---
# Create FiftyOne Notebooks
## Contents
- [Key Directives](#key-directives)
- [Complete Workflow](#complete-workflow)
- [Notebook Structure Reference](#notebook-structure-reference)
- [Common Use Cases](#common-use-cases)
- [Troubleshooting](#troubleshooting)
- [Best Practices](#best-practices)
- [Resources](#resources)
## Key Directives
**ALWAYS follow these rules:**
### 1. Determine notebook type first
Classify the user's request before anything else:
| User Request Pattern | Type | Template |
|---|---|---|
| "getting started", "beginner", "intro", "first notebook" | Getting Started | [GETTING-STARTED-TEMPLATES.md](GETTING-STARTED-TEMPLATES.md) |
| "tutorial", "how to use X", "deep dive", "demonstrate X" | Tutorial | [TUTORIAL-TEMPLATES.md](TUTORIAL-TEMPLATES.md) |
| "recipe", "quick", "snippet", "how do I X" | Recipe | [RECIPE-TEMPLATES.md](RECIPE-TEMPLATES.md) |
| "full pipeline", "end to end", "ML pipeline", "complete workflow" | Full Pipeline | [GETTING-STARTED-TEMPLATES.md](GETTING-STARTED-TEMPLATES.md) with all stages |
If ambiguous, ask the user.
### 2. Create the notebook file before adding cells
Use the Write tool to create a valid empty `.ipynb` file first:
```json
{
"nbformat": 4,
"nbformat_minor": 2,
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.10.0"
}
},
"cells": []
}
```
Then use `NotebookEdit` with `edit_mode: "insert"` to add cells.
### 3. Follow FiftyOne code conventions
All generated code must use standard FiftyOne import aliases:
```python
import fiftyone as fo
import fiftyone.zoo as foz
import fiftyone.brain as fob
import fiftyone.types as fot
from fiftyone import ViewField as F
```
See the "Code Pattern Sources" table below for full conventions.
### 4. Build notebooks cell-by-cell
Use `NotebookEdit` with `edit_mode: "insert"` for every cell. Build top-to-bottom using `cell_id` chaining: insert the first cell without `cell_id` (inserts at beginning), then read the notebook to get its `cell_id`, and insert each subsequent cell with `cell_id` set to the previous cell's ID. This ensures correct ordering.
**Critical:** Without `cell_id`, every insert goes to the **beginning** of the notebook, resulting in reversed cell order.
**Never** write the entire `.ipynb` JSON at once. Incremental cell insertion allows verification and correction.
### 5. Always include App visualization
Every notebook must include at least one cell with:
```python
session = fo.launch_app(dataset)
```
FiftyOne's core value is visual exploration. Notebooks without App visualization miss the point.
### 6. Use zoo datasets when user has no data
For getting-started and tutorial notebooks, default to `foz.load_zoo_dataset()` so users can run the notebook without bringing their own data. For recipes and custom pipelines, support both zoo and user data.
### 7. Precede every code cell with a markdown cell
Never place two code cells in a row without a markdown cell in between. The markdown cell explains **what** the code does and **why**. This is critical for tutorials and getting-started guides. Recipes are exempt — consecutive code cells are permitted for brevity (imports + load data, core solution + verify).
### 8. Present outline before generating
Before creating any cells, draft a notebook outline showing:
- Section headings
- Cell types (markdown/code)
- Brief description of each cell
Get user approval before generating.
### 9. Fetch current API documentation
When generating code, fetch `https://docs.voxel51.com/llms.txt` for the latest FiftyOne API patterns. This ensures generated code uses current APIs and avoids deprecated patterns.
### 10. Verify after generation
After all cells are inserted, read the notebook back with the Read tool to verify:
- Cells are in correct order
- Markdown/code alternation is maintained
- Import aliases are correct
- Narrative flow is logical
## Complete Workflow
### Phase 1: Requirements
Gather information before designing the notebook:
1. **Classify notebook type** — Use the decision matrix from Directive 1. Ask the user if ambiguous.
2. **Determine domain and task** — Ask or infer what ML task the notebook covers. Common domains include:
- Object Detection
- Image Classification
- Instance/Semantic Segmentation
- Embeddings & Similarity
- Data Curation (duplicates, outliers, annotation mistakes)
- Video analysis, 3D point clouds, or any other FiftyOne-supported workflow
3. **Determine data source:**
- **Zoo dataset** (recommended for tutorials): `foz.load_zoo_dataset("coco-2017", ...)`
- **User's local data**: `fo.Dataset.from_dir(...)`
- **Hugging Face Hub**: `foz.load_zoo_dataset("https://huggingface.co/datasets/...", ...)`
- **Quickstart**: `foz.load_zoo_dataset("quickstart")`
4. **Determine pipeline stages:**
| Stage | Description | Always Include? |
|---|---|---|
| Data Loading | Load/create dataset | Yes |
| Exploration | App, stats, filtering | Yes |
| Brain Methods | Embeddings, uniqueness, duplicates | If relevant |
| Inference | Model predictions | If relevant |
| Evaluation | Metrics, TP/FP/FN analysis | If predictions + ground truth |
| Export | Save to format | Optional |
5. **Confirm with user** — Present a summary:
- Notebook type: [Getting Started / Tutorial / Recipe / Full Pipeline]
- Domain: [Detection / Classification / ...]
- Data source: [Zoo dataset name / User path / HF URL]
- Pipeline stages: [Load, Explore, Infer, Evaluate, Export]
- Estimated cells: [N]
### Phase 2: Design
1. **Read the appropriate template doc** as a structural guide (adapt to the user's domain — do not copy specific datasets, models, or field names from the examples):
- [GETTING-STARTED-TEMPLATES.md](GETTING-STARTED-TEMPLATES.md) for getting-started and full pipeline
- [TUTORIAL-TEMPLATES.md](TUTORIAL-TEMPLATES.md) for tutorials
- [RECIPE-TEMPLATES.md](RECIPE-TEMPLATES.md) for recipes
2. **Fetch API documentation** — Fetch `https://docs.voxel51.com/llms.txt` using the WebFetch tool for current FiftyOne API patterns. This is the authoritative source for SDK usage.
3. **Draft notebook outline** — Create a numbered list of cells with cell number, type (markdown/code), and content summary:
```
0. [markdown] Title + description
1. [markdown] What You Will Learn
2. [code] pip install
3. [markdown] ## Setup
4. [code] Imports
5. [markdown] ## Load Dataset
6. [code] Load from zoo + print dataset info
...
```
4. **Present outline for approval** — Show the outline to the user. Wait for approval before generating.
### Phase 3: Generation
1. **Create empty notebook file:**
```python
# Use Write tool
Write(
file_path="/path/to/notebook.ipynb",
content='{"nbformat": 4, "nbformat_minor": 2, "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "language_info": {"name": "python", "version": "3.10.0"}}, "cells": []}'
)
```
Ask the user for the notebook file path, or suggest a default based on the title.
2. **Add cells with NotebookEdit using `cell_id` chaining:**
Insert the first cell without `cell_id` (goes to beginning), then read the notebook to get the assigned `cell_id`. Each subsequent cell uses `cell_id` of the previous cell:
```
# First cell — no cell_id, inserts at beginning
NotebookEdit(
notebook_path="/path/to/notebook.ipynb",
new_source="# Title\n\nDescription paragraph.",
cell_type="markdown",
edit_mode="insert"
)
# Read notebook to get the first cell's ID (e.g., "cell-0")
Read(file_path="/path/to/notebook.ipynb")
# Second cell — chain after cell-0
NotebookEdit(
notebook_path="/path/to/notebook.ipynb",
cell_id="cell-0",
new_source="!pip install -q fiftyone",
cell_type="code",
edit_mode="insert"
)
# Third cell — chain after cell-1
NotebookEdit(
notebook_path="/path/to/notebook.ipynb",
cell_id="cell-1",
new_source="import fiftyone as fo",
cell_type="code",
edit_mode="insert"
)
```
Continue chaining: each new cell's `cell_id` = previous cell's ID (cell-0, cell-1, cell-2, ...).
**Cell content guidelines:**
- Keep code cells under 15 lines
- One concept per code cell
- Include inline comments for non-obvious operations
- Use `print()` liberally so users see output
- Include `# Expected output:` comments where helpful
3. **Review during generation** — After every 5-10 cells, briefly verify the notebook is building correctly. Read it back if needed.
### Phase 4: Validation
1. **Read notebook back** — Use the Read tool to read the entire `.ipynb` file. Verify:
- Total cell count matches outline
- Cell order is correct
- No missing sections
2. **Verify code quality** — Check all code cells for:
- Correct FiftyOne import aliases (`fo`, `foz`, `fob`, `fot`, `F`)
- No deprecated APIs
- Consistent variable names throughout
- `dataset` variable used consistently
- Field names match between inference, evaluation, and filtering cells
3. **Verify narrative flow** — Check markdown cells for:
- Logical progression from section to section
- No jargon without explanation (for getting-started)
- Each markdown cell explains the **why**, not just the **what**
4. **Execute the notebook** — Create an isolated virtual environment and run end-to-end with `papermill` to avoid modifying the user's system Python:
```bash
python -m venv .notebook-test-env
.notebook-test-env/bin/pip install -q papermill ipykernel anywidget
.notebook-test-env/bin/python -m ipykernel install --user --name python3 --display-name "Python 3"
.notebook-test-env/bin/papermill notebook.ipynb notebook_output.ipynb
```
Fix any runtime errors, then re-run until all cells pass. Clean up after: `rm -rf .notebook-test-env`. Common issues:
- `session.view` requires a `DatasetView`, not a `Dataset` — use `dataset.view()`
- Missing packages — add them to the notebook's install cell
- Plotly widgets need `anywidget` in headless environments
5. **Present summary** — Tell the user:
- Notebook path
- Total cells (N markdown + N code)
- Sections covered
- Execution status (all cells passed / errors fixed)
- How to run it (e.g., `jupyter notebook path/to/notebook.ipynb`)
## Notebook Structure Reference
See [NOTEBOOK-STRUCTURE.md](NOTEBOOK-STRUCTURE.md) for detailed cell structure patterns for each pipeline stage, including cell shapes and markdown patterns.
### Code Pattern Sources
For actual code patterns, fetch `https://docs.voxel51.com/llms.txt` as the authoritative source. Related skills provide additional context for specific pipeline stages:
| Pipeline Stage | Related Skill |
|---|---|
| Imports & conventions | [fiftyone-code-style](../fiftyone-code-style/SKILL.md) |
| Data loading | [fiftyone-dataset-import](../fiftyone-dataset-import/SKILL.md) |
| Inference | [fiftyone-dataset-inference](../fiftyone-dataset-inference/SKILL.md) |
| Evaluation | [fiftyone-model-evaluation](../fiftyone-model-evaluation/SKILL.md) |
| Export | [fiftyone-dataset-export](../fiftyone-dataset-export/SKILL.md) |
| Embeddings & visualization | [fiftyone-embeddings-visualization](../fiftyone-embeddings-visualization/SKILL.md) |
| Duplicates | [fiftyone-find-duplicates](../fiftyone-find-duplicates/SKILL.md) |
## Common Use Cases
### Use Case 1: Getting Started with Object Detection
**User says:** "Create a getting-started notebook for object detection"
**Notebook outline (21 cells):**
| Cell | Type | Content |
|---|---|---|
| 0 | markdown | `# Getting Started with Object Detection in FiftyOne` |
| 1 | markdown | What You Will Learn (bullet list) |
| 2 | code | `!pip install fiftyone ultralytics` |
| 3 | markdown | ## Setup |
| 4 | code | Imports (`fo`, `foz`, `F`) |
| 5 | markdown | ## Load Dataset |
| 6 | code | `dataset = foz.load_zoo_dataset(...)` + `print(dataset)` + `print(dataset.first())` |
| 7 | markdown | ## Explore in the FiftyOne App |
| 8 | code | `session = fo.launch_app(dataset)` |
| 9 | markdown | ## Understand the Data |
| 10 | code | `dataset.count_values("ground_truth.detections.label")` |
| 11 | markdown | ## Run Model Inference |
| 12 | code | `model = foz.load_zoo_model(...)` + `dataset.apply_model(...)` + `session.view = dataset.view()` |
| 13 | markdown | ## Evaluate Predictions |
| 14 | code | `dataset.evaluate_detections(...)` + `results.print_report()` |
| 15 | markdown | ## Analyze Errors |
| 16 | code | Evaluation patches: `dataset.to_evaluation_patches("eval")`, filter to FP |
| 17 | markdown | ## Export for Training |
| 18 | code | `dataset.export(...)` to YOLOv5 format |
| 19 | markdown | ## Concl

