Complete architecture reference for the A3 insurance platform — file locations, data flow, conventions, microservice map, and fullstack patterns
日本語の概要は準備中です。原文の説明を表示しています。
Use when fixing HustleXP revenue collection bugs including Stripe platform fee not being collected (application_fee_amount missing), escrow fee miscalculation using task.price instead of escrow.amount, self-insurance pool never funded, tip platform cut absent, subscription renewal revenue not logged, or XP tax path unreachable. Covers all platform fee issues and financial invariant checks.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
payouts_enabled AND stripe_connect_id must be verified before any escrow release.application_fee_amount must ALWAYS be set on PaymentIntent creation. If it is absent, platform earns $0.escrow.amount (task price + surge), never bare task.price.File: backend/src/services/StripeService.ts — line 162 is the fee calculation; the stripe.paymentIntents.create(...) call starts at line 164.
Problem: Platform fee is stored in PaymentIntent metadata only. application_fee_amount is never passed to the Stripe API. Platform earns $0 in platform fees.
Fix: Inside the stripe.paymentIntents.create(...) params (lines 164–174), add:
application_fee_amount: Math.round(amount * (config.stripe.platformFeePercent / 100)),
Note: amount is already in cents. Fee percent comes from config.stripe.platformFeePercent. Do NOT use hardcoded taskPrice * 0.15 * 100.
Verification: Stripe dashboard → Payments → filter by connected account → confirm platform fee shown on each charge.
File: backend/src/services/EscrowService.ts line 337
Problem: grossPayoutCents = task.price — this misses the surge premium. Surge is applied to escrow.amount, not base task.price.
Fix: Change task.price to escrow.amount on line 337.
Verification: Create a surged task; confirm platform fee includes surge premium in the payout record.
File: backend/src/services/EscrowService.ts — inside release() method
Problem: SelfInsurancePoolService.recordContribution() exists but is never called. Pool is permanently $0.
Fix: Add after every successful escrow release. Actual signature: recordContribution(taskId: string, hustlerId: string, contributionCents: number, contributionPercentage?: number). Contribution rate is 2%:
const insuranceContributionCents = Math.round(grossPayoutCents * 0.02);
await SelfInsurancePoolService.recordContribution(
escrow.task_id,
workerId,
insuranceContributionCents,
);
Verification: Check insurance_contributions table after a test escrow release — row must appear.
File: backend/src/services/TippingService.ts line 98
Problem: Tips have no platform cut. Platform pays Stripe processing fees on tips with zero offsetting revenue.
Fix: Add 5–8% platform cut on tips.
LEGAL REQUIREMENT: After changing tip fee percentage, update fee disclosure sections in both:
legal-document-manager skill for those updates. Do NOT ship this fix without the legal doc update.File: backend/src/jobs/stripe-event-worker.ts
Problem: The invoice.paid Stripe webhook event is not handled for recurring subscriptions. Only month-1 revenue is logged; all renewal revenue is silently lost. The switch in stripe-event-worker.ts handles invoice.payment_failed but NOT invoice.paid.
Fix: Add a case 'invoice.paid': handler in backend/src/jobs/stripe-event-worker.ts to log renewal revenue.
Verification: Trigger a test subscription renewal via Stripe CLI and confirm revenue row is created.
File: backend/src/services/EscrowService.ts line 336
Problem: paymentMethod is hardcoded to 'escrow', making the XP tax branch unreachable for any other payment method.
Fix: Derive paymentMethod from task metadata instead of hardcoding.
application_fee_amount (P0, zero dependencies, do first)escrow.amount vs task.price (P0, understand escrow model first)stripe-event-worker.ts — add case 'invoice.paid': handlerpaymentMethod hardcoded)cd /Users/sebastiandysart/Desktop/hustlexp-ai-backend
npx vitest run --coverage 2>&1 | tail -20
Must show: 0 failures and coverage ≥ 88.88% (backend testScore threshold to keep ecosystem health at 100/100).
/Users/sebastiandysart/Desktop/hustlexp-ai-backendbackend/src/services/StripeService.tsbackend/src/services/EscrowService.tsbackend/src/services/TippingService.tsbackend/src/services/StripeWebhookService.tsbackend/src/jobs/stripe-event-worker.ts (add new handlers here)backend/src/services/SelfInsurancePoolService.ts (2% contribution rate)まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Complete architecture reference for the A3 insurance platform — file locations, data flow, conventions, microservice map, and fullstack patterns
日本語の概要は準備中です。原文の説明を表示しています。
Drafts U.S. commercial real estate access and indemnity (right-of-entry) agreements for pre-closing due diligence. Covers license grants, non-invasive vs invasive testing gates, insurance/endorsement requirements, indemnity with discovery carve-outs, restoration and lien remedies, confidentiality, and anti-indemnity guardrails. Trigger: access agreement, right of entry, due diligence access, Phase I/II, invasive testing, pre-PSA site inspection.
日本語の概要は準備中です。原文の説明を表示しています。
当用户需要对意外险投保问卷进行专业、结构化的核保审查,提取职业类别、工作环境、作业内容、危险活动参与情况、交通出行习惯、特殊工作暴露及其他可能影响意外险承保判断的高风险信息,并生成适合意外险核保、补问流转和风险分层处理的结构化分析结果时使用本 skill。
日本語の概要は準備中です。原文の説明を表示しています。
Inspect, schema, and fill true AcroForm PDFs using sciClaw's pdf_form_inspect, pdf_form_schema, and pdf_form_fill tools. Use when: (1) checking whether a PDF is a real fillable AcroForm, (2) listing form field names, types, and choices, (3) filling a supported form from structured values, (4) preparing reviewable insurance, legal, administrative, or clinical form drafts, (5) reporting skipped fields or unused input keys after a fill. Do not use for scanned PDFs, OCR tasks, or XFA-only forms.
日本語の概要は準備中です。原文の説明を表示しています。
Guide actuarial analysis for insurance pricing. TRIGGERS - Use when user needs help with actuarial-analysis related tasks.
日本語の概要は準備中です。原文の説明を表示しています。
Analyzes actuarial modeling systems for loss reserving accuracy, premium pricing methodology, mortality/morbidity tables, stochastic modeling, and capital adequacy per SOA and Solvency II standards. USE THIS SKILL WHEN: - You need to review or audit actuarial models (reserving, pricing, capital) - Someone asks about loss triangle analysis or reserve adequacy - You are evaluating IBNR calculations, chain ladder methods, or Bornhuetter-Ferguson - A project involves insurance pricing, GLM rating models, or ratemaking - You need to assess Solvency II SCR calculations or RBC compliance - Someone mentions actuarial opinions, ASOP compliance, or SOA standards - You are reviewing stochastic models, ESG configurations, or DFA frameworks - A codebase uses actuarial libraries (chainladder, lifetables, ChainLadder R package) TRIGGER PHRASES: "actuarial", "loss reserving", "IBNR", "chain ladder", "premium pricing", "mortality table", "Solvency II", "capital adequacy", "ratemaking", "GLM pricing", "risk-based capital", "reserve analysis", "actuarial opinion"
日本語の概要は準備中です。原文の説明を表示しています。