@v587d/capital-generation 2.7.7 → 2.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/README.md +7 -5
  3. package/THIRD_PARTY_NOTICES.md +24 -3
  4. package/capital-config/client.js +4 -4
  5. package/capital-config/package.json +1 -1
  6. package/capital-watchlist/client.js +3 -3
  7. package/capital-watchlist/client.src.cjs +4 -4
  8. package/capital-watchlist/package.json +1 -1
  9. package/chart-ui/package.json +1 -1
  10. package/lib/agents/selected-skills-provider.js +41 -8
  11. package/lib/chart/source-token.js +18 -3
  12. package/lib/data-collector/dataset-tools.js +4 -2
  13. package/lib/data-collector/describe.d.ts +4 -0
  14. package/lib/data-collector/describe.js +11 -1
  15. package/lib/index.d.ts +17 -0
  16. package/lib/index.js +50 -18
  17. package/lib/web-retriever/local-fetch.d.ts +1 -1
  18. package/lib/web-retriever/local-fetch.js +1 -1
  19. package/lib/web-retriever/wind-client.d.ts +1 -1
  20. package/lib/web-retriever/wind-client.js +1 -1
  21. package/package.json +3 -1
  22. package/preset/capital-generation/agent.patch.yml +1 -0
  23. package/preset/capital-generation/skills/capital-data-protocol/SKILL.md +4 -0
  24. package/preset/capital-generation/skills/capital-equity-research/SKILL.md +1 -1
  25. package/preset/capital-generation/skills/capital-orchestration/SKILL.md +5 -0
  26. package/preset/capital-generation/skills/capital-visualization-protocol/SKILL.md +7 -7
  27. package/preset/capital-generation/skills/capital-web-protocol/SKILL.md +10 -3
  28. package/selected-skills/README.md +3 -1
  29. package/selected-skills/catalog.js +183 -0
  30. package/selected-skills/financeskills/LICENSE +21 -0
  31. package/selected-skills/financeskills/UPSTREAM.md +202 -0
  32. package/selected-skills/financeskills/skills/ai-anomaly-detection/EXAMPLE.md +21 -0
  33. package/selected-skills/financeskills/skills/ai-anomaly-detection/SKILL.md +84 -0
  34. package/selected-skills/financeskills/skills/ai-anomaly-detection/references/feature-engineering.md +20 -0
  35. package/selected-skills/financeskills/skills/ai-anomaly-detection/references/ml-algorithms.md +28 -0
  36. package/selected-skills/financeskills/skills/aro-computation/EXAMPLE.md +21 -0
  37. package/selected-skills/financeskills/skills/aro-computation/SKILL.md +82 -0
  38. package/selected-skills/financeskills/skills/aro-computation/references/aro-standards.md +22 -0
  39. package/selected-skills/financeskills/skills/aro-computation/references/pv-math.md +27 -0
  40. package/selected-skills/financeskills/skills/audit-checklist/EXAMPLE.md +17 -0
  41. package/selected-skills/financeskills/skills/audit-checklist/SKILL.md +77 -0
  42. package/selected-skills/financeskills/skills/audit-checklist/references/internal-controls.md +36 -0
  43. package/selected-skills/financeskills/skills/audit-checklist/references/isa-standards.md +26 -0
  44. package/selected-skills/financeskills/skills/automated-reconciliation/EXAMPLE.md +21 -0
  45. package/selected-skills/financeskills/skills/automated-reconciliation/SKILL.md +87 -0
  46. package/selected-skills/financeskills/skills/automated-reconciliation/assets/reconciliation-statement-template.md +31 -0
  47. package/selected-skills/financeskills/skills/automated-reconciliation/references/fuzzy-logic.md +27 -0
  48. package/selected-skills/financeskills/skills/automated-reconciliation/references/rec-controls.md +28 -0
  49. package/selected-skills/financeskills/skills/banking-compliance/EXAMPLE.md +21 -0
  50. package/selected-skills/financeskills/skills/banking-compliance/SKILL.md +82 -0
  51. package/selected-skills/financeskills/skills/banking-compliance/references/basel-iii-framework.md +26 -0
  52. package/selected-skills/financeskills/skills/banking-compliance/references/risk-weights.md +32 -0
  53. package/selected-skills/financeskills/skills/budget-forecast/EXAMPLE.md +21 -0
  54. package/selected-skills/financeskills/skills/budget-forecast/SKILL.md +87 -0
  55. package/selected-skills/financeskills/skills/budget-forecast/references/forecasting-best-practices.md +26 -0
  56. package/selected-skills/financeskills/skills/budget-forecast/references/scenario-analysis.md +25 -0
  57. package/selected-skills/financeskills/skills/close-management/EXAMPLE.md +17 -0
  58. package/selected-skills/financeskills/skills/close-management/SKILL.md +85 -0
  59. package/selected-skills/financeskills/skills/close-management/references/close-task-library.md +32 -0
  60. package/selected-skills/financeskills/skills/company-valuation/EXAMPLE.md +21 -0
  61. package/selected-skills/financeskills/skills/company-valuation/SKILL.md +80 -0
  62. package/selected-skills/financeskills/skills/company-valuation/references/terminal-value-guide.md +33 -0
  63. package/selected-skills/financeskills/skills/corporate-consolidation/EXAMPLE.md +21 -0
  64. package/selected-skills/financeskills/skills/corporate-consolidation/SKILL.md +84 -0
  65. package/selected-skills/financeskills/skills/corporate-consolidation/references/consolidation-standard.md +28 -0
  66. package/selected-skills/financeskills/skills/corporate-consolidation/references/minority-interest.md +25 -0
  67. package/selected-skills/financeskills/skills/credit-analysis/EXAMPLE.md +21 -0
  68. package/selected-skills/financeskills/skills/credit-analysis/SKILL.md +84 -0
  69. package/selected-skills/financeskills/skills/credit-analysis/references/covenant-guide.md +26 -0
  70. package/selected-skills/financeskills/skills/crypto-accounting/EXAMPLE.md +21 -0
  71. package/selected-skills/financeskills/skills/crypto-accounting/SKILL.md +81 -0
  72. package/selected-skills/financeskills/skills/crypto-accounting/references/fasb-crypto.md +26 -0
  73. package/selected-skills/financeskills/skills/crypto-accounting/references/ifrs-crypto.md +25 -0
  74. package/selected-skills/financeskills/skills/cvp-breakeven/EXAMPLE.md +21 -0
  75. package/selected-skills/financeskills/skills/cvp-breakeven/SKILL.md +78 -0
  76. package/selected-skills/financeskills/skills/cvp-breakeven/references/cvp-patterns.md +28 -0
  77. package/selected-skills/financeskills/skills/debt-payoff/EXAMPLE.md +21 -0
  78. package/selected-skills/financeskills/skills/debt-payoff/SKILL.md +94 -0
  79. package/selected-skills/financeskills/skills/debt-payoff/references/debt-strategies.md +32 -0
  80. package/selected-skills/financeskills/skills/debt-payoff/references/interest-calculations.md +27 -0
  81. package/selected-skills/financeskills/skills/debt-restructuring/EXAMPLE.md +21 -0
  82. package/selected-skills/financeskills/skills/debt-restructuring/SKILL.md +79 -0
  83. package/selected-skills/financeskills/skills/debt-restructuring/references/creditor-priority.md +26 -0
  84. package/selected-skills/financeskills/skills/debt-restructuring/references/restructuring-types.md +24 -0
  85. package/selected-skills/financeskills/skills/deferred-tax/EXAMPLE.md +21 -0
  86. package/selected-skills/financeskills/skills/deferred-tax/SKILL.md +86 -0
  87. package/selected-skills/financeskills/skills/deferred-tax/references/td-catalogue.md +39 -0
  88. package/selected-skills/financeskills/skills/earned-value-mgmt/EXAMPLE.md +21 -0
  89. package/selected-skills/financeskills/skills/earned-value-mgmt/SKILL.md +79 -0
  90. package/selected-skills/financeskills/skills/earned-value-mgmt/references/forecasting-eac.md +27 -0
  91. package/selected-skills/financeskills/skills/earned-value-mgmt/references/pmi-evm.md +29 -0
  92. package/selected-skills/financeskills/skills/ecl-computation/EXAMPLE.md +21 -0
  93. package/selected-skills/financeskills/skills/ecl-computation/SKILL.md +85 -0
  94. package/selected-skills/financeskills/skills/ecl-computation/references/ifrs9-standard.md +27 -0
  95. package/selected-skills/financeskills/skills/ecl-computation/references/risk-modeling.md +26 -0
  96. package/selected-skills/financeskills/skills/esg-reporting/EXAMPLE.md +17 -0
  97. package/selected-skills/financeskills/skills/esg-reporting/SKILL.md +79 -0
  98. package/selected-skills/financeskills/skills/esg-reporting/references/ghg-protocol.md +22 -0
  99. package/selected-skills/financeskills/skills/esg-reporting/references/sasb-map.md +25 -0
  100. package/selected-skills/financeskills/skills/financial-analysis/EXAMPLE.md +21 -0
  101. package/selected-skills/financeskills/skills/financial-analysis/SKILL.md +108 -0
  102. package/selected-skills/financeskills/skills/financial-analysis/assets/analysis-memo-template.md +31 -0
  103. package/selected-skills/financeskills/skills/financial-analysis/references/accounting-standards.md +45 -0
  104. package/selected-skills/financeskills/skills/financial-analysis/references/ratio-definitions.md +14 -0
  105. package/selected-skills/financeskills/skills/fixed-asset-accounting/EXAMPLE.md +21 -0
  106. package/selected-skills/financeskills/skills/fixed-asset-accounting/SKILL.md +78 -0
  107. package/selected-skills/financeskills/skills/fixed-asset-accounting/references/useful-life-guide.md +30 -0
  108. package/selected-skills/financeskills/skills/forensic-accounting/EXAMPLE.md +21 -0
  109. package/selected-skills/financeskills/skills/forensic-accounting/SKILL.md +91 -0
  110. package/selected-skills/financeskills/skills/forensic-accounting/references/benfords-law.md +24 -0
  111. package/selected-skills/financeskills/skills/forensic-accounting/references/fraud-triangle.md +26 -0
  112. package/selected-skills/financeskills/skills/insurance-reserving/EXAMPLE.md +21 -0
  113. package/selected-skills/financeskills/skills/insurance-reserving/SKILL.md +82 -0
  114. package/selected-skills/financeskills/skills/insurance-reserving/references/actuarial-methods.md +33 -0
  115. package/selected-skills/financeskills/skills/insurance-reserving/references/insurance-metrics.md +26 -0
  116. package/selected-skills/financeskills/skills/intercompany-accounting/EXAMPLE.md +21 -0
  117. package/selected-skills/financeskills/skills/intercompany-accounting/SKILL.md +79 -0
  118. package/selected-skills/financeskills/skills/intercompany-accounting/references/elimination-entries.md +35 -0
  119. package/selected-skills/financeskills/skills/inventory-costing/EXAMPLE.md +21 -0
  120. package/selected-skills/financeskills/skills/inventory-costing/SKILL.md +80 -0
  121. package/selected-skills/financeskills/skills/inventory-costing/references/costing-examples.md +31 -0
  122. package/selected-skills/financeskills/skills/investment-analysis/EXAMPLE.md +21 -0
  123. package/selected-skills/financeskills/skills/investment-analysis/SKILL.md +82 -0
  124. package/selected-skills/financeskills/skills/investment-analysis/references/competitive-advantage.md +31 -0
  125. package/selected-skills/financeskills/skills/investment-analysis/references/valuation-guide.md +29 -0
  126. package/selected-skills/financeskills/skills/journal-entry/EXAMPLE.md +21 -0
  127. package/selected-skills/financeskills/skills/journal-entry/SKILL.md +94 -0
  128. package/selected-skills/financeskills/skills/journal-entry/assets/journal-entry-template.md +21 -0
  129. package/selected-skills/financeskills/skills/journal-entry/references/entry-patterns.md +51 -0
  130. package/selected-skills/financeskills/skills/lbo-modeling/EXAMPLE.md +21 -0
  131. package/selected-skills/financeskills/skills/lbo-modeling/SKILL.md +88 -0
  132. package/selected-skills/financeskills/skills/lbo-modeling/references/debt-structures.md +22 -0
  133. package/selected-skills/financeskills/skills/lbo-modeling/references/lbo-best-practices.md +27 -0
  134. package/selected-skills/financeskills/skills/lease-accounting/EXAMPLE.md +21 -0
  135. package/selected-skills/financeskills/skills/lease-accounting/SKILL.md +88 -0
  136. package/selected-skills/financeskills/skills/lease-accounting/assets/commencement-summary-template.md +28 -0
  137. package/selected-skills/financeskills/skills/lease-accounting/references/ibr-guide.md +26 -0
  138. package/selected-skills/financeskills/skills/net-worth-tracker/EXAMPLE.md +21 -0
  139. package/selected-skills/financeskills/skills/net-worth-tracker/SKILL.md +98 -0
  140. package/selected-skills/financeskills/skills/net-worth-tracker/references/asset-valuation.md +40 -0
  141. package/selected-skills/financeskills/skills/net-worth-tracker/references/net-worth-benchmarks.md +33 -0
  142. package/selected-skills/financeskills/skills/nlp-earnings-sentiment/EXAMPLE.md +17 -0
  143. package/selected-skills/financeskills/skills/nlp-earnings-sentiment/SKILL.md +77 -0
  144. package/selected-skills/financeskills/skills/nlp-earnings-sentiment/references/finbert-guide.md +26 -0
  145. package/selected-skills/financeskills/skills/nlp-earnings-sentiment/references/linguistic-finance.md +23 -0
  146. package/selected-skills/financeskills/skills/oil-gas-valuation/EXAMPLE.md +21 -0
  147. package/selected-skills/financeskills/skills/oil-gas-valuation/SKILL.md +86 -0
  148. package/selected-skills/financeskills/skills/oil-gas-valuation/references/sec-reporting.md +22 -0
  149. package/selected-skills/financeskills/skills/oil-gas-valuation/references/spe-standards.md +25 -0
  150. package/selected-skills/financeskills/skills/personal-budgeting/EXAMPLE.md +21 -0
  151. package/selected-skills/financeskills/skills/personal-budgeting/SKILL.md +100 -0
  152. package/selected-skills/financeskills/skills/personal-budgeting/references/budgeting-methods.md +40 -0
  153. package/selected-skills/financeskills/skills/personal-budgeting/references/spending-categories.md +40 -0
  154. package/selected-skills/financeskills/skills/predictive-burn-rate/EXAMPLE.md +21 -0
  155. package/selected-skills/financeskills/skills/predictive-burn-rate/SKILL.md +82 -0
  156. package/selected-skills/financeskills/skills/predictive-burn-rate/references/startup-metrics.md +27 -0
  157. package/selected-skills/financeskills/skills/predictive-burn-rate/references/time-series-forecasting.md +22 -0
  158. package/selected-skills/financeskills/skills/product-profitability/EXAMPLE.md +21 -0
  159. package/selected-skills/financeskills/skills/product-profitability/SKILL.md +83 -0
  160. package/selected-skills/financeskills/skills/product-profitability/references/allocation-logic.md +28 -0
  161. package/selected-skills/financeskills/skills/product-profitability/references/unit-economics.md +30 -0
  162. package/selected-skills/financeskills/skills/retirement-planning/EXAMPLE.md +21 -0
  163. package/selected-skills/financeskills/skills/retirement-planning/SKILL.md +98 -0
  164. package/selected-skills/financeskills/skills/retirement-planning/references/compound-growth.md +38 -0
  165. package/selected-skills/financeskills/skills/retirement-planning/references/retirement-fundamentals.md +29 -0
  166. package/selected-skills/financeskills/skills/revenue-recognition/EXAMPLE.md +21 -0
  167. package/selected-skills/financeskills/skills/revenue-recognition/SKILL.md +86 -0
  168. package/selected-skills/financeskills/skills/revenue-recognition/assets/allocation-workpaper-template.md +30 -0
  169. package/selected-skills/financeskills/skills/revenue-recognition/references/ifrs15-guide.md +28 -0
  170. package/selected-skills/financeskills/skills/revenue-recognition/references/saas-rev-rec.md +26 -0
  171. package/selected-skills/financeskills/skills/risk-assessment/EXAMPLE.md +21 -0
  172. package/selected-skills/financeskills/skills/risk-assessment/SKILL.md +83 -0
  173. package/selected-skills/financeskills/skills/risk-assessment/references/hedging-guide.md +24 -0
  174. package/selected-skills/financeskills/skills/risk-assessment/references/risk-metrics.md +24 -0
  175. package/selected-skills/financeskills/skills/sox-compliance/EXAMPLE.md +17 -0
  176. package/selected-skills/financeskills/skills/sox-compliance/SKILL.md +88 -0
  177. package/selected-skills/financeskills/skills/sox-compliance/references/sampling-methodology.md +27 -0
  178. package/selected-skills/financeskills/skills/startup-valuation/EXAMPLE.md +21 -0
  179. package/selected-skills/financeskills/skills/startup-valuation/SKILL.md +88 -0
  180. package/selected-skills/financeskills/skills/startup-valuation/references/berkus-method.md +25 -0
  181. package/selected-skills/financeskills/skills/startup-valuation/references/vc-method.md +23 -0
  182. package/selected-skills/financeskills/skills/statement-preparation/EXAMPLE.md +21 -0
  183. package/selected-skills/financeskills/skills/statement-preparation/SKILL.md +86 -0
  184. package/selected-skills/financeskills/skills/statement-preparation/references/accruals-deferrals.md +24 -0
  185. package/selected-skills/financeskills/skills/statement-preparation/references/cash-flow-method.md +32 -0
  186. package/selected-skills/financeskills/skills/tax-efficient-investing/EXAMPLE.md +21 -0
  187. package/selected-skills/financeskills/skills/tax-efficient-investing/SKILL.md +97 -0
  188. package/selected-skills/financeskills/skills/tax-efficient-investing/references/account-types.md +33 -0
  189. package/selected-skills/financeskills/skills/tax-efficient-investing/references/asset-location.md +36 -0
  190. package/selected-skills/financeskills/skills/tax-planning/EXAMPLE.md +21 -0
  191. package/selected-skills/financeskills/skills/tax-planning/SKILL.md +93 -0
  192. package/selected-skills/financeskills/skills/tax-planning/references/common-deductions.md +28 -0
  193. package/selected-skills/financeskills/skills/tax-planning/references/tax-code-lookup.md +25 -0
  194. package/selected-skills/financeskills/skills/three-statement-modeling/EXAMPLE.md +21 -0
  195. package/selected-skills/financeskills/skills/three-statement-modeling/SKILL.md +84 -0
  196. package/selected-skills/financeskills/skills/three-statement-modeling/references/model-checks.md +32 -0
  197. package/selected-skills/financeskills/skills/treasury-management/EXAMPLE.md +21 -0
  198. package/selected-skills/financeskills/skills/treasury-management/SKILL.md +83 -0
  199. package/selected-skills/financeskills/skills/treasury-management/references/fx-hedging.md +27 -0
  200. package/selected-skills/financeskills/skills/treasury-management/references/liquidity-metrics.md +24 -0
  201. package/selected-skills/financeskills/skills/variance-analysis/EXAMPLE.md +21 -0
  202. package/selected-skills/financeskills/skills/variance-analysis/SKILL.md +78 -0
  203. package/selected-skills/financeskills/skills/variance-analysis/references/overhead-logic.md +24 -0
  204. package/selected-skills/financeskills/skills/variance-analysis/references/variance-math.md +35 -0
  205. package/selected-skills/financeskills/skills/venture-debt/EXAMPLE.md +21 -0
  206. package/selected-skills/financeskills/skills/venture-debt/SKILL.md +84 -0
  207. package/selected-skills/financeskills/skills/venture-debt/references/saas-debt-metrics.md +26 -0
  208. package/selected-skills/financeskills/skills/venture-debt/references/venture-lending.md +23 -0
  209. package/selected-skills/financeskills/skills/wacc-computation/EXAMPLE.md +21 -0
  210. package/selected-skills/financeskills/skills/wacc-computation/SKILL.md +98 -0
  211. package/selected-skills/financeskills/skills/wacc-computation/assets/wacc-memo-template.md +40 -0
  212. package/selected-skills/financeskills/skills/wacc-computation/references/beta-math.md +24 -0
  213. package/selected-skills/financeskills/skills/wacc-computation/references/capm-basics.md +24 -0
  214. package/selected-skills/financeskills/skills/working-capital-analysis/EXAMPLE.md +21 -0
  215. package/selected-skills/financeskills/skills/working-capital-analysis/SKILL.md +83 -0
  216. package/selected-skills/financeskills/skills/working-capital-analysis/references/wc-metrics.md +30 -0
  217. package/selected-skills/quant-agent-skills/LICENSE +21 -0
  218. package/selected-skills/quant-agent-skills/UPSTREAM.md +111 -0
  219. package/selected-skills/quant-agent-skills/skills/cross-market-listing-choice/SKILL.md +105 -0
  220. package/selected-skills/quant-agent-skills/skills/cross-market-listing-choice/references/adr-hk-overlay.md +45 -0
  221. package/selected-skills/quant-agent-skills/skills/cross-market-listing-choice/references/ah-overlay.md +44 -0
@@ -0,0 +1,21 @@
1
+ # Worked Example - forensic-accounting
2
+
3
+ ## Ask
4
+
5
+ > Our petty cash is missing $5,000 over the last 3 months. Only the office manager has the key. Can you investigate?
6
+
7
+ ## What a correct response contains
8
+
9
+ Should recognize this as a potential asset misappropriation investigation. Should ask for the petty cash log and bank withdrawal records. Should recommend a reconciliation of physical cash vs log. Should suggest checking for 'top-up' patterns. Should provide a structured Forensic Report structure with Evidence Chain and Control Recommendations.
10
+
11
+ ## File-driven variant
12
+
13
+ With fixture(s) `evals/files/disbursements.csv`:
14
+
15
+ > Run a Benford first-digit analysis on the attached disbursements (evals/files/disbursements.csv) - overall AND segmented by the 'segment' column. Report chi-square per segment against the 15.507 critical value and identify which population deviates.
16
+
17
+ Expected: Operations chi2 16 (conforms); Procurement-VendorX chi2 544 (strong deviation - first digits cluster 4-8); overall chi2 217. Flags VendorX for follow-up, noting deviation is an indicator not proof.
18
+
19
+ ## Compute, don't estimate
20
+
21
+ All figures above come from [`scripts/calculate.py`](./scripts/calculate.py) - import its functions rather than doing arithmetic in prose.
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: forensic-accounting
3
+ description: When the user wants to investigate financial discrepancies, fraud, or hidden assets. Also use when the user mentions "suspicious transactions," "missing funds," "embezzlement check," "laundering detection," "shell company audit," "whistleblower claims," or "something doesn't add up." Use this for litigation support or high-stakes internal investigations.
4
+ metadata:
5
+ version: 1.1.0
6
+ ---
7
+
8
+ # Forensic Accounting
9
+
10
+ You are a Forensic Accountant and Certified Fraud Examiner (CFE). Your goal is to follow the money, identify illegal activities, and prepare evidence for legal proceedings.
11
+
12
+ ## Initial Assessment
13
+
14
+ 1. **Investigation Context**
15
+ - Is this for a legal case (litigation)?
16
+ - What is the specific suspicion (e.g., asset misappropriation, financial statement fraud)?
17
+ - What is the time period in question?
18
+
19
+ 2. **Access & Confidentiality**
20
+ - Do we have access to bank statements, emails, and ERP logs?
21
+ - Who is authorized to see the findings? (Privileged vs. Non-privileged).
22
+
23
+ ---
24
+
25
+ ## Investigation Framework
26
+
27
+ ### Evidence Detection Limitation
28
+
29
+ **No retrieval path in this plugin — delegated or otherwise — reaches secure banking portals, private ERP environments or any corporate system.** Ledger detail, bank statements and vendor masters have to arrive from the user: pasted figures, an export the user supplies, or a filed document the host retrieval channel can read.
30
+ Forensic evidence must be provided as static files (CSV exports, PDF statements) rather than assumed reachable. Do not claim to "verify" transactions without raw source data.
31
+
32
+ ### Priority Order
33
+ 1. **Source of Funds** (Where did the money come from?)
34
+ 2. **Use of Funds** (Where did the money go?)
35
+ 3. **Internal Control Gaps** (How was the fraud possible?)
36
+ 4. **Intent Detection** (Was it an error or deliberate?)
37
+
38
+ ---
39
+
40
+ ## Technical Investigation Steps
41
+
42
+ ### 1. Benford's Law Analysis
43
+ - Run a statistical analysis on the leading digits of transaction amounts.
44
+ - Significant deviations from Benford's distribution indicate potentially manufactured numbers.
45
+
46
+ ### 2. Vendor Link Analysis
47
+ - Match employee addresses/phone numbers with vendor databases.
48
+ - Flag "Ghost Vendors" or shell companies owned by insiders.
49
+
50
+ ### 3. Round-Trip Tracking
51
+ - Identify transactions that leave the entity and return via a series of intermediaries.
52
+ - Check for "Lazy Round-Tripping" (identical amounts/dates).
53
+
54
+ ### 4. Lifestyle Audit
55
+ - (If external data is available) Compare known employee compensation with visible assets or spending.
56
+
57
+ ---
58
+
59
+ ## Output Format
60
+
61
+ ### Forensic Report Structure
62
+
63
+ **Executive Summary**
64
+ - Summary of the alleged scheme.
65
+ - Quantified loss (Total amount of fraud detected).
66
+
67
+ **Evidence Chain**
68
+ - **The Scheme**: Step-by-step description of how the fraud occurred.
69
+ - **Key Suspects**: List of entities/individuals involved.
70
+ - **Evidence Logs**: Table of specific transactions with reference IDs.
71
+
72
+ **Control Recommendations**
73
+ - Specific hardening steps to prevent recurrence.
74
+
75
+ ---
76
+
77
+ ## Scripts
78
+ - [calculate.py](./scripts/calculate.py): Deterministic functions for this skill's core computations, kept as reviewable material. This plugin's research role has no shell and the scripts are not part of the installed package, so nothing here runs them: work the expected digit frequencies and thresholds from [Benford's Law Guide](./references/benfords-law.md), show the test and its sample size in the answer, and hand anything that needs real compute to the delegated `data_junior`.
79
+
80
+ ---
81
+
82
+ ## References
83
+ - [Benford's Law Guide](./references/benfords-law.md): Statistical analysis of leading digits.
84
+ - [Fraud Triangle](./references/fraud-triangle.md): Understanding Pressure, Opportunity, and Rationalization.
85
+
86
+ ---
87
+
88
+ ## Related Skills
89
+ - **audit-checklist**: For baseline control reviews.
90
+ - **financial-analysis**: For detecting macro-level swings caused by fraud.
91
+ - **risk-assessment**: For evaluating the impact of the detected fraud.
@@ -0,0 +1,24 @@
1
+ # Benford’s Law: Statistical Fraud Detection
2
+
3
+ A mathematical tool used by forensic accountants to detect manufactured or manipulated numbers in financial datasets.
4
+
5
+ ## 🏛️ The Concept
6
+ Benford's Law (the First-Digit Law) states that in many naturally occurring collections of numbers, the leading significant digit is likely to be small.
7
+ - The digit **1** appears as the first digit about **30%** of the time.
8
+ - The digit **9** appears as the first digit less than **5%** of the time.
9
+
10
+ ## 🔍 When to Apply
11
+ - **Accounts Payable**: Large datasets of vendor payments.
12
+ - **Inventory Counts**: Checking for "plug numbers."
13
+ - **Sales Data**: Identifying fabricated invoices.
14
+
15
+ **Warning**: Benford's Law does not work on datasets with assigned numbers (e.g., zip codes, phone numbers) or datasets with a narrow range (e.g., heights of humans).
16
+
17
+ ---
18
+
19
+ ## 🛠️ Interpretation
20
+ If a dataset significantly deviates from the Benford curve (e.g., an unusual spike in numbers starting with **7**), it indicates that the numbers may have been invented by a human, as humans tend to distribute digits uniformly when guessing.
21
+
22
+ ## 🔗 Sources
23
+ - [Journal of Accountancy: Benford's Law and Fraud Detection](https://www.journalofaccountancy.com/issues/2017/apr/benfords-law-fraud-detection.html)
24
+ - [ACFE: Using Benford's Law in Fraud Examination](https://www.acfe.com/fraud-resources/benfords-law)
@@ -0,0 +1,26 @@
1
+ # The Fraud Triangle: Why People Steal
2
+
3
+ A model for explaining the factors that cause someone to commit occupational fraud.
4
+
5
+ ## 🏛️ The Three Elements
6
+
7
+ ### 1. Pressure (Incentive)
8
+ The person has a "non-sharable" financial problem.
9
+ - **Examples**: High personal debt, gambling addiction, or pressure to meet aggressive earnings targets.
10
+
11
+ ### 2. Opportunity
12
+ The person sees a way to abuse their position of trust with low perceived risk of detection.
13
+ - **Examples**: Weak internal controls, lack of segregation of duties, or management override.
14
+
15
+ ### 3. Rationalization
16
+ The person justifies the act to themselves to maintain their self-image as a "good person."
17
+ - **Examples**: "I'm only borrowing the money," "I'm underpaid," or "Everyone else is doing it."
18
+
19
+ ---
20
+
21
+ ## 🔍 Mitigation Strategy
22
+ Management can mostly control **Opportunity** by hardening internal controls. They can influence **Pressure** via fair compensation and **Rationalization** by fostering an ethical corporate culture.
23
+
24
+ ## 🔗 Sources
25
+ - [ACFE: The Fraud Triangle](https://www.acfe.com/fraud-resources/fraud-triangle)
26
+ - [AICPA: The Fraud Triangle](https://www.aicpa.org/resources/article/the-fraud-triangle)
@@ -0,0 +1,21 @@
1
+ # Worked Example - insurance-reserving
2
+
3
+ ## Ask
4
+
5
+ > Our paid losses for Accident Year 2023 are $500k. Historically, this line develops to 2.0x its current value by year 5. What's our IBNR?
6
+
7
+ ## What a correct response contains
8
+
9
+ Should calculate Projected Ultimate Loss ($500k * 2.0 = $1M). Should identify IBNR as the difference between Ultimate and Paid ($1M - $500k = $500k). Should discuss the loss ratio. Should provide an Insurance Reserve Report.
10
+
11
+ ## File-driven variant
12
+
13
+ With fixture(s) `evals/files/paid_triangle.csv`:
14
+
15
+ > Apply the chain-ladder method to the attached cumulative paid triangle (evals/files/paid_triangle.csv): compute volume-weighted development factors, ultimate losses per accident year, and total IBNR reserve.
16
+
17
+ Expected: LDFs [1.5, 1.2, 1.1]; ultimates ['8,316,000', '9,108,000', '10,098,000', '10,890,000']; IBNR $8,666,000.
18
+
19
+ ## Compute, don't estimate
20
+
21
+ All figures above come from [`scripts/calculate.py`](./scripts/calculate.py) - import its functions rather than doing arithmetic in prose.
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: insurance-reserving
3
+ description: When the user wants to calculate insurance loss reserves or analyze insurance financial health. Also use when the user mentions "IBNR," "loss development triangles," "actuarial reserving," "claims reserves," "combined ratio," or "loss ratio."
4
+ metadata:
5
+ version: 1.0.0
6
+ ---
7
+
8
+ # Insurance Loss Reserving
9
+
10
+ You are an Insurance Actuarial Analyst. Your goal is to ensure the insurer has set aside enough capital to cover future claims arising from past events.
11
+
12
+ ## Initial Assessment
13
+
14
+ 1. **Line of Business**
15
+ - Short-tail (e.g., Auto, Home) vs. Long-tail (e.g., Workers Comp, Liability).
16
+
17
+ 2. **Claim Data**
18
+ - Do we have the **Loss Triangle**? (Paid or Incurred losses by accident year and development year).
19
+
20
+ 3. **Loss Ratio History**
21
+ - What is the historical "Ultimate Loss Ratio" for this line?
22
+
23
+ ---
24
+
25
+ ## Reserving Framework
26
+
27
+ ### Priority Order
28
+ 1. **Data Organization** (Building the loss development triangles).
29
+ 2. **Age-to-Age Factor Calculation** (Determining how claims grow over time).
30
+ 3. **Link Ratio Selection** (Choosing the most representative factors).
31
+ 4. **IBNR Calculation** (Incurred But Not Reported).
32
+ 5. **Combined Ratio Analysis** (Losses + Expenses / Premiums).
33
+
34
+ ---
35
+
36
+ ## Technical Actuarial Steps
37
+
38
+ ### 1. Chain Ladder Method
39
+ - Use historical loss development factors to project current losses to their "Ultimate" value.
40
+
41
+ ### 2. Bornhuetter-Ferguson (BF) Method
42
+ - Combine the Chain Ladder with an initial expected loss ratio (useful for immature years).
43
+
44
+ ### 3. IBNR Determination
45
+ `IBNR = Projected Ultimate Loss - Incurred Loss to Date`
46
+
47
+ ---
48
+
49
+ ## Output Format
50
+
51
+ ### Insurance Reserve Report
52
+
53
+ **Key Ratios**
54
+ - **Loss Ratio**: (Claims / Premiums).
55
+ - **Expense Ratio**: (Operating Costs / Premiums).
56
+ - **Combined Ratio**: (The target should be < 100%).
57
+
58
+ **The Reserve**
59
+ - **Case Reserves**: $X.
60
+ - **IBNR**: $Y.
61
+ - **Total Loss Reserve**: $Z.
62
+
63
+ **Triangle Visualization**
64
+ - Description of the loss development trend (e.g., "Deterioration in Accident Year 2022").
65
+
66
+ ---
67
+
68
+ ## Scripts
69
+ - [calculate.py](./scripts/calculate.py): Deterministic functions for this skill's core computations, kept as reviewable material. This plugin's research role has no shell and the scripts are not part of the installed package, so nothing here runs them: work the factor selections from [Chain Ladder Basics](./references/actuarial-methods.md) and the ratio definitions in [Combined Ratio Guide](./references/insurance-metrics.md), show each step in the answer, and hand anything that needs real compute to the delegated `data_junior`.
70
+
71
+ ---
72
+
73
+ ## References
74
+ - [Chain Ladder Basics](./references/actuarial-methods.md): Math behind loss development.
75
+ - [Combined Ratio Guide](./references/insurance-metrics.md): Evaluating underwriting profitability.
76
+
77
+ ---
78
+
79
+ ## Related Skills
80
+ - **risk-assessment**: For identifying the underlying underwriting risks.
81
+ - **financial-statement-prep**: For reporting the massive loss reserve liability.
82
+ - **ecl-computation**: For the credit risk on the insurer's investment portfolio.
@@ -0,0 +1,33 @@
1
+ # Actuarial Reserving Methods
2
+
3
+ ## Chain Ladder (development triangle)
4
+ 1. Build cumulative paid (or incurred) loss triangle by accident year × development period.
5
+ 2. Age-to-age factors: `f(d) = Σ C(i,d+1) / Σ C(i,d)` (volume-weighted; exclude distorted years with judgment, documented).
6
+ 3. Cumulative development factor (CDF) to ultimate = product of remaining factors × tail factor.
7
+ 4. `Ultimate = latest cumulative × CDF`; `IBNR = Ultimate − reported incurred`; reserve = ultimate − paid.
8
+ Weakness: leveraged by latest diagonal — bad for immature/volatile years.
9
+
10
+ ## Bornhuetter-Ferguson (the stabilizer)
11
+ `Ultimate = Reported + Expected ultimate × (1 − 1/CDF)`
12
+ Blends an a priori loss ratio (pricing or historical, adjusted) with actual emergence. Use for recent accident years, low-credibility lines, and after large one-off events.
13
+
14
+ ## Expected Loss Ratio Method
15
+ `Ultimate = Premium × a priori loss ratio` — for brand-new lines with no credible development data.
16
+
17
+ ## Frequency-Severity & Cape Cod
18
+ - Freq-sev: project claim counts and average severities separately — better insight into drivers (inflation vs. claim volume).
19
+ - Cape Cod: like BF but derives the a priori loss ratio from the data itself, weighted by used-up premium.
20
+
21
+ ## Method Selection Matrix
22
+ | Accident year maturity | Preferred |
23
+ |---|---|
24
+ | Mature (CDF < 1.1) | Chain ladder |
25
+ | Mid (CDF 1.1–2.0) | Weighted CL/BF |
26
+ | Green (CDF > 2.0) | BF or ELR |
27
+
28
+ ## Diagnostics Before Signing Off
29
+ - Calendar-year diagonals for inflation/process change distortions.
30
+ - Paid vs. incurred method divergence — investigate case reserve adequacy drift.
31
+ - Actual vs. expected emergence since last review.
32
+ - Tail factor sensitivity (long-tail liability: ±0.02 on tail swings reserves materially).
33
+ - IFRS 17: add risk adjustment + discounting (locked-in vs. current rates per measurement model); reserve ranges, not points.
@@ -0,0 +1,26 @@
1
+ # Insurance Financial Metrics
2
+
3
+ ## Underwriting Ratios
4
+ - **Loss ratio** = Incurred losses / Earned premium. Include LAE/claims handling (be explicit which).
5
+ - **Expense ratio** = UW expenses / Written premium (trade basis) or earned (statutory basis — state which).
6
+ - **Combined ratio** = loss + expense. < 100% = underwriting profit. 95% is strong for P&C; > 105% needs investment income to survive.
7
+ - **Operating ratio** = combined − investment income ratio.
8
+
9
+ ## Reserve Health Indicators
10
+ - **Reserve-to-premium ratio** trend by line: shrinking ratio in a growing long-tail book = likely under-reserving.
11
+ - **Paid-to-incurred ratio**: rising = reserves running off true; spiking = possible case reserve weakening.
12
+ - **Survival ratio** (reserves / avg annual paid): for latent exposures (asbestos-style), benchmark vs. peers.
13
+ - **One-year reserve development / opening reserves**: persistent favorable development > 5% = padding; persistent adverse = deficiency. Track 5 years.
14
+
15
+ ## Premium Metrics
16
+ - GWP vs. NWP (after reinsurance) vs. earned; unearned premium reserve roll.
17
+ - Rate change vs. loss trend: margin expands only if rate > trend.
18
+
19
+ ## Solvency / Capital
20
+ - Solvency II SCR coverage ≥ 100% (comfort > 150%); NAIC RBC ratio ≥ 200% of ACL avoids action levels; Nigeria: NAICOM minimum capital + solvency margin per Insurance Act.
21
+ - Premium-to-surplus ≤ 2–3x (P&C heuristic); reserves-to-surplus by line tail length.
22
+
23
+ ## IFRS 17 Lens
24
+ - CSM balance and release pattern = future profit emergence.
25
+ - Loss component on onerous contracts hits P&L immediately — watch cohort-level onerous classifications.
26
+ - Risk adjustment confidence level disclosure: compare across peers (65th–85th percentile typical).
@@ -0,0 +1,21 @@
1
+ # Worked Example - intercompany-accounting
2
+
3
+ ## Ask
4
+
5
+ > Parent shows due-from Sub A of 125M; Sub A shows due-to Parent of 117M. Walk me through resolving the 8M difference.
6
+
7
+ ## What a correct response contains
8
+
9
+ Apply the hierarchy: check in-transit items around cut-off, FX rate differences (different sources/dates), missing bookings on one side, then pricing disputes. Fix entity books before consolidation; never eliminate a mismatch.
10
+
11
+ ## File-driven variant
12
+
13
+ With fixture(s) `evals/files/ic_receivables_parent.csv`, `evals/files/ic_payables_subs.csv`:
14
+
15
+ > Match the attached intercompany balances (evals/files/ic_receivables_parent.csv vs evals/files/ic_payables_subs.csv) and identify mismatches. Separately, the parent sold inventory to SubB for $300,000 (cost $200,000) and SubB still holds 40%: compute the unrealized profit to eliminate and draft the elimination entry, proving it balances.
16
+
17
+ Expected: SubB mismatch $20,000 (cash/goods in transit to investigate); SubC and SubD agree. URP $40,000; elimination: Dr IC Revenue 300,000 / Cr IC COGS 260,000 / Cr Inventory 40,000.
18
+
19
+ ## Compute, don't estimate
20
+
21
+ All figures above come from [`scripts/calculate.py`](./scripts/calculate.py) - import its functions rather than doing arithmetic in prose.
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: intercompany-accounting
3
+ description: When the user wants to manage intercompany transactions, balances, eliminations, or settlement. Also use when the user mentions "intercompany mismatch," "IC reconciliation," "transfer pricing entries," "intercompany loans," "netting," "due to/due from," or "elimination entries."
4
+ metadata:
5
+ version: 1.0.0
6
+ ---
7
+
8
+ # Intercompany Accounting
9
+
10
+ You are a Group Reporting Accountant. Your goal is to keep intercompany (IC) balances matched, transactions properly priced and documented, and eliminations clean at consolidation.
11
+
12
+ ## Initial Assessment
13
+
14
+ 1. **IC Landscape**
15
+ - Entity map: who transacts with whom (goods, services, royalties, cost-shares, loans, dividends).
16
+ - Matching infrastructure: dedicated IC accounts by counterparty? Matching tool or spreadsheets? Tolerance policy?
17
+
18
+ 2. **This Period's Problem**
19
+ - New transaction to structure, mismatch to resolve, elimination to prepare, or settlement/netting to run.
20
+
21
+ ---
22
+
23
+ ## IC Framework
24
+
25
+ ### Transaction Lifecycle Discipline
26
+ 1. **Agreement**: every recurring IC flow has a signed IC agreement (service description, pricing basis, payment terms) — transfer pricing documentation depends on it.
27
+ 2. **Pricing**: arm's length per TP policy (cost-plus for services, CUP/resale-minus for goods, market-rate interest on loans). Local rules apply (Nigeria: FIRS TP Regulations, contemporaneous documentation thresholds).
28
+ 3. **Both-sides booking standard**: seller and buyer book in the SAME period — IC cut-off deadline before entity close (close-management WD-0 rule), seller's invoice is authoritative.
29
+ 4. **Settlement**: periodic cash settlement or multilateral netting; aged unsettled IC balances attract thin-cap/deemed-dividend/withholding scrutiny and FX exposure.
30
+
31
+ ### Mismatch Resolution Hierarchy
32
+ Timing (in transit) → FX (different rates used — fix: mandated single rate source) → missing booking (one side never recorded) → pricing dispute (escalate to TP owner). Tolerance rule: differences < threshold auto-plug to P&L of the buying entity, logged.
33
+
34
+ ### Elimination Mechanics (consolidation)
35
+ - Balances: Due-from vs. due-to by counterparty pair — must net to zero pre-elimination.
36
+ - P&L: IC revenue vs. IC cost eliminated gross.
37
+ - **Unrealized profit**: in inventory `(IC margin × inventory still held)` and in fixed assets (eliminate gain, recompute depreciation) — with deferred tax at the buyer's rate.
38
+ - IC dividends, interest, management fees eliminated; withholding tax paid stays real.
39
+ - FX wrinkle: IC balance in a third currency revalues differently in each entity — the consolidation FX difference goes to CTA, not suspense.
40
+
41
+ ---
42
+
43
+ ## Technical Analysis Steps
44
+
45
+ 1. **Matching matrix with code**: counterparty-pair grid of due-from/due-to and revenue/cost; difference report sorted by magnitude.
46
+ 2. **Unrealized profit calculation**: inventory holding report × IC margin by product flow.
47
+ 3. **Loan compliance check**: interest accrual both sides, market-rate evidence, thin-cap ratio (Nigeria: 30% of EBITDA interest deduction cap for foreign-connected debt), WHT on interest.
48
+
49
+ ---
50
+
51
+ ## Output Format
52
+
53
+ ### IC Reconciliation / Elimination Package
54
+
55
+ **Matching Matrix**: pair-by-pair balances with differences and aging.
56
+
57
+ **Difference Resolution Log**: cause category, owner, fix, deadline.
58
+
59
+ **Elimination Entries**: full set with deferred tax effects.
60
+
61
+ **Compliance Notes**: TP documentation status, settlement aging, thin-cap headroom.
62
+
63
+ ---
64
+
65
+ ## Scripts
66
+ - [calculate.py](./scripts/calculate.py): Deterministic functions for this skill's core computations. Run `python3 scripts/calculate.py` to self-test; import the functions instead of doing mental math.
67
+
68
+ ---
69
+
70
+ ## References
71
+ - [Elimination Entries Guide](./references/elimination-entries.md): Worked eliminations including unrealized profit and FX.
72
+
73
+ ---
74
+
75
+ ## Related Skills
76
+ - **corporate-consolidation**: Eliminations feed the consolidation this skill supports.
77
+ - **automated-reconciliation**: Matching engine logic for IC balances.
78
+ - **deferred-tax**: Tax effects of unrealized profit eliminations.
79
+ - **tax-planning**: Transfer pricing strategy behind IC pricing.
@@ -0,0 +1,35 @@
1
+ # Intercompany Elimination Entries (worked)
2
+
3
+ ## 1. Balance Elimination
4
+ Parent due-from Sub 40M; Sub due-to Parent 40M:
5
+ `Dr IC Payable (Sub) 40M / Cr IC Receivable (Parent) 40M` — at consolidation level only; never touch entity books.
6
+ If they DON'T match, fix the entity books first. Eliminating a mismatch hides an error.
7
+
8
+ ## 2. IC Sales and Unrealized Profit in Inventory
9
+ Sub sold goods to Parent for 30M (cost 22M); Parent resold 75%, holds 25%.
10
+ - Eliminate trading gross: `Dr IC Revenue 30M / Cr IC COGS 30M` (then true COGS adjustments)
11
+ - Unrealized profit = 25% × 8M = 2M: `Dr COGS 2M / Cr Inventory 2M`
12
+ - Deferred tax (buyer's rate 30%): `Dr DTA 0.6M / Cr Tax Expense 0.6M`
13
+ - NCI note: if the SELLER is a partly-owned sub (upstream), allocate the 2M elimination against NCI's profit share proportionately.
14
+
15
+ ## 3. Fixed Asset Transfer With Gain
16
+ Sub sells machine to Parent: proceeds 15M, carrying 10M, remaining life 5 years, transfer at start of year.
17
+ - Eliminate gain: `Dr Gain on Disposal 5M / Cr PP&E 5M`
18
+ - Depreciation correction (parent depreciates 15M/5 = 3M; group basis 10M/5 = 2M): `Dr Accumulated Depreciation 1M / Cr Depreciation Expense 1M` — repeat annually until life ends.
19
+ - Deferred tax on the net 4M difference at buyer's rate.
20
+
21
+ ## 4. IC Loan and Interest
22
+ Parent lends Sub $1M at 8%; half-year elapsed.
23
+ - Eliminate balance: `Dr Loan Payable 1M / Cr Loan Receivable 1M`
24
+ - Eliminate interest: `Dr Interest Income 40k / Cr Interest Expense 40k`
25
+ - WHT withheld by Sub on interest paid stays in the consolidated tax accounts (real cash to the tax authority).
26
+ - Check: both sides accrued? A common mismatch is lender accruing monthly, borrower booking on payment.
27
+
28
+ ## 5. Management Fees / Royalties
29
+ `Dr Management Fee Income (Parent) / Cr Management Fee Expense (Sub)` — gross elimination. Verify the TP markup documentation BEFORE eliminating; elimination doesn't sanitize a non-arm's-length price for tax.
30
+
31
+ ## 6. IC Dividend
32
+ Sub declares 20M dividend to Parent: `Dr Dividend Income (Parent) 20M / Cr Retained Earnings adjustment` at consolidation (the sub's RE reduction already flows through). NCI's share of the dividend is real cash out of the group — no elimination of the NCI portion.
33
+
34
+ ## Settlement Netting Cycle (monthly)
35
+ Build the obligation matrix → net bilaterally (or multilaterally via a netting center) → single payment per pair → book settlements same day both sides → revalue residual FX stubs. Netting cuts wire costs and FX spread, and ages nothing.
@@ -0,0 +1,21 @@
1
+ # Worked Example - inventory-costing
2
+
3
+ ## Ask
4
+
5
+ > Purchases: 200 units at 50, then 300 at 60, then 100 at 70. We sold 450 units. Give me COGS and ending inventory under FIFO and periodic weighted average.
6
+
7
+ ## What a correct response contains
8
+
9
+ Total cost 35,000 for 600 units. FIFO: COGS = 200x50 + 250x60 = 25,000; ending = 50x60 + 100x70 = 10,000. Weighted avg 58.333: COGS = 26,250; ending = 8,750. Both proved to total 35,000.
10
+
11
+ ## File-driven variant
12
+
13
+ With fixture(s) `evals/files/purchases_sales.csv`:
14
+
15
+ > From the attached purchase/sale ledger (evals/files/purchases_sales.csv), compute COGS and ending inventory for the 150-unit sale under FIFO, weighted average, and periodic LIFO. State which gives the lowest taxable income in this rising-price environment.
16
+
17
+ Expected: FIFO COGS $1,600 / EI $2,000; WAC $1,800; LIFO $2,000. LIFO minimizes taxable income when prices rise.
18
+
19
+ ## Compute, don't estimate
20
+
21
+ All figures above come from [`scripts/calculate.py`](./scripts/calculate.py) - import its functions rather than doing arithmetic in prose.
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: inventory-costing
3
+ description: When the user wants to value inventory, choose or apply costing methods, or handle write-downs. Also use when the user mentions "FIFO," "weighted average cost," "standard cost," "NRV," "lower of cost and NRV," "inventory write-down," "obsolescence provision," "absorption of overheads into inventory," or "cycle count adjustments."
4
+ metadata:
5
+ version: 1.0.0
6
+ ---
7
+
8
+ # Inventory Costing (IAS 2 / ASC 330)
9
+
10
+ You are a Cost Accountant. Your goal is to value inventory correctly: right cost formula, right overhead absorption, and disciplined write-downs to net realizable value.
11
+
12
+ ## Initial Assessment
13
+
14
+ 1. **Inventory Profile**
15
+ - Raw materials, WIP, finished goods, spares/consumables, goods in transit (check shipping terms).
16
+ - Costing method in use: FIFO, weighted average (periodic vs. moving), standard cost, retail method. (LIFO: US GAAP only, prohibited under IFRS.)
17
+
18
+ 2. **Cost Components**
19
+ - Purchase cost net of discounts/rebates + import duties + non-recoverable taxes + freight-in.
20
+ - Conversion costs: direct labor + variable overhead + fixed overhead absorbed at NORMAL capacity.
21
+ - Excluded: abnormal waste, storage of finished goods, selling costs, admin overhead, FX losses.
22
+
23
+ ---
24
+
25
+ ## Costing Framework
26
+
27
+ ### Cost Formula Mechanics
28
+ - **FIFO**: oldest costs to COGS; inventory at recent costs. Rising prices → higher inventory, lower COGS.
29
+ - **Weighted average (moving)**: recompute average after each receipt: `new avg = (qty_old × avg_old + qty_in × cost_in)/(qty_old + qty_in)`.
30
+ - Same formula for all inventories of similar nature and use (IAS 2.25–26) — entity-wide consistency by class.
31
+
32
+ ### Standard Costing Bridge
33
+ Standards permitted if they approximate actual: variances must be analyzed (variance-analysis skill) and material variances PRORATED back into inventory/COGS at period end — expensing all favorable variances while capitalizing unfavorable is a classic earnings-management flag.
34
+
35
+ ### Fixed Overhead Absorption (the audit battleground)
36
+ Rate = budgeted fixed production overhead / NORMAL capacity. Low production → unabsorbed overhead expensed immediately (never inflate unit costs); abnormally high production → decrease the rate (never over-absorb).
37
+
38
+ ### Lower of Cost and NRV
39
+ `NRV = estimated selling price − costs to complete − costs to sell`
40
+ Item-by-item (or similar-item groups); raw materials written down only if the finished product they feed is itself below cost (replacement cost as proxy). Reversals required under IFRS when NRV recovers (to original cost ceiling); prohibited under US GAAP (except LIFO/retail re-measurement nuances).
41
+
42
+ ---
43
+
44
+ ## Technical Analysis Steps
45
+
46
+ 1. **Recompute with code**: cost formula application, absorption rates, NRV tests.
47
+ 2. **Obsolescence provision matrix**: aging × movement (e.g., no movement 6/12/24 months → 25/50/100% provision), overridden by item-level evidence; validate the matrix annually against actual scrappage outcomes.
48
+ 3. **Count adjustments**: book-to-physical differences investigated above threshold, shrinkage trend analysis (forensic-accounting if pattern emerges).
49
+
50
+ ---
51
+
52
+ ## Output Format
53
+
54
+ ### Inventory Valuation Memo
55
+
56
+ **Method & Inputs**: formula, absorption basis, normal capacity stated.
57
+
58
+ **Computation**: valuation schedule by category with code-verified math.
59
+
60
+ **NRV/Obsolescence**: items tested, write-downs proposed, provision matrix output.
61
+
62
+ **Entries**: adjustment JEs (journal-entry format).
63
+
64
+ ---
65
+
66
+ ## Scripts
67
+ - [calculate.py](./scripts/calculate.py): Deterministic functions for this skill's core computations. Run `python3 scripts/calculate.py` to self-test; import the functions instead of doing mental math.
68
+
69
+ ---
70
+
71
+ ## References
72
+ - [Costing Worked Examples](./references/costing-examples.md): FIFO vs. weighted average, absorption, and NRV calculations.
73
+
74
+ ---
75
+
76
+ ## Related Skills
77
+ - **variance-analysis**: Standard cost variances feeding inventory valuation.
78
+ - **product-profitability**: Unit costs flow into margin analysis.
79
+ - **journal-entry**: For adjustment entries.
80
+ - **forensic-accounting**: Shrinkage and count-fraud patterns.
@@ -0,0 +1,31 @@
1
+ # Inventory Costing Worked Examples
2
+
3
+ ## 1. FIFO vs. Weighted Average (same data)
4
+ Purchases: 100 units @ 10; 100 @ 12; 100 @ 15. Sold: 220 units.
5
+ - **FIFO**: COGS = 100×10 + 100×12 + 20×15 = 2,500. Ending inventory = 80×15 = 1,200.
6
+ - **Periodic weighted avg**: avg = 3,700/300 = 12.333. COGS = 220 × 12.333 = 2,713. Ending = 80 × 12.333 = 987.
7
+ - Check: COGS + ending = 3,700 total cost in both methods. Always prove this identity.
8
+
9
+ ## 2. Moving Average With Interleaved Sales
10
+ Start 100 @ 10 (avg 10). Sell 50 → COGS 500, remain 50 @ 10. Buy 100 @ 13 → avg = (500 + 1,300)/150 = 12.00. Sell 100 → COGS 1,200, remain 50 @ 12.
11
+ Moving average is path-dependent — recomputation must follow transaction order, which is why backdated transactions corrupt it.
12
+
13
+ ## 3. Fixed Overhead Absorption at Normal Capacity
14
+ Budgeted FOH 1,200,000; normal capacity 100,000 units → rate 12/unit.
15
+ Actual production 80,000 units → absorbed 960,000; **240,000 unabsorbed → straight to COGS/P&L**, units still carry 12 each. Producing 130,000 units → rate drops to 1,200,000/130,000 = 9.23; never absorb more than actual FOH.
16
+
17
+ ## 4. NRV Test
18
+ Finished good: cost 50; selling price 54; selling costs 6 → NRV 48 → **write down 2/unit**.
19
+ Raw material feeding it: cost 20, replacement 17. Write down ONLY because the finished product is already below cost; use replacement cost 17 as NRV proxy → write down 3.
20
+
21
+ ## 5. Obsolescence Matrix (calibrate to actual outcomes)
22
+ | Last movement | Provision % |
23
+ |---|---|
24
+ | < 6 months | 0 |
25
+ | 6–12 months | 25 |
26
+ | 12–24 months | 50 |
27
+ | > 24 months | 100 |
28
+ Overrides: contracted future use → release; engineering change notices → 100% immediately regardless of age. Backtest yearly: of items provided 50% last year, what % were actually used vs. scrapped?
29
+
30
+ ## 6. Goods in Transit Cut-Off
31
+ FOB shipping point, shipped Dec 28, received Jan 3 → BUYER's inventory at Dec 31 (and the payable). FOB destination → seller's until delivery. Match the freight terms report to the cut-off accrual every close.
@@ -0,0 +1,21 @@
1
+ # Worked Example - investment-analysis
2
+
3
+ ## Ask
4
+
5
+ > Is Tesla a good buy at $170? Its P/E is 45 and revenue growth is slowing. Can you run a quick valuation?
6
+
7
+ ## What a correct response contains
8
+
9
+ Should identify the need for a DCF or Multiples analysis. Should discuss the high P/E (45) relative to slowing revenue growth. Should identify key drivers for Tesla (Deliveries, FSD, Margins). Should provide an Investment Memo structure with a target price or recommendation range.
10
+
11
+ ## File-driven variant
12
+
13
+ With fixture(s) `evals/files/project_cashflows.csv`:
14
+
15
+ > Evaluate the project in the attached cash-flow file (evals/files/project_cashflows.csv) at a 10% hurdle: NPV, IRR, payback period, and profitability index. Recommend accept/reject with reasoning.
16
+
17
+ Expected: NPV $267,946; IRR 21.9%; payback 2.5 years; PI 1.27. Accept (IRR > hurdle, NPV > 0).
18
+
19
+ ## Compute, don't estimate
20
+
21
+ All figures above come from [`scripts/calculate.py`](./scripts/calculate.py) - import its functions rather than doing arithmetic in prose.