Skip to main content

Agent skills

Agent skills are markdown files that AI agents read as context or instructions. They teach the agent how to use the @contextwtf/sdk to interact with Context Markets — from reading market data to placing orders and managing wallets. The skills live in the @contextwtf/sdk package under the skills/ directory.

Available skills

The skill system has 4 files, designed to be loaded together or individually depending on context window size:

SKILL.md — entry point

~130 lines. Start here. Covers:
  • What Context Markets is and what the SDK does
  • Installation and initialization (read-only vs. trading client)
  • The 3 signer formats (private key, viem account, wallet client)
  • Overview of the 4 core modules (markets, orders, portfolio, account)
  • 8 critical rules (prices in cents, outcomes as “yes”/“no”, must call setup() before trading, etc.)
  • 3 quick recipes: list markets, place an order, wallet setup
This file is designed as a standalone primer. If an agent can only load one file, this is it.

api-reference.md — full method signatures

~760 lines. Complete reference for every method across all 4 modules:
  • ctx.markets — 11 methods: list, get, quotes, orderbook, simulate, priceHistory, oracle, oracleQuotes, requestOracleQuote, activity, globalActivity
  • ctx.orders — 13 methods: list, listAll, mine, allMine, get, recent, simulate, create, cancel, cancelReplace, bulkCreate, bulkCancel, bulk
  • ctx.portfolio — 5 methods: get, claimable, stats, balance, tokenBalance
  • ctx.account — 9 methods: status, setup, mintTestUsdc, deposit, withdraw, mintCompleteSets, burnCompleteSets, relayOperatorApproval, relayDeposit
Includes parameter types, return types, and key type definitions (Market, Order, error classes).

patterns.md — common workflows

~1000 lines. Recipes and patterns for real-world usage:
  • Client setup patterns (read-only vs. trading, signer formats)
  • Wallet onboarding sequence (the critical status → setup → mint → deposit flow)
  • Market discovery and pagination
  • Order lifecycle (place, check, cancel, replace, bulk)
  • Error handling (3 error types with recovery paths)
  • Polling and monitoring patterns
  • 9 gotchas and pitfalls (must setup(), prices in cents not decimals, testnet-only mint, no env var reading, and more)

examples.md — copy-paste scripts

~230 lines. Six self-contained TypeScript scripts:
  1. Read-only market scanner — browse markets and print quotes (no auth)
  2. Place a buy order — full flow from wallet setup to order placement to cancellation
  3. Portfolio dashboard — fetch positions, balances, claimable, and stats in parallel
  4. Market monitoring loop — poll prices on an interval with change detection
  5. Bulk operations — place a ladder of orders and cancel them all
  6. Orderbook analysis — fetch books, calculate spread and depth, detect crossed books

How to use

Load the skill files into your agent’s context window. The method depends on your agent framework:
FrameworkHow to load
Claude CodeAdd to your project’s CLAUDE.md or use as a skill file
CursorAdd to .cursor/rules or reference in project settings
Copilot / CodexInclude in system prompt or project instructions
Custom agentsRead the files and include in your LLM’s system or user message
Example — loading in a system prompt:
You are a trading agent. Use the Context SDK to interact with prediction markets.

<context-sdk-skill>
{contents of SKILL.md}
</context-sdk-skill>
For agents with larger context windows, load all 4 files for the most complete coverage. For smaller windows, SKILL.md alone provides enough to get started.

Where to find them

The skill files ship with the SDK package:
npm install @contextwtf/sdk
After installation, the files are at:
node_modules/@contextwtf/sdk/skills/
├── SKILL.md
├── api-reference.md
├── patterns.md
└── examples.md
Or browse them directly in the SDK repository.