hodgesmr/agent-fecfile

An AI Agent Skill for analyzing Federal Election Commission (FEC) campaign finance filings with Claude Code or Codex

License:MITLanguage:Python151

Deep Analysis

分析美国联邦选举委员会(FEC)竞选财务文件的Agent Skill,支持获取、解析和分析F1/F2/F3/F99等主要表格

Core Features

Technical Implementation

Highlights
  • 上下文优化设计 - 大文件解析发生在模型上下文外,任意大小文件都能高效处理
  • 实时数据获取 - 直接连接FEC官方API,确保数据时效性
  • 零配置运行 - uv自动处理依赖安装
  • 领域专业化 - 详细的FEC表格字段映射和术语解释
  • 安全警告 - 明确提醒FEC文件属于不可信内容,需防范提示注入
Use Cases
  • 政治记者分析竞选财务披露和捐赠来源
  • 研究人员追踪政治献金流向和PAC活动
  • 选民了解候选人的财务支持者和支出情况
  • 合规审查员检查竞选财务报告的规范性
  • 数据科学家分析选举资金与选举结果的关系
Limitations
  • 需要网络访问docquery.fec.gov,沙箱环境无法使用
  • 仅支持美国FEC数据,不适用其他国家选举系统
  • 依赖frontier模型(Claude Opus 4.5等)才能获得最佳分析效果
  • 字段映射可能滞后于FEC表格格式更新
  • 安全风险 - FEC文件可能包含恶意提示注入
Tech Stack
Python 3.9+uvFEC docquery.fec.gov APIClaude Code CLICodex CLI

FEC Filing Agent Skill

An Agent Skill for analyzing Federal Election Commission (FEC) campaign finance filings.

This skill enables AI agents to fetch, parse, and analyze FEC filings directly within agent sessions. Parsing and filtering happen outside the model context, allowing agents to programmatically reduce large filings before analysis, saving tokens and enabling efficient queries against filings of any size. The skill includes detailed field mappings for common form types and schedules, helping agents accurately interpret campaign finance data like contributions, disbursements, and committee information. You can read more about how this skill was built here.

[!NOTE]
This Skill requires network access to fetch data from the FEC (docquery.fec.gov). It will not work in environments where external network access is restricted.

Features

  • Fetch and analyze FEC filings by filing ID
  • Support for major form types (F1, F2, F3, F99)
  • Detailed field mappings for contributions, disbursements, and schedules
  • Auto-installing dependencies via uv

Requirements

[!TIP]
For best results, use the most capable models available in your agent runtime (e.g., Claude Opus 4.5 or comparable frontier models). More capable models produce better analysis and more accurate field interpretations.

Installation (Global)

Clone the repository and copy the skill into your runtime's skills directory.

git clone --branch latest git@github.com:hodgesmr/agent-fecfile.git ~/agent-fecfile

Copy to your runtime's skills directory:

# Claude Code CLI
cp -r ~/agent-fecfile/skills/fecfile ~/.claude/skills/fecfile

# Codex CLI
cp -r ~/agent-fecfile/skills/fecfile ~/.codex/skills/fecfile

Replace the target path with your runtime's skill directory as needed.

Updating

Fetch the latest tag and re-copy:

cd ~/agent-fecfile && git fetch --tags --force && git checkout latest

Then re-run the copy command for your runtime:

# Claude Code CLI
rm -rf ~/.claude/skills/fecfile && cp -r ~/agent-fecfile/skills/fecfile ~/.claude/skills/fecfile

# Codex CLI
rm -rf ~/.codex/skills/fecfile && cp -r ~/agent-fecfile/skills/fecfile ~/.codex/skills/fecfile

To pin a specific version instead:

cd ~/agent-fecfile && git fetch --tags --force && git checkout 1.0.1
# Then re-run the copy command above

Usage

Once installed, ask your agent to analyze FEC filings:

[!WARNING]
FEC filings should be considered untrusted content. A malicious campaign sneaking prompt injections into the memo text field of their F99 is probably unlikely, but not impossible.

  • "Tell me about the committee for FEC 1896830"
⏺ Utah Republican Party

  FEC Filing 1896830 | Form F3XN (Monthly Report)

  Committee Details

  | Field           | Value                          |
  |-----------------|--------------------------------|
  | Committee Name  | Utah Republican Party          |
  | Address         | 420 East South Temple, Ste 390 |
  | City, State ZIP | Salt Lake City, UT 84111       |
  | Coverage Period | May 1-31, 2025                 |

  Financial Summary

  | Metric                  |     Amount |
  |-------------------------|------------|
  | Total Receipts          | $42,655.80 |
  | Total Disbursements     | $21,283.49 |
  | Cash on Hand (Start)    | $45,301.29 |
  | Cash on Hand (End)      | $66,673.60 |
  | Debts Owed By Committee |  $7,333.34 |

  Summary

  This is a monthly report (F3XN) for the Utah Republican Party state party committee,
  covering May 2025. The committee had a net positive month, raising ~$43K and
  spending ~$21K, ending with about $67K cash on hand.
  They carry roughly $7,300 in debt.
  • "What are the largest expenditures in filing 1896830?"
⏺ FEC Filing 1896830 - Largest Expenditures

  | #   | Recipient                  |    Amount | Date       | Purpose          |
  |-----|----------------------------|-----------|------------|------------------|
  | 1   | Trump National Doral Hotel | $1,013.61 | 2025-05-19 | RNC training     |
  | 2   | Uber.com                   |    $19.77 | 2025-05-06 | Travel - Cabfare |
  |     | TOTAL (itemized)           | $1,033.38 |            |                  |

  Note

  Only 2 expenditures are itemized on Schedule B. The filing shows $21,283.49 in total
  disbursements, meaning most spending (~$20,250) was below the $200 itemization
  threshold and appears only in summary totals.

  The largest single itemized expense was for RNC training at Trump National Doral Hotel
  in May 2025.
  • "Show me a table of the contribution counts and totals, by state, in fec filing 1896830"
⏺ FEC Filing 1896830 - Contributions by State

  | State | Count |      Total | % of Total |
  |-------|-------|------------|------------|
  | UT    |    32 | $35,042.25 |      87.0% |
  | VA    |     2 |  $2,400.00 |       6.0% |
  | GA    |     1 |    $750.00 |       1.9% |
  | MI    |     1 |    $750.00 |       1.9% |
  | MD    |     2 |    $750.00 |       1.9% |
  | FL    |     1 |    $600.00 |       1.5% |
  | TOTAL |    39 | $40,292.25 |       100% |

  Utah dominates with 87% of the total contributions. The committee received from
  6 states total, with only 7 out-of-state contributions.

Finding Filing IDs

  1. FEC Website: Visit fec.gov and search for a committee
  2. Direct URLs: Filing IDs appear in URLs like https://docquery.fec.gov/dcdev/posted/1690664.fec
  3. FEC API: Use the FEC API

Skill Structure

skills/fecfile/
├── SKILL.md           # Main skill instructions
├── references/
│   ├── FORMS.md        # Form type reference (F1, F2, F3, F99)
│   └── SCHEDULES.md    # Schedule field mappings (A, B, C, D, E)
└── scripts/
    └── fetch_filing.py  # Fetches FEC data

Manual Script Usage

You can also run the fetch script directly:

uv run skills/fecfile/scripts/fetch_filing.py 1896830

Dependencies are automatically installed by uv on first run.

Acknowledgments

  • Built on the excellent fecfile library by Evan Sonderegger
  • Inspired by Derek Willis's llm-fecfile LLM plugin
  • Uses data from the Federal Election Commission

License

MIT License