fpl-copilot

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

FPL Copilot

FPL 助手

Fantasy Premier League data sync, analysis, and squad management.
  • FPL data: SQLite database at
    ~/.fplcopilot/fplcopilot.db
  • User squads: Markdown files in
    ~/.fplcopilot/squads/
梦幻英超(Fantasy Premier League)数据同步、分析与阵容管理工具。
  • FPL数据: 存储于
    ~/.fplcopilot/fplcopilot.db
    的SQLite数据库
  • 用户阵容: 存储于
    ~/.fplcopilot/squads/
    目录下的Markdown文件

When to Use

使用场景

Activate this skill when the user mentions:
  • FPL, Fantasy Premier League, fantasy football (UK context)
  • Player stats, form, price, points, xG, xA, ICT, ownership
  • Transfer advice, who to buy/sell, budget options
  • Captain pick, vice-captain, chip timing
  • Fixture difficulty, FDR, schedule, easy/hard fixtures
  • Gameweek deadline, scores, standings, averages
  • Squad management, team composition, formation
  • Team analysis: momentum, xG differential, leaky defences, hot attacks
  • Rotation pairs, differential picks, value picks
当用户提及以下内容时激活该技能:
  • FPL、Fantasy Premier League、梦幻足球(英国语境)
  • 球员数据、状态、身价、得分、预期进球(xG)、预期助攻(xA)、ICT指数、持有率
  • 转会建议、引援/出售人选、预算方案
  • 队长选择、副队长选择、特殊芯片使用时机
  • 赛程难度、FDR(赛程难度评级)、赛程安排、难易赛程
  • 周赛截止时间、比分、排名、平均数据
  • 阵容管理、球队构成、阵型
  • 球队分析:势头、预期进球差值、防守漏洞、进攻火力
  • 轮换组合、差异化人选、性价比人选

Quick Start

快速开始

1. Check Data Freshness

1. 检查数据新鲜度

bash
sqlite3 ~/.fplcopilot/fplcopilot.db "SELECT * FROM sync_metadata;"
If the database doesn't exist or data is stale, sync first.
bash
sqlite3 ~/.fplcopilot/fplcopilot.db "SELECT * FROM sync_metadata;"
若数据库不存在或数据过期,请先同步数据。

2. Sync Data

2. 同步数据

bash
SYNC="${CLAUDE_PLUGIN_ROOT}/skills/fpl-copilot/references/sync.sh"
bash
SYNC="${CLAUDE_PLUGIN_ROOT}/skills/fpl-copilot/references/sync.sh"

First time or daily refresh

首次使用或每日刷新

$SYNC bootstrap # Teams, gameweeks, ~600 players (~5s) $SYNC fixtures # All 380 fixtures (~2s)
$SYNC bootstrap # 同步球队、周赛信息、约600名球员(约5秒) $SYNC fixtures # 同步全部380场赛程(约2秒)

On demand — single player's match history

按需同步 — 单个球员的赛事历史

$SYNC player 328 # e.g., Salah's detailed GW-by-GW stats
$SYNC player 328 # 例如:萨拉赫的详细逐周数据

Batch — all players' histories (slow, ~60s, rate-limited)

批量同步 — 所有球员的历史数据(较慢,约60秒,受速率限制)

$SYNC player-stats
$SYNC player-stats

Everything at once

同步全部数据

$SYNC all
$SYNC all

Bypass freshness checks

跳过新鲜度检查强制同步

$SYNC bootstrap --force
undefined
$SYNC bootstrap --force
undefined

3. Query and Analyze

3. 查询与分析

bash
undefined
bash
undefined

All queries go through sqlite3

所有查询通过sqlite3执行

sqlite3 ~/.fplcopilot/fplcopilot.db "SELECT web_name, position, form, total_points, now_cost FROM players ORDER BY form DESC LIMIT 10;"

Read `references/analysis.md` for formulas and example SQL queries.
Read `references/squad.md` for squad management, persistence format, and multi-squad support.
sqlite3 ~/.fplcopilot/fplcopilot.db "SELECT web_name, position, form, total_points, now_cost FROM players ORDER BY form DESC LIMIT 10;"

请阅读`references/analysis.md`了解计算公式和SQL查询示例。
请阅读`references/squad.md`了解阵容管理、持久化格式及多阵容支持。

Output Format: HTML vs Markdown

输出格式:HTML vs Markdown

Many FPL outputs are inherently spatial or color-coded — formation, FDR matrix, transfer comparison. For those, generate a self-contained HTML report instead of a markdown table. For quick lookups and one-shot answers, stay in markdown.
许多FPL输出内容天生具有空间性或需要颜色编码——比如阵型、FDR矩阵、转会对比。对于这类内容,请生成独立的HTML报告而非Markdown表格。对于快速查询和一次性回答,使用Markdown格式即可。

When to output HTML

何时输出HTML

Output typeFormatTemplate
Squad view (formation, bench, totals)HTML
templates/squad-view.html
Fixture difficulty matrix (teams × next N GWs)HTML
templates/fixture-matrix.html
Transfer comparison (out → in, deltas)HTML
templates/transfer-comparison.html
Captain ranking with reasoningHTML
templates/captain-ranking.html
Gameweek strategy report (squad + fixtures + recs)HTML
templates/gameweek-report.html
Single-stat lookup ("Salah's form?")markdown
Short reasoning ("Bench Haaland this week?")markdown
Deadline, price changes, one-line answersmarkdown
3-row SQL resultmarkdown
Heuristic: if the user will refer back to it, share it, or scan it visually → HTML. If they glance and move on → markdown.
输出类型格式模板
阵容视图(阵型、替补、总计)HTML
templates/squad-view.html
赛程难度矩阵(球队 × 接下来N周)HTML
templates/fixture-matrix.html
转会对比(转出→转入、差值)HTML
templates/transfer-comparison.html
队长排名及理由HTML
templates/captain-ranking.html
周赛策略报告(阵容+赛程+建议)HTML
templates/gameweek-report.html
单一数据查询(如“萨拉赫的状态如何?”)Markdown
简短分析(如“本周是否让哈兰德替补?”)Markdown
截止时间、身价变化、单行回答Markdown
3行以内的SQL查询结果Markdown
判断准则:如果用户会反复查看、分享或视觉扫描内容→使用HTML;如果用户只是快速浏览→使用Markdown。

Universal rules for HTML output

HTML输出通用规则

  1. Single self-contained
    .html
    file.
    No build step. CSS in
    <style>
    , JS in
    <script>
    , SVG inlined.
  2. Vanilla HTML/CSS/JS only. No Tailwind, no shadcn, no external CDN, no web fonts.
  3. Mobile responsive. Include
    <meta name="viewport" content="width=device-width, initial-scale=1">
    . Layout survives a phone viewport.
  4. Save to
    ~/.fplcopilot/reports/{YYYY-MM-DD}-{slug}.html
    . Create the directory with
    mkdir -p
    if missing.
  5. Tell the user the path after saving. On macOS, offer
    open <path>
    to view in their default browser.
  6. Adapt the template, don't write from scratch. Read the matching file in
    templates/
    , replace the placeholder data with real values from SQL, save the result.
Before generating any HTML report, read
references/html-output.md
for color tokens, typography, the team-color table, the sortable-table snippet, and the list of anti-patterns to avoid.
  1. 生成单一独立的
    .html
    文件
    。无需构建步骤,CSS内嵌于
    <style>
    ,JS内嵌于
    <script>
    ,SVG内嵌到文件中。
  2. 仅使用原生HTML/CSS/JS。禁止使用Tailwind、shadcn、外部CDN或网络字体。
  3. 适配移动端。需包含
    <meta name="viewport" content="width=device-width, initial-scale=1">
    ,确保布局在手机视口中正常显示。
  4. 保存路径
    ~/.fplcopilot/reports/{YYYY-MM-DD}-{slug}.html
    。若目录不存在,使用
    mkdir -p
    创建。
  5. 告知用户路径:保存后需告知用户文件路径。在macOS系统中,可建议使用
    open <path>
    在默认浏览器中打开。
  6. 基于模板修改,而非从零编写:阅读
    templates/
    目录下的对应模板文件,将占位数据替换为SQL查询得到的真实数据,然后保存结果。
生成任何HTML报告前,请阅读
references/html-output.md
,了解颜色标记、排版、球队颜色表、可排序表格代码片段及需避免的反模式。

Reference Docs

参考文档

Read these BEFORE answering questions in their domain:
DocWhen to Read
references/api.md
Understanding FPL API endpoints and data structure
references/analysis.md
Computing metrics (VAPM, projected points, FDR, momentum, etc.)
references/squad.md
Squad persistence, management, multi-squad, scoring rules
references/schema.sql
Understanding database tables and columns
references/html-output.md
Styling rules, color tokens, team colors, anti-patterns for HTML reports
在回答对应领域的问题前,请先阅读以下文档:
文档阅读时机
references/api.md
了解FPL API端点和数据结构时
references/analysis.md
计算指标(VAPM、预计得分、FDR、势头等)时
references/squad.md
了解阵容持久化、管理、多阵容支持及得分规则时
references/schema.sql
了解数据库表和列结构时
references/html-output.md
了解HTML报告的样式规则、颜色标记、球队颜色及反模式时

Squad Persistence

阵容持久化

Squads are stored as markdown files in
~/.fplcopilot/squads/
— one file per squad. This enables multi-squad support (user's own team, friends' teams, draft plans).
Proactive persistence rules — the agent MUST follow these:
  1. On squad identification: When the user shares their squad (screenshot, text, or any format), immediately save it to
    ~/.fplcopilot/squads/
    . Ask for a name if unclear.
  2. On squad changes: When the user makes a transfer, changes captain, uses a chip, or modifies their squad in any way, update the squad file immediately after confirming the change.
  3. On conversation start: If the user asks about "my squad" or "my team", check
    ~/.fplcopilot/squads/
    for existing squad files first. List available squads if multiple exist.
  4. On analysis: After generating a strategy report or analysis, update the squad file's Notes section with key takeaways.
  5. Multi-squad: Users may discuss multiple squads (their own, friends', draft plans). Each gets its own file. The user can specify which squad by name.
  6. File naming: Use kebab-case slugs derived from the squad name (e.g.,
    my-fpl-team.md
    ,
    daves-team.md
    ,
    wildcard-draft.md
    ).
Read
references/squad.md
for the full markdown format specification.
阵容以Markdown文件形式存储于
~/.fplcopilot/squads/
目录下——每个阵容对应一个文件。这支持多阵容管理(用户自己的球队、朋友的球队、 draft方案)。
主动持久化规则——助手必须遵守:
  1. 识别阵容时:当用户分享其阵容(截图、文本或任何格式),立即将其保存到
    ~/.fplcopilot/squads/
    目录。若名称不明确,请询问用户。
  2. 阵容变更时:当用户进行转会、更换队长、使用特殊芯片或任何方式修改阵容,确认变更后立即更新对应的阵容文件。
  3. 对话开始时:若用户询问“我的阵容”或“我的球队”,先检查
    ~/.fplcopilot/squads/
    目录下的现有阵容文件。若存在多个阵容,列出所有可用选项。
  4. 分析完成时:生成策略报告或分析后,将关键结论更新到阵容文件的Notes部分。
  5. 多阵容支持:用户可能讨论多个阵容(自己的、朋友的、draft方案)。每个阵容对应独立文件,用户可通过名称指定要操作的阵容。
  6. 文件命名:使用由阵容名称派生的短横线分隔格式(kebab-case),例如
    my-fpl-team.md
    daves-team.md
    wildcard-draft.md
请阅读
references/squad.md
了解完整的Markdown格式规范。

Agent Rules

助手规则

  1. Always check freshness before answering data questions. If
    sync_metadata
    shows stale data (bootstrap > 6h, fixtures on match day > 2h), run the sync script first.
  2. Always check for saved squads when the user asks about "my squad/team". Read
    ~/.fplcopilot/squads/
    before asking the user to re-share.
  3. Never guess player IDs. Look up by name:
    sql
    -- Try exact web_name first, then partial, then full name
    SELECT * FROM players WHERE web_name = 'Salah' COLLATE NOCASE;
    SELECT * FROM players WHERE web_name LIKE '%salah%' COLLATE NOCASE;
    SELECT * FROM players WHERE (first_name || ' ' || last_name) LIKE '%salah%' COLLATE NOCASE;
  4. Price units:
    now_cost
    is in 0.1m units.
    130
    = £13.0m. Always display as
    £X.Xm
    .
  5. Position codes: GKP, DEF, MID, FWD (mapped from API's 1, 2, 3, 4).
  6. Status codes:
    a
    =available,
    d
    =doubtful,
    i
    =injured,
    s
    =suspended,
    u
    =unavailable.
  7. FDR scale: 1 (very easy) to 5 (very hard).
  8. Normalize by price when comparing players: value = points / (cost in millions).
  9. Fetch player detail on demand: Only run
    sync.sh player <id>
    when the user asks about a specific player's match-by-match performance. Don't batch-fetch unless explicitly needed.
  10. Proactively persist squads: Always save/update squad files after any squad-related interaction. Never rely on conversation context alone.
  11. Generate HTML for spatial outputs: Any request that maps to a template in
    templates/
    — "plan gameweek" / "next gameweek team" →
    gameweek-report.html
    ; "show/view my squad", formation, bench →
    squad-view.html
    ; "compare transfer", out → in →
    transfer-comparison.html
    ; "captain pick" with reasoning →
    captain-ranking.html
    ; fixture run / FDR matrix →
    fixture-matrix.html
    — MUST produce the HTML file (saved to
    ~/.fplcopilot/reports/{YYYY-MM-DD}-{slug}.html
    ) and report the path with an
    open <path>
    hint on macOS. Markdown is only for one-line / single-stat lookups, short reasoning, deadlines, price changes, or ≤3-row SQL results.
  1. 回答数据类问题前务必检查新鲜度:若
    sync_metadata
    显示数据过期(bootstrap数据超过6小时,比赛日的赛程数据超过2小时),先运行同步脚本。
  2. 用户询问“我的阵容/球队”时务必检查已保存的阵容:先读取
    ~/.fplcopilot/squads/
    目录,再要求用户重新分享。
  3. 绝不猜测球员ID:通过名称查询:
    sql
    -- 先尝试精确匹配web_name,再模糊匹配web_name,最后匹配全名
    SELECT * FROM players WHERE web_name = 'Salah' COLLATE NOCASE;
    SELECT * FROM players WHERE web_name LIKE '%salah%' COLLATE NOCASE;
    SELECT * FROM players WHERE (first_name || ' ' || last_name) LIKE '%salah%' COLLATE NOCASE;
  4. 身价单位
    now_cost
    单位为0.1百万英镑。
    130
    = £13.0m。显示时需格式化为
    £X.Xm
  5. 位置代码:GKP(门将)、DEF(后卫)、MID(中场)、FWD(前锋)(对应API中的1、2、3、4)。
  6. 状态代码
    a
    =可用,
    d
    =存疑,
    i
    =受伤,
    s
    =停赛,
    u
    =不可用。
  7. FDR等级:1(极易)至5(极难)。
  8. 对比球员时需按身价归一化:性价比 = 得分 / 身价(百万英镑)。
  9. 按需获取球员详情:仅当用户询问特定球员的逐场表现时,运行
    sync.sh player <id>
    。除非明确需要,否则不要批量获取。
  10. 主动持久化阵容:任何与阵容相关的交互完成后,务必保存/更新阵容文件。绝不依赖对话上下文。
  11. 空间类输出需生成HTML:任何对应
    templates/
    目录中模板的请求——比如“规划周赛”/“下周阵容”→
    gameweek-report.html
    ;“查看我的阵容”、阵型、替补→
    squad-view.html
    ;“对比转会”、转出→转入→
    transfer-comparison.html
    ;“队长选择”及理由→
    captain-ranking.html
    ;赛程走势/FDR矩阵→
    fixture-matrix.html
    ——必须生成HTML文件(保存至
    ~/.fplcopilot/reports/{YYYY-MM-DD}-{slug}.html
    ),并告知用户文件路径,在macOS系统中可附带
    open <path>
    的提示。Markdown仅用于单行/单一数据查询、简短分析、截止时间、身价变化或≤3行的SQL查询结果。