[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BANC8ZXMVWWHSY3E31AAC3":3,"skill-same:01M7BANC8ZXMVWWHSY3E31AAC3":56},{"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":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M7BANC8ZXMVWWHSY3E31AAC3","order-lifecycle-safety",null,"Idempotency, reconcile-before-retry, audit-before-forward and environment-proof preflight rules for any code or agent that places broker orders. Use when building or reviewing an order path, handling a timeout or unknown order outcome, adding client_order_id, deciding whether a retry is safe, or confirming paper vs live before sending an order.","mphinance\u002Falpha-skills","mphinance","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F217996678?v=4","01M71VQC89A6CMFACD2J1CJW6E","Michael H","01M71VQC9B4C0BJ7XXKT8RWRV9",32,"MIT","https:\u002F\u002Fgithub.com\u002Fmphinance\u002Falpha-skills\u002Fblob\u002Fmain\u002Fskills\u002Forder-lifecycle-safety\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: order-lifecycle-safety\ndescription: Idempotency, reconcile-before-retry, audit-before-forward and environment-proof preflight rules for any code or agent that places broker orders. Use when building or reviewing an order path, handling a timeout or unknown order outcome, adding client_order_id, deciding whether a retry is safe, or confirming paper vs live before sending an order.\n---\n\n# Order Lifecycle Safety\n\nPure markdown. No dependencies, no code to install. These are the rules an order path must own itself; do not assume an external approval gate exists.\n\n## 1. Unique `client_order_id` on every order\n\n- Every order carries a `client_order_id` generated by *your* code, once, before the first send.\n- It must be unique per intended order and stable across retries of that same order.\n- Persist it (audit log) before sending, so a crash cannot lose it.\n- Respect broker length\u002Fcharset limits: see `references\u002Fbroker-caveats.md`.\n\n## 2. Same terms vs different terms (REPLAY \u002F ID_REUSED)\n\n| Repeat of an existing id | Correct behaviour | Label |\n|---|---|---|\n| Same id, **same** terms | Return the first result; do not create a second order | `REPLAY` |\n| Same id, **different** terms | Refuse; never mutate or resubmit under that id | `ID_REUSED` |\n\nImplement this in your own layer (compare a hash of symbol, side, qty, type, price, TIF). Do not rely on the broker to do it; broker behaviour varies (see caveats).\n\n## 3. Unknown outcome: reconcile before retry\n\nA timeout, 5xx, dropped connection, or crash after send means the outcome is **unknown**, not failed.\n\n1. Mark the order `UNKNOWN` in the audit log.\n2. Look the order up **by client id** (or list recent orders and match). \n3. Found → adopt its status. Not found after the broker's lookup is known consistent → only then may you resend **with the same client id**.\n4. Lookup itself fails → stay `UNKNOWN`, alert a human. Never blind-retry.\n\n## 4. Audit before forward\n\n1. Decide (allow\u002Frefuse).\n2. Write the decision, with the client id and terms, to an append-only audit log **before** forwarding.\n3. Forward to the broker.\n4. If forwarding raises or times out, append `UNKNOWN` (not `FAILED`) and go to section 3.\n5. Redact credentials from log lines.\n\nIf the audit write fails, do not forward: fail closed.\n\n## 5. Environment-proof preflight\n\nNever infer paper vs live from config, env var names, base URLs, or account-number shape. Config can be wrong or edited.\n\n- Before the first order of a session, **read the environment back from the broker**.\n- Prefer a call that states the environment\u002Fcapabilities of the session (a session-capabilities call) over a bare auth-status call, which usually proves only that credentials work, not which environment they belong to.\n- Compare the broker's answer to the environment the operator intended. Match → proceed. Mismatch, missing field, or any ambiguity → **refuse**.\n- Re-run after any credential or endpoint change.\n- Whether a given broker exposes such a call is per-broker; see `references\u002Fbroker-caveats.md`. If none does, treat the environment as unproven and require a human to confirm in a terminal the agent cannot reach.\n\n## Checklist\n\n- [ ] client id generated and persisted before send\n- [ ] REPLAY \u002F ID_REUSED handled locally\n- [ ] audit entry written before forward; forward failure recorded as UNKNOWN\n- [ ] no retry without lookup by client id\n- [ ] environment read back from broker, ambiguity refuses\n\nSee `references\u002F` for tables.\n","# Order Lifecycle Safety\n\nPure markdown. No dependencies, no code to install. These are the rules an order path must own itself; do not assume an external approval gate exists.\n\n## 1. Unique `client_order_id` on every order\n\n- Every order carries a `client_order_id` generated by *your* code, once, before the first send.\n- It must be unique per intended order and stable across retries of that same order.\n- Persist it (audit log) before sending, so a crash cannot lose it.\n- Respect broker length\u002Fcharset limits: see `references\u002Fbroker-caveats.md`.\n\n## 2. Same terms vs different terms (REPLAY \u002F ID_REUSED)\n\n| Repeat of an existing id | Correct behaviour | Label |\n|---|---|---|\n| Same id, **same** terms | Return the first result; do not create a second order | `REPLAY` |\n| Same id, **different** terms | Refuse; never mutate or resubmit under that id | `ID_REUSED` |\n\nImplement this in your own layer (compare a hash of symbol, side, qty, type, price, TIF). Do not rely on the broker to do it; broker behaviour varies (see caveats).\n\n## 3. Unknown outcome: reconcile before retry\n\nA timeout, 5xx, dropped connection, or crash after send means the outcome is **unknown**, not failed.\n\n1. Mark the order `UNKNOWN` in the audit log.\n2. Look the order up **by client id** (or list recent orders and match). \n3. Found → adopt its status. Not found after the broker's lookup is known consistent → only then may you resend **with the same client id**.\n4. Lookup itself fails → stay `UNKNOWN`, alert a human. Never blind-retry.\n\n## 4. Audit before forward\n\n1. Decide (allow\u002Frefuse).\n2. Write the decision, with the client id and terms, to an append-only audit log **before** forwarding.\n3. Forward to the broker.\n4. If forwarding raises or times out, append `UNKNOWN` (not `FAILED`) and go to section 3.\n5. Redact credentials from log lines.\n\nIf the audit write fails, do not forward: fail closed.\n\n## 5. Environment-proof preflight\n\nNever infer paper vs live from config, env var names, base URLs, or account-number shape. Config can be wrong or edited.\n\n- Before the first order of a session, **read the environment back from the broker**.\n- Prefer a call that states the environment\u002Fcapabilities of the session (a session-capabilities call) over a bare auth-status call, which usually proves only that credentials work, not which environment they belong to.\n- Compare the broker's answer to the environment the operator intended. Match → proceed. Mismatch, missing field, or any ambiguity → **refuse**.\n- Re-run after any credential or endpoint change.\n- Whether a given broker exposes such a call is per-broker; see `references\u002Fbroker-caveats.md`. If none does, treat the environment as unproven and require a human to confirm in a terminal the agent cannot reach.\n\n## Checklist\n\n- [ ] client id generated and persisted before send\n- [ ] REPLAY \u002F ID_REUSED handled locally\n- [ ] audit entry written before forward; forward failure recorded as UNKNOWN\n- [ ] no retry without lookup by client id\n- [ ] environment read back from broker, ambiguity refuses\n\nSee `references\u002F` for tables.\n",{"name":5,"description":7},"main","902c7c604aa4e646544039b5fb051f267c6ebd85","skills\u002Forder-lifecycle-safety",6,"https:\u002F\u002Fgithub.com\u002Fmphinance\u002Falpha-skills","https:\u002F\u002Fgithub.com\u002Fmphinance","https:\u002F\u002Fmphinance.com","2026-11-13 05:04:11",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add mphinance\u002Falpha-skills --skill order-lifecycle-safety",{"tool":38,"command":39},"bunx","bunx skills add mphinance\u002Falpha-skills --skill order-lifecycle-safety",{"tool":41,"command":42},"pnpm","pnpm dlx skills add mphinance\u002Falpha-skills --skill order-lifecycle-safety","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmphinance\u002Falpha-skills\u002Fblob\u002Fmain\u002Fskills\u002Forder-lifecycle-safety\u002FSKILL.md",true,[46,52],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fbroker-caveats.md","REFERENCE","参考文档",1230,"https:\u002F\u002Fgithub.com\u002Fmphinance\u002Falpha-skills\u002Fblob\u002Fmain\u002Fskills\u002Forder-lifecycle-safety\u002Freferences\u002Fbroker-caveats.md",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fstates.md",494,"https:\u002F\u002Fgithub.com\u002Fmphinance\u002Falpha-skills\u002Fblob\u002Fmain\u002Fskills\u002Forder-lifecycle-safety\u002Freferences\u002Fstates.md",[57,62,70,77,84,91],{"skillNo":58,"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":59,"categories":60,"keywords":61,"publishedAt":19},"01M7BAMZ37XP7XM8YDXWWSX0T9","https:\u002F\u002Fgithub.com\u002Fmphinance\u002Falpha-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fquant-skills\u002Fskills\u002Forder-lifecycle-safety\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":69},"01M74928K9ZC74YQ1GMYB4N2Q0","write-a-skill","Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, or build a new skill.","https:\u002F\u002Fgithub.com\u002Fmphinance\u002Falpha-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwrite-a-skill\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":69},"01M749259PAEA22A891D0EJTKK","wireframe-sketch","A hand-drawn wireframe exploration — graph-paper background, marker \u002F\npencil tone, multiple tab labels for variants, sticky-note annotations,\nscribbled chart placeholders, hatched fills. Reads like a designer's\nwhiteboard before any pixels are committed. Use when the brief asks for\n\"wireframe\", \"sketch wireframe\", \"hand-drawn\", \"lo-fi\", \"whiteboard\",\n\"草稿\", or \"手绘原型\".","https:\u002F\u002Fgithub.com\u002Fmphinance\u002Falpha-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwireframe-sketch\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":69},"01M74920ZWJS5Q1JRVJ8TSTQ5A","weekly-update","Single-file horizontal-swipe slide deck for a weekly team update —\nshipped, in flight, blocked, metrics, asks. 6–8 slides. Use when the\nbrief mentions \"weekly update\", \"team update slides\", \"weekly status\",\n\"周报演示\".","https:\u002F\u002Fgithub.com\u002Fmphinance\u002Falpha-skills\u002Fblob\u002Fmain\u002Fskills\u002Fweekly-update\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":69},"01M7491YFRHYFV5QPS0MJ3DSNP","webull-openapi","Trade stocks, options, futures, crypto, and event contracts on Webull. Query real-time and historical market data. Manage accounts and positions. Supports US, HK, JP, SG, TH, MY, UK, MX, BR, EU, ZA, and AU regions with configurable risk controls.","https:\u002F\u002Fgithub.com\u002Fmphinance\u002Falpha-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwebull-openapi\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":69},"01M7491VNEXMFSWAJ9ET9CKQ8E","web-prototype","General-purpose desktop web prototype. Single self-contained HTML file built\nby copying the seed `assets\u002Ftemplate.html` and pasting section layouts from\n`references\u002Flayouts.md`. Default for any landing \u002F marketing \u002F docs \u002F SaaS\npage when no more specific skill matches.","https:\u002F\u002Fgithub.com\u002Fmphinance\u002Falpha-skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-prototype\u002FSKILL.md",[],[]]