cowprotocol/services/docs
Claude Code and agent skill by cowprotocol/services
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install cowprotocol/services/docsSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
CoW Protocol Order Debug Skill
Debug why CoW Protocol orders fail to match. Requires DB access + Victoria Logs access (via CoW-Prod MCP).
Quick Checklist
Run through these in order:
- [ ] Order status — Check API status first (cancelled/expired/fulfilled/open)
- [ ] User cancellation — If cancelled, search logs for
"order cancelled" AND all:ORDER_UIDFIRST - [ ] Order in auction — Was order in autopilot auction? When?
- [ ] Solver bids — Did any solver bid? What happened to their solution?
- [ ] Settlement outcome — Did settlement succeed/fail/timeout?
- [ ] Limit price sanity — Was quote reasonable? Check slippage, fees, gas
- [ ] Price movement — Did price move between quote and expiry?
1. Fetch Order Data
GPV2Order Struct (Smart Contract Source of Truth)
| Field | Meaning | Debug Notes | |
|---|---|---|---|
sellToken | Token being sold | ||
buyToken | Token being bought | ||
sellAmount | Amount to sell (wei) | For sell orders, this is exact | |
buyAmount | Min amount to receive | For buy orders, this is exact | |
validTo | Unix timestamp expiry | Check if expired | |
appData | Hash of metadata JSON | Contains hooks, partner fees, flash loan hints | |
feeAmount | Legacy, always 0 | Fee now in limit price | |
kind | "sell" or "buy" | ||
partiallyFillable | bool | Swaps = false (fill-or-kill), limits can be true | |
sellTokenBalance | Legacy, always "erc20" | Balancer vault balances never took off | |
buyTokenBalance | Legacy, always "erc20" | ||
signingScheme | eip712/ethsign/presign/eip1271 | See signing section | |
signature | The actual signature bytes | ||
receiver | Who gets buy tokens | null = order owner |
Additional API fields:
class: deprecated, always "limit" — see note belowstatus: fulfilled/open/cancelled/expiredsurplusFee: Protocol's fee estimate for limit orderssurplusFeeTimestamp: Must be <10 min old or order won't enter auction
Note on order class: Order classes no longer exist (there is no class column in the DB anymore and the API always returns limit). The "market" vs "limit" distinction that still matters is about fee policy, not order type:
- Market order: Had a quote attached, and the order's limit price is within that quote (in-market). Gets market fee policy.
- Limit order: Either no quote, or limit price is outside the quote (out-of-market). Gets limit fee policy with surplus fee.
The appData.metadata.orderClass field shows what the UI intended, but the actual classification is determined by comparing the order's price to the quote at placement time.
2. Signing Schemes
Orders can fail if signature validation fails. Different schemes have different failure modes:
| Scheme | Type | Validation | Common Failures | |
|---|---|---|---|---|
eip712 | EOA | Static, checked once | Sig doesn't match order fields, or signed by unexpected user | |
ethsign | EOA (legacy) | Static, checked once | Same as above |
Note on unexpected signers: The majority of signature issues are valid signatures but signed by an unexpected user. This causes the settlement contract to attempt transferring tokens from an account that doesn't have the necessary balance.
presign | Smart contract | On-chain state (setPreSignature) | User called setPreSignature(uid, false) to cancel | |
|---|---|---|---|---|
eip1271 | Smart contract | Calls isValidSignature() at settlement time | Contract state changed, Safe signer removed, custom logic rejects |
EIP-1271 is dynamic — signature can be valid at order placement but invalid later. Autopilot re-checks these every auction.
3. Check Logs (Victoria Logs via MCP)
Logs are stored in Victoria Logs and accessible via the CoW-Prod MCP tools. Use mcp__CoW-Prod__victorialogs_query for log searches. Timestamps must be RFC3339 format (compute from current date).
IMPORTANT — Protect context window: Always append | fields _time, _msg, all to queries to strip kubernetes/ec2 metadata (~4KB per entry). Use small limit values (10-20). When you only need specific fields, use | fields _time, _msg, parsed.fields.err, parsed.fields.driver etc.
Example queries (use `victorialogs_query` tool):
Useful filters (part of the LogsQL expression):
container:!controller— excludes nginx access logs (REQUIRED for order UID searches)network:$NETWORK— always include when debugging an order to filter by chain (mainnet, bnb, arbitrum-one, base, etc). Reduces noise and speeds up queries.all:— prefix for searching structured fields (order UIDs, auction IDs, quote IDs). Without a field prefix, Victoria Logs only searches the log message text, not structured fields. You can also useparsed.fields.order_uid:0x...for precise matching, butall:works universally.| fields _time, _msg, all— always append to strip k8s metadata and protect context window
Note: Always use the full order UID with 0x prefix and the all: field prefix for reliable matching.
IMPORTANT - Run targeted lifecycle queries in parallel (use FULL order UID with 0x). Call multiple victorialogs_query MCP tools simultaneously. Always include network:$NETWORK and | fields pipe:
What to look for:
order created— order placement with quote_idNew orders in auction— order entered auctioncomputed solutions— solver found a routesolved auction— solver submitted winning bidfiltered out in-flight— order being settledorder cancelled— user cancelled via API
Get auction competition data:
4. Common Log Patterns
IMPORTANT: Many log messages use spaces not underscores (e.g., order cancelled not order_cancelled).
Order lifecycle (search by order UID):
Issues to watch for:
order cancelled— user cancelled the order (check timestamp vs settlement!)settlement failed err=Timeout— driver timed out during settlementsettlement failed— settlement failed (other reasons)filtered— order excluded from auction (check reason)errororError— something went wrongrevert— simulation or settlement failedinsufficient_balance/insufficient_allowance— user moved funds
5. Quote History
Method 1: API response (easiest)
The order API response includes the quote that was used:
Returns:
Method 2: Database
Method 3: Logs (fallback)
Find the quote_id from the "order created" log using victorialogs_query:
Example log line:
Then search for quote details by ID:
6. Quoting Deep Dive
Quotes determine the limit price users sign. Bad quotes = orders that can't fill.
Quote Process
Quote Types
| Type | Behavior | Use Case | |
|---|---|---|---|
| Fast | Returns after first 3 solver responses, always unverified | UI responsiveness | |
| Optimal | Waits for all solvers (5s timeout), attempts verification | Actual order placement | |
| Native | Cached quote for "buy 0.1 ETH with token X" | Native price lookups |
Verified vs Unverified:
- Verified = simulation succeeded, high confidence quote is achievable
- Unverified = simulation failed or skipped, solver might have bad math
Limit Price Calculation
Smart slippage: Smaller orders get higher slippage bc network fee dominates. A 10% gas price spike on a $10 order (where fee is ~$2) eats way more than on a $1M order.
7. Order Placement Validation
Orderbook rejects orders that have no chance of executing. Checks:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingdocs/COW_ORDER_DEBUG_SKILL.md
Popularity
- Repository stars
- 288
- Repository forks
- 153
- 7-day trend score
- 28
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 7 months ago.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/cowprotocol/services/docs)