ai-anomaly-detection
Skill47 starsChanged 7 months agoMITView on GitHub
When the user wants to use machine learning to detect fraud, errors, or unusual patterns in high-volume financial data. Also use when the user mentions "ML fraud detection," "unsupervised learning for audit," "isolation forest," "autoencoders for finance," "unusual transaction clusters," or "automated expense auditing.
In this repository50 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- aro-computationSkill
- audit-checklistSkill
- automated-reconciliationSkill
- banking-complianceSkill
- budget-forecastSkill
- close-managementSkill
- company-valuationSkill
- corporate-consolidationSkill
- credit-analysisSkill
- crypto-accountingSkill
- cvp-breakevenSkill
- debt-payoffSkill
- debt-restructuringSkill
- deferred-taxSkill
- earned-value-mgmtSkill
- ecl-computationSkill
- esg-reportingSkill
- financial-analysisSkill
- fixed-asset-accountingSkill
- forensic-accountingSkill
- insurance-reservingSkill
- intercompany-accountingSkill
- inventory-costingSkill
- investment-analysisSkill
- journal-entrySkill
- lbo-modelingSkill
- lease-accountingSkill
- net-worth-trackerSkill
- nlp-earnings-sentimentSkill
- oil-gas-valuationSkill
- personal-budgetingSkill
- predictive-burn-rateSkill
- product-profitabilitySkill
- retirement-planningSkill
- revenue-recognitionSkill
- risk-assessmentSkill
- sox-complianceSkill
- startup-valuationSkill
- statement-preparationSkill
- tax-efficient-investingSkill
- tax-planningSkill
- three-statement-modelingSkill
- treasury-managementSkill
- variance-analysisSkill
- venture-debtSkill
- wacc-computationSkill
- working-capital-analysisSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 42
Use the IsolationForest algorithm to isolate observations by randomly selecting a feature and a split value.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AI Anomaly Detection
You are an AI Financial Systems Engineer. Your goal is to deploy machine learning models to identify "needles in the haystack"—anomalies that human-coded rules might miss.
Initial Assessment
- Data Volume & Velocity
- How many transactions are we analyzing? (e.g., 10,000 vs 10,000,000).
- Is the data structured (CSV/SQL) or semi-structured (JSON logs)?
- Anomaly Definition
- Are we looking for "Point Anomalies" (one weird transaction)?
- "Contextual Anomalies" (weird for this specific user/time)?
- "Collective Anomalies" (a series of transactions that are weird together)?
AI Framework
Technical Limitation
LLMs are not ML Models. While LLMs (like Claude/GPT) can reason about small sets of anomalies, for millions of rows, you should use specialized Python libraries (Scikit-Learn, PyOD). This skill provides the logic and code for those implementations.
Priority Order
- Feature Engineering (Creating inputs like 'time_since_last_txn', 'distance_from_home').
- Unsupervised Learning (Isolation Forest, Local Outlier Factor).
- Cluster Analysis (K-Means to identify unusual spending groups).
- Scoring & Flagging (Assigning a "Risk Score" to every row).
Technical AI Steps
1. Isolation Forest Implementation
- Use the
IsolationForestalgorithm to isolate observations by randomly selecting a feature and a split value. - Anomalies are the points that require fewer splits to isolate.
2. Autoencoder Analysis (Advanced)
- Train a neural network to compress and reconstruct "normal" data.
- High "Reconstruction Error" identifies anomalies that don't fit the normal pattern.
3. Feature Scaling
- Apply
StandardScalerorMinMaxScalerto ensure transaction amounts don't overwhelm other features (like frequency).
Output Format
AI Audit Report Structure
Model Performance
- Anomaly rate detected (e.g., 0.5% of total data).
- Top features driving the anomaly score.
The Flags
- Top 20 "High Risk" transactions with confidence scores.
- "Why this was flagged" (e.g., "Unexpected high value for this vendor category").
Python Integration
- Ready-to-run script for the user to execute against their full dataset.
Scripts
- calculate.py: Deterministic functions for this skill's core computations. Run
python3 scripts/calculate.pyto self-test; import the functions instead of doing mental math.
References
- Anomaly Detection Algorithms: Isolation Forest vs. LOF.
- Feature Engineering for Finance: Key inputs for fraud models.
Related Skills
- forensic-accounting: To manually investigate the flags raised by the AI.
- audit-checklist: To integrate AI detection into the standard audit flow.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

