Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Write Python code following FiftyOne's official conventions. Use when contributing to FiftyOne, developing plugins, or writing code that integrates with FiftyOne's codebase.
.claude/skills/aiskillstore-fiftyone-code-style/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 50% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 241% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 76% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 126% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 125% | 0% |
python""" Module description. | Copyright 2017-2025, Voxel51, Inc. | `voxel51.com <https://voxel51.com/>`_ | """ # Standard library import logging import os # Third-party import numpy as np # eta (Voxel51 utilities) import eta.core.utils as etau # FiftyOne 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 (underscore prefix).""" return arg
Four groups, alphabetized within each:
| Group | Example | |-------|---------| | 1. Standard library | import logging, import os | | 2. Third-party | import numpy as np, from PIL import Image | | 3. eta packages | import eta.core.utils as etau | | 4. FiftyOne | import fiftyone.core.labels as fol |
| 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 |
pythondef 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 """
pythonclass ImageMetadata(Metadata): """Class for storing metadata about image samples. Args: size_bytes (None): the size of the image on disk, in bytes mime_type (None): the MIME type of the image width (None): the width of the image, in pixels height (None): the height of the image, in pixels """
Key patterns:
param (default): description:class:fiftyone.module.Classpython# Public API delegates to private helper def build_for(cls, path_or_url, mime_type=None): """Builds a Metadata object for the given file.""" if path_or_url.startswith("http"): return cls._build_for_url(path_or_url, mime_type=mime_type) return cls._build_for_local(path_or_url, mime_type=mime_type) # Private: underscore prefix, focused purpose def _build_for_local(cls, filepath, mime_type=None): """Internal helper for local files.""" size_bytes = os.path.getsize(filepath) if mime_type is None: mime_type = etau.guess_mime_type(filepath) return cls(size_bytes=size_bytes, mime_type=mime_type)
Use fou.lazy_import() for optional/heavy dependencies:
python# Basic lazy import o3d = fou.lazy_import("open3d", callback=lambda: fou.ensure_package("open3d")) # With ensure_import for pycocotools mask_utils = fou.lazy_import( "pycocotools.mask", callback=lambda: fou.ensure_import("pycocotools") ) # Internal module lazy import fop = fou.lazy_import("fiftyone.core.plots.plotly")
When to use:
Use hasattr() for conditional behavior:
python# Check for optional attribute if hasattr(label, "confidence"): if label.confidence is None or label.confidence < threshold: label = label.__class__() # Check for config attribute if hasattr(eval_info.config, "iscrowd"): crowd_attr = eval_info.config.iscrowd else: crowd_attr = None # Dynamic state initialization if not hasattr(pb, "_next_idx"): pb._next_idx = 0 pb._next_iters = []
Use logger.warning() for non-fatal errors:
python# Non-fatal: warn and continue try: for target in fo.config.logging_debug_targets.split(","): if logger_name := target.strip(): loggers.append(logging.getLogger(logger_name)) except Exception as e: logger.warning( "Failed to parse logging debug targets '%s': %s", fo.config.logging_debug_targets, e, ) # Missing optional import try: import resource except ImportError as e: if warn_on_failure: logger.warning(e) return # Graceful fallback try: mask = etai.render_instance_image(dobj.mask, dobj.bounding_box, frame_size) except: width, height = frame_size mask = np.zeros((height, width), dtype=bool)
Before writing new functions, check if FiftyOne already provides the functionality.
fiftyone.core.utils (fou)| Function | Purpose | |----------|---------| | fou.lazy_import() | Lazy module loading | | fou.ensure_package() | Install missing package | | fou.ensure_import() | Verify import available | | fou.extract_kwargs_for_class() | Split kwargs for class | | fou.load_xml_as_dict() | Parse XML to dict | | fou.get_default_executor() | Get thread pool executor |
eta.core.utils (etau)| Function | Purpose | |----------|---------| | etau.guess_mime_type() | Detect file MIME type | | etau.is_str() | Check if string | | etau.ensure_dir() | Create directory if missing | | etau.ensure_basedir() | Create parent directory | | etau.make_temp_dir() | Create temp directory |
bash grep -r "def your_function_name" fiftyone/ grep -r "similar_keyword" fiftyone/core/utils.py
fiftyone.core.utils - General utilitiesfiftyone.core.storage - File/cloud operationsfiftyone.utils.* - Format-specific utilitieseta.core.utils - Low-level helpersos.path or etaueta.core.serialfiftyone.utils.imageetau.is_str(), etc.Before submitting code, verify:
logger = logging.getLogger(__name__)_fou.lazy_import()hasattr() guardslogger.warning()except: (specify exception type when possible)bash# Run linting pylint fiftyone/your_module.py # Check style black --check fiftyone/your_module.py # Run tests pytest tests/unittests/your_test.py -v
| Pattern | Convention | |---------|------------| | Module structure | Docstring → imports → logger → public → private → classes | | Private functions | _prefix, module-level, small & focused | | Docstrings | Google-style with Args/Returns/Raises | | Error handling | try/except + logger.warning() for non-fatal | | Lazy imports | fou.lazy_import() for optional deps | | Guard patterns | hasattr() checks for conditional behavior | | Import aliases | fol, fof, fom, fos, fou | | Constants | UPPERCASE, private: _UPPERCASE | | Class inheritance | Explicit class Foo(object): | | Redundancy check | Search fou, etau, existing modules first |
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-05 | pass→pass | 5,533 | 2,137 | -61% | 1 | 1 | 0% | 1,085 | 2,741 | +153% | 0 | 0 | — |
case-01 | fail→pass | 16,481 | 13,040 | -21% | 1 | 1 | 0% | 3,542 | 5,316 | +50% | 0 | 0 | — |
case-02 | fail→pass | 7,705 | 11,360 | +47% | 1 | 1 | 0% | 1,394 | 4,752 | +241% | 0 | 0 | — |
case-03 | fail→pass | 11,064 | 4,888 | -56% | 1 | 1 | 0% | 1,879 | 3,299 | +76% | 0 | 0 | — |
case-04 | fail→pass | 6,533 | 3,363 | -49% | 1 | 1 | 0% | 1,336 | 3,019 | +126% | 0 | 0 | — |
case-06 | fail→pass | 7,745 | 4,368 | -44% | 1 | 1 | 0% | 1,409 | 3,166 | +125% | 0 | 0 | — |
case-07 | fail→pass | 8,135 | 3,548 | -56% | 1 | 1 | 0% | 1,692 | 3,043 | +80% | 0 | 0 | — |
case-08 | pass→pass | 13,425 | 7,244 | -46% | 1 | 1 | 0% | 2,343 | 3,702 | +58% | 0 | 0 | — |
case-09 | fail→pass | 12,443 | 5,151 | -59% | 1 | 1 | 0% | 2,138 | 3,318 | +55% | 0 | 0 | — |
case-10 | fail→pass | 11,813 | 4,169 | -65% | 1 | 1 | 0% | 2,204 | 3,041 | +38% | 0 | 0 | — |
case-11 | fail→pass | 11,710 | 3,928 | -66% | 1 | 1 | 0% | 2,226 | 2,988 | +34% | 0 | 0 | — |
case-12 | pass→pass | 6,131 | 2,675 | -56% | 1 | 1 | 0% | 1,168 | 2,710 | +132% | 0 | 0 | — |
case-13 | pass→pass | 11,633 | 4,299 | -63% | 1 | 1 | 0% | 1,985 | 3,089 | +56% | 0 | 0 | — |
case-14 | pass→pass | 11,721 | 7,336 | -37% | 1 | 1 | 0% | 2,130 | 3,878 | +82% | 0 | 0 | — |
case-15 | pass→pass | 8,466 | 9,892 | +17% | 1 | 1 | 0% | 1,589 | 3,165 | +99% | 0 | 0 | — |
case-16 | fail→pass | 12,514 | 3,571 | -71% | 1 | 1 | 0% | 2,543 | 3,050 | +20% | 0 | 0 | — |
case-17 | pass→pass | 10,077 | 5,185 | -49% | 1 | 1 | 0% | 2,181 | 3,404 | +56% | 0 | 0 | — |
case-18 | pass→pass | 6,517 | 2,749 | -58% | 1 | 1 | 0% | 1,032 | 2,716 | +163% | 0 | 0 | — |
case-19 | fail→pass | 7,650 | 3,011 | -61% | 1 | 1 | 0% | 1,516 | 2,766 | +82% | 0 | 0 | — |
case-20 | pass→pass | 7,661 | 8,075 | +5% | 1 | 1 | 0% | 1,399 | 3,770 | +169% | 0 | 0 | — |
case-21 | fail→fail | 9,452 | 6,531 | -31% | 1 | 1 | 0% | 1,795 | 3,601 | +101% | 0 | 0 | — |
case-22 | pass→pass | 7,272 | 5,254 | -28% | 1 | 1 | 0% | 1,307 | 3,378 | +158% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +50 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.