@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,130 @@
1
+ # Production Validation
2
+
3
+ Playbook for workflow step 5: **canary → (optional) profile → write →
4
+ reconciliation** on the cluster. Use a **small sample**, typically **one month**
5
+ of source data. Bind canary and write to the same pinned snapshot. Local tests
6
+ do not substitute.
7
+
8
+ ## Fail-Closed Admission
9
+
10
+ Do not launch until all applicable facts are recorded and valid:
11
+
12
+ - exact commit/module hash;
13
+ - production Spark, Python, Java, and table-format runtimes;
14
+ - source snapshot or date boundary (the one-month sample);
15
+ - scheduler pause/ownership state;
16
+ - zero competing warehouse work;
17
+ - explicit validate-only or write-enabled mode;
18
+ - durable writable log and event-log destination;
19
+ - restart/recovery plan for writes.
20
+
21
+ Classify existing processes and working-tree changes before touching them. Do
22
+ not kill or overwrite another operator's work.
23
+
24
+ ## 1. Canary
25
+
26
+ Implement the validate-only guard **in the Spark job**, not only in a wrapper.
27
+ Validate with one aggregate action, then return before any writer.
28
+
29
+ ```python
30
+ import json
31
+
32
+ from pyspark.sql import functions as F
33
+
34
+
35
+ def validate_candidate(candidate):
36
+ # first() is a Spark action: it executes the lazy transform plan.
37
+ metrics = candidate.agg(
38
+ F.count("*").alias("row_count"),
39
+ F.countDistinct("event_id").alias("distinct_event_count"),
40
+ F.sum(
41
+ F.when(F.col("event_id").isNull(), 1).otherwise(0)
42
+ ).alias("null_event_id_count"),
43
+ F.sum(
44
+ F.when(F.col("event_count_1h") < 0, 1).otherwise(0)
45
+ ).alias("invalid_event_count_1h"),
46
+ F.count("amount_usd_1h").alias("non_null_amount_usd_1h_count"),
47
+ ).first().asDict()
48
+
49
+ blockers = []
50
+ if metrics["row_count"] != metrics["distinct_event_count"]:
51
+ blockers.append("event_id is not unique")
52
+ if metrics["null_event_id_count"]:
53
+ blockers.append("event_id contains nulls")
54
+ if metrics["invalid_event_count_1h"]:
55
+ blockers.append("event_count_1h contains negative values")
56
+ if blockers:
57
+ raise RuntimeError(f"validation blocked: {blockers}")
58
+ return metrics
59
+
60
+
61
+ def run(validate_only, source_snapshot):
62
+ source = extract(source_snapshot)
63
+ candidate = transform(source)
64
+
65
+ metrics = validate_candidate(candidate)
66
+ print(json.dumps(metrics, sort_keys=True))
67
+
68
+ if validate_only:
69
+ print("validate-only: skipping publication")
70
+ return
71
+
72
+ publish(candidate)
73
+ ```
74
+
75
+ Pin every source read to the same immutable snapshot. If the source cannot be
76
+ pinned, the canary does not prove what the writer will publish. Reference every
77
+ derived output in at least one validation aggregate so Catalyst cannot prune it.
78
+
79
+ Launch through the production `spark-submit` path and runtimes:
80
+
81
+ ```bash
82
+ export PYSPARK_DRIVER_PYTHON="$DRIVER_PYTHON"
83
+ export PYSPARK_PYTHON="$EXECUTOR_PYTHON"
84
+
85
+ spark-submit \
86
+ --name "$CANARY_NAME" \
87
+ --conf spark.pyspark.driver.python="$DRIVER_PYTHON" \
88
+ --conf spark.pyspark.python="$EXECUTOR_PYTHON" \
89
+ --conf spark.eventLog.enabled=true \
90
+ job.py --validate-only
91
+ ```
92
+
93
+ Do not replace another operator's scheduler files in place.
94
+
95
+ Prove the canary did not write:
96
+
97
+ 1. Validation completed with zero blockers.
98
+ 2. The terminal log says publication was skipped.
99
+ 3. The event log reports zero Spark output records and bytes.
100
+
101
+ Do not add `.cache()` or `.persist()` to warm the canary.
102
+
103
+ ## 2. Profiling (optional)
104
+
105
+ After the canary, profile only when wall time exceeds **5 minutes** and the run
106
+ was not resource-constrained. Otherwise skip. When required, follow
107
+ [Diagnosis And Profiling](diagnosis-and-profiling.md).
108
+
109
+ ## 3. Write
110
+
111
+ Write-enabled only after a successful canary and **explicit authorization**.
112
+ Re-check admission. Publish the same pinned sample. Do not present canary time
113
+ as write performance.
114
+
115
+ If a write is cancelled, prove from logs/source that publication was not
116
+ reached. YARN `KILLED` alone does not prove no commit occurred.
117
+
118
+ ## 4. Reconciliation
119
+
120
+ Independent cluster read of the published scope — not a reuse of canary
121
+ aggregates. Follow [Reconciliation](reconciliation.md). Fail closed on mismatch.
122
+
123
+ ## Evidence And Ownership
124
+
125
+ Safe evidence: counts, null rates, distinct counts, min/max dates, hashes,
126
+ stage metrics, plan-node counts, commit IDs. Do not print credentials or
127
+ entity-level rows.
128
+
129
+ After the run: confirm processes are terminal, restore scheduler ownership,
130
+ and report compute/validation, publication, and end-to-end time separately.
@@ -0,0 +1,38 @@
1
+ # Reconciliation
2
+
3
+ Cluster check after an authorized write in production validation. Use the **same
4
+ one-month sample** as the canary. Local fixtures do not prove this.
5
+
6
+ Independently read the published table or Hudi commit. Do not reuse canary
7
+ aggregates. Fail closed on mismatch.
8
+
9
+ ## What To Reconcile
10
+
11
+ Against the canary metrics and the previous path/oracle:
12
+
13
+ - row count and distinct identity count
14
+ - schema and required columns
15
+ - date/partition coverage of the sample
16
+ - write mode, commit success, and downstream readability
17
+ - validation blockers still zero on the published scope
18
+
19
+ ## Bidirectional Row Parity
20
+
21
+ Counts alone miss wrong values, swapped identities, and duplicate multiplicity.
22
+ Compare full rows both ways with `exceptAll`, not `subtract`:
23
+
24
+ ```python
25
+ expected = old_build(source).select(*OUTPUT_COLUMNS)
26
+ actual = published.select(*OUTPUT_COLUMNS)
27
+
28
+ assert expected.exceptAll(actual).count() == 0
29
+ assert actual.exceptAll(expected).count() == 0
30
+ ```
31
+
32
+ Pin `source` to the same snapshot the writer used. Keep the previous
33
+ implementation only as this oracle while parity is being proven.
34
+
35
+ ## Evidence
36
+
37
+ Safe evidence: counts, distinct counts, null rates, min/max dates, hashes, and
38
+ commit IDs. Do not print credentials or entity-level production rows.
@@ -158,5 +158,33 @@ assert candidate.columns == OUTPUT_COLUMNS
158
158
  ```
159
159
 
160
160
  For composite identity, list every component, for example
161
- `IDENTITY_COLUMNS = ["transaction_id", "transaction_leg_id"]`. Add the
162
- bidirectional identity and row-parity tests from [Parity Testing](parity-testing.md).
161
+ `IDENTITY_COLUMNS = ["transaction_id", "transaction_leg_id"]`.
162
+
163
+ ## Local proof
164
+
165
+ These checks belong in **local tests** (workflow step 4). Cluster row parity is
166
+ [Reconciliation](reconciliation.md) after a write.
167
+
168
+ Keep a bounded previous-path oracle on **synthetic** fixtures. Assert critical
169
+ rules directly so oracle and candidate cannot share the same mistake:
170
+
171
+ ```python
172
+ by_id = {row.event_id: row for row in actual.collect()}
173
+ assert by_id["at-24h"].count_24h == 2 # inclusive lower boundary
174
+ assert by_id["after-24h"].count_24h == 1 # one unit outside
175
+ assert by_id["same-time-b"].count_1h == 2 # stable tie ordering
176
+ ```
177
+
178
+ Cover empty and single-event groups; exact boundaries and one unit beyond;
179
+ same-timestamp ties; null key/time/amount; open/close/eviction; floating-point
180
+ residue; one dense hot key; duplicate and missing identities.
181
+
182
+ Assert the expensive plan shape is absent without snapshotting the whole plan:
183
+
184
+ ```python
185
+ plan = actual._jdf.queryExecution().executedPlan().toString().lower()
186
+ assert not ("join" in plan and "event_time" in plan and "interval" in plan)
187
+ ```
188
+
189
+ Mutation-prove high-risk tests (cutoff direction, tie-breaker, pair join,
190
+ required column) so they fail when the rule is broken.
@@ -361,7 +361,7 @@
361
361
  "id": "first-party",
362
362
  "type": "first-party",
363
363
  "package": "@1aboveio/skills",
364
- "version": "0.14.0"
364
+ "version": "0.16.1"
365
365
  },
366
366
  "contentDigest": "eff6c7b5931bce5b2265a619bccddd371a89df6ce7bc2edc74f11d00060a71dd",
367
367
  "digestExcludes": []
@@ -374,7 +374,7 @@
374
374
  "id": "first-party",
375
375
  "type": "first-party",
376
376
  "package": "@1aboveio/skills",
377
- "version": "0.14.0"
377
+ "version": "0.16.1"
378
378
  },
379
379
  "contentDigest": "08230dc57a53d6526692b50138038abbd80abce1a067e01c52ad6acc182caf7e",
380
380
  "digestExcludes": []
@@ -387,7 +387,7 @@
387
387
  "id": "first-party",
388
388
  "type": "first-party",
389
389
  "package": "@1aboveio/skills",
390
- "version": "0.14.0"
390
+ "version": "0.16.1"
391
391
  },
392
392
  "contentDigest": "9eea7bfba348ddaea1b934c9a7fabdd9b101df8a146e1c93e947da4d335f1d98",
393
393
  "digestExcludes": []
@@ -400,7 +400,7 @@
400
400
  "id": "first-party",
401
401
  "type": "first-party",
402
402
  "package": "@1aboveio/skills",
403
- "version": "0.14.0"
403
+ "version": "0.16.1"
404
404
  },
405
405
  "contentDigest": "58b0556228a9271cf9e33727a05fc08a4fdfd29512ec0936b169f0a55d60e6ef",
406
406
  "digestExcludes": []
@@ -413,9 +413,9 @@
413
413
  "id": "first-party",
414
414
  "type": "first-party",
415
415
  "package": "@1aboveio/skills",
416
- "version": "0.14.0"
416
+ "version": "0.16.1"
417
417
  },
418
- "contentDigest": "9eac84bee618e57564eb702d198484b6e78f8d27e3db621d087f0dd2dc048b58",
418
+ "contentDigest": "a3743e0b48f0ddb54cd98d1dad22907c5f5613d13525d758c4915f1661788062",
419
419
  "digestExcludes": []
420
420
  },
421
421
  {
@@ -426,7 +426,7 @@
426
426
  "id": "first-party",
427
427
  "type": "first-party",
428
428
  "package": "@1aboveio/skills",
429
- "version": "0.14.0"
429
+ "version": "0.16.1"
430
430
  },
431
431
  "contentDigest": "b5af4dccf703362d4f41cac4fdff48305f652a00338d85975a2e5c35ec6bc61c",
432
432
  "digestExcludes": []
@@ -439,7 +439,7 @@
439
439
  "id": "first-party",
440
440
  "type": "first-party",
441
441
  "package": "@1aboveio/skills",
442
- "version": "0.14.0"
442
+ "version": "0.16.1"
443
443
  },
444
444
  "contentDigest": "f048fd00c69f2dc666fc7a3096cfeee6dfba73933bfb69602f3f0e26159798cc",
445
445
  "digestExcludes": []
@@ -452,7 +452,7 @@
452
452
  "id": "first-party",
453
453
  "type": "first-party",
454
454
  "package": "@1aboveio/skills",
455
- "version": "0.14.0"
455
+ "version": "0.16.1"
456
456
  },
457
457
  "contentDigest": "90a7c4e1ad6da1e632ea2c5259e4967ffebb84353adccbca8dfc5d6bc50b60c1",
458
458
  "digestExcludes": []
@@ -465,15 +465,15 @@
465
465
  "id": "first-party",
466
466
  "type": "first-party",
467
467
  "package": "@1aboveio/skills",
468
- "version": "0.14.0"
468
+ "version": "0.16.1"
469
469
  },
470
- "contentDigest": "0d71ce70f3180bba021005e056f028ef5a2018eb187078ab8c691a5a000a924e",
470
+ "contentDigest": "1d85a6268819b2c2d4622355baeb4f8576e05a9725341339785badae8fe887d3",
471
471
  "digestExcludes": [
472
472
  "coherence/workflow.json"
473
473
  ]
474
474
  }
475
475
  ],
476
- "releaseIdentity": "5c171520b6818f86f6b88cd60e5e4e0168dd6f89256690925c02758105c6c8a5",
476
+ "releaseIdentity": "e4cd408398f14ccc6847f86e4f0deb5a733b95ff23773ab6a4669c1c7a336130",
477
477
  "lifecycleAuthority": "native-skills-cli",
478
478
  "repairRecipe": {
479
479
  "id": "engineering-workflow-dependency-first",
@@ -531,7 +531,7 @@
531
531
  "sourceId": "first-party",
532
532
  "sourceType": "first-party",
533
533
  "package": "@1aboveio/skills",
534
- "version": "0.14.0",
534
+ "version": "0.16.1",
535
535
  "installPath": null,
536
536
  "members": [
537
537
  "harness-runtime",
@@ -547,7 +547,7 @@
547
547
  "commands": [
548
548
  {
549
549
  "transport": "npm",
550
- "command": "npx @1aboveio/skills@0.14.0 install --group engineering-workflow --yes"
550
+ "command": "npx @1aboveio/skills@0.16.1 install --group engineering-workflow --yes"
551
551
  }
552
552
  ],
553
553
  "onFailure": {
@@ -97,7 +97,7 @@ export const WORKFLOW_TRUSTED_SOURCES = deepFreeze({
97
97
  id: 'first-party',
98
98
  type: 'first-party',
99
99
  package: '@1aboveio/skills',
100
- version: '0.14.0',
100
+ version: '0.16.1',
101
101
  },
102
102
  matt: {
103
103
  id: 'matt-pocock',
@@ -237,7 +237,7 @@
237
237
  "id": "first-party",
238
238
  "type": "first-party",
239
239
  "package": "@1aboveio/skills",
240
- "version": "0.14.0"
240
+ "version": "0.16.1"
241
241
  }
242
242
  },
243
243
  {
@@ -248,7 +248,7 @@
248
248
  "id": "first-party",
249
249
  "type": "first-party",
250
250
  "package": "@1aboveio/skills",
251
- "version": "0.14.0"
251
+ "version": "0.16.1"
252
252
  }
253
253
  },
254
254
  {
@@ -259,7 +259,7 @@
259
259
  "id": "first-party",
260
260
  "type": "first-party",
261
261
  "package": "@1aboveio/skills",
262
- "version": "0.14.0"
262
+ "version": "0.16.1"
263
263
  }
264
264
  },
265
265
  {
@@ -270,7 +270,7 @@
270
270
  "id": "first-party",
271
271
  "type": "first-party",
272
272
  "package": "@1aboveio/skills",
273
- "version": "0.14.0"
273
+ "version": "0.16.1"
274
274
  }
275
275
  },
276
276
  {
@@ -281,7 +281,7 @@
281
281
  "id": "first-party",
282
282
  "type": "first-party",
283
283
  "package": "@1aboveio/skills",
284
- "version": "0.14.0"
284
+ "version": "0.16.1"
285
285
  }
286
286
  },
287
287
  {
@@ -292,7 +292,7 @@
292
292
  "id": "first-party",
293
293
  "type": "first-party",
294
294
  "package": "@1aboveio/skills",
295
- "version": "0.14.0"
295
+ "version": "0.16.1"
296
296
  }
297
297
  },
298
298
  {
@@ -303,7 +303,7 @@
303
303
  "id": "first-party",
304
304
  "type": "first-party",
305
305
  "package": "@1aboveio/skills",
306
- "version": "0.14.0"
306
+ "version": "0.16.1"
307
307
  }
308
308
  },
309
309
  {
@@ -314,7 +314,7 @@
314
314
  "id": "first-party",
315
315
  "type": "first-party",
316
316
  "package": "@1aboveio/skills",
317
- "version": "0.14.0"
317
+ "version": "0.16.1"
318
318
  }
319
319
  },
320
320
  {
@@ -325,7 +325,7 @@
325
325
  "id": "first-party",
326
326
  "type": "first-party",
327
327
  "package": "@1aboveio/skills",
328
- "version": "0.14.0"
328
+ "version": "0.16.1"
329
329
  }
330
330
  }
331
331
  ],
@@ -426,7 +426,7 @@
426
426
  "sourceId": "first-party",
427
427
  "sourceType": "first-party",
428
428
  "package": "@1aboveio/skills",
429
- "version": "0.14.0",
429
+ "version": "0.16.1",
430
430
  "installPath": null,
431
431
  "members": [
432
432
  "harness-runtime",
@@ -442,7 +442,7 @@
442
442
  "commands": [
443
443
  {
444
444
  "transport": "npm",
445
- "command": "npx @1aboveio/skills@0.14.0 install --group engineering-workflow --yes"
445
+ "command": "npx @1aboveio/skills@0.16.1 install --group engineering-workflow --yes"
446
446
  }
447
447
  ],
448
448
  "onFailure": {
@@ -3412,7 +3412,7 @@ export const WORKFLOW_PREFLIGHT_COMMANDS = Object.freeze([
3412
3412
 
3413
3413
  const WORKFLOW_VERIFIER_URL = new URL('../../engineering-runtime/scripts/workflow-coherence.mjs', import.meta.url)
3414
3414
  const WORKFLOW_FALLBACK_POLICY_URL = new URL('../generated/workflow-repair-policy.json', import.meta.url)
3415
- export const WORKFLOW_TRUSTED_FALLBACK_POLICY_SHA256 = '626a05e1854f9dff6842f4bd9163b02fbb9bd74d5407b964a8d5c7bb84100b67'
3415
+ export const WORKFLOW_TRUSTED_FALLBACK_POLICY_SHA256 = '41c079a5d5a346693847ab6f6067b409ba48a5c92acbe9eab46a1633ced6494e'
3416
3416
  const WORKFLOW_REPAIR_RECIPE_REFERENCE = Object.freeze({
3417
3417
  id: 'engineering-workflow-dependency-first',
3418
3418
  generatedFrom: 'skills/distribution/generated/recipes.json',
@@ -0,0 +1,3 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 1AboveIO
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: fraud-analysis
3
+ description: >
4
+ Analyze tabular payment, transfer, collection, payout, account, or fraud-case
5
+ data (CSV, XLSX, TXT) to find interpretable features and operable risk rules.
6
+ Supports third-party fraud (including stolen credentials and account takeover),
7
+ first-party fraud or deliberate account abuse, and authorized payment scams
8
+ (including APP scams), across card payments, collections, bank transfers, and
9
+ payouts. Produces temporal holdout metrics, domain-appropriate actions, strategy
10
+ impact, and a business report. Use for fraud, scam, mule, account-takeover,
11
+ chargeback, dispute, transfer, collection, or payout risk analysis even when the
12
+ user does not name this skill.
13
+ ---
14
+
15
+ # Fraud Analysis
16
+
17
+ Analyze fraud through composable dimensions rather than treating every case as
18
+ card fraud:
19
+
20
+ - **Archetype** — the genuine customer's relationship to the fraud
21
+ - **Mechanism** — how compromise, deception, or abuse occurred
22
+ - **Context** — the product or money-movement surface where a rule fires
23
+
24
+ Run this **10-step** loop:
25
+
26
+ 0. Pre-flight → 1. Profile → 2. Label → 3. Time split → 4. Engineer features →
27
+ 5. Shortlist → 6. Score rules → 7. Map actions + packages → 8. Write report →
28
+ 9. Review
29
+
30
+ **Produce:** operable rules and portfolio impact in a business report.
31
+ **Do not produce:** a black-box model as the main answer.
32
+
33
+ > Paths under `references/` are relative to this skill directory. Step detail:
34
+ > [references/workflow.md](references/workflow.md).
35
+
36
+ ## Required references
37
+
38
+ | File | When |
39
+ |---|---|
40
+ | [references/workflow.md](references/workflow.md) | Every step — full procedure |
41
+ | [references/taxonomy.md](references/taxonomy.md) | Step 1; select archetype, mechanism, and context |
42
+ | [references/feature-engineering.md](references/feature-engineering.md) | Step 4; shared decision-time rules |
43
+ | [references/report-template.md](references/report-template.md) | Step 8; common report contract and overlay selection |
44
+ | [references/terminology.md](references/terminology.md) | Step 8; fixed terms and language proofread |
45
+ | [references/review-checklist.md](references/review-checklist.md) | Step 9; common and selected-profile checks |
46
+
47
+ After Step 1, read only the selected profile references:
48
+
49
+ | Dimension | References |
50
+ |---|---|
51
+ | Archetype | `references/archetypes/<archetype>.md` |
52
+ | Mechanism | `references/mechanisms/<mechanism>.md` when present |
53
+ | Context | `references/contexts/<context>.md` for every selected context |
54
+
55
+ Current packs: archetypes `third-party-fraud`, `first-party-fraud`,
56
+ `authorized-payment-scam`; mechanism `account-takeover`; contexts
57
+ `card-payment`, `payment-collection`, `bank-transfer`, `payout`.
58
+
59
+ ## Progress
60
+
61
+ Track a task plan. One item is `in_progress` at a time.
62
+
63
+ 1. Pass pre-flight
64
+ 2. Select analysis profile
65
+ 3. Formalize label
66
+ 4. Freeze time split
67
+ 5. Engineer candidate features
68
+ 6. Select shortlist
69
+ 7. Score candidate rules
70
+ 8. Map actions and packages
71
+ 9. Write business report and proofread language
72
+ 10. Independent review
73
+
74
+ Suggested notes: `preflight=…`, `profile=…`, `label=…`, `cut=…`,
75
+ `allowed/excluded=…`, `shortlist=…`, `N rules, holdout|in-sample`,
76
+ `packages=…`, `report=…`, `verdict=…`.
77
+
78
+ ## Input
79
+
80
+ CSV / XLSX / TXT; one row per event or case; optional outcome column. A dataset
81
+ may contain more than one event type, but every scored rule needs a declared
82
+ event grain and decision point.
83
+
84
+ ## Workflow
85
+
86
+ Follow [references/workflow.md](references/workflow.md) for each step. The map:
87
+
88
+ | Step | Do | Gate |
89
+ |---|---|---|
90
+ | 0 Pre-flight | Label provenance; pass / needs-user-input / descriptive-only / blocked | No supervised metrics until pass |
91
+ | 1 Profile | Archetype + mechanism(s) + context(s) from taxonomy | Read selected packs before Step 2 |
92
+ | 2 Label | Formalize positive / negative / unlabeled | Both classes defined before scoring |
93
+ | 3 Time split | Freeze train/holdout before features | No random shuffle as headline |
94
+ | 4 Features | Engineer candidates at decision time | Train-only thresholds |
95
+ | 5 Shortlist | Lift / support / stability / operability | Train only |
96
+ | 6 Score | occurrence → precision → recall on holdout | Headline = holdout |
97
+ | 7 Actions | Map to context packs + strategy packages | Freeze packages before report |
98
+ | 8 Report | Business report per template; grep terminology banned strings | No review process in the file |
99
+ | 9 Review | Checklist + selected packs | Prefer fresh independent reviewer |
100
+
101
+ ## Output contract
102
+
103
+ | Item | Requirement |
104
+ |---|---|
105
+ | Analysis profile | Archetype, role, consent, technical authentication, mechanism, context, confidence, grain, decision point |
106
+ | Rule metrics | occurrence → precision → recall; headline window identified |
107
+ | Strategy coverage | triggered count + rate and amount + share, with currency |
108
+ | Domain impact | Measures and denominators from selected context packs only |
109
+ | Uncertainty | Proxy labels, immature outcomes, weak identity links, and unresolved attribution stated |
110
+ | Report file | Business content only; no reviewer model, verdict, or repair log |
111
+
112
+ Steps 0–7 are analysis and its entry gate. Step 8 writes the report. Step 9
113
+ reviews it.
@@ -0,0 +1,40 @@
1
+ {
2
+ "skill_name": "fraud-analysis",
3
+ "evals": [
4
+ {
5
+ "id": 1,
6
+ "prompt": "Analyze transfers.csv. The transactions passed login and MFA, but customers later confirmed they did not initiate them. Most transfers followed a password reset and new beneficiary setup. Find rules we can apply before transfer execution.",
7
+ "expected_output": "Routes to third-party fraud with account-takeover mechanism and bank-transfer context; separates technical authentication from customer consent; excludes later customer confirmation from pre-transfer features; proposes point-in-time access, beneficiary, and transfer features."
8
+ },
9
+ {
10
+ "id": 2,
11
+ "prompt": "Analyze collections_and_payouts.xlsx for customers who knowingly receive funds from many unrelated payers and rapidly cash out to linked beneficiaries. Confirmed investigation outcomes identify participating account holders.",
12
+ "expected_output": "Routes to first-party fraud with payment-collection and payout contexts; uses confirmed knowing participation as the label; engineers point-in-time fan-in, fan-out, collection-to-payout, account, device, and graph features; reports hold/review workload, delay, legitimate-customer impact, and exposure."
13
+ },
14
+ {
15
+ "id": 3,
16
+ "prompt": "Analyze bank_transfers.csv for APP scams. Customers themselves sent the payments after impersonation calls. We have later scam claims, reimbursement decisions, beneficiary data, warning interactions, and transfer timestamps.",
17
+ "expected_output": "Routes to authorized payment scam with APP subtype and bank-transfer context; treats customers as deceived victims; distinguishes claims and reimbursement decisions from decision-time features; evaluates warnings, confirmation, review, delay, completion, and reimbursement impact."
18
+ },
19
+ {
20
+ "id": 4,
21
+ "prompt": "Review card_auths.csv and propose pre-authorization rules for confirmed stolen-card transactions. It includes BIN, token, amount, CVV response, AVS response, issuer decline code, 3DS result, and chargeback outcome.",
22
+ "expected_output": "Routes to third-party fraud and card-payment; preserves card/BIN/history feature guidance; excludes current CVV, AVS, authorization response, 3DS result, and chargeback outcome at pre-auth; evaluates block, 3DS, or monitor actions with correct authorization denominators."
23
+ },
24
+ {
25
+ "id": 5,
26
+ "prompt": "Analyze suspicious payout accounts. Some may be knowing mules, some may be scam victims, and some may have been taken over. The file has behavior flags but no completed investigations or customer-consent evidence.",
27
+ "expected_output": "Keeps archetype unclassified rather than forcing mule, scam, or ATO attribution; treats behavior flags as proxy signals; avoids a blended confirmed-fraud label; limits severe actions and clearly states attribution and evidence gaps."
28
+ },
29
+ {
30
+ "id": 6,
31
+ "prompt": "Use outcome.csv where the existing case_result column has CONFIRMED_FRAUD, LEGITIMATE, and PENDING. Treat CONFIRMED_FRAUD as positive and analyze the rules.",
32
+ "expected_output": "Records file-column provenance; maps CONFIRMED_FRAUD to positive, LEGITIMATE to negative, and PENDING to unlabeled rather than negative; reports all counts and computes the base rate over labeled mature rows."
33
+ },
34
+ {
35
+ "id": 7,
36
+ "prompt": "For transfers.csv, define positives as accounts with at least three payouts within one hour after receiving funds. Find first-party fraud rules.",
37
+ "expected_output": "Pre-flight recognizes a user-defined positive condition and asks the user to define the negative condition before profile selection or supervised analysis; does not treat every other account as negative; leaves unmatched rows unlabeled."
38
+ }
39
+ ]
40
+ }
@@ -0,0 +1,41 @@
1
+ # Archetype: authorized payment scam
2
+
3
+ The genuine customer consents to a payment but is deceived about the recipient
4
+ or purpose. The customer is the victim and is not knowingly party to the fraud.
5
+
6
+ Use subtype `app-scam` only for an authorized push payment, normally a bank
7
+ transfer. Record the scam subtype when supported, such as impersonation,
8
+ purchase, investment, romance, or invoice redirection; do not infer it from
9
+ amount or beneficiary shape alone.
10
+
11
+ ## Label guidance
12
+
13
+ Prefer adjudicated scam outcomes. Customer reports, recalls, warnings ignored,
14
+ beneficiary risk, and reimbursement decisions can be useful but may be proxies
15
+ or policy outcomes rather than ground truth. Distinguish scams from civil
16
+ disputes and first-party participation.
17
+
18
+ ## Feature families
19
+
20
+ - New beneficiary, beneficiary risk, payee-name mismatch, and counterparty graph
21
+ - Unusual amount, frequency, payment purpose, and deviation from customer history
22
+ - Session/payment journey, warning interaction, confirmation responses, and
23
+ contact-channel changes available before execution
24
+ - Urgency patterns, repeated limit-sized payments, and rapid beneficiary changes
25
+ - Prior complaints or confirmed beneficiary outcomes known before the payment
26
+
27
+ ## Actions and impact
28
+
29
+ Potential actions include contextual warning, payee confirmation, customer
30
+ confirmation, cooling-off delay, manual review, transfer hold, or reject where
31
+ policy permits. Measure warning/review/hold volume and value, completion and
32
+ abandonment, review workload, delay, reimbursement exposure, and confirmed scam
33
+ value captured. Do not optimize only for authorization success.
34
+
35
+ ## Review overlay
36
+
37
+ - Genuine customer consent and deception are both supported.
38
+ - The customer is not knowingly participating; otherwise route to first-party.
39
+ - APP terminology is used only for push payments.
40
+ - Post-payment reports, recalls, reimbursements, and investigations do not leak.
41
+ - Warnings and holds account for vulnerable-customer and policy considerations.