Card Optimizer
Maximize credit card rewards by always using the right card for every purchase.
Data Location
- - Skill logic:
skills/card-optimizer/ (this file) - User data: INLINECODE1
-
cards.json — card definitions, reward rates, spending estimates, category map
Card Database Schema
Each card in cards.json follows this structure:
CODEBLOCK0
Point Valuations
For points/miles cards, store point_valuation_cpp (cents per point):
- - Chase Ultimate Rewards: 1.0 cpp base, 1.25 cpp with Sapphire Preferred, 1.5 cpp with Sapphire Reserve
- Amex Membership Rewards: 1.0 cpp base, varies by transfer partner
- When comparing cards, multiply rate × pointvaluationcpp to get effective cashback equivalent
Category Map
The category_map in cards.json maps each spending category to the best card ID. This is the precomputed optimal assignment — recalculate when cards are added or removed.
Spending Estimates
To power ROI calculations, gap analysis, and new card recommendations, the user can optionally set estimated monthly spending per category in cards.json:
CODEBLOCK1
If no estimates are provided, the skill can still recommend cards per-purchase — it just can't run ROI or gap analysis. Ask the user to estimate during first-time setup.
Note: This skill does NOT track individual purchases. If the user wants detailed spending data, they should connect their bank accounts through a budgeting tool. These estimates are rough numbers for optimization calculations.
Purchase Optimizer
How to Recommend a Card
When the user asks "which card for [category]?" or "I'm buying [item]":
- 1. Identify the category from the purchase (see Category Matching below)
- Check all cards for that category's reward rate
- Factor in caps: If a card has a cap and the user's estimated annual spending in that category exceeds it, note the cap and when they'd likely exhaust it
- Factor in network acceptance: If the best card is Amex, mention that some merchants don't accept Amex and provide a Visa/MC fallback
- Compare effective rates: For points cards, use pointvaluationcpp to convert to cashback-equivalent
- Return recommendation with reasoning
Response Format
CODEBLOCK2
Cap-Aware Recommendations
When a card has spending caps:
- - Well under cap: Recommend normally
- Cap likely to exhaust (based on estimated spending): Note when the cap would be hit and what to switch to after
- Cap exists: Always mention the cap so the user is aware
Example: "Your Amex BCP gets 6% on groceries up to $6,000/year. At ~$600/month, you'll hit the cap around October. After that, it drops to 1% — switch to Wells Fargo Active Cash for 2%."
Quarterly Category Management
Rotating Categories
Some cards (Chase Freedom Flex, Discover It) have rotating 5% categories that change quarterly and require activation.
Quarterly Alerts
At the start of each quarter (Jan 1, Apr 1, Jul 1, Oct 1):
- - Check for cards with INLINECODE8
- If not yet activated for the current quarter, remind the user
- List the current quarter's bonus categories
- Note: To automate this, add a quarterly cron job or include in the mileage check heartbeat
Store activation status per card:
CODEBLOCK3
Annual Fee ROI Analysis
For each card with an annual fee, calculate whether it's worth keeping based on estimated_monthly_spending:
- 1. Calculate bonus rewards: For each bonus category, compute annual rewards at the bonus rate
- Calculate baseline: What a no-fee 2% flat card would earn on the same spending
- Bonus value: bonusrewards − baselinerewards
- Net ROI: bonusvalue − annualfee
- Verdict: Worth it if net ROI > 0
Report Format
CODEBLOCK4
Optimization & Gap Analysis
Spending Gap Analysis
Using estimated_monthly_spending, identify:
- 1. Weak categories: High spending where the best available card only earns 1-2%
- Underperforming fee cards: Annual fee cards not earning enough bonus to justify the fee
- Cap exhaustion: Categories where estimated spending exceeds bonus caps — may benefit from a second card
- Missing coverage: Common categories with no bonus card at all
Report Format
CODEBLOCK5
New Card Recommendations
Based on spending estimates, suggest cards that would add value:
- 1. Identify the user's highest-spending weak categories
- Match against popular cards with strong rates in those categories
- Calculate projected annual rewards from the new card
- Factor in annual fees
- Mention signup bonuses as first-year sweetener
Do not recommend specific affiliate links — just name the card and explain why.
Popular cards to consider by category:
| Category | Cards | Notes |
|---|
| Dining | Chase Sapphire Preferred (3x), Amex Gold (4x), Capital One SavorOne (3%) | Sapphire and Gold have annual fees |
| Groceries |
Amex BCP (6%), Amex Gold (4x MR) | BCP has $6k cap |
| Travel | Chase Sapphire Reserve (3x), Amex Platinum (5x flights), Capital One Venture X (2x) | All have significant annual fees |
| Gas | Citi Custom Cash (5% top category), PenFed Platinum Rewards (5x gas) | Custom Cash is flexible |
| Flat rate | Citi Double Cash (2%), Wells Fargo Active Cash (2%), Fidelity Visa (2%) | No-fee safety nets |
| Rotating | Chase Freedom Flex (5% quarterly), Discover It (5% quarterly + first-year match) | Requires activation |
Category Matching
Merchant → Category Mapping
When the user mentions a merchant, map to the correct card category:
| Merchant / Keyword | Category | Notes |
|---|
| Kroger, Publix, Safeway, HEB, Aldi, Trader Joe's | groceries | Supermarkets |
| Costco, Sam's Club |
groceries OR warehouse | Costco is Visa-only in store. Amex may code as groceries at Sam's Club |
| Target, Walmart | varies | May code as "superstore" not "groceries" — depends on card issuer |
| Amazon, amazon.com | amazon | Some cards have specific Amazon category |
| Whole Foods | whole_foods OR groceries | Chase Prime has specific Whole Foods category |
| Shell, Exxon, BP, Chevron | gas | Gas stations |
| Uber, Lyft, subway, bus | transit | Public transit and rideshare |
| Netflix, Hulu, Spotify, Disney+, HBO Max, YouTube TV | streaming | Streaming subscriptions |
| Chipotle, McDonald's, DoorDash, Grubhub | restaurants | Dining and food delivery |
| CVS, Walgreens, Rite Aid | drugstores | Pharmacies |
| Hilton, Marriott, Airbnb | hotels/travel | Travel/lodging |
| United, Delta, Southwest | airlines/travel | Airfare |
Fuzzy Category Matching
When the user says something informal:
- - "food" / "eating out" / "dinner" → restaurants
- "grocery run" / "supermarket" → groceries
- "gas" / "fuel" / "fill up" → gas
- "uber" / "lyft" / "ride" → transit
- "stuff on amazon" / "prime order" → amazon
- "pharmacy" / "meds" / "prescription" → drugstores
- "subscription" / "monthly streaming" → streaming
- "general" / "random purchase" → everything_else
If ambiguous, ask: "Is this a grocery store or a restaurant?"
Network Acceptance Warnings
Amex Acceptance
American Express has lower merchant acceptance than Visa/Mastercard:
- - Small/local businesses
- Some international merchants
- Costco (Visa only in-store in the US)
- Some government payments
When recommending an Amex card, always provide a Visa/MC fallback.
Costco Special Case
Costco US stores only accept Visa credit cards (plus debit/cash):
- - In-store: Must use Visa
- Online (costco.com): Visa, Mastercard, Discover (no Amex)
Adding a New Card
When the user wants to add a card:
- 1. Gather info:
- Card name and issuer
- Payment network (Visa/MC/Amex/Discover)
- Annual fee
- Reward type (cashback/points/miles) and point valuation if applicable
- Category reward rates (each bonus category + base rate)
- Any caps or limits per category
- Rotating categories? Which quarters, activation required?
- Signup bonus details (optional)
- 2. Research the card if the user just gives a name — look up current reward rates, fees, and categories via web search
- 3. Create card entry in INLINECODE11
- 4. Recalculate
category_map — determine which card now wins each category
- 5. Confirm and show updated recommendations
Removing a Card
- 1. Remove from
cards array in INLINECODE14 - Recalculate INLINECODE15
- Confirm and show any categories that now have weaker coverage
First-Time Setup
If data/card-optimizer/cards.json doesn't exist:
- 1. Ask the user what credit cards they have
- For each card, either:
- Look up the card's current reward structure via web search, OR
- Ask the user for rates if it's an unusual/regional card
- 3. Build
cards.json with all cards and the precomputed category map - Ask for estimated monthly spending per major category (groceries, gas, dining, amazon, streaming, general, etc.) — explain this powers ROI and gap analysis but is optional
- Run an initial optimization report showing their best card per category and any gaps
Quick Reference
| User Says | Action |
|---|
| "Which card for groceries?" | Recommend best card for that category |
| "I'm buying gas" |
Recommend with gas category |
| "Best card for Amazon?" | Recommend with Amazon category |
| "Annual fee worth it?" | ROI analysis for all fee cards |
| "Add a new card" | Walk through new card setup |
| "Remove a card" | Remove and recalculate |
| "Card optimization report" | Full gap analysis + recommendations |
| "What cards should I get?" | New card recommendations |
| "Activate Q2 categories" | Update quarterly activation status |
| "Does Costco take Amex?" | Network acceptance info |
| "What are my cards?" | List all cards with key rates |
| "Update my spending estimates" | Revise estimated monthly spending |
卡片优化器
通过每次购物使用正确的信用卡,最大化信用卡奖励。
数据位置
- - 技能逻辑: skills/card-optimizer/(本文件)
- 用户数据: data/card-optimizer/
- cards.json — 卡片定义、奖励率、消费估算、类别映射
卡片数据库结构
cards.json 中的每张卡片遵循以下结构:
json
{
id: 唯一标识,
name: 卡片名称,
issuer: 发卡机构名称,
network: visa|mastercard|amex|discover,
annual_fee: 95,
reward_type: cashback|points|miles,
pointvaluationcpp: null,
transfer_partners: [],
notes: 可选备注,
signup_bonus: {
amount: 200,
type: cashback,
spend_requirement: 3000,
timeframe_months: 3,
earned: false
},
categories: [
{
category: groceries,
rate: 6.0,
cap_amount: 6000,
cap_period: yearly,
rateaftercap: 1.0
},
{
category: rotating,
rate: 5.0,
cap_amount: 1500,
cap_period: quarterly,
rateaftercap: 1.0,
quarterly_categories: {
Q1: [gas, ev_charging],
Q2: [groceries, home_improvement],
Q3: [restaurants, paypal],
Q4: [amazon, target, walmart]
},
activation_required: true
},
{
category: everything_else,
rate: 1.0
}
]
}
积分估值
对于积分/里程卡,存储 pointvaluationcpp(每积分美分):
- - 大通终极奖励:基础 1.0 美分/积分,搭配蓝宝石首选卡为 1.25 美分/积分,搭配蓝宝石尊贵卡为 1.5 美分/积分
- 美国运通会员奖励:基础 1.0 美分/积分,因转点合作伙伴而异
- 比较卡片时,将奖励率 × 积分估值美分/积分,得出有效返现等价率
类别映射
cards.json 中的 category_map 将每个消费类别映射到最佳卡片 ID。这是预计算的最优分配——在添加或移除卡片时重新计算。
消费估算
为了支持投资回报率计算、差距分析和新卡推荐,用户可以选择在 cards.json 中设置每个类别的预估月消费:
json
{
estimatedmonthlyspending: {
groceries: 600,
gas: 200,
restaurants: 300,
amazon: 150,
streaming: 50,
everything_else: 500
}
}
如果未提供估算,该技能仍可按单次购买推荐卡片——只是无法进行投资回报率或差距分析。在首次设置时请用户进行估算。
注意: 此技能不追踪单笔购买。如果用户想要详细的消费数据,应通过预算工具连接其银行账户。这些估算只是用于优化计算的粗略数字。
购买优化器
如何推荐卡片
当用户询问买[类别]用哪张卡?或我要买[物品]时:
- 1. 从购买中识别类别(参见下面的类别匹配)
- 检查所有卡片在该类别的奖励率
- 考虑上限: 如果卡片有上限且用户在该类别的预估年消费超过上限,则注明上限以及可能用尽的时间
- 考虑网络接受度: 如果最佳卡片是美国运通卡,则提及一些商户不接受美国运通卡,并提供 Visa/MC 备用卡
- 比较有效利率: 对于积分卡,使用积分估值美分/积分转换为返现等价率
- 返回推荐并附上理由
回复格式
💳 使用:[卡片名称]([发卡机构])
💰 奖励:[X]% [返现/积分/里程] 在 [类别] 上
⚠️ 注意:[任何上限、网络警告或注意事项]
🔄 备用:[如果商户不接受首选卡,则使用次优卡]
考虑上限的推荐
当卡片有消费上限时:
- - 远低于上限: 正常推荐
- 可能用尽上限(基于预估消费):注明何时达到上限以及之后应切换的卡片
- 存在上限: 始终提及上限,以便用户知晓
示例:您的美国运通 BCP 在杂货类别上可获得 6% 返现,上限为每年 6,000 美元。按每月约 600 美元计算,您将在 10 月左右达到上限。之后,返现率降至 1%——请切换到富国银行 Active Cash 以获得 2% 返现。
季度类别管理
轮换类别
一些卡片(大通自由灵活卡、发现卡)有每季度轮换的 5% 类别,需要激活。
季度提醒
在每个季度开始时(1 月 1 日、4 月 1 日、7 月 1 日、10 月 1 日):
- - 检查 activation_required: true 的卡片
- 如果当前季度尚未激活,提醒用户
- 列出当前季度的奖励类别
- 注意:要实现自动化,请添加季度定时任务或包含在里程检查心跳中
存储每张卡片的激活状态:
json
{
quarterly_activations: {
chasefreedomflex: {
2026-Q1: {activated: true, date: 2026-01-02}
}
}
}
年费投资回报率分析
对于每张有年费的卡片,根据 estimatedmonthlyspending 计算是否值得保留:
- 1. 计算奖励收益: 对于每个奖励类别,按奖励率计算年奖励
- 计算基准: 一张免年费 2% 固定返现卡在相同消费上的收益
- 奖励价值: 奖励收益 − 基准收益
- 净投资回报率: 奖励价值 − 年费
- 结论: 如果净投资回报率 > 0,则值得保留
报告格式
💳 [卡片名称] — 年费:$[费用]
获得的奖励收益: $[金额]
对比 2% 固定返现卡: $[金额]
奖励价值: $[金额]
年费: -$[费用]
━━━━━━━━━━━━━━━━━━━━━━━━
净价值: $[金额] ✅ 值得保留 / ❌ 考虑降级
盈亏平衡点:需要在奖励类别上消费 $[X]/年才能证明年费合理
优化与差距分析
消费差距分析
使用 estimatedmonthlyspending,识别:
- 1. 薄弱类别: 高消费但最佳可用卡片仅能获得 1-2% 返现的类别
- 表现不佳的收费卡: 有年费但获得的奖励不足以证明年费合理的卡片
- 上限用尽: 预估消费超过奖励上限的类别——可能需要第二张卡片
- 缺失覆盖: 完全没有奖励卡覆盖的常见类别
报告格式
📊 卡片优化报告
✅ 覆盖良好:
- - 杂货 → 美国运通 BCP(6%)— 每年约赚取 $360
- 亚马逊 → 大通 Prime(5%)— 每年约赚取 $90
⚠️ 识别出的差距:
- - 餐饮:每月 $300 仅获 2%(大通 Prime)— 一张 4% 的餐饮卡每年可节省 $72
- 旅行:每月 $200 仅获 1% — 一张 3 倍积分的旅行卡每年可多赚 $48
❌ 收费卡提醒:
- - [卡片] 年费 $95,但仅产生 $60 的奖励收益 — 净亏损 $35
💡 建议:
- - 添加 [卡片名称] 每年可在 [类别] 上多赚约 $[X]
- 考虑将 [卡片] 降级为免年费版本
新卡推荐
根据消费估算,推荐能增加价值的卡片:
- 1. 识别用户消费最高的薄弱类别
- 与在这些类别中提供高奖励率的热门卡片进行匹配
- 计算新卡