本文へ移動
cccskills
無料GitHub で公開

StreamFlow Code Style

This skill should be used when the user asks to "add docstrings", "write error handling", "use naming conventions", "handle exceptions", or when writing new Python code for StreamFlow that requires docstring format, naming conventions, exception handling, or async cleanup patterns.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md3.8 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

StreamFlow Code Style Skill

Conventions for writing Python code in StreamFlow that are not automatically enforced by the formatter. For type annotations, load the StreamFlow Mypy Type Checking skill.

Run auto-fix before committing:

uv run make format codespell pyupgrade

Exclude streamflow/cwl/antlr from all checks. Use American English in all code, docstrings, and comments.

Imports: Two Manual Rules

Everything else is handled by ruff automatically. Two things ruff never does for you:

1. Always add from __future__ import annotations as the first import in every file:

from __future__ import annotations

2. Use TYPE_CHECKING to break circular imports:

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from streamflow.core.data import DataManager

Naming Conventions

KindConventionExample
ClassesPascalCaseWorkflowExecutor
Functions / methodssnake_caserun_workflow
ConstantsUPPER_SNAKE_CASEMAX_RETRIES
Private members_prefix_internal_state
Type variablesShort uppercase_KT, _VT, _T

Error Handling

Use StreamFlow's custom exceptions — never raise bare Exception or RuntimeError.

from streamflow.core.exception import WorkflowExecutionException
from streamflow.log_handler import logger

try:
    result = await process()
except SpecificException as e:
    logger.exception(e)
    raise WorkflowExecutionException(f"Failed to process: {e}") from e

Available exceptions (from streamflow.core.exception):

ExceptionWhen to use
WorkflowExceptionGeneral workflow errors
WorkflowDefinitionExceptionInvalid workflow definition
WorkflowExecutionExceptionRuntime execution failures
WorkflowProvenanceExceptionProvenance/tracking errors
FailureHandlingExceptionFault tolerance failures
InvalidPluginExceptionPlugin loading/validation errors
ProcessorTypeErrorType mismatches in processors

Async Cleanup Pattern

Use asyncio.gather with create_task for concurrent teardown, with a finally block to guarantee database closure:

async def close(self) -> None:
    try:
        await asyncio.gather(
            asyncio.create_task(self.manager.close()),
            asyncio.create_task(self.scheduler.close()),
        )
    except Exception as e:
        logger.exception(e)
    finally:
        await self.database.close()

Docstrings

Use Sphinx-style field lists. Every non-trivial public function/method should have a docstring.

def deploy_connector(
    self, name: str, config: ConnectorConfig, location: ExecutionLocation
) -> Connector:
    """
    Deploy a connector at the given execution location.

    :param name: Unique name for the connector instance
    :param config: Deployment configuration for the connector
    :param location: Target execution location
    :returns: The deployed connector instance
    :raises WorkflowExecutionException: If deployment fails
    """
  • One-line summary on the first line, no blank line before it
  • Blank line before :param block if a body paragraph follows
  • Use :returns: (not :return:)
  • Only document :raises: for exceptions callers should handle
  • Do not repeat the type in the param description — types live in annotations

See Also

  • StreamFlow Mypy Type Checking skill — type annotations and forbidden types
  • StreamFlow Git Workflow skill — commit message format

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

This skill should be used when the user asks to "update the changelog", "add a changelog entry", "write a CHANGELOG entry", or when preparing a git commit in StreamFlow that requires updating the `## [Unreleased]` section of `CHANGELOG.md`.

日本語の概要は準備中です。原文の説明を表示しています。

alpha-unito/streamflow662026年10月9日 更新

This skill should be used when the user asks to "write documentation", "add a doc page", "update RST files", "add a tutorial", or when writing or editing Sphinx RST documentation for StreamFlow.

日本語の概要は準備中です。原文の説明を表示しています。

alpha-unito/streamflow662026年10月9日 更新

This skill should be used when the user asks to "add an example", "write a tutorial", "document a new workflow example", or when creating a new worked example under `docs/source/examples/`.

日本語の概要は準備中です。原文の説明を表示しています。

alpha-unito/streamflow662026年10月9日 更新

This skill should be used when the user asks to "write a commit message", "create a commit", "format a commit", "what commit type to use", or when preparing changes for a git commit in StreamFlow. Provides commit message format, type conventions, and examples.

日本語の概要は準備中です。原文の説明を表示しています。

alpha-unito/streamflow662026年10月9日 更新

This skill should be used when the user encounters "no-untyped-def" mypy errors, asks to "fix no-untyped-def errors", "add type annotations to functions", or mentions "Function is missing a type annotation". Provides specific workflow for fixing missing type annotations while respecting forbidden type constraints.

日本語の概要は準備中です。原文の説明を表示しています。

alpha-unito/streamflow662026年10月9日 更新

This skill should be used when the user asks to "fix mypy errors", "add type annotations", "fix type checking", "resolve no-untyped-def", "fix mypy type errors", or when working with type hints while respecting StreamFlow's forbidden type constraints (no Any, dict[str, Any], etc.).

日本語の概要は準備中です。原文の説明を表示しています。

alpha-unito/streamflow662026年10月9日 更新

alpha-unito のスキルをすべて見る

このスキルの問題を報告する