@1aboveio/skills 0.14.0 → 0.16.1

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 (54) hide show
  1. package/README.md +8 -2
  2. package/package.json +1 -1
  3. package/runtime/skills/distribution/generated/recipes.json +178 -34
  4. package/runtime/skills/distribution/scripts/bundles.mjs +11 -3
  5. package/runtime/skills/engineering/engineering-runtime/scripts/workflow-policy.mjs +1 -1
  6. package/skills/{backend → data-science}/pyspark/SKILL.md +42 -40
  7. package/skills/{backend → data-science}/pyspark/references/diagnosis-and-profiling.md +28 -13
  8. package/skills/data-science/pyspark/references/production-validation.md +130 -0
  9. package/skills/data-science/pyspark/references/reconciliation.md +38 -0
  10. package/skills/{backend → data-science}/pyspark/references/transformation-design.md +30 -2
  11. package/skills/engineering/engineering-runtime/coherence/workflow.json +14 -14
  12. package/skills/engineering/engineering-runtime/scripts/workflow-policy.mjs +1 -1
  13. package/skills/engineering/resolve-issues/generated/workflow-repair-policy.json +11 -11
  14. package/skills/engineering/resolve-issues/scripts/run-state.mjs +1 -1
  15. package/skills/payment/fraud-analysis/LICENSE +3 -0
  16. package/skills/payment/fraud-analysis/SKILL.md +113 -0
  17. package/skills/payment/fraud-analysis/evals/evals.json +40 -0
  18. package/skills/payment/fraud-analysis/references/archetypes/authorized-payment-scam.md +41 -0
  19. package/skills/payment/fraud-analysis/references/archetypes/first-party-fraud.md +44 -0
  20. package/skills/payment/fraud-analysis/references/archetypes/third-party-fraud.md +27 -0
  21. package/skills/payment/fraud-analysis/references/contexts/bank-transfer.md +24 -0
  22. package/skills/payment/fraud-analysis/references/contexts/card-payment.md +30 -0
  23. package/skills/payment/fraud-analysis/references/contexts/payment-collection.md +20 -0
  24. package/skills/payment/fraud-analysis/references/contexts/payout.md +20 -0
  25. package/skills/payment/fraud-analysis/references/feature-engineering.md +158 -0
  26. package/skills/payment/fraud-analysis/references/mechanisms/account-takeover.md +36 -0
  27. package/skills/payment/fraud-analysis/references/report-rationale.md +45 -0
  28. package/skills/payment/fraud-analysis/references/report-template.md +190 -0
  29. package/skills/payment/fraud-analysis/references/review-checklist.md +175 -0
  30. package/skills/payment/fraud-analysis/references/taxonomy.md +79 -0
  31. package/skills/payment/fraud-analysis/references/terminology.md +108 -0
  32. package/skills/payment/fraud-analysis/references/workflow.md +175 -0
  33. package/skills/payment/payment-analysis/LICENSE +3 -0
  34. package/skills/payment/payment-analysis/SKILL.md +127 -0
  35. package/skills/payment/payment-analysis/references/auth-rate-actions.md +30 -0
  36. package/skills/payment/payment-analysis/references/chargebacks.md +88 -0
  37. package/skills/payment/payment-analysis/references/event-layers.md +79 -0
  38. package/skills/payment/payment-analysis/references/fx.md +59 -0
  39. package/skills/payment/payment-analysis/references/journey.md +78 -0
  40. package/skills/payment/payment-analysis/references/metrics.md +62 -0
  41. package/skills/payment/payment-analysis/references/report-template.md +98 -0
  42. package/skills/payment/payment-analysis/references/terminology.md +85 -0
  43. package/skills/payment/payment-analysis/references/visualization.md +47 -0
  44. package/skills/backend/pyspark/references/parity-testing.md +0 -83
  45. package/skills/backend/pyspark/references/production-validation.md +0 -166
  46. /package/skills/{backend → data-science}/airflow-dag-develop/LICENSE +0 -0
  47. /package/skills/{backend → data-science}/airflow-dag-develop/SKILL.md +0 -0
  48. /package/skills/{backend → data-science}/pyspark/LICENSE +0 -0
  49. /package/skills/{backend → data-science}/pyspark/assets/templates/etl.py +0 -0
  50. /package/skills/{backend → data-science}/pyspark/assets/templates/utils/__init__.py +0 -0
  51. /package/skills/{backend → data-science}/pyspark/assets/templates/utils/hudi_metadata.py +0 -0
  52. /package/skills/{backend → data-science}/pyspark/references/etl-contract.md +0 -0
  53. /package/skills/{backend → data-science}/pyspark/references/velocity-feature-calculation.md +0 -0
  54. /package/skills/{backend → data-science}/pyspark/scripts/spark_eventlog_summary.py +0 -0
@@ -0,0 +1,175 @@
1
+ # Independent review checklist
2
+
3
+ Use after the report is written. Review the common contract below plus every
4
+ selected archetype, mechanism, and context pack. Do not re-mine features unless
5
+ a fatal issue requires a user-approved restart.
6
+
7
+ ## Inputs
8
+
9
+ - Draft report and source paths
10
+ - Analysis profile, event grain, and decision point
11
+ - Label definition, maturity window, and attribution confidence
12
+ - Time cut and train/holdout sizes, or explicit in-sample status
13
+ - Allowed and excluded fields
14
+ - Rule definitions and metrics with evaluation window
15
+ - Strategy actions, impact measures, denominators, and assumptions
16
+ - Selected profile pack paths
17
+
18
+ ## Verdicts and severity
19
+
20
+ | Verdict | Meaning |
21
+ |---|---|
22
+ | PASS | Common and profile checks clear |
23
+ | PASS_WITH_FLAGS | Valid with residual monitoring or judgment issues |
24
+ | NEEDS_CHANGES | Mechanical or substantive issues require repair |
25
+ | BLOCKED | Label, attribution, timing, or data foundation is unusable |
26
+
27
+ | Severity | Response |
28
+ |---|---|
29
+ | mechanical | Auto-fix and recheck |
30
+ | judgment | Surface; do not silently change attribution or action |
31
+ | fatal | Stop and ask the user |
32
+
33
+ ## Common method checks
34
+
35
+ ### Pre-flight
36
+
37
+ - [ ] Pre-flight status passed before supervised analysis began
38
+ - [ ] Input readability, row grain, time field, and label provenance were checked
39
+ - [ ] File-column positives map remaining mature rows to negative only after
40
+ preserving explicit missing/pending/unknown/unlabeled states
41
+ - [ ] User-defined positives received an explicit user-defined negative condition
42
+ during pre-flight; `NOT positive` was not silently assumed
43
+ - [ ] Both/neither/immature rows are unlabeled, or their absence is demonstrated
44
+ - [ ] Descriptive-only analysis is clearly separated from supervised metrics when
45
+ pre-flight could not establish both classes
46
+
47
+ ### Analysis profile and attribution
48
+
49
+ - [ ] Exactly one primary archetype, or separate analyses for multiple archetypes
50
+ - [ ] Customer role, consent, technical authentication, mechanism, context,
51
+ attribution confidence, event grain, and decision point are stated
52
+ - [ ] Technical authentication is not used as proof of genuine-customer consent
53
+ - [ ] First-party means knowing participation; authorized-payment scam means a
54
+ deceived victim; third-party means absent genuine-customer consent
55
+ - [ ] APP terminology is limited to authorized push payments
56
+ - [ ] Unresolved victim/participant attribution remains unclassified
57
+
58
+ ### Label and maturity
59
+
60
+ - [ ] Label provenance is stated as file-column or user-defined
61
+ - [ ] Exact positive, negative, and unlabeled definitions and counts are stated
62
+ - [ ] Existing outcome-column labels disclose the assumption used to map other
63
+ mature values to negative and preserve explicit pending/unknown states
64
+ - [ ] User-defined positive labels have a separately user-defined negative class;
65
+ all other rows are not automatically treated as negative
66
+ - [ ] Positive and negative conditions are disjoint; neither/both rows are unlabeled
67
+ - [ ] Confirmed versus proxy status is honest
68
+ - [ ] Positive base rate is factual and uses labeled rows as denominator
69
+ - [ ] Outcome maturity window is defined; immature rows are not clean negatives
70
+ - [ ] Separate archetypes are not blended into one target
71
+ - [ ] Label, synonyms, actions, and later investigation outcomes are excluded
72
+
73
+ ### Temporal validation
74
+
75
+ - [ ] Earlier train and later holdout cut is stated, or metrics are unvalidated
76
+ - [ ] No random split is presented as temporal validation
77
+ - [ ] Headline metrics come from the claimed window
78
+ - [ ] Thresholds, rate lists, graph lists, and watchlists are fit on train only
79
+ - [ ] Holdout rows may use only history known before each row
80
+
81
+ ### Decision-time validity
82
+
83
+ - [ ] Every rule field exists at the stated decision point
84
+ - [ ] Current response, settlement, return, recall, dispute, reimbursement,
85
+ restriction, and investigation fields do not leak backward
86
+ - [ ] History uses prior events and defines timestamp ties
87
+ - [ ] Graph features are point-in-time snapshots
88
+ - [ ] Zero-variance, timing, leakage, and context-only exclusions are listed
89
+ - [ ] Weak entity links are not presented as unique identities
90
+
91
+ ### Metrics and actions
92
+
93
+ - [ ] Rule metrics use occurrence → precision → recall
94
+ - [ ] Count metrics remain present when value metrics are added
95
+ - [ ] Small-N, unstable, or attribution-uncertain segments are monitored or dropped
96
+ - [ ] Actions come from selected contexts and match precision/evidence severity
97
+ - [ ] Holds, freezes, rejects, restrictions, and reporting state policy/legal
98
+ dependencies where applicable
99
+
100
+ ## Common report checks
101
+
102
+ - [ ] Reader order is executive summary → sample/profile/label → rules →
103
+ strategy impact → features → appendix
104
+ - [ ] Analysis profile and attribution table appears near the start
105
+ - [ ] Strategy impact is a standalone chapter
106
+ - [ ] Every package/action has triggered count/rate and amount/share with currency,
107
+ followed by precision and recall
108
+ - [ ] Mixed currencies are not summed without documented FX conversion
109
+ - [ ] Domain impact measures and denominators come from selected context packs
110
+ - [ ] Observed results are distinct from scenario estimates
111
+ - [ ] Proxy labels are not translated into measured loss prevented
112
+ - [ ] Executive summary has no more than five top-level findings
113
+ - [ ] No Markdown bold markers or review-process details in the report
114
+ - [ ] Fixed terminology is consistent with `terminology.md`
115
+ - [ ] Banned strings in `terminology.md` have no unexplained hits
116
+
117
+ ## Required profile overlays
118
+
119
+ Read and check each selected pack. At minimum:
120
+
121
+ ### Third-party fraud
122
+
123
+ - Unauthorized outcome is supported; not every decline/dispute is fraud.
124
+ - Behavioral deviation uses the genuine customer's prior history.
125
+
126
+ ### First-party fraud
127
+
128
+ - Evidence supports knowing participation, not merely unusual behavior.
129
+ - Mule/facilitator attribution is not inferred from money flow alone.
130
+ - Restrictions and reporting identify policy/legal dependencies.
131
+
132
+ ### Authorized payment scam
133
+
134
+ - Consent and deception are both supported.
135
+ - Civil dispute and knowing participation are not mislabeled as scams.
136
+ - Warnings/holds include customer and vulnerability impact.
137
+
138
+ ### Account takeover
139
+
140
+ - Authentication success is separate from customer consent.
141
+ - Profile/recovery changes and device novelty are point-in-time.
142
+ - Shared IP/device infrastructure is not identity proof.
143
+
144
+ ### Card payment
145
+
146
+ - Current CVV, AVS, authorization response, and 3DS result respect timing.
147
+ - BIN lists are train-fit; issuer name is live-operable if used.
148
+ - 3DS failures are outside subsequent authorization denominator.
149
+
150
+ ### Collection, transfer, and payout
151
+
152
+ - Settlement, reversibility, completion, return, and recall timing are correct.
153
+ - Sequence and graph features are point-in-time.
154
+ - Completion, abandonment, delay, workload, and exposure denominators are stated.
155
+
156
+ ## Finding format
157
+
158
+ ```text
159
+ - severity: mechanical | judgment | fatal
160
+ - axis: profile | label | time | decision-time | metrics | actions | report | claims
161
+ - item: <short title>
162
+ - evidence: <specific report location or missing artifact>
163
+ - required_fix: <concrete repair or ask user>
164
+ ```
165
+
166
+ End with:
167
+
168
+ ```text
169
+ VERDICT: PASS | PASS_WITH_FLAGS | NEEDS_CHANGES | BLOCKED
170
+ REVIEWER_MODEL: <id or fallback note>
171
+ AXES: method=…; profile=…; presentation=…
172
+ ```
173
+
174
+ After mechanical fixes, recheck all mechanical items and ensure the repair did
175
+ not alter attribution, introduce leakage, or change action severity silently.
@@ -0,0 +1,79 @@
1
+ # Fraud analysis taxonomy
2
+
3
+ Read this before defining a label. The dimensions are independent: an archetype
4
+ describes the genuine customer's relationship to the fraud, a mechanism explains
5
+ how it happened, and a context identifies where a control operates.
6
+
7
+ ## Archetype router
8
+
9
+ | Customer consent | Customer participation | Deceived about recipient or purpose | Archetype |
10
+ |---|---|---|---|
11
+ | absent | no | no / unknown | `third-party-fraud` |
12
+ | present | knowing | no | `first-party-fraud` |
13
+ | present | no | yes | `authorized-payment-scam` |
14
+ | disputed / unknown | unknown | unknown | `unclassified` |
15
+
16
+ Ask:
17
+
18
+ 1. Did the genuine customer consent to this transaction?
19
+ 2. Did the customer knowingly participate in the abuse?
20
+ 3. Was the customer deceived about the recipient or payment purpose?
21
+
22
+ Authorization language is overloaded. Record both:
23
+
24
+ - **Customer consent** — whether the genuine customer intended the transaction.
25
+ - **Technical authentication** — whether credentials, device, session, MFA, or
26
+ payment authentication passed.
27
+
28
+ A technically authenticated transaction can still be unauthorized by the
29
+ genuine customer after account takeover.
30
+
31
+ ## Archetypes
32
+
33
+ ### Third-party fraud
34
+
35
+ An external actor uses another person's account, credentials, instrument, or
36
+ identity without genuine-customer consent. Examples: stolen card, stolen token,
37
+ credential theft, account takeover.
38
+
39
+ ### First-party fraud
40
+
41
+ The genuine customer or account holder is the perpetrator or a knowing
42
+ participant and misrepresents, manipulates, or deliberately misuses their own
43
+ account for gain. Examples: deliberate collection abuse, false non-receipt or
44
+ refund claims, knowing mule activity, deliberate payout abuse.
45
+
46
+ Do not call this `first-party scam`: scam usually implies a deceived victim.
47
+
48
+ ### Authorized payment scam
49
+
50
+ The genuine customer authorizes a payment but is deceived about its recipient or
51
+ purpose. The customer is the victim, not a knowing participant.
52
+
53
+ `APP scam` is a subtype for a victim-deceived push payment, normally in a bank
54
+ transfer context. Do not apply APP terminology to all authorized payment scams.
55
+
56
+ ### Unclassified
57
+
58
+ Use when consent, deception, or knowing participation cannot yet be established.
59
+ Analyze observable risk signals, but do not claim archetype-specific loss or use
60
+ the unresolved class as confirmed ground truth.
61
+
62
+ ## Mechanisms and contexts
63
+
64
+ Mechanisms may include `account-takeover`, stolen payment credential, social
65
+ engineering, synthetic identity, or deliberate account misuse. Add a mechanism
66
+ pack only when its data and controls require specialized guidance.
67
+
68
+ Supported contexts are `card-payment`, `payment-collection`, `bank-transfer`,
69
+ and `payout`. Select all relevant contexts for linked money-flow analysis, but
70
+ name the event grain and decision point for every rule.
71
+
72
+ ## Mixed cases
73
+
74
+ - Separate confirmed archetypes into separate targets and metrics.
75
+ - A mule may be a knowing participant (first-party fraud), a coerced or deceived
76
+ victim (authorized payment scam or unclassified), or an account-takeover victim
77
+ (third-party fraud). Do not infer the role from rapid movement alone.
78
+ - A customer claim is evidence, not automatic proof of consent or attribution.
79
+ - Civil disputes and service dissatisfaction are not automatically fraud.
@@ -0,0 +1,108 @@
1
+ # Terminology and plain language
2
+
3
+ Use fixed terms consistently in business reports. Selected profile packs may add
4
+ domain terms but must not replace common metric definitions. Read this file
5
+ before writing. After writing, run the proofread in `SKILL.md` step 8.
6
+
7
+ ## Analysis terms
8
+
9
+ | English | Chinese | Do not write |
10
+ |---|---|---|
11
+ | archetype | 欺诈类型 / 分析类型 | |
12
+ | mechanism | 作案机制 | |
13
+ | context | 业务场景 | |
14
+ | customer consent | 客户真实授权 / 客户同意 | 用技术认证代替真实授权 |
15
+ | technical authentication | 技术认证 | 当成持卡人同意的证据 |
16
+ | label | 标签 | |
17
+ | label provenance | 标签来源 | |
18
+ | positive class | 正样本 | 正例 |
19
+ | negative class | 负样本 | |
20
+ | unlabeled | 未标注样本 | |
21
+ | proxy label | 近似标签 | 代理标签 |
22
+ | confirmed outcome | 已确认结果 | |
23
+ | base rate | 正样本基线率 | |
24
+ | occurrence | 触发率 | |
25
+ | precision | 精准率 | 精确率(作指标名时) |
26
+ | recall | 召回率 | |
27
+ | lift | 首次写「相对基线倍数(lift)」 | 只写英文且从不解释 |
28
+ | train set | 训练集 | |
29
+ | holdout | 留出集(holdout) | 与「验证集」来回换;正文首次后可简称留出集 |
30
+ | zero-variance | 零方差字段 | |
31
+ | condition | 条件 | 谓词(对业务读者) |
32
+ | outcome maturity | 标签成熟度 | |
33
+ | attribution confidence | 归因置信度 | |
34
+ | attempt | 授权尝试 | |
35
+ | auth rate | 授权成功率 | 转化率;3DS 转化(指授权成功率时) |
36
+ | hard decline | 硬性拒绝(hard decline) | hard 拦截(指拒绝类型时) |
37
+ | chargeback | 拒付(chargeback) | 与清算混用;正文首次后可简称拒付 |
38
+ | insufficient funds | 余额不足 | 余额 |
39
+ | clerical | 文书错误 | 文书 |
40
+ | quality | 质量争议 | 质量 |
41
+ | weak identity | 弱身份线索 | 弱身份键;永久黑箱 |
42
+ | point-in-time | 截至授权时点 | 不经解释的 point-in-time |
43
+ | headline metrics | 主指标 | 不经解释的 headline |
44
+ | before / after (strategy) | 策略前 / 策略后 | after 分母(单独出现) |
45
+ | false hit on good traffic | 误伤 | |
46
+
47
+ Keep proper nouns: Visa Debit, MasterCard Prepaid, D102, BIN, IIN, PAN, MID,
48
+ MCC, Worldpay, Pazien, Order ID, 3DS, Timestamp.
49
+
50
+ ## Archetypes
51
+
52
+ | ID | English | Chinese guidance |
53
+ |---|---|---|
54
+ | `third-party-fraud` | Third-party fraud | 第三方欺诈;客户未真实授权 |
55
+ | `first-party-fraud` | First-party fraud | 第一方欺诈;客户本人实施或知情参与 |
56
+ | `authorized-payment-scam` | Authorized payment scam | 授权付款诈骗;客户受骗后真实授权 |
57
+ | `unclassified` | Unclassified | 待归因;不强行归类 |
58
+ | `app-scam` | APP scam | 授权推送付款诈骗,仅用于 push payment |
59
+ | `account-takeover` | Account takeover (ATO) | 账户接管;机制,不是独立欺诈类型 |
60
+
61
+ Avoid `first-party scam`: it confuses knowing participation with victim
62
+ deception. Do not translate technical authentication as proof of customer
63
+ consent.
64
+
65
+ ## Actions
66
+
67
+ Use only actions that exist in the selected context:
68
+
69
+ | English | Chinese |
70
+ |---|---|
71
+ | block / reject | 拦截 / 拒绝 |
72
+ | require 3DS | 要求 3DS |
73
+ | reauthenticate | 要求重新认证 |
74
+ | warn / confirm | 风险提示 / 要求确认 |
75
+ | manual review | 人工审核 |
76
+ | delay / cooling-off | 延迟处理 / 冷静期 |
77
+ | hold | 暂缓 / 冻结处理(按实际政策) |
78
+ | restrict account | 限制账户(按实际政策) |
79
+ | monitor | 仅监控 |
80
+
81
+ Do not use `冻结` casually when the implemented action is only a review hold.
82
+ State policy or legal dependencies for severe actions.
83
+
84
+ ## Presentation contract
85
+
86
+ - No Markdown `**bold**` or `__bold__` in report body.
87
+ - Metrics use occurrence → precision → recall.
88
+ - Strategy coverage pairs count/rate and amount/share; money has currency.
89
+ - AND joins co-required conditions; `+` joins package components.
90
+ - Headings and tables provide structure; avoid agent/process language.
91
+ - Keep reviewer verdict, model, and repair logs out of the report.
92
+ - Prefer 留出集 after the first gloss `留出集(holdout)`. Do not bounce
93
+ between 验证集 and holdout in the same report unless quoting a column name.
94
+
95
+ ## Banned strings (grep after writing)
96
+
97
+ Chinese: `正例`, `代理标签`, `精确率`, `转化率`, `3DS 转化`, `弱身份键`,
98
+ `永久黑箱`, `方案侧证据`, `偏热`, `变冷`, `赋能`, `抓手`, `闭环`
99
+
100
+ English leftovers in Chinese reports: `headline`, `uplift` without a Chinese
101
+ gloss, `after 分母`, `hard 拦截` (when meaning decline class), `point-in-time`
102
+ without 截至授权时点.
103
+
104
+ ## Proofread
105
+
106
+ 1. Apply this glossary to headings, tables, and body.
107
+ 2. Grep the report for banned strings.
108
+ 3. Fix language only. Do not change numbers, BIN lists, thresholds, or paths.
@@ -0,0 +1,175 @@
1
+ # Fraud-analysis workflow (steps 0–9)
2
+
3
+ Called from [SKILL.md](../SKILL.md). Paths below are relative to the skill root.
4
+
5
+ ## 0 — Pre-flight
6
+
7
+ Inspect the input, requested target, and label provenance before planning a
8
+ supervised analysis. Record:
9
+
10
+ ```yaml
11
+ label_provenance: file-column | user-defined | absent
12
+ positive_definition: ""
13
+ negative_definition: ""
14
+ unlabeled_definition: ""
15
+ preflight_status: pass | needs-user-input | descriptive-only | blocked
16
+ ```
17
+
18
+ - Confirm the file is readable and identify its row grain, candidate time field,
19
+ outcome/label fields, and requested positive definition.
20
+ - When the positive label comes from an existing row-level outcome column, map
21
+ its positive value(s). Assume the rest of the mature analysis population is
22
+ negative, except explicit missing, pending, unknown, or unlabeled states.
23
+ State this assumption and show the observed values to the user when ambiguous.
24
+ - When the user defines the positive label as a condition or derived rule,
25
+ require the user to define the negative condition during pre-flight. Do not
26
+ infer `NOT positive` as negative. Ask one focused clarification and set status
27
+ to `needs-user-input` until answered.
28
+ - Rows matching neither class, both classes, explicit unknown states, or an
29
+ immature outcome window are unlabeled.
30
+ - If no usable positive and negative definitions exist, offer descriptive
31
+ segmentation without precision/recall, or block supervised analysis.
32
+
33
+ Do not proceed to the supervised workflow until pre-flight passes. A
34
+ `descriptive-only` analysis may select a profile and explore segments, but it
35
+ must not compute precision, recall, lift, or supervised strategy performance.
36
+ Profile clarification may be grouped into the same user question when both
37
+ label and attribution inputs are missing.
38
+
39
+ ## 1 — Select analysis profile
40
+
41
+ Read [taxonomy.md](taxonomy.md). Record:
42
+
43
+ ```yaml
44
+ archetype: third-party-fraud | first-party-fraud | authorized-payment-scam | unclassified
45
+ customer_role: victim | perpetrator | knowing-participant | facilitator | unknown
46
+ customer_consent: present | absent | disputed | unknown
47
+ technical_authentication: passed | failed | not-applicable | unknown
48
+ mechanisms: []
49
+ contexts: []
50
+ subtype: null
51
+ attribution_confidence: confirmed | probable | proxy | unknown
52
+ event_grain: ""
53
+ decision_point: ""
54
+ ```
55
+
56
+ - Select exactly one primary archetype. Select one or more mechanisms and
57
+ contexts when the data supports them.
58
+ - Customer consent and technical authentication are separate facts. Passed
59
+ login, MFA, or session checks do not prove genuine-customer consent.
60
+ - `APP scam` is a subtype of `authorized-payment-scam` in a `bank-transfer`
61
+ context; it is not a synonym for first-party fraud.
62
+ - If victimization versus knowing participation is unresolved, use
63
+ `unclassified`. Do not silently force attribution.
64
+ - If multiple archetypes are confirmed, run separate labels, rules, metrics,
65
+ and impact sections. Never blend them into one positive class.
66
+
67
+ Read the selected archetype, mechanism, and context references before Step 2.
68
+
69
+ ## 2 — Formalize label
70
+
71
+ - One primary label per archetype analysis. Confirmed outcomes are ground truth;
72
+ proxies must be identified as proxies.
73
+ - Carry forward the pre-flight provenance and class definitions; do not discover
74
+ the negative class here.
75
+ - Validate the pre-flight mapping against observed rows and record the resulting
76
+ positive, negative, and unlabeled counts.
77
+ - If the mapping is incomplete or contradictory, return to pre-flight with
78
+ `needs-user-input`; do not ask for or invent a negative class in this step.
79
+ - Derive labels only from supplied data and documented business meaning. Positive
80
+ and negative conditions must be disjoint. Rows matching neither, both, or an
81
+ immature/pending state are unlabeled and excluded from supervised metrics.
82
+ - Record positive definition/count, negative definition/count, unlabeled
83
+ definition/count, base rate among labeled rows, maturity window, exclusions,
84
+ and attribution confidence.
85
+ - Exclude the label, synonyms, investigations, recalls, disputes, or other later
86
+ outcomes from features when unavailable at the selected decision point.
87
+ - For delayed outcomes, ensure enough observation time or mark recent rows as
88
+ immature rather than negative.
89
+ - Do not continue to precision, recall, or supervised rule scoring until both
90
+ positive and negative classes are defined.
91
+
92
+ ## 3 — Freeze temporal validation
93
+
94
+ - Freeze the cut before feature work. Train is earlier; holdout is later.
95
+ - Do not random-shuffle rows or use random k-fold as headline validation.
96
+ - History and graph snapshots contain prior events only.
97
+ - No time column means full-sample descriptive analysis; mark metrics
98
+ **unvalidated**.
99
+
100
+ ## 4 — Engineer candidates
101
+
102
+ Read [feature-engineering.md](feature-engineering.md) and all selected
103
+ profile packs.
104
+
105
+ - Declare event grain and decision point before assessing columns.
106
+ - Classify fields as allowed now, excluded for zero variance, excluded for
107
+ timing, excluded for leakage, or context-only.
108
+ - Build thresholds, rate lists, graph lists, and watchlists on train only.
109
+ - Prefer interpretable conditions with explicit units and windows.
110
+ - Do not invent columns, identity links, consent, intent, or actor attribution.
111
+
112
+ ## 5 — Select shortlist
113
+
114
+ Use train only: lift, support, stability, operability, and meaningful
115
+ interactions. Keep tiny or attribution-uncertain spikes for monitoring.
116
+
117
+ ## 6 — Score rules
118
+
119
+ State explicit conditions, event grain, units, windows, and decision point.
120
+ Headline holdout metrics use this order:
121
+
122
+ **occurrence → precision → recall**
123
+
124
+ Train metrics are debugging evidence only. If outcomes are value-bearing, also
125
+ measure captured positive amount without replacing count-based metrics.
126
+
127
+ ## 7 — Map actions and packages
128
+
129
+ Use actions from the selected context packs; there is no universal 3DS action.
130
+
131
+ | Metric and evidence profile | Shared guidance |
132
+ |---|---|
133
+ | High precision, stable, severe impact | Consider the context's strongest preventive action |
134
+ | Higher recall, moderate precision | Add verification, review, warning, hold, or friction |
135
+ | Weak, unstable, small-N, uncertain attribution | Monitor or investigate |
136
+
137
+ - Legal, regulatory, policy, and operational authority constrain account holds,
138
+ freezes, rejects, beneficiary blocks, and reporting.
139
+ - Keep individual rules separate from multi-rule **strategy packages**.
140
+ - Freeze default and comparison packages before report writing.
141
+ - For each package compute triggered count/rate and amount/share, then precision
142
+ and recall, plus the context-specific customer, operations, conversion, delay,
143
+ and loss measures required by its pack.
144
+
145
+ ## 8 — Write business report
146
+
147
+ Read [report-template.md](report-template.md),
148
+ [terminology.md](terminology.md), and selected profile packs.
149
+
150
+ Use reader order:
151
+
152
+ 执行摘要 → 抽样、分析画像与标签 → 规则发现 → 策略整体影响 → 特征 → 附录
153
+
154
+ - Include the analysis profile and actor attribution near the start.
155
+ - Report only domain-appropriate actions, denominators, and impact KPIs.
156
+ - Strategy impact always includes count/rate and amount/share, then precision
157
+ and recall. Add only the selected contexts' required impact measures.
158
+ - Do not present scenario estimates or proxy-label value as measured loss saved.
159
+ - Save to a path such as `reports/fraud-analysis/<scope>.md`.
160
+ - Before finishing: grep the report for banned strings in
161
+ [terminology.md](terminology.md) and fix language only (not numbers,
162
+ BIN lists, or thresholds).
163
+
164
+ ## 9 — Independent review
165
+
166
+ Read [review-checklist.md](review-checklist.md) and selected packs.
167
+
168
+ - Review the common method and presentation contract.
169
+ - Apply checks from every selected archetype, mechanism, and context pack.
170
+ - Auto-fix mechanical issues only. Do not silently change attribution, label,
171
+ customer role, or action severity.
172
+ - Prefer a fresh independent reviewer. If unavailable, use a fresh same-session
173
+ checklist and disclose that only in the chat delivery note.
174
+ - Deliver the business report plus a short note with verdict, fixes, and open
175
+ judgment issues. Keep review process details out of the report.
@@ -0,0 +1,3 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 1AboveIO
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: payment-analysis
3
+ description: >
4
+ Produce a visualized payment overview from authorization + settlement
5
+ extracts (optional chargebacks): executive summary, top statistics, payment
6
+ journey Sankey, and topics (volume, WoW trend, auth rate, BIN-country
7
+ contribution, decline-by-reason, decline-by-country). Amounts report in USD
8
+ (Forex Service daily conversion). Chargebacks use Visa same-month and
9
+ Mastercard lagged 拒付率. 运营影响 is 3DS / 风控拦截 / soft-decline retry
10
+ only. Use whenever the user asks for payment overview, auth-rate analysis,
11
+ decline mix, BIN/issuer-country contribution, settlement GMV, payment journey,
12
+ Sankey funnel, FX-to-USD, chargeback rate, 运营影响, or "business analysis of
13
+ transactions" — even if they do not say payment-analysis. Do NOT use for
14
+ supervised fraud-rule mining (that is fraud-analysis).
15
+ ---
16
+
17
+ # Payment Analysis
18
+
19
+ Descriptive payment-funnel analytics with charts. Explains what happened in the
20
+ book. Does not invent fraud rules or claim loss saved.
21
+
22
+ Use authorization **and** settlement when both files exist. Chargebacks are
23
+ optional topic fuel, not required for the journey core.
24
+
25
+ | Layer | Typical file | Row grain |
26
+ |---|---|---|
27
+ | Authorizations | `Authorizations_*.csv` | one auth attempt |
28
+ | Settlements | `Sales-and-refunds_*settlements*.csv` | one sale or refund |
29
+ | Chargebacks | `Chargebacks_*.csv` | one dispute (optional) |
30
+
31
+ **Produce:** Markdown + preferred Chinese/bilingual HTML under
32
+ `reports/payment-analysis/`.
33
+ **Do not produce:** supervised precision/recall packages (`fraud-analysis`).
34
+
35
+ Read the playbook for the step you are on. Paths under `references/` are
36
+ relative to this skill.
37
+
38
+ ## Workflow
39
+
40
+ Follow these steps in order.
41
+
42
+ ### 0 — Pre-flight
43
+
44
+ Read [event-layers.md](references/event-layers.md). Record layers present and
45
+ missing, paths, time fields, currencies, and which journey checkpoints have
46
+ usable columns. Amount reporting is USD: read [fx.md](references/fx.md) before
47
+ any amount KPI (all-USD books still write `金额均为 USD` and do not call Forex).
48
+
49
+ ### 1 — Window and segments
50
+
51
+ Freeze the analysis window (defaults in event-layers.md). Segment by BIN
52
+ country, card product, response message/code, settlement type when present.
53
+
54
+ ### 2 — KPIs
55
+
56
+ Compute auth + settlement metrics from [metrics.md](references/metrics.md).
57
+ Convert non-USD amounts per [fx.md](references/fx.md) before any sum or share.
58
+ If chargebacks are present, monthly 拒付率 follows
59
+ [chargebacks.md](references/chargebacks.md) (Visa same-month, Mastercard lagged,
60
+ skip empty brand-months, no blended Visa+Mastercard ratio).
61
+
62
+ ### 3 — Journey Sankey
63
+
64
+ Build **count** flows with [journey.md](references/journey.md). Join sales to
65
+ approved auths on `Order ID`. Footnote unjoined refunds. Skip risk/3DS nodes
66
+ when authentication fields are empty; caption the skips.
67
+
68
+ ### 4 — Write outputs
69
+
70
+ Structure and chapter minima:
71
+ [report-template.md](references/report-template.md). Chart marks:
72
+ [visualization.md](references/visualization.md). English/Chinese terms:
73
+ [terminology.md](references/terminology.md). 运营影响 only from
74
+ [auth-rate-actions.md](references/auth-rate-actions.md) when the extract
75
+ supports the trigger.
76
+
77
+ ```text
78
+ reports/payment-analysis/<scope>_overview.md
79
+ reports/payment-analysis/<scope>_overview.zh.md
80
+ reports/payment-analysis/<scope>_overview.zh.html
81
+ ```
82
+
83
+ HTML is preferred when there are charts. Glossary applies to headings, KPI
84
+ labels, legends, and Sankey skip chips.
85
+
86
+ ### 5 — Language proofread
87
+
88
+ Grep every report file for the banned strings in
89
+ [terminology.md](references/terminology.md). Replace hits using that table.
90
+ Do not change numbers, joins, or chart data.
91
+
92
+ ### 6 — Sanity check
93
+
94
+ - [ ] Structure is summary → top stats → Sankey → topics → 运营影响
95
+ - [ ] Auth + settlement both used when both files exist
96
+ - [ ] Sankey skips unavailable risk/3DS checkpoints and says so
97
+ - [ ] Count/amount are bars; rate is a line; dual axes when combined
98
+ - [ ] Amount axes/legends include currency (`授权尝试金额 USD`, …)
99
+ - [ ] No supervised fraud-rule metrics
100
+ - [ ] Non-USD amounts converted per fx.md; all-USD books say 金额均为 USD
101
+ - [ ] Chargeback monthly rates skip empty brand-months; no blended Visa+MC ratio
102
+ - [ ] 运营影响 only from auth-rate-actions.md when triggered
103
+ - [ ] Language matches terminology.md; banned strings have no unexplained hits
104
+
105
+ ## Boundary with fraud-analysis
106
+
107
+ | Need | Skill |
108
+ |---|---|
109
+ | Volume, journey Sankey, auth rate, decline mix, settlement overview, 运营影响 routing | `payment-analysis` |
110
+ | Proxy/confirmed fraud labels, holdout precision/recall, 3DS/block **packages** | `fraud-analysis` |
111
+
112
+ Routing 3DS / 风控拦截 / retry from this extract is not a fraud-analysis rule
113
+ package.
114
+
115
+ ## Reference index
116
+
117
+ | Need | Read |
118
+ |---|---|
119
+ | Grains, joins, windows | [event-layers.md](references/event-layers.md) |
120
+ | USD conversion | [fx.md](references/fx.md) |
121
+ | KPI formulas | [metrics.md](references/metrics.md) |
122
+ | Visa / Mastercard 拒付率 | [chargebacks.md](references/chargebacks.md) |
123
+ | Sankey checkpoints | [journey.md](references/journey.md) |
124
+ | Chart marks | [visualization.md](references/visualization.md) |
125
+ | Report chapters | [report-template.md](references/report-template.md) |
126
+ | 运营影响 | [auth-rate-actions.md](references/auth-rate-actions.md) |
127
+ | Language / banned strings | [terminology.md](references/terminology.md) |