Communitygithub.com

baronguyen001/ai-automation-skills

スケジュールスクリプトに1つのSQLiteファイルで実行間のメモリを提供します。重複排除用のシーンネットセット、中断した場所から再開するためのキー/バリューカーソル、順序を保持する新規アイテムフィルタリングを備えています。実行間の重複排除、同じアイテムの再アラート防止、最後のIDの記憶、スクレイパーの再開、cron実行間の状態の永続化に使用します。

ai-automation-skills とは?

AIエージェントがスケジュールされたスクリプトやcronジョブで、実行間の状態を永続化するためのスキルです。SQLiteファイルを利用して、重複排除(seen-set)、処理の中断・再開(カーソル)、新しいアイテムのみのフィルタリングを実現します。主なユースケースは、ニューススクレイパーでの重複アラート防止、ページネーションのあるAPIの処理再開、cronジョブの状態管理などです。`filter_new`と`mark_seen`、`set_cursor`/`get_cursor`というシンプルな関数群を提供し、コードベースに容易に統合できます。このスキルは、1つのSQLiteファイルで動作するため、追加のサーバーや依存関係が不要で、オフライン環境やリソースに制約のある環境に最適です。

対応~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/baronguyen001/ai-automation-skills/tree/HEAD/skills/sqlite-state

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

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

ドキュメント

SQLite 状態管理

このスキルは、定期的に実行されるジョブが過去の処理内容を記憶する必要がある場合に使用します。つまり、どのアイテムについて既にアラートを送信したか、最後に処理したカーソルは何か、などを記憶し、次の実行時に同じ通知を重複して送信したり、同じスクレイピングをやり直したりするのを防ぎます。標準のSQLiteファイルを使用するため、サーバーを立てたり、追加の依存関係をインストールする必要はありません。

使用すべき場合

  • 「同じものを2回通知しないで」「実行間で重複を排除して」「最後のIDを覚えて」「中断したところから再開して」といったユーザーの要望がある場合。
  • 会話内のコードが、毎回すべてを再処理するcronジョブや定期実行スクリプトである場合。

使用すべきでない場合

  • 状態が小さく、1回の実行内でのみ一時的に必要な場合。この場合、単純なsetやdictで十分です。
  • 複数のマシンが同時に状態を共有する必要がある場合。この場合は、単一ファイルではなく、実際のサーバーデータベースを使用してください。

具体例

ユーザー入力:

私のニューススクレイパーは毎時間同じ見出しを再送信します。新しいものだけを送信するようにしてください。

出力:

from state import filter_new, mark_seen

db = "news.db"
fresh = filter_new(db, [a["url"] for a in articles])   # 未処理のURLのみ
for url in fresh:
    send_alert(url)
mark_seen(db, *fresh)                                   # 次回の実行のために記憶

適用するパターン

  1. 各アイテムを、配列のインデックスではなく、一意で安定したキー(URL、ID、コンテンツのハッシュなど)で特定します。
  2. filter_new を使用して処理対象を決定し、アクションが成功した後にのみ mark_seen を呼び出します。
  3. 名前付きカーソル(set_cursor/get_cursor)を使用して進捗状況を保存し、再開可能なスクレイパーが途中から再開できるようにします。
  4. 永続的な書き込みと同時読み取りのためにWALモードを有効にします。書き込みは1つに制限します。
  5. 1つの .db ファイルをバックアップまたはバージョン管理します。これがジョブの全記憶です。

参考: assets/state.py。

ソース

作者の自動化プロジェクトにおける本番環境での使用経験から抽出されました。v1.0.0。 関連項目: [[pipeline-orchestrator]], [[cron-dispatch]], [[webhook-receiver]]。

→ Trawlkitで完全に実行可能なボットを構築します。

Individual skills in this repo

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

baronguyen001/ai-automation-skills

Schedule any script to run on a recurring schedule on Windows (Task Scheduler) or Linux (cron) - register, list, and remove jobs from one command, with logging to a file and a guard against overlapping runs. Use for schedule a script, run nightly, set up a cron job, windows task scheduler, or run on a timer.

baronguyen001/ai-automation-skills

Turn a run's list of result dicts into a schema'd CSV and a Markdown table from one column spec - declare columns once, emit both, with stable ordering and safe escaping, stdlib only, no pandas. Use when the user asks to write results to CSV, export a report, make a markdown summary table, or save a run's output as a spreadsheet.

baronguyen001/ai-automation-skills

Strip HTML to clean plain text with the standard library only (no BeautifulSoup/lxml): drops script/style, turns block tags into line breaks, and collapses whitespace. Use when the user wants readable text from an HTML page/email, to clean scraped HTML before sending it to an LLM, or to build a text index from web content.

baronguyen001/ai-automation-skills

Persist records between scheduled runs as append-only JSON Lines (one object per line) with streaming reads and optional key-based dedup, stdlib only. Use when the user wants to log run results to JSONL, append events to a file, dedup records by id across runs, or keep a simple durable history without a database.

baronguyen001/ai-automation-skills

Extract text and simple table-like rows from a PDF for downstream AI without OCR binaries. Use when the user asks to read a PDF, turn a PDF into text, pull simple tables from statements/reports, or feed PDF content into an LLM pipeline.

baronguyen001/ai-automation-skills

Rotate a pool of HTTP/SOCKS proxies with round-robin selection, failure tracking, and a cooldown that benches dead proxies before retrying. BYO proxy list via env - none are shipped. Use for rotate proxies, spread requests across proxies, avoid IP bans, retry through a different proxy, or proxy health check.

baronguyen001/ai-automation-skills

Parse an RSS 2.0 or Atom feed into normalized item dicts (title, link, id, published, summary) with the standard library only - no feedparser. Use when the user asks to read an RSS/Atom feed, poll a blog/news feed, extract feed entries, or watch a site that publishes a feed.

baronguyen001/ai-automation-skills

Upload and download run artifacts from S3-compatible storage with BYO bucket and credentials from env. Use when the user asks to store scraper output, archive reports, publish artifacts to object storage, fetch a prior run file, or use MinIO/R2/Spaces/S3 without hardcoding credentials.

baronguyen001/ai-automation-skills

Draft a short-form TikTok/Reels/Shorts or long-form video script from a topic and creator persona file - hook variants, beat-structured body, CTA, b-roll cues, caption overlays, and [STORY]/[NUMBER] slots so the model never fabricates personal facts. Use for write a video script, tiktok script, youtube script, or /shortform-script.

関連スキル