Communitygithub.com

baronguyen001/ai-automation-skills

実行結果の辞書リストを、スキーマ定義されたCSVとMarkdownテーブルに変換します。列定義を一度記述するだけで、安定した順序と安全なエスケープ処理で両方の出力を生成。pandas不要、標準ライブラリのみで動作します。ユーザーが結果をCSVに書き出したり、レポートをエクスポートしたり、Markdownのサマリテーブルを作成したいときに使用します。

ai-automation-skills とは?

このスキルは、AIエージェントがジョブの実行結果(`list[dict]`形式)を、整形式のCSVファイルとMarkdownテーブルの両方に変換するための標準化された方法を提供します。最大の利点は、列定義(キー、ヘッダー、オプションのフォーマッター)を一度宣言するだけで、両方の出力が常に同期される点です。これにより、CSVとMarkdownテーブルで列の順序やヘッダーが食い違うというミスを防げます。内部ではPythonの標準ライブラリ(`csv`モジュールなど)のみを使用し、pandasやnumpyのような重たい依存関係は不要です。フォーマッター関数を指定することで、数値の通貨表示や丸めなどを柔軟に制御でき、欠損キーは空セルとして安全に処理されます。Claude CodeやCodexなどのコーディングエージェントに組み込んで、レポート生成やスプレッドシートエクスポートのタスクを自動化するのに適しています。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/baronguyen001/ai-automation-skills/tree/HEAD/skills/csv-report-writer

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

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

ドキュメント

CSVレポートライター

このスキルは、ジョブが結果行のリストを生成し、スプレッドシート用の整形式CSVと、PRコメントやTelegramダイジェスト用のMarkdownテーブルの両方が必要な場合に使用します。単一の列定義から両方を生成するので、二つの出力がずれることはありません。列(キー、ヘッダー、オプションのフォーマッター)を一度宣言するだけで、ヘルパーが安定した列順序、適切なCSV引用符、Markdown用のパイプエスケープ処理を施した両方を出力します。pandasは不要です。

呼び出しタイミング

  • ユーザーが「結果をCSVに書き出して」「レポートをエクスポートして」「これのMarkdownテーブルを作って」「実行結果をスプレッドシートとして保存して」と依頼したとき。
  • 会話内のコードにlist[dict](またはオブジェクトのリスト)があり、現在アドホックにprintしているとき。

呼び出してはいけないタイミング

  • データに本当のデータフレーム処理(結合、グループ化、ピボット)が必要な場合。その場合はpandas/polarsを使用してください。
  • 単一のスカラー結果の場合。CSV/テーブルは過剰です。

具体的な例

ユーザー入力:

スキャンしたトークンのリストがあり、スコアと価格が含まれています。CSVを保存し、Telegramダイジェスト用のMarkdownテーブルもください。

出力:

# assets/report.py をプロジェクトにコピーしてから:
from report import Column, write_csv, to_markdown

columns = [
    Column("symbol", "シンボル"),
    Column("score", "スコア", fmt=lambda v: f"{v:.1f}"),
    Column("price_usd", "価格", fmt=lambda v: f"${v:,.4f}"),
]
rows = [
    {"symbol": "ABC", "score": 8.4, "price_usd": 0.0123},
    {"symbol": "XYZ", "score": 6.1, "price_usd": 1.5},
]

write_csv("scan.csv", columns, rows)        # スキーマ定義されたCSV、安定した列順序
print(to_markdown(columns, rows))           # 同じ列でMarkdownテーブル

両方の出力はまったく同じ列をまったく同じ順序で使用するため、CSVとダイジェストテーブルは常に一致します。

適用するパターン

  1. 各Column(key, header, fmt=...)を一度だけ宣言します。両方のライターが同じリストを消費するため、ヘッダーと順序が同期し続けます。
  2. 列の順序を安定かつ明示的に保ちます。任意の行のdict挿入順序に依存しないでください。
  3. fmtコールバックに表示(通貨、丸め)を任せ、生の値は行のdictに保持します。
  4. 正しい引用のためにcsv.writerを使用し、Markdownテーブルでは|と改行をエスケープしてレイアウトが壊れないようにします。
  5. キーが欠けている場合はクラッシュせずに空セルとして扱い、部分的な行でもレポート可能にします。

参考:assets/report.py。

ソース

作者の自動化プロジェクトにおける実運用から抽出。v1.0.0。 関連項目:[[pr-body-formatter]]、[[sqlite-state]]、[[telegram-alerter]]。

→ 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

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.

baronguyen001/ai-automation-skills

Give scheduled scripts memory between runs with one SQLite file - a seen-set for dedup, a key/value cursor to resume where you left off, and order-preserving new-item filtering. Use for dedup across runs, don't re-alert the same item, remember the last id, resume a scraper, or persist state between cron runs.

関連スキル