synapse-action-development

Explains how to create Synapse plugin actions. Use when the user asks to "create an action", "write an action", uses "@action decorator", "BaseAction class", "function-based action", "class-based action", "Pydantic params", "ActionPipeline", "DataType", "input_type", "output_type", "semantic types", "YOLODataset", "ModelWeights", "pipeline chaining", or needs help with synapse plugin action development.

181 stars

Best use case

synapse-action-development is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Explains how to create Synapse plugin actions. Use when the user asks to "create an action", "write an action", uses "@action decorator", "BaseAction class", "function-based action", "class-based action", "Pydantic params", "ActionPipeline", "DataType", "input_type", "output_type", "semantic types", "YOLODataset", "ModelWeights", "pipeline chaining", or needs help with synapse plugin action development.

Teams using synapse-action-development should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/action-development/SKILL.md --create-dirs "https://raw.githubusercontent.com/majiayu000/claude-skill-registry/main/skills/data/action-development/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/action-development/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How synapse-action-development Compares

Feature / Agentsynapse-action-developmentStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Explains how to create Synapse plugin actions. Use when the user asks to "create an action", "write an action", uses "@action decorator", "BaseAction class", "function-based action", "class-based action", "Pydantic params", "ActionPipeline", "DataType", "input_type", "output_type", "semantic types", "YOLODataset", "ModelWeights", "pipeline chaining", or needs help with synapse plugin action development.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Synapse Action Development

Synapse SDK provides two patterns for plugin actions: **function-based** (simple, stateless) and **class-based** (complex, stateful).

## Quick Start: Function-Based Action

```python
from pydantic import BaseModel
from synapse_sdk.plugins.decorators import action
from synapse_sdk.plugins.context import RuntimeContext

class TrainParams(BaseModel):
    epochs: int = 10
    learning_rate: float = 0.001

@action(name='train', description='Train a model', params=TrainParams)
def train(params: TrainParams, ctx: RuntimeContext) -> dict:
    for epoch in range(params.epochs):
        ctx.set_progress(epoch + 1, params.epochs)
    return {'status': 'completed'}
```

## Quick Start: Class-Based Action

```python
from pydantic import BaseModel
from synapse_sdk.plugins.action import BaseAction

class InferParams(BaseModel):
    model_path: str
    threshold: float = 0.5

class InferAction(BaseAction[InferParams]):
    action_name = 'inference'

    def execute(self) -> dict:
        self.set_progress(0, 100)
        # Implementation here
        return {'predictions': []}
```

## When to Use Each Pattern

| Criteria | Function-Based | Class-Based |
|----------|----------------|-------------|
| Complexity | Simple, single-purpose | Complex, multi-step |
| State | Stateless | Can use helper methods |
| Semantic types | Limited | Full support |

**Recommendation**: Start with function-based. Use class-based when needing helper methods or semantic type declarations.

## @action Decorator Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `name` | No | Action name (defaults to function name) |
| `description` | No | Human-readable description |
| `params` | No | Pydantic model for parameter validation |
| `result` | No | Pydantic model for result validation |
| `category` | No | PluginCategory for grouping |

### Category Parameter Examples

```python
from synapse_sdk.plugins.decorators import action
from synapse_sdk.plugins.constants import PluginCategory

# Training action
@action(
    name='train',
    category=PluginCategory.NEURAL_NET,
    description='Train object detection model'
)
def train(params, ctx):
    ...

# Export action
@action(
    name='export_coco',
    category=PluginCategory.EXPORT,
    description='Export to COCO format'
)
def export_coco(params, ctx):
    ...

# Smart tool (AI-assisted annotation)
@action(
    name='auto_segment',
    category=PluginCategory.SMART_TOOL,
    description='Auto-segmentation tool'
)
def auto_segment(params, ctx):
    ...

# Pre-annotation
@action(
    name='pre_label',
    category=PluginCategory.PRE_ANNOTATION,
    description='Pre-label with model predictions'
)
def pre_label(params, ctx):
    ...
```

**Available Categories**: `NEURAL_NET`, `EXPORT`, `UPLOAD`, `SMART_TOOL`, `PRE_ANNOTATION`, `POST_ANNOTATION`, `DATA_VALIDATION`, `CUSTOM`

## BaseAction Class Attributes

| Attribute | Description |
|-----------|-------------|
| `action_name` | Action name for invocation |
| `category` | PluginCategory |
| `input_type` | Semantic input type for pipelines |
| `output_type` | Semantic output type for pipelines |
| `params_model` | Auto-extracted from generic |
| `result_model` | Optional result schema |

## Available Methods in BaseAction

- `self.params` - Validated parameters
- `self.ctx` - RuntimeContext
- `self.logger` - Logger shortcut
- `self.set_progress(current, total, category)` - Progress tracking
- `self.set_metrics(value, category)` - Metrics recording
- `self.log(event, data, file)` - Event logging

## Additional Resources

For detailed patterns and advanced techniques:
- **[references/patterns.md](references/patterns.md)** - Parameter validation, semantic types
- **[references/categories.md](references/categories.md)** - Available PluginCategory values
- **[references/types-hierarchy.md](references/types-hierarchy.md)** - Semantic type system (DataType, Dataset, Model)
- **[references/pipelines.md](references/pipelines.md)** - ActionPipeline for chaining actions

Related Skills

adr-decision-extraction

181
from majiayu000/claude-skill-registry

Extract architectural decisions from conversations. Identifies problem-solution pairs, trade-off discussions, and explicit choices. Use when analyzing session transcripts for ADR generation.

Addon/Feature System Development Guide

181
from majiayu000/claude-skill-registry

**Version:** 1.0

add-ws-action

181
from majiayu000/claude-skill-registry

Add a new outgoing WebSocket action with typed payload and API exposure

add-reaction

181
from majiayu000/claude-skill-registry

Slack メッセージにリアクションを追加する。「リアクション追加」「リアクションつけて」「👍つけて」「絵文字で反応」「リアクションで返信」「いいねして」「リアクション送って」などで起動。User Token があればユーザーとしてリアクション、なければ Bot としてリアクション。

adapter-development

181
from majiayu000/claude-skill-registry

Comprehensive guide for AIDB debug adapter development. Covers component-based architecture, language-specific patterns (Python/debugpy, JavaScript/vscode-js-debug, Java/java-debug), lifecycle hooks, process management, port management, launch orchestration, resource cleanup, child sessions, and common pitfalls. Essential for developing or maintaining AIDB debug adapters.

github-actions

181
from majiayu000/claude-skill-registry

Create and configure GitHub Actions. Use when building custom actions, setting up runners, implementing security practices, or publishing to the marketplace.

actions-pattern

181
from majiayu000/claude-skill-registry

Garante que novas Actions sigam o padrão de classes actions reutilizáveis do Easy Budget.

actions-debugger

181
from majiayu000/claude-skill-registry

GitHub Actions のワークフロー実行エラーを調査し、原因を特定して解決策を提案する。「Actions エラー」「ワークフロー失敗」「CI が落ちた」「ビルド失敗」「テスト失敗」「Actions を調べて」「CI のエラーを見て」などで起動。失敗したジョブのログを分析し、具体的な修正方法を提示。

actions-cicd-practices

181
from majiayu000/claude-skill-registry

GitHub Actions and CI/CD best practices for automated testing, building, and deployment.

actionbook

181
from majiayu000/claude-skill-registry

This skill should be used when the user needs to automate multi-step website tasks. Activates for browser automation, web scraping, UI testing, or building AI agents. Provides complete action manuals with step-by-step instructions and verified selectors.

actionable-review-format-standards

181
from majiayu000/claude-skill-registry

Standardized output format for code reviews with severity labels, file:line references, and fix code snippets. Use when generating review reports that need consistent, actionable feedback structure.

actionable-alerting-runbook-design

181
from majiayu000/claude-skill-registry

Designing effective alerts and runbooks for incident response. PROACTIVELY activate for: (1) Creating alerting rules, (2) Writing runbooks, (3) Reducing alert fatigue, (4) On-call escalation setup, (5) Incident response procedures. Triggers: "alerting", "runbook", "on-call", "pagerduty", "incident", "alert fatigue", "escalation", "playbook"