Command Palette

Search for a command to run...

Назад к скиллам
скилл № 59529

scistudio-write-type

Use when the user's data needs its own data type: a Python class in `types/<name>.py` that subclasses a core type (Array, Series, DataFrame, Text, Artifact…

БесплатноБез исполняемых скриптов
jiazhenz026от jiazhenz026★ 30 звёзд на GitHub

Установить scistudio-write-type в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

scistudio-write-type

1. What a data type is

A data type is the kind of thing blocks pass to each other. SciStudio ships six general types (Array, Series, DataFrame, Text, Artifact, CompositeData), and a project makes its own by subclassing the one that holds its data. A custom type inherits storage, reading, and large-data access from its base; it adds a name, the rules that make the data valid (required axes or slots), and typed metadata that travels with the data.

A type is complete only when data of that type can be read: every new type comes with an IO block that loads it from a file, so core load_data can bring it into a workflow. A type with no way to load it is unusable.

Declaring a type lets ports require it, so a mis-wired canvas is caught before a run; gives it a name and color in the Data types tab; and lets a preview panel or MiniApp target it. Write one when the user's data has structure or metadata the general types do not capture. When a general type or an installed package type already fits, use it.

2. Steps to write a data type

  1. Check for reuse. Call list_types. When a registered type (core or from a package) already describes the data, use it and stop.
  2. Pick the base. Choose the core type whose shape matches the data (§4), or subclass an existing type when the new one is a narrower kind of it.
  3. Write the class. Create types/<name>.py with one class per type; the class name is the registered type name. Give it a one-line docstring, which the Data types tab shows.
  4. Add the rules. For an Array, require axes with required_axes, allowed_axes, and canonical_order; for a CompositeData, map each slot to its type in expected_slots.
  5. Add metadata, if any. Write a frozen Pydantic model and point Meta at it.
  6. Write its IO block (required). With scistudio-write-block, write a SimpleLoader in blocks/<name>.py whose output_type is the new type, with the file format it reads (format_id, extensions). Add a SimpleSaver too when the user will write this type to files.
  7. Register and check. Call reload_blocks, confirm the type in list_types under the intended parent, and confirm get_block_schema("load_data") offers the type in its core_type choices and lists the loader under format_capabilities. Then load a real file through core load_data and check the result with inspect_data.
  8. Use it. Declare the type on block ports with scistudio-write-block.

3. Anti-patterns

  • A type with no IO block that reads it. Every new type needs a loader, so load_data can bring its data into a workflow.
  • Writing a new type when a core or installed package type already fits.
  • Subclassing DataObject directly instead of one of the six core types.
  • Naming a class like a registered type (Array, Image, a package type): the existing type keeps the name and the file's class is skipped.
  • Naming the file after an installed Python package (json.py, numpy.py); the types/ folder is on the import path, so such a file is refused.
  • Redefining to_memory, to_pandas, to_numpy, sel, or with_meta, which the base already provides.
  • Mutable metadata, or metadata fields that do not survive a JSON round trip.
  • Metadata fields without defaults, so an instance cannot be created without them.
  • Declaring a type and never checking that it registered with list_types.

4. Defaults, tool sequence, and failure handling

Which base to subclass.

The data is Subclass
N-dimensional numeric data (image, volume, stack) Array
A 1-D indexed signal (spectrum, chromatogram, time series) Series
A table DataFrame
Plain text, Markdown, or JSON Text
An opaque file (PDF, report, binary) Artifact
A named bundle of the above CompositeData

Where it goes. <project>/types/ holds types for this project, and ~/.scistudio/types/ holds the user's types for every project. One file may declare several types.

Array axes. required_axes lists axes every instance must have, allowed_axes limits which axes it may have, and canonical_order fixes their order. Use the axis names t, z, c (discrete channel), lambda (continuous spectral), y, and x. An instance missing a required axis is rejected when it is constructed.

Metadata. Define a Pydantic model with model_config = ConfigDict(frozen=True), give every field a default and a JSON-safe type, and set Meta: ClassVar[type[BaseModel] | None] = MyMeta on the class. Instances take meta=MyMeta(...), and with_meta(**changes) returns an updated copy.

By default, no extra batch handling is needed. When you write an IO block for a new data type, inherit SimpleLoader/SimpleSaver and handle the read or write as a single-file operation; the core automatically fans in and fans out.

Appearance (optional). ui_color (a CSS hex color)

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл scistudio-write-type?

Use when the user's data needs its own data type: a Python class in `types/<name>.py` that subclasses a core type (Array, Series, DataFrame, Text, Artifact, CompositeData) to name the data, require its axes or slots, and carry typed metadata, together with the IO block that reads it. Call list_types first and reuse a type that already fits. Not for writing the block that uses the type (scistudio-write-block).

Как установить скилл scistudio-write-type?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл scistudio-write-type запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить scistudio-write-type с