MCP HubMCP Hub
SKILL·B16894

workflows-as-code

TomGranot
更新日 3 days ago
51
14
51
GitHubで表示
メタapiautomation

について

このスキルは、HubSpotのワークフローをAPI経由でバージョン管理されたJSONファイルとしてエクスポートし、それらをコードとして扱えるようにします。開発者は差分で変更を追跡し、JSONバックアップからワークフローを完全に復元することが可能となり、重要な安全網を提供します。HubSpot UIでは保護されていない自動化設定を、バックアップ、レビュー、復旧するためにご利用ください。

クイックインストール

Claude Code

推奨
メイン
npx skills add TomGranot/hubspot-admin-skills -a claude-code
プラグインコマンド代替
/plugin add https://github.com/TomGranot/hubspot-admin-skills
Git クローン代替
git clone https://github.com/TomGranot/hubspot-admin-skills.git ~/.claude/skills/workflows-as-code

このコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします

ドキュメント

Workflows as Code

Export every workflow in the portal to JSON files, keep the exports under version control, and restore workflows from JSON when something breaks. HubSpot has no recycle bin for workflows — a deleted or mangled workflow is gone unless you have its definition. This skill gives you that safety net, plus reviewable diffs of what changed between exports.

Why This Matters

Workflows are production automation, but most portals treat them like disposable UI configuration: no backups, no change history, no review. One mis-click in the workflow editor can silently break lead routing or suppression for weeks. The v4 Automation API supports full read and create of workflow definitions, which makes a code-like lifecycle possible: export → version → diff → restore.

Prerequisites

  • A HubSpot private app access token (HUBSPOT_ACCESS_TOKEN in .env) with the automation scope (plus sensitive-data scopes if any flows touch sensitive properties)
  • Python 3.10+ with uv
  • A place to keep exports — a git repository is ideal (data/workflow-exports/ is gitignored here by default because exports may reference internal names; move them to a private repo if you want history)

Scripts

StageScriptRun with
Exportscripts/export.pyuv run skills/workflows-as-code/scripts/export.py
Restorescripts/restore.pyuv run skills/workflows-as-code/scripts/restore.py <export-file.json>

export.py lists all flows via GET /automation/v4/flows, fetches each full definition via the batch read endpoint (POST /automation/v4/flows/batch/read, falling back to per-flow GETs), and writes one JSON file per workflow plus a manifest. restore.py recreates a workflow from an export file via POST /automation/v4/flowsalways disabled, under a "(restored)" name, for review before enabling.

Execution Pattern

Stage 1: Plan

  1. Decide export cadence: before any workflow cleanup (mandatory — see /cleanup-workflows), after building new workflows, and on a schedule (monthly pairs well with /quarterly-database-cleanup).
  2. Decide where exports live long-term (private git repo recommended).

Stage 2: Before

Nothing to prepare — the export is read-only. Note the current workflow count from Automation > Workflows for comparison.

Stage 3: Execute — Export

uv run skills/workflows-as-code/scripts/export.py

Output layout:

data/workflow-exports/<YYYY-MM-DD>/
├── manifest.csv              # flowId, name, type, isEnabled, revisionId, file
├── flow-<flowId>.json        # one full definition per workflow
└── ...

To diff two exports:

diff -u data/workflow-exports/2026-06-01/flow-12345.json \
        data/workflow-exports/2026-07-01/flow-12345.json

(Timestamps and revision IDs will differ; meaningful changes show up in actions and enrollmentCriteria.)

Stage 3 (alternative): Execute — Restore

To recreate a deleted or broken workflow from an export:

uv run skills/workflows-as-code/scripts/restore.py data/workflow-exports/2026-06-01/flow-12345.json

The script strips server-assigned fields (id, revisionId, timestamps), renames the flow with a "(restored)" suffix to avoid name collisions, and creates it disabled. Review it in the UI, verify enrollment criteria and actions against the original, then rename and enable.

Stage 4: After

  1. Export: verify the manifest row count matches the portal's workflow count and spot-open one JSON file.
  2. Restore: open the restored workflow in Automation > Workflows, compare against the export, then enable.

Rollback

  • Export is read-only — nothing to roll back.
  • A restored workflow you do not want: it was created disabled; just delete it.

Technical Gotchas

  1. Updating in place requires the current revisionId. PUT /automation/v4/{flowId} must include the flow's latest revisionId and type — a stale revision is rejected. The restore script sidesteps this by creating a new flow instead of updating.
  2. Some actions round-trip imperfectly. Actions whose field shapes are undocumented (e.g., copy-from-associated-object, notification recipients) export fine but may be rejected on re-create in a different portal. The restore script reports per-action errors; add rejected actions in the UI.
  3. v3 workflow IDs are not v4 flow IDs. If you have old tooling built on /automation/v3/workflows, the v4 API provides workflowId → flowId mapping endpoints for migration. New tooling should use v4 exclusively — v3 is legacy.
  4. Sensitive-data scopes. Flows that read or set sensitive properties require the corresponding sensitive-data scopes on your private app, or reads will fail.
  5. Exports may contain internal data. Workflow names, property names, list IDs, and notification text are all in the JSON. Treat exports like configuration secrets — keep them in a private repo.

GitHub リポジトリ

TomGranot/hubspot-admin-skills
パス: skills/workflows-as-code
0
hubspothubspot-apihubspot-crmhubspot-integration
FAQ

Frequently asked questions

What is the workflows-as-code skill?

workflows-as-code is a Claude Skill by TomGranot. Skills package instructions and resources that Claude loads on demand, so Claude can perform workflows-as-code-related tasks without extra prompting.

How do I install workflows-as-code?

Use the install commands on this page: add workflows-as-code to Claude Code as a plugin, or clone its repository into your skills directory, then restart Claude so it picks up the skill.

What category does workflows-as-code belong to?

workflows-as-code is in the Meta category, tagged api and automation.

Is workflows-as-code free to use?

Yes. workflows-as-code is listed on AIMCP and free to install. It runs inside Claude, so no separate service account is required to use the skill itself.

関連スキル

content-collections
メタ

このスキルは、Content Collections(Markdown/MDXファイルを型安全なデータコレクションに変換するTypeScriptファーストのツール)の本番環境でテストされた設定を提供します。Zodバリデーションによる型安全性を実現し、ブログ、ドキュメントサイト、コンテンツ重視のVite + Reactアプリケーション構築時にご利用ください。Viteプラグインの設定、MDXコンパイルから、デプロイ最適化、スキーマバリデーションまで、すべてを網羅しています。

スキルを見る
polymarket
メタ

このスキルは、開発者がPolymarket予測市場プラットフォームを活用したアプリケーション構築を可能にします。API統合による取引や市場データの取得に加え、WebSocketを介したリアルタイムデータストリーミングにより、ライブ取引や市場活動を監視できます。取引戦略の実装や、ライブ市場更新を処理するツールの作成にご利用ください。

スキルを見る
creating-opencode-plugins
メタ

このスキルは、開発者がコマンド、ファイル、LSP操作など25種類以上のイベントタイプにフックするOpenCodeプラグインを作成することを支援します。JavaScript/TypeScriptモジュール向けに、プラグイン構造、イベントAPI仕様、および実装パターンを提供します。カスタムイベント駆動ロジックでOpenCode AIアシスタントのライフサイクルをインターセプト、監視、または拡張する必要がある場合にご利用ください。

スキルを見る
sglang
メタ

SGLangは、高性能なLLMサービングフレームワークであり、RadixAttentionプレフィックスキャッシュを活用したJSON、正規表現、エージェントワークフロー向けの高速で構造化された生成を特長とします。特にプレフィックスが繰り返されるタスクにおいて、大幅に高速な推論を実現し、複雑な構造化出力やマルチターン対話に最適です。制約付きデコードが必要な場合や、広範なプレフィックス共有を伴うアプリケーションを構築する場合は、vLLMなどの代替案ではなくSGLangを選択してください。

スキルを見る