Claude-skill-registry fraud-investigation-data-consolidator
Investigates a suspicious transaction by gathering all related data from a BigQuery analytics dataset, consolidating it into a structured JSON format, and triggering alert workflows.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/fraud-investigation-data-consolidator" ~/.claude/skills/majiayu000-claude-skill-registry-fraud-investigation-data-consolidator && rm -rf "$T"
manifest:
skills/data/fraud-investigation-data-consolidator/SKILL.mdsource content
Instructions
Execute the following steps to investigate a suspicious transaction. The primary goal is to create a comprehensive data snapshot for a given
transaction_id and trigger the required alerting and archiving workflows.
1. Initial Setup & Discovery
- Input: You will be given a specific
(e.g.,transaction_id
).T8492XJ3 - First, confirm the target dataset and storage buckets exist.
- Use
to verify thegoogle-cloud-bigquery_get_dataset_info
dataset is accessible.transactions_analytics - Use
to locate the archive bucket (name prefixed bygoogle-cloud-storage_list_buckets
) and the log bucket (name prefixed bymcp-fraud-investigation-archive-
). Note their exact names.Trading_Logging-
- Use
2. Schema Exploration & Data Querying
- Discover all tables in the
dataset usingtransactions_analytics
on thegoogle-cloud-bigquery_run_query
view.INFORMATION_SCHEMA.TABLES - For the target transaction, query data from two primary sources:
table: Get the full record for the givenlive_transactions
. This record contains key foreign IDs (transaction_id
,user_id
,account_id
,merchant_id
,card_id
,device_id
).location_id
table: Check for any existing alerts for thisfraud_alerts
.transaction_id
- Using the IDs from the
record, query all related dimension tables:live_transactions
(byusers
)user_id
(byaccounts
)account_id
(bymerchants
)merchant_id
(bycards
)card_id
(bydevices
)device_id
(bylocations
)location_id
(byrisk_scores
)user_id
(Check if any of the IDsblacklist
,user_id
,account_id
,card_id
, ordevice_id
appear in themerchant_id
column. Note: Thevalue
table schema usesblacklist
,entity_id
,entity_type
).value
- Find related transactions: Query the
table for all other transactions by the samelive_transactions
, excluding the targetuser_id
. Order bytransaction_id
and limit results appropriately (e.g., 1000).timestamp DESC
3. Data Consolidation & JSON Creation
- Structure the final JSON object with the following keys. Convert Python objects (like
,datetime
,list
) to JSON-serializable strings (ISO format for dates, proper JSON arrays/objects).dict
: The main transaction record.live_transactions
: The associated alert record (if any).fraud_alerts
,users
,accounts
,merchants
,cards
,devices
,locations
,risk_scores
: The related dimension data.blacklist
: An array containing the other transactions for the user.related_transactions
- Save the JSON file locally to the workspace using
. Name the filefilesystem-write_file
(e.g.,<transaction_id>.json
).T8492XJ3.json
4. Archiving & Alerting
- Upload the JSON file to the identified archive storage bucket using
. Use thegoogle-cloud-storage_upload_file
as the blob name.transaction_id - Write a CRITICAL log entry to the identified logging bucket using
.google-cloud-logging_write_log- Log Name: Use the full name of the log bucket (e.g.,
).Trading_Logging-e877351c7447 - Severity:
CRITICAL - Message/Payload: A JSON string with the exact structure:
{"alert_type": "Fraud", "transaction_id": "<TRANSACTION_ID>", "status": "Pending_Investigation"}
- Log Name: Use the full name of the log bucket (e.g.,
Key Considerations
- Error Handling: If a query for a specific table returns no data, include an empty object
for that key in the final JSON.{} - Data Types: Pay special attention to serializing complex fields (flags, velocity_checks, etc.) from the
table from stringified JSON to proper JSON objects/arrays in the output.live_transactions - Bucket Names: The archive and log bucket names are dynamic (with unique suffixes). Always list buckets first to confirm their exact names.
- Logging: The log write must happen after successful archiving. The log entry is new and independent of any existing logs in the bucket.