Skip to main content
ClaudeWave
Skill209 estrellas del repoactualizado 7d ago

algo-ad-vcg

Implement VCG mechanism for incentive-compatible ad slot allocation with truthful bidding. Use this skill when the user needs to design a truthful auction mechanism, compute externality-based payments, or understand why platforms may prefer GSP over VCG — even if they say 'truthful auction design', 'VCG payments', or 'incentive-compatible mechanism'.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/asgard-ai-platform/skills /tmp/algo-ad-vcg && cp -r /tmp/algo-ad-vcg/algo-ad-vcg ~/.claude/skills/algo-ad-vcg
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# VCG Mechanism (Vickrey-Clarke-Groves)

## Overview

VCG allocates slots to maximize total social welfare and charges each winner the externality they impose on others. Truthful bidding is a dominant strategy. Runs in O(N log N + K × N) where N=bidders, K=slots.

## When to Use

**Trigger conditions:**
- Designing an incentive-compatible (truthful) multi-slot auction
- Computing welfare-maximizing allocations with externality pricing
- Academic analysis comparing VCG to GSP auctions

**When NOT to use:**
- When revenue maximization matters more than truthfulness (GSP often generates more revenue)
- For single-item auctions (standard Vickrey suffices)

## Algorithm

```
IRON LAW: VCG Guarantees Truthful Bidding BUT May Not Maximize Revenue
VCG payments are based on externality (harm to others), not competition.
This makes VCG payments often LOWER than GSP payments. Platforms
choose GSP because it typically generates higher revenue despite
strategic bidding. Truthfulness has a revenue cost.
```

### Phase 1: Input Validation
Collect true valuations per click for each advertiser and CTR for each slot position. Valuations must be non-negative.
**Gate:** All valuations non-negative, slot CTRs decreasing by position.

### Phase 2: Core Algorithm
1. Compute welfare-maximizing allocation: assign advertisers to slots to maximize Σ(value_i × CTR_slot_i)
2. For each winner i in slot s: compute total welfare WITHOUT advertiser i (re-optimize remaining bidders)
3. VCG payment_i = (welfare of others without i) - (welfare of others with i present)
4. This equals: Σ over lower positions j of (value_{j+1} × (CTR_j - CTR_{j+1}))

### Phase 3: Verification
Check: all payments ≤ valuations (individual rationality), truthful bidding is dominant strategy, allocation maximizes welfare.
**Gate:** IR satisfied, welfare is optimal.

### Phase 4: Output
Return allocation with VCG payments and welfare metrics.

## Output Format

```json
{
  "allocation": [{"advertiser": "A", "slot": 1, "vcg_payment_per_click": 1.80, "total_welfare_contribution": 500}],
  "metadata": {"total_welfare": 1500, "total_revenue": 420, "mechanism": "vcg"}
}
```

## Examples

### Sample I/O
**Input:** 3 bidders values [10, 8, 2], 2 slots CTRs [0.5, 0.3]
**Expected:** Allocation: Bidder1→Slot1, Bidder2→Slot2. VCG payments: Bidder1 = 8×(0.5-0.3)+2×0.3 = 2.20, Bidder2 = 2×0.3 = 0.60.

### Edge Cases
| Input | Expected | Why |
|-------|----------|-----|
| All same valuation | All pay 0 | No externality imposed — no marginal harm |
| One bidder, one slot | Pays 0 | No other bidder harmed |
| Bidders < slots | All win, all pay 0 | No competition = no externality |

## Gotchas

- **Revenue deficit**: VCG often generates less revenue than GSP. In some cases, winners pay nothing (zero externality).
- **Computational complexity**: For general combinatorial auctions, VCG requires solving NP-hard welfare maximization. For position auctions, it's polynomial.
- **Collusion vulnerability**: VCG can be manipulated by colluding bidders who coordinate to reduce each other's externalities.
- **Non-monotonicity**: Adding a slot can sometimes DECREASE revenue (known as the "lonely bidder" pathology).
- **Practical rarity**: Almost no major ad platform uses pure VCG. It's theoretically elegant but commercially suboptimal.

## References

- For VCG vs GSP revenue comparison, see `references/revenue-comparison.md`
- For combinatorial VCG extensions, see `references/combinatorial-vcg.md`
algo-ad-biddingSkill

Implement and select ad bidding strategies from manual CPC to automated target-CPA and target-ROAS. Use this skill when the user needs to choose a bidding strategy, set up automated bidding, or optimize bid parameters — even if they say 'what bidding strategy should I use', 'target CPA setup', or 'smart bidding configuration'.

algo-ad-budgetSkill

Optimize advertising budget allocation across campaigns using marginal returns analysis. Use this skill when the user needs to distribute budget across multiple campaigns, optimize spend pacing, or maximize overall ROAS under budget constraints — even if they say 'how to split my ad budget', 'campaign budget optimization', or 'diminishing returns on ad spend'.

algo-ad-ctrSkill

Build CTR prediction models for estimating ad click-through rates from features. Use this skill when the user needs to predict click probability, build an ad ranking model, or evaluate ad creative performance — even if they say 'predict click rate', 'ad relevance scoring', or 'which ad will get more clicks'.

algo-ad-gspSkill

Implement Generalized Second Price auction for ad slot allocation and pricing. Use this skill when the user needs to understand search ad auctions, compute ad positions and costs-per-click, or analyze bidding dynamics — even if they say 'how does Google Ads auction work', 'ad rank calculation', or 'second price auction for ads'.

algo-blockchain-basicsSkill

Explain blockchain fundamentals including distributed ledger architecture, consensus mechanisms, and block structure. Use this skill when the user needs to understand blockchain concepts, evaluate whether blockchain fits a use case, or design a blockchain-based solution — even if they say 'how does blockchain work', 'do I need blockchain', or 'distributed ledger'.

algo-blockchain-smart-contractSkill

Design and implement smart contracts as self-executing programmatic agreements on blockchain. Use this skill when the user needs to build automated on-chain logic, evaluate smart contract security, or design tokenized business rules — even if they say 'smart contract development', 'automated agreement', or 'on-chain logic'.

algo-ecom-bm25Skill

Implement BM25 ranking function for e-commerce product search relevance scoring. Use this skill when the user needs to build a text-based product search engine, improve search result relevance, or replace basic TF-IDF with a more robust ranking function — even if they say 'product search ranking', 'search relevance', or 'BM25 implementation'.

algo-ecom-rankingSkill

Design multi-objective e-commerce product ranking combining relevance, conversion, and business metrics. Use this skill when the user needs to build a product ranking system beyond text relevance, balance relevance with commercial objectives, or implement learning-to-rank — even if they say 'product sorting', 'search result ranking', or 'how to rank products'.