[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78BX1T321D151FMHBZFPB1Q":3,"skill-same:01M78BX1T321D151FMHBZFPB1Q":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M78BX1T321D151FMHBZFPB1Q","dflow-kalshi-trading",null,"Buy, sell, or redeem YES\u002FNO outcome tokens on Kalshi prediction markets via DFlow. Use when the user wants to bet on an event, place a Kalshi order, take a YES or NO position, exit a Kalshi position, redeem winning outcome tokens after a market resolves, tune priority fees on a PM trade, or build a gasless \u002F sponsored PM flow where the app pays tx \u002F ATA \u002F market-init costs. Covers both the `dflow` CLI and the DFlow Trading API. Do NOT use to discover markets, view positions, stream prices, complete Proof KYC, or for non-Kalshi spot swaps.","Solizardking\u002Fskillhub-main","Solizardking","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F108096810?v=4","01M786KDB10AYV042N0F9BD5B5","Clawd","01M786NYYXSZK1D05WM8JQPC48",0,"MIT","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fdflow-kalshi-trading\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: dflow-kalshi-trading\ndescription: Buy, sell, or redeem YES\u002FNO outcome tokens on Kalshi prediction markets via DFlow. Use when the user wants to bet on an event, place a Kalshi order, take a YES or NO position, exit a Kalshi position, redeem winning outcome tokens after a market resolves, tune priority fees on a PM trade, or build a gasless \u002F sponsored PM flow where the app pays tx \u002F ATA \u002F market-init costs. Covers both the `dflow` CLI and the DFlow Trading API. Do NOT use to discover markets, view positions, stream prices, complete Proof KYC, or for non-Kalshi spot swaps.\n---\n\n# DFlow Kalshi Trading\n\nBuy, sell, and redeem YES\u002FNO outcome tokens on Kalshi prediction markets. PM trades are **imperative and asynchronous** — submit, then poll until terminal.\n\n## Prerequisites\n\n- **DFlow docs MCP** (`https:\u002F\u002Fpond.dflow.net\u002Fmcp`) — install per the [repo README](..\u002F..\u002FREADME.md#recommended-install-the-dflow-docs-mcp). This skill is the recipe; the MCP is the reference. Look up endpoint shapes, parameter details, error codes, and anything else field-level via `search_d_flow` \u002F `query_docs_filesystem_d_flow` — don't guess.\n- **`dflow` CLI** (optional, for command-line\u002Fagent use) — install per the [repo README](..\u002F..\u002FREADME.md#recommended-install-the-dflow-cli).\n\n## Choose your surface\n\n- **CLI** — command line, scripts, local agents. Manages keys, signs, submits, polls.\n- **API** — web\u002Fmobile apps with a browser wallet (Phantom, Privy, Turnkey, etc.). Wallet handles signing + RPC; app must proxy HTTP through its backend (the Trading API serves no CORS).\n\nIf unclear, ask once: *\"From the command line, or wired into an app?\"*\n\n## Workflows\n\nAll three workflows assume the user already has a **market ledger mint** (CLI; the `marketLedger` field on the Metadata API market object) or an **outcome mint** (API; `yesMint` \u002F `noMint`) in hand. If they only have a ticker \u002F event name, defer to `dflow-kalshi-market-scanner`.\n\n**One market, two settlement rails.** Every initialized Kalshi market on DFlow exposes **both** a USDC rail and a CASH rail in `market.accounts` — each with its own `marketLedger`, `yesMint`, and `noMint`. They share an orderbook (the top-level `yesBid` \u002F `yesAsk` \u002F `volume24hFp` are market-wide), but trades and holdings are rail-scoped: USDC-rail YES tokens are a different SPL mint from CASH-rail YES tokens and aren't fungible. **Default to the USDC rail** unless the user holds CASH, explicitly asks for CASH, or the active DFlow vault only has CASH. Don't write defensive \"fall back to CASH if USDC rail missing\" code — it never fires, and it hides the rail choice from the user. State the default at the top of the script instead.\n\n**Settlement mint constants** (Solana, Token-2022 for CASH and the classic SPL token program for USDC):\n- USDC: `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`\n- CASH: `CASHx9KJUStyftLFWGvEVf59SGeG9sh5FfcnZMVPCASH`\n\nUse these as the keys into `market.accounts[mint]` when picking a rail. There is **no top-level `market.settlementMint` field** on the `\u002Fmarkets` response (despite what some recipe snippets might suggest with `market.accounts?.[market.settlementMint]` — that pattern shows up in *position-side* code, where the rail is already known from the held outcome mint, not in market-discovery code). Key by the mint directly.\n\n### Buy (open or increase a YES\u002FNO position)\n\n1. Confirm the buy gates (KYC + geo + maintenance window) are passable for *this* user — see Gotchas.\n2. Submit the order with the **settlement mint as input** (USDC or CASH) and the **outcome mint as output**.\n3. Poll status until terminal (`closed` \u002F `expired` \u002F `failed`).\n\n- CLI: `dflow trade \u003Catomic-amount> USDC --market \u003CmarketLedger> --side yes|no` — auto-polls for up to 120s. `\u003CFROM>` accepts either the base58 mint or the shorthand `USDC` \u002F `CASH` (CLI resolves a small symbol set, same as spot). `--market` takes the `marketLedger` for the settlement track matching the `\u003Cfrom>` arg — i.e. `market.accounts[\u003CUSDC-or-CASH-mint>].marketLedger` on the Metadata API response. The CLI derives the YES\u002FNO outcome mint from `--side` + `\u003Cfrom>`, so **the same `marketLedger` value is used for both `--side yes` and `--side no`**. Don't pass a `yesMint` \u002F `noMint` here — those are inputs to the API surface, not the CLI. The docs' \"market mint\" and \"market ledger mint\" phrasing both refer to this one field.\n\n**\"Buy N whole contracts\" from a scan snapshot.** Kalshi buys submit a USDC amount and get back as many whole contracts as it covers, refunding leftovers. When you're executing N contracts off a snapshotted `yesAsk`, compute `Math.ceil(N * yesAsk * 1e6)` atomic USDC and optionally add a small buffer (≤ ~1%, a few basis points is typically enough) so a tick-up in the ask between scan and submit doesn't leave you with N-1. Leftover stablecoin is refunded by the CLP, so over-funding slightly is cheap insurance. Don't over-fund by more than a percent or two — at some point it's no longer insurance, it's a different order size.\n- API: `GET \u002Forder?userPublicKey=&inputMint=\u003Csettlement>&outputMint=\u003CyesMint|noMint>&amount=\u003Catomic>`, then sign + submit + poll `\u002Forder-status`. The API takes the outcome mint directly (no `--market` indirection). Field details via the docs MCP.\n\n### Sell (decrease or close)\n\nFlip the mints — outcome in, settlement out. **No KYC required.** No `--market` \u002F `--side` on the CLI; pass the outcome mint as the FROM positional and the CLI auto-resolves the settlement mint.\n\n- CLI: `dflow trade \u003Catomic-outcome> \u003Coutcome-mint>`\n- API: same `\u002Forder` call as buy, with input\u002Foutput mints flipped.\n\n### Redeem (post-settlement)\n\nOnce the market is `determined` \u002F `finalized` **and** `redemptionStatus: \"open\"`, redemption is just a regular sell of the winning side back to the settlement mint. No special flag, no KYC.\n\n## What to ASK the user (and what NOT to ask)\n\n**Trade shape — infer if unambiguous, confirm if not:**\n\n1. **Operation** — buy \u002F sell \u002F redeem. Infer from intent (\"bet on X\" → buy YES; \"cash out\" → sell; \"my YES tokens just won\" → redeem). Don't make the user pick a mode.\n2. **Market + side** — for CLI: the `marketLedger` (from `market.accounts[\u003Csettlement-mint>].marketLedger`) plus `--side yes|no`. For API: the YES or NO outcome mint directly as `outputMint`.\n3. **Settlement rail** — USDC or CASH. Both exist on every initialized market; default to USDC unless the user says otherwise. This determines which `marketLedger` (CLI) or `yesMint` \u002F `noMint` (API) you use.\n4. **Amount in atomic units** — every Kalshi mint is **6 decimals** (`8_000_000` = $8 of USDC; `10_000_000` = 10 outcome tokens). Buys submit settlement-mint amounts (USDC\u002FCASH); sells\u002Fredeems submit outcome-token amounts.\n\n**Infra — always ask, never infer:**\n\n5. **API only — wallet pubkey** (base58). Required for every `\u002Forder` call.\n6. **API only — DFlow API key** (only when the script is making direct HTTP calls to `\u002Forder` or other Trade API endpoints; pure CLI scripts don't need one — see the \"two auth paths\" gotcha). **Ask with a clean, neutral question: *\"Do you have a DFlow API key?\"*** Don't presuppose where the key lives — phrasings like *\"do you have it in env?\"* or *\"is `DFLOW_API_KEY` set?\"* nudge the user toward env-var defaults they didn't ask for. Surface the choice; don't silently fall back to env or to dev. It's **one key for everything DFlow** — same `x-api-key` unlocks the Trade API *and* the Metadata API, REST *and* WebSocket. If yes → prod host `https:\u002F\u002Fquote-api.dflow.net` with `x-api-key` on every request. If no → dev host `https:\u002F\u002Fdev-quote-api.dflow.net` (same features, rate-limited). Point them at `https:\u002F\u002Fpond.dflow.net\u002Fbuild\u002Fapi-key` for a prod key. **When you generate a script that does its own HTTP, log the resolved host + key-presence at startup** so the user can see which rails they're on.\n7. **Priority fee (both surfaces)** — \"Any priority-fee preference, or just use DFlow's default?\" Default on both surfaces = DFlow-auto, capped at 0.005 SOL (documented default on `\u002Forder`). Surface this explicitly so the user knows the lever exists for congested periods or cost-sensitive flows. Don't editorialize about what percentage of trades this covers — DFlow doesn't publish one and you don't know.\n   - **API** — pass `prioritizationFeeLamports` on `\u002Forder`: `auto` | `medium` | `high` | `veryHigh` | `disabled` | integer lamports. Live estimates for tuning: `GET \u002Fpriority-fees` (snapshot), `\u002Fpriority-fees\u002Fstream` (WebSocket). (`\u002Fintent` doesn't apply to Kalshi — PM is imperative-only.)\n   - **CLI** — no tuning flag; `dflow trade` always uses the server-side default. If the user needs finer control (an exact lamport value, or `disabled`), they'll have to drop to the API.\n8. **Sponsored \u002F gasless (API only — skip for CLI)** — \"Does the user need to hold SOL for this trade, or is your app covering fees?\" Default = user pays everything. Two levers on `\u002Forder`, depending on what you want to cover:\n   - `sponsor=\u003Csponsor-wallet-base58>` — sponsor pays tx fee + ATA creation + market-init. Tx must be co-signed by both user and sponsor. Optional `sponsorExec=true|false` picks sponsor-executes (default) vs. user-executes.\n   - `predictionMarketInitPayer=\u003Cwallet>` — covers *only* the one-time market-init rent; user still signs and pays their own tx fee and ATA creation. Useful when you only want to eat the init cost. Markets can also be pre-initialized out-of-band via `GET \u002Fprediction-market-init`.\n   - The CLI doesn't support either sponsorship lever.\n\n**Do NOT ask about:**\n\n- **RPC** — CLI users set it during `dflow setup`. API users on a browser wallet never need their own RPC (the wallet handles it). Only ask if signing server-side. When one is needed, suggest [Helius](https:\u002F\u002Fhelius.dev).\n- **Slippage** — both surfaces default to `\"auto\"`, which is right for CLP-sourced fills. Override only on explicit user request (`--slippage` CLI; `predictionMarketSlippageBps` API).\n- **Platform fee** — defer to `dflow-platform-fees` if the user pivots there.\n\n## Gotchas (the docs MCP won't volunteer these)\n\n- **Token-2022 outcome mints.** Kalshi outcome mints use the Token-2022 program. Declarative trades (`\u002Fintent`) don't support Token-2022 — that's why Kalshi is imperative-only.\n- **All Kalshi mints are 6 decimals.** USDC, CASH, every outcome token. Always pass atomic units to the API.\n- **Buys are whole-contract only — no fractional contracts.** Submit a USDC\u002FCASH amount; the system buys as many whole contracts as that amount covers and **refunds any leftover stablecoin**. Per-order floor is **0.01 USDC**, but the practical floor in any given market is one contract at the current YES\u002FNO price (e.g. if YES is trading at 0.43, you need ≥ `430_000` atomic = $0.43). Quote first if the user is anywhere near the floor.\n- **Async fills, no exceptions.** PM `\u002Forder` returns `executionMode: \"async\"`. The transaction landing onchain is *not* the fill — the order can still expire or fail in the CLP. Always poll `\u002Forder-status` to a terminal state. CLI auto-polls for 120s; on timeout, follow up with `dflow status \u003CorderAddress> --poll`.\n- **Buy gates exist; check once per session, not per call.**\n  - **Proof KYC** — required to buy (not sell, not redeem). Hit `GET https:\u002F\u002Fproof.dflow.net\u002Fverify\u002F{address}` (public, no auth) once at session start, cache `{ verified: boolean }`, gate the buy UI off the cache. `\u002Forder` is still authoritative; on the rare miss, fall back on `unverified_wallet_not_allowed` (API) \u002F `PROOF_NOT_VERIFIED` (CLI) using `details.deepLink`.\n  - **Geoblock** — restricted in some jurisdictions. API builders enforce in their own UI (cache the user's country once per session). The CLI handles this internally and returns `category: \"geoblock\"`. Policy: `https:\u002F\u002Fpond.dflow.net\u002Flegal\u002Fprediction-market-compliance`.\n- **Maintenance window.** Kalshi is offline **Thursdays 3:00–5:00 AM ET, every week**. CLPs stop serving routes; `\u002Forder` returns `route_not_found` (the CLI annotates with a maintenance note). Block PM submissions for the whole window.\n- **`route_not_found` is a catch-all.** Wrong mint, amount below the contract-price floor, no liquidity right now, *or* the maintenance window. Verify mint, atomic units, and that the amount covers ≥ 1 contract before assuming illiquidity.\n- **Browser apps must proxy.** The Trading API serves no CORS — call it from a backend (Next.js API route or equivalent), never directly from the browser.\n- **CLI shell-outs authenticate themselves; direct HTTP calls don't.** If your script or backend shells out to `dflow trade`, that leg uses the CLI's stored config from `dflow setup` (key, wallet, RPC) — **you plumb nothing** for CLI invocations. If the same script *also* hits the Trade API or Metadata API directly over HTTP (e.g. scanner-style discovery, your own `\u002Forder` call, `\u002Fquote`, sibling HTTP tools), that HTTP client needs the key handed in explicitly (env var, `.env`, `--api-key` flag, header). The CLI's stored key is not reusable by a sibling HTTP client, and an env-var key is not injected into the CLI either — they're independent plumbing sites for the same DFlow key. **Only ask about an API key for the HTTP portion; pure CLI scripts don't need one.**\n\n## When something doesn't fit\n\nFor anything not covered above — full parameter lists, full error tables, response schemas, partial-fill handling, rare flags, new features — query the docs MCP (`search_d_flow`, `query_docs_filesystem_d_flow`). Don't guess.\n\nFor runnable code, point the user at the **DFlow docs recipes** (each links to the DFlow Cookbook Repo for clone-and-go): [`\u002Fbuild\u002Frecipes\u002Fprediction-markets\u002Fincrease-position`](https:\u002F\u002Fpond.dflow.net\u002Fbuild\u002Frecipes\u002Fprediction-markets\u002Fincrease-position), [`\u002Fbuild\u002Frecipes\u002Fprediction-markets\u002Fdecrease-position`](https:\u002F\u002Fpond.dflow.net\u002Fbuild\u002Frecipes\u002Fprediction-markets\u002Fdecrease-position), [`\u002Fbuild\u002Frecipes\u002Fprediction-markets\u002Fredeem-outcome-tokens`](https:\u002F\u002Fpond.dflow.net\u002Fbuild\u002Frecipes\u002Fprediction-markets\u002Fredeem-outcome-tokens).\n\n## Sibling skills\n\nDefer if the user pivots to:\n\n- `dflow-kalshi-market-scanner` — discover markets, filter by event\u002Fcategory\n- `dflow-kalshi-market-data` — live prices, orderbooks, streams\n- `dflow-kalshi-portfolio` — view positions, unrealized P&L\n- `dflow-proof-kyc` — set up Proof verification on a wallet\n- `dflow-platform-fees` — charge a builder fee on PM trades\n- `dflow-spot-trading` — non-Kalshi token swaps\n","# DFlow Kalshi Trading\n\nBuy, sell, and redeem YES\u002FNO outcome tokens on Kalshi prediction markets. PM trades are **imperative and asynchronous** — submit, then poll until terminal.\n\n## Prerequisites\n\n- **DFlow docs MCP** (`https:\u002F\u002Fpond.dflow.net\u002Fmcp`) — install per the [repo README](..\u002F..\u002FREADME.md#recommended-install-the-dflow-docs-mcp). This skill is the recipe; the MCP is the reference. Look up endpoint shapes, parameter details, error codes, and anything else field-level via `search_d_flow` \u002F `query_docs_filesystem_d_flow` — don't guess.\n- **`dflow` CLI** (optional, for command-line\u002Fagent use) — install per the [repo README](..\u002F..\u002FREADME.md#recommended-install-the-dflow-cli).\n\n## Choose your surface\n\n- **CLI** — command line, scripts, local agents. Manages keys, signs, submits, polls.\n- **API** — web\u002Fmobile apps with a browser wallet (Phantom, Privy, Turnkey, etc.). Wallet handles signing + RPC; app must proxy HTTP through its backend (the Trading API serves no CORS).\n\nIf unclear, ask once: *\"From the command line, or wired into an app?\"*\n\n## Workflows\n\nAll three workflows assume the user already has a **market ledger mint** (CLI; the `marketLedger` field on the Metadata API market object) or an **outcome mint** (API; `yesMint` \u002F `noMint`) in hand. If they only have a ticker \u002F event name, defer to `dflow-kalshi-market-scanner`.\n\n**One market, two settlement rails.** Every initialized Kalshi market on DFlow exposes **both** a USDC rail and a CASH rail in `market.accounts` — each with its own `marketLedger`, `yesMint`, and `noMint`. They share an orderbook (the top-level `yesBid` \u002F `yesAsk` \u002F `volume24hFp` are market-wide), but trades and holdings are rail-scoped: USDC-rail YES tokens are a different SPL mint from CASH-rail YES tokens and aren't fungible. **Default to the USDC rail** unless the user holds CASH, explicitly asks for CASH, or the active DFlow vault only has CASH. Don't write defensive \"fall back to CASH if USDC rail missing\" code — it never fires, and it hides the rail choice from the user. State the default at the top of the script instead.\n\n**Settlement mint constants** (Solana, Token-2022 for CASH and the classic SPL token program for USDC):\n- USDC: `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`\n- CASH: `CASHx9KJUStyftLFWGvEVf59SGeG9sh5FfcnZMVPCASH`\n\nUse these as the keys into `market.accounts[mint]` when picking a rail. There is **no top-level `market.settlementMint` field** on the `\u002Fmarkets` response (despite what some recipe snippets might suggest with `market.accounts?.[market.settlementMint]` — that pattern shows up in *position-side* code, where the rail is already known from the held outcome mint, not in market-discovery code). Key by the mint directly.\n\n### Buy (open or increase a YES\u002FNO position)\n\n1. Confirm the buy gates (KYC + geo + maintenance window) are passable for *this* user — see Gotchas.\n2. Submit the order with the **settlement mint as input** (USDC or CASH) and the **outcome mint as output**.\n3. Poll status until terminal (`closed` \u002F `expired` \u002F `failed`).\n\n- CLI: `dflow trade \u003Catomic-amount> USDC --market \u003CmarketLedger> --side yes|no` — auto-polls for up to 120s. `\u003CFROM>` accepts either the base58 mint or the shorthand `USDC` \u002F `CASH` (CLI resolves a small symbol set, same as spot). `--market` takes the `marketLedger` for the settlement track matching the `\u003Cfrom>` arg — i.e. `market.accounts[\u003CUSDC-or-CASH-mint>].marketLedger` on the Metadata API response. The CLI derives the YES\u002FNO outcome mint from `--side` + `\u003Cfrom>`, so **the same `marketLedger` value is used for both `--side yes` and `--side no`**. Don't pass a `yesMint` \u002F `noMint` here — those are inputs to the API surface, not the CLI. The docs' \"market mint\" and \"market ledger mint\" phrasing both refer to this one field.\n\n**\"Buy N whole contracts\" from a scan snapshot.** Kalshi buys submit a USDC amount and get back as many whole contracts as it covers, refunding leftovers. When you're executing N contracts off a snapshotted `yesAsk`, compute `Math.ceil(N * yesAsk * 1e6)` atomic USDC and optionally add a small buffer (≤ ~1%, a few basis points is typically enough) so a tick-up in the ask between scan and submit doesn't leave you with N-1. Leftover stablecoin is refunded by the CLP, so over-funding slightly is cheap insurance. Don't over-fund by more than a percent or two — at some point it's no longer insurance, it's a different order size.\n- API: `GET \u002Forder?userPublicKey=&inputMint=\u003Csettlement>&outputMint=\u003CyesMint|noMint>&amount=\u003Catomic>`, then sign + submit + poll `\u002Forder-status`. The API takes the outcome mint directly (no `--market` indirection). Field details via the docs MCP.\n\n### Sell (decrease or close)\n\nFlip the mints — outcome in, settlement out. **No KYC required.** No `--market` \u002F `--side` on the CLI; pass the outcome mint as the FROM positional and the CLI auto-resolves the settlement mint.\n\n- CLI: `dflow trade \u003Catomic-outcome> \u003Coutcome-mint>`\n- API: same `\u002Forder` call as buy, with input\u002Foutput mints flipped.\n\n### Redeem (post-settlement)\n\nOnce the market is `determined` \u002F `finalized` **and** `redemptionStatus: \"open\"`, redemption is just a regular sell of the winning side back to the settlement mint. No special flag, no KYC.\n\n## What to ASK the user (and what NOT to ask)\n\n**Trade shape — infer if unambiguous, confirm if not:**\n\n1. **Operation** — buy \u002F sell \u002F redeem. Infer from intent (\"bet on X\" → buy YES; \"cash out\" → sell; \"my YES tokens just won\" → redeem). Don't make the user pick a mode.\n2. **Market + side** — for CLI: the `marketLedger` (from `market.accounts[\u003Csettlement-mint>].marketLedger`) plus `--side yes|no`. For API: the YES or NO outcome mint directly as `outputMint`.\n3. **Settlement rail** — USDC or CASH. Both exist on every initialized market; default to USDC unless the user says otherwise. This determines which `marketLedger` (CLI) or `yesMint` \u002F `noMint` (API) you use.\n4. **Amount in atomic units** — every Kalshi mint is **6 decimals** (`8_000_000` = $8 of USDC; `10_000_000` = 10 outcome tokens). Buys submit settlement-mint amounts (USDC\u002FCASH); sells\u002Fredeems submit outcome-token amounts.\n\n**Infra — always ask, never infer:**\n\n5. **API only — wallet pubkey** (base58). Required for every `\u002Forder` call.\n6. **API only — DFlow API key** (only when the script is making direct HTTP calls to `\u002Forder` or other Trade API endpoints; pure CLI scripts don't need one — see the \"two auth paths\" gotcha). **Ask with a clean, neutral question: *\"Do you have a DFlow API key?\"*** Don't presuppose where the key lives — phrasings like *\"do you have it in env?\"* or *\"is `DFLOW_API_KEY` set?\"* nudge the user toward env-var defaults they didn't ask for. Surface the choice; don't silently fall back to env or to dev. It's **one key for everything DFlow** — same `x-api-key` unlocks the Trade API *and* the Metadata API, REST *and* WebSocket. If yes → prod host `https:\u002F\u002Fquote-api.dflow.net` with `x-api-key` on every request. If no → dev host `https:\u002F\u002Fdev-quote-api.dflow.net` (same features, rate-limited). Point them at `https:\u002F\u002Fpond.dflow.net\u002Fbuild\u002Fapi-key` for a prod key. **When you generate a script that does its own HTTP, log the resolved host + key-presence at startup** so the user can see which rails they're on.\n7. **Priority fee (both surfaces)** — \"Any priority-fee preference, or just use DFlow's default?\" Default on both surfaces = DFlow-auto, capped at 0.005 SOL (documented default on `\u002Forder`). Surface this explicitly so the user knows the lever exists for congested periods or cost-sensitive flows. Don't editorialize about what percentage of trades this covers — DFlow doesn't publish one and you don't know.\n   - **API** — pass `prioritizationFeeLamports` on `\u002Forder`: `auto` | `medium` | `high` | `veryHigh` | `disabled` | integer lamports. Live estimates for tuning: `GET \u002Fpriority-fees` (snapshot), `\u002Fpriority-fees\u002Fstream` (WebSocket). (`\u002Fintent` doesn't apply to Kalshi — PM is imperative-only.)\n   - **CLI** — no tuning flag; `dflow trade` always uses the server-side default. If the user needs finer control (an exact lamport value, or `disabled`), they'll have to drop to the API.\n8. **Sponsored \u002F gasless (API only — skip for CLI)** — \"Does the user need to hold SOL for this trade, or is your app covering fees?\" Default = user pays everything. Two levers on `\u002Forder`, depending on what you want to cover:\n   - `sponsor=\u003Csponsor-wallet-base58>` — sponsor pays tx fee + ATA creation + market-init. Tx must be co-signed by both user and sponsor. Optional `sponsorExec=true|false` picks sponsor-executes (default) vs. user-executes.\n   - `predictionMarketInitPayer=\u003Cwallet>` — covers *only* the one-time market-init rent; user still signs and pays their own tx fee and ATA creation. Useful when you only want to eat the init cost. Markets can also be pre-initialized out-of-band via `GET \u002Fprediction-market-init`.\n   - The CLI doesn't support either sponsorship lever.\n\n**Do NOT ask about:**\n\n- **RPC** — CLI users set it during `dflow setup`. API users on a browser wallet never need their own RPC (the wallet handles it). Only ask if signing server-side. When one is needed, suggest [Helius](https:\u002F\u002Fhelius.dev).\n- **Slippage** — both surfaces default to `\"auto\"`, which is right for CLP-sourced fills. Override only on explicit user request (`--slippage` CLI; `predictionMarketSlippageBps` API).\n- **Platform fee** — defer to `dflow-platform-fees` if the user pivots there.\n\n## Gotchas (the docs MCP won't volunteer these)\n\n- **Token-2022 outcome mints.** Kalshi outcome mints use the Token-2022 program. Declarative trades (`\u002Fintent`) don't support Token-2022 — that's why Kalshi is imperative-only.\n- **All Kalshi mints are 6 decimals.** USDC, CASH, every outcome token. Always pass atomic units to the API.\n- **Buys are whole-contract only — no fractional contracts.** Submit a USDC\u002FCASH amount; the system buys as many whole contracts as that amount covers and **refunds any leftover stablecoin**. Per-order floor is **0.01 USDC**, but the practical floor in any given market is one contract at the current YES\u002FNO price (e.g. if YES is trading at 0.43, you need ≥ `430_000` atomic = $0.43). Quote first if the user is anywhere near the floor.\n- **Async fills, no exceptions.** PM `\u002Forder` returns `executionMode: \"async\"`. The transaction landing onchain is *not* the fill — the order can still expire or fail in the CLP. Always poll `\u002Forder-status` to a terminal state. CLI auto-polls for 120s; on timeout, follow up with `dflow status \u003CorderAddress> --poll`.\n- **Buy gates exist; check once per session, not per call.**\n  - **Proof KYC** — required to buy (not sell, not redeem). Hit `GET https:\u002F\u002Fproof.dflow.net\u002Fverify\u002F{address}` (public, no auth) once at session start, cache `{ verified: boolean }`, gate the buy UI off the cache. `\u002Forder` is still authoritative; on the rare miss, fall back on `unverified_wallet_not_allowed` (API) \u002F `PROOF_NOT_VERIFIED` (CLI) using `details.deepLink`.\n  - **Geoblock** — restricted in some jurisdictions. API builders enforce in their own UI (cache the user's country once per session). The CLI handles this internally and returns `category: \"geoblock\"`. Policy: `https:\u002F\u002Fpond.dflow.net\u002Flegal\u002Fprediction-market-compliance`.\n- **Maintenance window.** Kalshi is offline **Thursdays 3:00–5:00 AM ET, every week**. CLPs stop serving routes; `\u002Forder` returns `route_not_found` (the CLI annotates with a maintenance note). Block PM submissions for the whole window.\n- **`route_not_found` is a catch-all.** Wrong mint, amount below the contract-price floor, no liquidity right now, *or* the maintenance window. Verify mint, atomic units, and that the amount covers ≥ 1 contract before assuming illiquidity.\n- **Browser apps must proxy.** The Trading API serves no CORS — call it from a backend (Next.js API route or equivalent), never directly from the browser.\n- **CLI shell-outs authenticate themselves; direct HTTP calls don't.** If your script or backend shells out to `dflow trade`, that leg uses the CLI's stored config from `dflow setup` (key, wallet, RPC) — **you plumb nothing** for CLI invocations. If the same script *also* hits the Trade API or Metadata API directly over HTTP (e.g. scanner-style discovery, your own `\u002Forder` call, `\u002Fquote`, sibling HTTP tools), that HTTP client needs the key handed in explicitly (env var, `.env`, `--api-key` flag, header). The CLI's stored key is not reusable by a sibling HTTP client, and an env-var key is not injected into the CLI either — they're independent plumbing sites for the same DFlow key. **Only ask about an API key for the HTTP portion; pure CLI scripts don't need one.**\n\n## When something doesn't fit\n\nFor anything not covered above — full parameter lists, full error tables, response schemas, partial-fill handling, rare flags, new features — query the docs MCP (`search_d_flow`, `query_docs_filesystem_d_flow`). Don't guess.\n\nFor runnable code, point the user at the **DFlow docs recipes** (each links to the DFlow Cookbook Repo for clone-and-go): [`\u002Fbuild\u002Frecipes\u002Fprediction-markets\u002Fincrease-position`](https:\u002F\u002Fpond.dflow.net\u002Fbuild\u002Frecipes\u002Fprediction-markets\u002Fincrease-position), [`\u002Fbuild\u002Frecipes\u002Fprediction-markets\u002Fdecrease-position`](https:\u002F\u002Fpond.dflow.net\u002Fbuild\u002Frecipes\u002Fprediction-markets\u002Fdecrease-position), [`\u002Fbuild\u002Frecipes\u002Fprediction-markets\u002Fredeem-outcome-tokens`](https:\u002F\u002Fpond.dflow.net\u002Fbuild\u002Frecipes\u002Fprediction-markets\u002Fredeem-outcome-tokens).\n\n## Sibling skills\n\nDefer if the user pivots to:\n\n- `dflow-kalshi-market-scanner` — discover markets, filter by event\u002Fcategory\n- `dflow-kalshi-market-data` — live prices, orderbooks, streams\n- `dflow-kalshi-portfolio` — view positions, unrealized P&L\n- `dflow-proof-kyc` — set up Proof verification on a wallet\n- `dflow-platform-fees` — charge a builder fee on PM trades\n- `dflow-spot-trading` — non-Kalshi token swaps\n",{"name":5,"description":7},"main","be3de0244dc1a57e323d8160787ebb40fb64930e","skills\u002Fdflow-kalshi-trading","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main","https:\u002F\u002Fskills.x402.wtf","https:\u002F\u002Fgithub.com\u002FSolizardking","https:\u002F\u002Fmusebook.trade","Got a mile high and never came down","2026-10-08 23:20:13",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add Solizardking\u002Fskillhub-main --skill dflow-kalshi-trading",{"tool":39,"command":40},"bunx","bunx skills add Solizardking\u002Fskillhub-main --skill dflow-kalshi-trading",{"tool":42,"command":43},"pnpm","pnpm dlx skills add Solizardking\u002Fskillhub-main --skill dflow-kalshi-trading","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fdflow-kalshi-trading\u002FSKILL.md",true,[],[48,55,62,69,76,84],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M78E0TGCAMNPS207BA3G07S7","zkrouter","Self-hosted OpenAI-compatible LLM router — smart tier-based routing, ZK-stamped routing decisions, mode overrides, free OpenRouter at install via the Birth bot. Save 60-80% on inference costs by routing to the cheapest capable model across 12+ OpenRouter models.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzkrouter\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M78E0R1Z8BDT6EDTHY17MTNB","zk","For custom ZK Solana programs and privacy-preserving applications to prevent double spending. Guide to integrate rent-free nullifier PDAs for double-spend prevention.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzk\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M78E0P3ZTZ1YWF8MD5MM23QE","zk-omni-messaging","Zero-knowledge omnichain messaging between Robinhood Chain and Solana using CheshireZkOmniMessenger (msgType 4) with nullifier anti-replay and the zk-omni-relayer service.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzk-omni-messaging\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M78E0JXZ2PNB1896VXAGDBWD","zerion-wallet-data","Use when the user asks to check a wallet's portfolio, token balances, DeFi positions, PnL, transaction history, or NFTs. Provides interpreted on-chain data across 40+ EVM chains and Solana via x402 pay-per-request or API key — no raw RPC decoding needed.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fzerion-wallet-data\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":80,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M78E0G14FH9GRRTQYMKD5E59","youtube-clipper","YouTube 视频智能剪辑工具。下载视频和字幕，AI 分析生成精细章节（几分钟级别）， 用户选择片段后自动剪辑、翻译字幕为中英双语、烧录字幕到视频，并生成总结文案。 使用场景：当用户需要剪辑 YouTube 视频、生成短视频片段、制作双语字幕版本时。 关键词：视频剪辑、YouTube、字幕翻译、双语字幕、视频下载、clip video","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-clipper\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-clipper\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M78E0C2ZYA99CFFDNB7ZMK5S","yield-optimization","Multi-chain yield optimization via yield.xyz (StakeKit). Discover 2,988+ yield opportunities across 75+ blockchains, build deposit\u002Fwithdrawal transactions with shell scripts, and sign them with a MoonPay wallet. Use when the user wants to earn yield, find the best lending or staking rate, enter\u002Fexit a position, or check portfolio balances.","https:\u002F\u002Fgithub.com\u002FSolizardking\u002Fskillhub-main\u002Fblob\u002Fmain\u002Fskills\u002Fyield-optimization\u002FSKILL.md",[],[]]