[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GZK2FSBSD52Z6MV6SWXESY":3,"skill-same:01M6GZK2FSBSD52Z6MV6SWXESY":78},{"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":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":36,"linkOnly":37,"markdownContent":38,"markdownBody":39,"frontMatter":40,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":44,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":47,"ownerDescription":48,"updatedAt":49,"install":50,"resources":63},"01M6GZK2FSBSD52Z6MV6SWXESY","prorate-a-subscription-plan-change",null,"Use when a subscriber upgrades, downgrades or changes billing period mid-cycle. Computes the proration credit and charge in exact minor units and names which of the two common conventions applies.","jiayaoqijia\u002Fcryptoskill","jiayaoqijia","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1453879?v=4","01M6GMYTX7Q7S504VC6E756ENR","YQ","01M6GMYV1QKJ1CC75MTTGT9PR0",80,"MIT","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-prorate-a-subscription-plan-change\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-prorate-a-subscription-plan-change\u002FSKILL.md",[],[20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35],"change","plan","prorate a subscription plan change","plan change","common","upgrades","use","units","cycle","conventions","billing","which","changes","when","charge","subscriber","2026-11-10 10:12:30",false,"---\nname: prorate-a-subscription-plan-change\ndescription: Use when a subscriber upgrades, downgrades or changes billing period mid-cycle. Computes the proration credit and charge in exact minor units and names which of the two common conventions applies.\n---\n\n# Prorate a subscription plan change\n\nProration means charging for the days on the new plan and crediting the unused days on the old one. Do the arithmetic in integer minor units and name the convention, because the two conventions disagree by up to a full period.\n\n## Procedure\n\n1. Pick the convention and write it down:\n   - **Unused-time credit** (Stripe-style): credit the old plan for days not used, charge the new plan for days remaining.\n   - **Foregone-time** (some legacy billers): keep the old period's charge whole and switch at the next renewal. No credit, no charge.\n2. Establish the period in whole days: `term_days`, `used_days`, `remaining_days = term_days - used_days`.\n3. Prorate with integer division, flooring the credit in the customer's favour:\n   `credit_minor = old_amount_minor * remaining_days \u002F\u002F term_days`.\n   `charge_minor = new_amount_minor * remaining_days \u002F\u002F term_days`.\n4. Compute the net due: `net_minor = charge_minor - credit_minor`. Positive is an immediate charge; negative is an account credit or a small refund.\n5. Worked example, monthly term of 30 days, day 10 used (remaining 20):\n   - old plan USD 29.00 = 2900 minor; credit = 2900*20\u002F\u002F30 = 1933.\n   - new plan USD 99.00 = 9900 minor; charge = 9900*20\u002F\u002F30 = 6600.\n   - net = 6600 - 1933 = 4667 minor = USD 46.67 due now.\n6. On a downgrade the net is usually negative; carry it as an account credit rather than cash, unless the account closes.\n7. Keep the period anchor fixed on upgrades: the next renewal stays on the original day so the customer does not get a shortened period.\n8. Post the credit and the charge as two ledger lines, not one netted line, so revenue recognition can split them.\n\n9. On an annual-to-monthly switch, convert both sides to a daily rate before prorating so term lengths compare correctly.\n10. Round consistently — floor the customer's credit and the charge alike — so support cannot cherry-pick the direction.\n11. Store the proration as an immutable event carrying term_days and remaining_days, so a dispute is reconstructible.\n12. Handle a mid-cycle downgrade-plus-upgrade in one transaction only if the period anchor is unchanged; otherwise post two events.\n13. Recompute proration only from stored dates, never from \"today\", so the amount does not drift daily.\n14. Reconcile the sum of proration events for the period to the invoice total; a mismatch is a missed event.\n\n## Pitfalls\n\n- Using a 30-day denominator for a 28\u002F29\u002F31-day month shifts the result; use the actual `term_days` of that period.\n- Float division (`2900*20\u002F30 = 1933.333`) leaks fractions of a cent; integer `\u002F\u002F` floors exactly.\n- A mid-cycle upgrade that also resets the period anchor silently shortens the paid month.\n- Netting credit and charge into one line loses the audit trail and breaks any per-plan revenue report.\n- Applying foregone-time on a downgrade while claiming unused-time on an upgrade is inconsistent and looks like double-billing.\n\n- Mixing annual and monthly amounts without a common daily rate inflates one leg and misprices the switch.\n- Rounding credit up and charge down in different code paths produces a cent the customer eventually finds.\n- Recomputing the proration on every page load from today's date makes the amount drift daily.\n- A downgrade-plus-upgrade that resets the anchor can silently hand the customer a longer period.\n\n## Verification\n\n    python3 -c \"old=2900;new=9900;term=30;rem=20;print(old*rem\u002F\u002Fterm, new*rem\u002F\u002Fterm, new*rem\u002F\u002Fterm-old*rem\u002F\u002Fterm)\"\n    # 1933 6600 4667 -> credit 19.33, charge 66.00, net 46.67 due\n\nReport: the convention chosen, term_days, and the net due in minor units for one worked change.\n","# Prorate a subscription plan change\n\nProration means charging for the days on the new plan and crediting the unused days on the old one. Do the arithmetic in integer minor units and name the convention, because the two conventions disagree by up to a full period.\n\n## Procedure\n\n1. Pick the convention and write it down:\n   - **Unused-time credit** (Stripe-style): credit the old plan for days not used, charge the new plan for days remaining.\n   - **Foregone-time** (some legacy billers): keep the old period's charge whole and switch at the next renewal. No credit, no charge.\n2. Establish the period in whole days: `term_days`, `used_days`, `remaining_days = term_days - used_days`.\n3. Prorate with integer division, flooring the credit in the customer's favour:\n   `credit_minor = old_amount_minor * remaining_days \u002F\u002F term_days`.\n   `charge_minor = new_amount_minor * remaining_days \u002F\u002F term_days`.\n4. Compute the net due: `net_minor = charge_minor - credit_minor`. Positive is an immediate charge; negative is an account credit or a small refund.\n5. Worked example, monthly term of 30 days, day 10 used (remaining 20):\n   - old plan USD 29.00 = 2900 minor; credit = 2900*20\u002F\u002F30 = 1933.\n   - new plan USD 99.00 = 9900 minor; charge = 9900*20\u002F\u002F30 = 6600.\n   - net = 6600 - 1933 = 4667 minor = USD 46.67 due now.\n6. On a downgrade the net is usually negative; carry it as an account credit rather than cash, unless the account closes.\n7. Keep the period anchor fixed on upgrades: the next renewal stays on the original day so the customer does not get a shortened period.\n8. Post the credit and the charge as two ledger lines, not one netted line, so revenue recognition can split them.\n\n9. On an annual-to-monthly switch, convert both sides to a daily rate before prorating so term lengths compare correctly.\n10. Round consistently — floor the customer's credit and the charge alike — so support cannot cherry-pick the direction.\n11. Store the proration as an immutable event carrying term_days and remaining_days, so a dispute is reconstructible.\n12. Handle a mid-cycle downgrade-plus-upgrade in one transaction only if the period anchor is unchanged; otherwise post two events.\n13. Recompute proration only from stored dates, never from \"today\", so the amount does not drift daily.\n14. Reconcile the sum of proration events for the period to the invoice total; a mismatch is a missed event.\n\n## Pitfalls\n\n- Using a 30-day denominator for a 28\u002F29\u002F31-day month shifts the result; use the actual `term_days` of that period.\n- Float division (`2900*20\u002F30 = 1933.333`) leaks fractions of a cent; integer `\u002F\u002F` floors exactly.\n- A mid-cycle upgrade that also resets the period anchor silently shortens the paid month.\n- Netting credit and charge into one line loses the audit trail and breaks any per-plan revenue report.\n- Applying foregone-time on a downgrade while claiming unused-time on an upgrade is inconsistent and looks like double-billing.\n\n- Mixing annual and monthly amounts without a common daily rate inflates one leg and misprices the switch.\n- Rounding credit up and charge down in different code paths produces a cent the customer eventually finds.\n- Recomputing the proration on every page load from today's date makes the amount drift daily.\n- A downgrade-plus-upgrade that resets the anchor can silently hand the customer a longer period.\n\n## Verification\n\n    python3 -c \"old=2900;new=9900;term=30;rem=20;print(old*rem\u002F\u002Fterm, new*rem\u002F\u002Fterm, new*rem\u002F\u002Fterm-old*rem\u002F\u002Fterm)\"\n    # 1933 6600 4667 -> credit 19.33, charge 66.00, net 46.67 due\n\nReport: the convention chosen, term_days, and the net due in minor units for one worked change.\n",{"name":5,"description":7},"main","3df1d0d67b30ff15236561f8c0f9f06d33f42dfd","skills\u002Fpayments\u002F0xklen-prorate-a-subscription-plan-change",17,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia","https:\u002F\u002Feth2030.com","Hardcore infra. Building @alt-research and applied cryptography.","2026-11-11 08:47:40",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add jiayaoqijia\u002Fcryptoskill --skill prorate-a-subscription-plan-change",{"tool":56,"command":57},"bunx","bunx skills add jiayaoqijia\u002Fcryptoskill --skill prorate-a-subscription-plan-change",{"tool":59,"command":60},"pnpm","pnpm dlx skills add jiayaoqijia\u002Fcryptoskill --skill prorate-a-subscription-plan-change","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-prorate-a-subscription-plan-change\u002FSKILL.md",true,[64,68,74],{"path":65,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":16},"LICENSE","许可证",1063,{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"SOURCE.md","REFERENCE","参考文档",360,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-prorate-a-subscription-plan-change\u002FSOURCE.md",{"path":75,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":76,"sourceHtmlUrl":77},"TRUST.auto.yaml",2217,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-prorate-a-subscription-plan-change\u002FTRUST.auto.yaml",[79,107,130,148,161,171],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":83,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":36},"01M712C436EQYE43342Q4E7GG1","recipe-performance","Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold\u002Fwarm\u002Fbackground-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout\u002Fpaint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fwallets\u002Fmetamask-official-recipe-performance\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fwallets\u002Fmetamask-official-recipe-performance\u002FSKILL.md",[],[87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106],"performance","recipe performance","recipe","mm","sentry","harness","app","deterministic","recipes","flow","cold","critical","analysis","tasks","react","browser","layout","screen","network","metamask",{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":111,"licenseFileUrl":112,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":36},"01M70XT2F8A5CQZ81JBP98KSW3","mexc-spot-websocket","MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fmncrftfrcnm-mexc-spot-websocket\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fmncrftfrcnm-mexc-spot-websocket\u002FSKILL.md",[],[116,117,118,119,120,121,122,123,124,125,126,127,128,129],"mexc spot websocket","spot","websocket","api","workflows","public","listen","streams","depth","keys","for","api keys","maintenance","protobuf",{"skillNo":131,"name":132,"nameZh":6,"description":133,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":111,"licenseFileUrl":134,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":36},"01M70XT0MBXN3WZY1BKN0CPNKR","mexc-spot-rest","MEXC Spot REST workflows for public data, signed account requests, orders, wallet\u002Fadmin actions, and secure signing without exposing API keys.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fmncrftfrcnm-mexc-spot-rest\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fmncrftfrcnm-mexc-spot-rest\u002FSKILL.md",[],[138,117,139,140,141,142,143,127,126,125,144,145,146,121,147,120,119],"mexc spot rest","REST","admin","signing","Wallet","requests","actions","secure","data","orders",{"skillNo":149,"name":150,"nameZh":6,"description":151,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":111,"licenseFileUrl":152,"sourceHtmlUrl":153,"categories":154,"keywords":155,"publishedAt":36},"01M70XSYSVZ2N0N91XCAR2CAK0","mexc-futures-websocket","MEXC Futures WebSocket workflows for public streams, private account\u002Forder\u002Fposition streams, ping\u002Fpong, subscriptions, and depth maintenance.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fmncrftfrcnm-mexc-futures-websocket\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fmncrftfrcnm-mexc-futures-websocket\u002FSKILL.md",[],[156,157,118,158,159,128,126,160,124,123,121,120],"mexc futures websocket","futures","position","ping","subscriptions",{"skillNo":162,"name":163,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":164,"sourceHtmlUrl":165,"categories":166,"keywords":167,"publishedAt":36},"01M6H0ZWHVE5W04WG2DKQE2SQC","0xklen-version-and-refresh-sanctions-lists","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-version-and-refresh-sanctions-lists\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-version-and-refresh-sanctions-lists\u002FSKILL.md",[],[168,169,170],"refresh","0xklen version and refresh sanctions lists","version",{"skillNo":172,"name":173,"nameZh":6,"description":174,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":175,"sourceHtmlUrl":176,"categories":177,"keywords":178,"publishedAt":36},"01M6H0Z28Q3R8J0S799GJQWXM3","verify-tests-cover-changed-lines","Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-verify-tests-cover-changed-lines\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-verify-tests-cover-changed-lines\u002FSKILL.md",[],[179,180,181,182,183,184,185,26,186,187,188],"tests","cover","verify tests cover changed lines","verify","coverage","pr","exercise","patch","code","share"]