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★ 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
- Check for reuse. Call
list_types. When a registered type (core or from a package) already describes the data, use it and stop. - 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.
- Write the class. Create
types/<name>.pywith one class per type; the class name is the registered type name. Give it a one-line docstring, which the Data types tab shows. - Add the rules. For an
Array, require axes withrequired_axes,allowed_axes, andcanonical_order; for aCompositeData, map each slot to its type inexpected_slots. - Add metadata, if any. Write a frozen Pydantic model and point
Metaat it. - Write its IO block (required). With
scistudio-write-block, write aSimpleLoaderinblocks/<name>.pywhoseoutput_typeis the new type, with the file format it reads (format_id,extensions). Add aSimpleSavertoo when the user will write this type to files. - Register and check. Call
reload_blocks, confirm the type inlist_typesunder the intended parent, and confirmget_block_schema("load_data")offers the type in itscore_typechoices and lists the loader underformat_capabilities. Then load a real file through coreload_dataand check the result withinspect_data. - 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_datacan bring its data into a workflow. - Writing a new type when a core or installed package type already fits.
- Subclassing
DataObjectdirectly 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); thetypes/folder is on the import path, so such a file is refused. - Redefining
to_memory,to_pandas,to_numpy,sel, orwith_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)
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
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), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…