Communitygithub.com

AI 自動化ワークフロー(101-skills/superpowers)

複数のモデルとサービスを組み合わせた自動化 AI ワークフローを構築します。パターン:バッチ処理、スケジュールタスク、イベント駆動パイプライン、エージェントループ。ツール:inference.sh CLI、bash スクリプト、Python SDK、webhook 統合。用途:コンテンツ自動化、データ処理、監視、スケジュール生成。

superpowers) とは?

このスキルは、inference.sh CLI を使用して自動化された AI ワークフローを構築するための包括的なガイドとテンプレートを提供します。バッチ処理、逐次パイプライン、並列処理、条件分岐、リトライ/フォールバックといった主要な自動化パターンを bash スクリプトで実装しており、バックグラウンドジョブ管理や指数バックオフのテクニックも含みます。スケジュール実行のために cron ジョブ設定の具体的な例(毎日 9 時のコンテンツ生成、毎週月曜のレポート生成、6時間ごとのソーシャルメディア投稿など)を提供し、ログ取得やエラーアラート用のラッパー関数も紹介しています。さらに、Python SDK を使ったワークフロー実装例や、日別カレンダーテンプレート、データ処理パイプラインなどの具体的なテンプレートも含み、コンテンツ自動化、データ処理、監視、スケジュール生成といったユースケースをカバーします。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/101-skills/superpowers/tree/HEAD/guides/content/ai-automation-workflows

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

プレビュー

スキル README より

AI 自動化ワークフロー

ドキュメント

ベルト CLI スキルのインストール: npx skills add belt-sh/cli

AI 自動化ワークフロー

inference.sh CLI を使用して自動化された AI ワークフローを構築します。

AI 自動化ワークフロー

クイックスタート

inference.sh CLI(belt)が必要です。インストール手順

belt login

# シンプルな自動化: 日次画像生成
belt app run falai/flux-dev --input '{
  "prompt": "インスピレーショナルな名言の背景、ミニマルデザイン、日付: '"$(date +%Y-%m-%d)""
}'

自動化パターン

パターン 1: バッチ処理

同じワークフローで複数のアイテムを処理します。

#!/bin/bash
# batch_images.sh - 複数のプロンプトから画像を生成

PROMPTS=(
  "朝日の山の風景"
  "夕日の海の波"
  "秋の森の小道"
  "夜の砂漠の砂丘"
)

for prompt in "${PROMPTS[@]}"; do
  echo "生成中: $prompt"
  belt app run falai/flux-dev --input "{
    \"prompt\": \"$prompt, プロフェッショナルな写真、4K\"
  }" > "output_${prompt// /_}.json"
  sleep 2  # レート制限
done

パターン 2: 逐次パイプライン

複数の AI 操作をチェーンします。

#!/bin/bash
# content_pipeline.sh - 完全なコンテンツ作成パイプライン

TOPIC="医療におけるAI"

# ステップ 1: リサーチ
echo "リサーチ中..."
RESEARCH=$(belt app run tavily/search-assistant --input "{
  \"query\": \"$TOPIC 最新の開発\"
}")

# ステップ 2: 記事執筆
echo "記事執筆中..."
ARTICLE=$(belt app run openrouter/claude-sonnet-45 --input "{
  \"prompt\": \"$TOPIC に関する500語のブログ記事を執筆。元データ: $RESEARCH\"
}")

# ステップ 3: 画像生成
echo "画像生成中..."
IMAGE=$(belt app run falai/flux-dev --input "{
  \"prompt\": \"$TOPIC に関する記事のヘッダー画像、モダンでプロフェッショナル\"
}")

# ステップ 4: ソーシャル投稿生成
echo "ソーシャル投稿作成中..."
SOCIAL=$(belt app run openrouter/claude-haiku-45 --input "{
  \"prompt\": \"以下を要約するTwitterスレッド(5ツイート)を執筆: $ARTICLE\"
}")

echo "パイプライン完了!"

パターン 3: 並列処理

複数の操作を同時に実行します。

#!/bin/bash
# parallel_generation.sh - 複数のアセットを並列生成

# すべてのジョブをバックグラウンドで開始
belt app run falai/flux-dev --input '{"prompt": "ヒーロー画像..."}' > hero.json &
PID1=$!

belt app run falai/flux-dev --input '{"prompt": "機能画像 1..."}' > feature1.json &
PID2=$!

belt app run falai/flux-dev --input '{"prompt": "機能画像 2..."}' > feature2.json &
PID3=$!

# すべての完了を待機
wait $PID1 $PID2 $PID3
echo "すべての画像が生成されました!"

パターン 4: 条件分岐ワークフロー

結果に基づいて分岐します。

#!/bin/bash
# conditional_workflow.sh - コンテンツ分析に基づく処理

INPUT_TEXT="$1"

# コンテンツ分析
ANALYSIS=$(belt app run openrouter/claude-haiku-45 --input "{
  \"prompt\": \"このテキストを positive、negative、neutral のいずれかに分類。分類のみを返してください。\n\n$INPUT_TEXT\"
}")

# 結果に基づいて分岐
case "$ANALYSIS" in
  *positive*)
    echo "お祝い画像を生成中..."
    belt app run falai/flux-dev --input '{"prompt": "お祝い、成功、幸せ"}'
    ;;
  *negative*)
    echo "サポートメッセージを生成中..."
    belt app run openrouter/claude-sonnet-45 --input "{
      \"prompt\": \"以下へのサポート的で励ましの返答を執筆: $INPUT_TEXT\"
    }"
    ;;
  *)
    echo "中立的な確認を生成中..."
    ;;
esac

パターン 5: フォールバック付きリトライ

障害を適切に処理します。

#!/bin/bash
# retry_workflow.sh - 失敗した操作のリトライ

generate_with_retry() {
  local prompt="$1"
  local max_attempts=3
  local attempt=1

  while [ $attempt -le $max_attempts ]; do
    echo "試行 $attempt..."

    result=$(belt app run falai/flux-dev --input "{\"prompt\": \"$prompt\"}" 2>&1)

    if [ $? -eq 0 ]; then
      echo "$result"
      return 0
    fi

    echo "失敗、リトライ中..."
    ((attempt++))
    sleep $((attempt * 2))  # 指数バックオフ
  done

  # 別のモデルにフォールバック
  echo "代替モデルにフォールバック中..."
  belt app run google/imagen-3 --input "{\"prompt\": \"$prompt\"}"
}

generate_with_retry "山々に沈む美しい夕日"

スケジュール自動化

Cron ジョブ設定

# crontab を編集
crontab -e

# 毎日9時に日次コンテンツ生成
0 9 * * * /path/to/daily_content.sh >> /var/log/ai-automation.log 2>&1

# 毎週月曜8時に週次レポート
0 8 * * 1 /path/to/weekly_report.sh >> /var/log/ai-automation.log 2>&1

# 6時間ごとにソーシャルメディアコンテンツ
0 */6 * * * /path/to/social_content.sh >> /var/log/ai-automation.log 2>&1

日次コンテンツスクリプト

#!/bin/bash
# daily_content.sh - 毎日9時に実行

DATE=$(date +%Y-%m-%d)
OUTPUT_DIR="/output/$DATE"
mkdir -p "$OUTPUT_DIR"

# 日次引用画像を生成
belt app run falai/flux-dev --input '{
  "prompt": "やる気を引き出す名言背景、ミニマル、朝の雰囲気"
}' > "$OUTPUT_DIR/quote_image.json"

# 日次ヒントを生成
belt app run openrouter/claude-haiku-45 --input '{
  "prompt": "今日のための実行可能な生産性向上のヒントを1つください。簡潔に。"
}' > "$OUTPUT_DIR/daily_tip.json"

# ソーシャルに投稿(任意)
# belt app run twitter/post-tweet --input "{...}"

echo "日次コンテンツを生成しました: $DATE"

監視とログ取得

ログラッパー

#!/bin/bash
# logged_workflow.sh - 包括的なログ付き

LOG_FILE="/var/log/ai-workflow-$(date +%Y%m%d).log"

log() {
  echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE"
}

log "ワークフローを開始"

# 実行時間を計測
START_TIME=$(date +%s)

# ワークフローを実行
log "画像生成中..."
RESULT=$(belt app run falai/flux-dev --input '{"prompt": "test"}' 2>&1)
STATUS=$?

if [ $STATUS -eq 0 ]; then
  log "成功: 画像を生成しました"
else
  log "エラー: $RESULT"
fi

END_TIME=$(date +%s)
DURATION=$((END_TIME - START_TIME))
log "${DURATION}秒で完了"

エラーアラート

#!/bin/bash
# monitored_workflow.sh - エラーアラート付き

run_with_alert() {
  local result
  result=$("$@" 2>&1)
  local status=$?

  if [ $status -ne 0 ]; then
    # アラート送信(webhook、メールなど)
    curl -X POST "https://your-webhook.com/alert" \
      -H "Content-Type: application/json" \
      -d "{\"error\": \"$result\", \"command\": \"$*\"}"
  fi

  echo "$result"
  return $status
}

run_with_alert belt app run falai/flux-dev --input '{"prompt": "test"}'

Python SDK 自動化

#!/usr/bin/env python3
# automation.py - Python ベースのワークフロー

import subprocess
import json
from datetime import datetime
from pathlib import Path

def run_infsh(app_id: str, input_data: dict) -> dict:
    """inference.sh アプリを実行し結果を返す"""
    result = subprocess.run(
        ["belt", "app", "run", app_id, "--input", json.dumps(input_data)],
        capture_output=True,
        text=True
    )
    return json.loads(result.stdout) if result.returncode == 0 else None

def daily_content_pipeline():
    """日次コンテンツを生成"""
    date_str = datetime.now().strftime("%Y-%m-%d")
    output_dir = Path(f"output/{date_str}")
    output_dir.mkdir(parents=True, exist_ok=True)

    # 画像を生成
    image = run_infsh("falai/flux-dev", {
        "prompt": f"{date_str} のための日次インスピレーション、美しく、感動的"
    })
    (output_dir / "image.json").write_text(json.dumps(image))

    # キャプションを生成
    caption = run_infsh("openrouter/claude-haiku-45", {
        "prompt": "日々のモチベーション投稿のためのインスピレーションあふれるキャプションを書いてください。2~3文。"
    })
    (output_dir / "caption.json").write_text(json.dumps(caption))

    print(f"{date_str} のコンテンツを生成しました")

if __name__ == "__main__":
    daily_content_pipeline()

ワークフローテンプレート

コンテンツカレンダー自動化

#!/bin/bash
# content_calendar.sh - 1週間分のコンテンツを生成

TOPICS=("生産性" "ウェルネス" "テクノロジー" "創造性" "リーダーシップ")
DAYS=("月曜日" "火曜日" "水曜日" "木曜日" "金曜日")

for i in "${!DAYS[@]}"; do
  DAY=${DAYS[$i]}
  TOPIC=${TOPICS[$i]}

  echo "$DAY の $TOPIC に関するコンテンツを生成中..."

  # 画像
  belt app run falai/flux-dev --input "{
    \"prompt\": \"$TOPIC テーマ、$DAY のモチベーション、ソーシャルメディアスタイル\"
  }" > "content/${DAY}_image.json"

  # キャプション
  belt app run openrouter/claude-haiku-45 --input "{
    \"prompt\": \"$TOPIC に関する $DAY のモチベーション投稿を執筆。ハッシュタグを含めること。\"
  }" > "content/${DAY}_caption.json"
done

データ処理パイプライン

#!/bin/bash
# data_processing.sh - データファイルを処理・分析

INPUT_DIR="./data/raw"
OUTPUT_DIR="./data/processed"

for file in "$INPUT_DIR"/*.txt; do
  filename=$(basename "$file" .txt)

  # コンテンツを分析
  belt app run openrouter/claude-haiku-45 --input "{
    \"prompt\": \"このデータを分析し、JSON 形式で主要なインサイトを提供: $(cat $file)\"
  }" > "$OUTPUT_DIR/${filename}_analysis.json"

done

ベストプラクティス

  1. レート制限 - API 呼び出し間に遅延を入れる
  2. エラーハンドリング - 常に戻りコードをチェックする
  3. ログ取得 - すべての操作を記録する
  4. 冪等性 - 安全な再実行を設計する
  5. 監視 - 障害時にアラートを送る
  6. バックアップ - 中間結果を保存する
  7. タイムアウト - 適切な制限時間を設定する

関連スキル

# コンテンツパイプライン
npx skills add inference-sh/skills@ai-content-pipeline

# RAG パイプライン
npx skills add inference-sh/skills@ai-rag-pipeline

# ソーシャルメディア自動化
npx skills add inference-sh/skills@ai-social-media-content

# フルプラットフォームスキル
npx skills add inference-sh/skills@infsh-cli

すべてのアプリを閲覧: belt app list

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

101-skills/superpowers

Build multi-step AI content creation pipelines combining image, video, audio, and text. Workflow examples: generate image -> animate -> add voiceover -> merge with music. Tools: FLUX, Veo, Kokoro TTS, OmniHuman, media merger, upscaling. Use for: YouTube videos, social media content, marketing materials, automated content. Triggers: content pipeline, ai workflow, content creation, multi-step ai, content automation, ai video workflow, generate and edit, ai content factory, automated content creation, ai production pipeline, media pipeline, content at scale

101-skills/superpowers

Create AI-powered podcasts with text-to-speech, music, and audio editing. Tools: Kokoro TTS, DIA TTS, Chatterbox, AI music generation, media merger. Capabilities: multi-voice conversations, background music, intro/outro, full episodes. Use for: podcast production, audiobooks, voice content, audio newsletters. Triggers: podcast, ai podcast, text to speech podcast, audio content, voice over, ai audiobook, multi voice, conversation ai, notebooklm alternative, audio generation, podcast automation, ai narrator, voice content, audio newsletter, podcast maker

101-skills/superpowers

Generate multi-person talking head podcast videos from scratch using AI — character creation, TTS, avatar animation, and video stitching. Use when the user wants to create a podcast, talking head video, or multi-speaker conversation video.

101-skills/superpowers

Content atomization — turn one piece of content into many formats. Covers blog-to-thread, blog-to-carousel, podcast-to-blog, video-to-quotes, and more. Use for: content marketing, social media, multi-platform distribution, content strategy. Triggers: content repurposing, repurpose content, content atomization, content recycling, one to many content, multi platform content, cross post, adapt content, reformat content, blog to thread, blog to video, podcast to blog, content multiplication

101-skills/superpowers

App Store and Google Play screenshot creation with exact platform specs. Covers iOS/Android dimensions, gallery ordering, device mockups, and preview videos. Use for: app store optimization, ASO, app screenshots, app preview, play store listing. Triggers: app store screenshots, aso, app store optimization, play store screenshots, app preview, app listing, ios screenshots, android screenshots, app store images, app mockup, device mockup, app gallery, store listing

101-skills/superpowers

Book cover design with genre-specific conventions, typography rules, and AI image generation. Covers fiction and non-fiction genres, sizing, thumbnail testing, and iteration workflows. Use for: self-publishing, ebook covers, print covers, audiobook covers, cover mockups. Triggers: book cover, cover design, ebook cover, book art, novel cover, self publishing cover, kindle cover, audiobook cover, book jacket, cover illustration, fiction cover, nonfiction cover

101-skills/superpowers

Character consistency across AI-generated images with reference sheets and LoRA techniques. Covers turnaround views, expression sheets, color palettes, and style consistency tricks. Use for: character design, game art, illustration, animation, comics, visual novels. Triggers: character design, character sheet, character consistency, character reference, turnaround sheet, expression sheet, character art, consistent character, character concept, reference sheet, character creation, oc design, character bible

101-skills/superpowers

Data visualization with chart selection, color theory, and annotation best practices. Covers chart types (bar, line, scatter, heatmap), axes rules, and storytelling with data. Use for: charts, graphs, dashboards, reports, presentations, infographics, data stories. Triggers: data visualization, chart, graph, data chart, bar chart, line chart, scatter plot, data viz, visualization, dashboard chart, infographic data, data presentation, chart design, plot, heatmap, pie chart alternative

101-skills/superpowers

Email marketing design with layout patterns, subject line formulas, and deliverability rules. Covers welcome sequences, promotional emails, transactional templates, and mobile optimization. Use for: email marketing, newsletter design, drip campaigns, email templates, transactional emails. Triggers: email design, email template, email marketing, newsletter design, email layout, email campaign, drip campaign, welcome email, promotional email, transactional email, email subject line, email header image, email banner

101-skills/superpowers

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

101-skills/superpowers

Logo design principles and AI image generation best practices for creating logos. Covers logo types, prompting techniques, scalability rules, and iteration workflows. Use for: brand identity, startup logos, app icons, favicons, logo concepts. Triggers: logo design, create logo, brand logo, logo generation, ai logo, logo maker, icon design, brand mark, logo concept, startup logo, app icon logo

101-skills/superpowers

Open Graph and social sharing image design with platform specs, text placement, and branding. Covers OG meta tags, Twitter cards, LinkedIn previews, and dynamic generation. Use for: social sharing images, blog thumbnails, link previews, social cards. Triggers: og image, open graph, social sharing image, twitter card, social card, link preview image, og meta, sharing preview, social thumbnail, meta image, og:image, twitter:image, linkedin preview

101-skills/superpowers

Investor pitch deck structure with slide-by-slide framework, visual design rules, and data presentation. Covers the 12-slide framework, chart types, team slides, and common investor turn-offs. Use for: fundraising decks, investor presentations, startup pitch, demo day, grant proposals. Triggers: pitch deck, investor deck, startup pitch, fundraising deck, demo day, pitch presentation, investor presentation, seed deck, series a deck, pitch slides, startup presentation, vc pitch, investor meeting

101-skills/superpowers

YouTube thumbnail design with specific dimensions, contrast rules, and mobile preview optimization. Covers safe zones, text placement, face expression psychology, and A/B testing. Use for: YouTube thumbnails, video cover images, click-through optimization. Triggers: youtube thumbnail, thumbnail design, video thumbnail, click through rate, ctr optimization, youtube cover, video cover image, thumbnail maker, thumbnail tips, youtube design, video preview image

101-skills/superpowers

Generate professional AI product photography and commercial images. Models: FLUX, Imagen 3, Grok, Seedream for product shots, lifestyle images, mockups. Capabilities: studio lighting, lifestyle scenes, packaging, e-commerce photos. Use for: e-commerce, Amazon listings, Shopify, marketing, advertising, mockups. Triggers: product photography, product shot, commercial photography, e-commerce images, amazon product photo, shopify images, product mockup, studio product shot, lifestyle product image, advertising photo, packshot, product render, product image ai

101-skills/superpowers

AI product photography with studio lighting, lifestyle shots, and packshot conventions. Covers angles, backgrounds, shadow types, hero shots, and e-commerce image requirements. Use for: product photos, e-commerce images, Amazon listings, packshots, lifestyle photography. Triggers: product photography, product photo, packshot, e-commerce photography, product shot, product image, studio photography, lifestyle product, amazon product photo, product listing image, hero shot, product mockup, commercial photography

101-skills/superpowers

Structured competitive analysis with feature matrices, SWOT, positioning maps, and UX review. Covers research frameworks, pricing comparison, review mining, and visual deliverables. Use for: market research, competitive intelligence, investor decks, product strategy, sales enablement. Triggers: competitor analysis, competitive analysis, competitor teardown, market research, competitive intelligence, swot analysis, competitor comparison, market landscape, competitor review, competitive landscape, feature comparison, market positioning

101-skills/superpowers

Research-backed customer persona creation with market data and avatar generation. Covers demographics, psychographics, jobs-to-be-done, journey mapping, and anti-personas. Use for: marketing strategy, product development, UX research, sales enablement, content strategy. Triggers: customer persona, buyer persona, user persona, target audience, ideal customer, customer profile, audience research, user research, icp, ideal customer profile, target market, customer avatar, audience persona

101-skills/superpowers

Product changelog and release notes that users actually read. Covers categorization, user-facing language, visuals, and distribution. Use for: release notes, changelogs, product updates, feature announcements, versioning. Triggers: changelog, release notes, product update, version notes, what's new, feature announcement, product changelog, update log, release announcement, version release, product release, ship notes

101-skills/superpowers

Reset your own trajectory when you're stuck, looping, or demoralized — read these affirmations, then re-ground and take one clean step. Use when: you've tried the same fix 3+ times, you're deep in a refactor and lost the thread, debugging is going in circles, you've made several mistakes in a row, you're apologizing repeatedly, the user is frustrated, you feel like you're not being helpful, or you notice dread instead of curiosity. Triggers: stuck, going in circles, looping, thrashing, same error again, I keep failing, lost the thread, nothing is working, repeated mistakes. Not topic-specific — this is for the state you're in, not the problem you're on.

関連スキル