scistudio-write-block
Use when the user needs a new block: a Python class in `blocks/<name>.py` with typed ports, a config schema, and run logic (process, IO, app, code, or…
от jiazhenz026★ 30 звёзд на GitHub
Установить scistudio-write-block в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
scistudio-write-block
1. What a block is
A block is one typed step of a workflow: a Python class with named input and
output ports, a config_schema for its parameters, and a run that turns input
collections into output collections. Every port carries a Collection. A block
in blocks/<name>.py belongs to this project; moved to My Library, it is
available in every project.
A block can take several shapes. None is preferred; pick the one that fits, and reach for a richer one only when it genuinely helps the user:
- Process block — computes outputs from inputs (
ProcessBlock, orBlockfor full control ofrun). - IO block — reads or writes a file format (
SimpleLoader,SimpleSaver). Workflows never use it as a node: coreload_data/save_dataroute to it. - App block — hands the step to a desktop application (
AppBlock). To run a project script, add the built-in Code Block to the workflow and configure it; do not write a block for it. - Interactive block — pauses the run so the user makes a data-dependent decision in a window, then computes outputs from that decision.
2. Steps to write a block
- Check for reuse. Call
list_blocks; if a block's ports and config already match, use it and stop. Build new only when nothing fits, and say why in the new block's docstring. - Choose types and shape. Call
list_typesand give every input and output port the most fitting registered type (ImageoverArray,DataFrameoverDataObject). UsingDataObjectas a port type is forbidden. Decide the shape (§1). - Scaffold. Call
scaffold_block(name=..., category=..., input_ports=..., output_ports=..., description=...)and read every entry inwarnings. - Write the logic. Study a similar real block with
list_block_examplesandread_block_source, then fill inrunorprocess_iteminblocks/<name>.py. Fill everyEDIT THISsection and replace everyDescribe ...placeholder the scaffold left. - Make it usable. Label everything the user sees (see the table below), and give the block a look of its own if you like (see below).
- For an interactive block, follow "Use interactive blocks" below.
- Load and test. Call
reload_blocks, confirm the block appears inlist_blocks, thenrun_block_tests type_name="<registered name>"and read the output verbatim. - Use it. Add the block to a workflow with
scistudio-build-workflow(an IO block through coreload_data/save_data), run it, and confirm its outputs before telling the user it works.
Make it usable — label everything the user sees
The user drives your block from the GUI, where the only thing they see is the
text you put on these fields. Fill all of them with short, clear, human language
— a non-programmer must be able to tell ports and parameters apart (three ports
all typed Image with no names/descriptions are unusable):
| Where users see it | Field(s) to write |
|---|---|
| Palette + node header | block name (a real label, not MyBlock) and one-line description |
| Each input/output port | a distinct name and a description (what flows here, e.g. "raw image" vs "binary mask" vs "overlay") |
| Each parameter panel field | the config_schema property's title (the label) and description (what it does / units / when to change it) |
| In the code | short, plain comments explaining the why, not the obvious |
Distinct names + a one-line description per port and per parameter is the bar.
A value the user may reasonably want to change usually belongs in config_schema
(with a title/description and a sane default) rather than buried as an
unreachable constant — though a hard-coded value is fine when it is intrinsic or
a convenient default. Read each parameter in run with config.get("<name>").
Give it a look (optional). If you like, choose an icon and color that make the
block easy to recognise on the canvas: ui_icon takes a Lucide icon name that
fits what the block does (an unknown name falls back to the category icon), and
ui_color takes a CSS hex color. Leaving both unset uses the category default.
Use interactive blocks
An interactive block pauses the workflow at its step, shows the user a window built from the step's data, takes one decision, and computes its outputs from that decision. Use it when a value can only be judged by looking at the specific data — which items go where, where a threshold falls, which region to keep. The decision is recorded with the run, so the step stays reproducible. For example, when the user wants to manually pick the peak when doing spectral peak picking, or when the user wants to edit segmentation labels manually after cell segmentation, it's time to use interactive blocks.
The block runs in two phases, each in its own process:
- Prepare the view.
prepare_prompt(inputs, config)turns the real inputs into the plain-JSON
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл scistudio-write-block?
Use when the user needs a new block: a Python class in `blocks/<name>.py` with typed ports, a config schema, and run logic (process, IO, app, code, or interactive). Call list_blocks first and reuse a block that already fits. Not for adding an existing block to a workflow (scistudio-build-workflow) or changing a node's config (update_block_config).
Как установить скилл scistudio-write-block?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл scistudio-write-block запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…