Skip to main content

data-analysis

Analyze banking data — spending patterns, income vs expenses, savings projections, and financial health metrics

Informations de source

Dépôt
aiappsgbb/kratos-agent
Dernière activité de la source
21 avril 2026 à 09:30
Langue détectée de SKILL.md
anglais
Étoiles
23
Forks
21

Options d'installation

Le prompt qui vérifie d'abord la source est sélectionné par défaut. Vous pouvez passer à une commande directe ou télécharger une copie locale.

Vérifiez les fichiers source

Lisez SKILL.md et les fichiers associés affichés par SkillsMP avant de décider de l'installer.

Explorateur de fichiers
2 fichiers

Affichage de SKILL.md

SKILL.md
Instructions source · Aperçu en lecture seule
name
data-analysis
description
Analyze banking data — spending patterns, income vs expenses, savings projections, and financial health metrics
enabled
true
## Instructions When the user asks for spending analysis, budget breakdown, savings projections, or financial insights, follow this workflow: ### 1. Data Ingestion - If the user has transaction data from `transaction-history`, use that as input - If the user provides CSV/JSON data inline, write it to `/tmp` first - If no data is available, use the **Faker MCP server** to generate realistic sample banking data (transactions, balances, spending patterns). Prefer calling Faker MCP tools directly (e.g., `faker_date_between`, `faker_random_element`, `faker_pyfloat`) over writing inline Python with the faker library. ### 2. Banking-Specific Analyses #### Spending Breakdown ```python import pandas as pd df = pd.DataFrame(transactions) spending = df[df["amount"] < 0].copy() spending["amount"] = spending["amount"].abs() breakdown = spending.groupby("category")["amount"].agg(["sum", "count", "mean"]) breakdown.columns = ["Total Spent", "# Transactions", "Avg Transaction"] breakdown = breakdown.sort_values("Total Spent", ascending=False) print(breakdown) ``` #### Income vs Expenses ```python income = df[df["amount"] > 0]["amount"].sum() expenses = df[df["amount"] < 0]["amount"].abs().sum() net = income - expenses savings_rate = (net / income * 100) if income > 0 else 0 print(f"Total Income: ${income:,.2f}") print(f"Total Expenses: ${expenses:,.2f}") print(f"Net Cash Flow: ${net:,.2f}") print(f"Savings Rate: {savings_rate:.1f}%") ``` #### Monthly Trend ```python df["month"] = pd.to_datetime(df["date"]).dt.to_period("M") monthly = df.groupby("month")["amount"].sum() print(monthly) ``` #### Top Merchants ```python top = spending.groupby("description")["amount"].sum().nlargest(10) print("Top 10 Merchants by Spend:") print(top) ``` ### 3. Visualizations Generate charts with matplotlib and save to `/tmp`: ```python import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt # Spending by category pie chart fig, ax = plt.subplots(figsize=(10, 8)) breakdown["Total Spent"].plot(kind="pie", autopct="%1.1f%%", ax=ax) ax.set_ylabel("") ax.set_title("Spending by Category") plt.tight_layout() plt.savefig("/tmp/spending_breakdown.png", dpi=150) plt.close() print("Chart saved: /tmp/spending_breakdown.png") ``` Common banking charts: - **Pie chart**: Spending by category - **Bar chart**: Monthly income vs. expenses - **Line chart**: Account balance trend over time - **Stacked bar**: Category breakdown per month ### 4. Financial Health Indicators Provide insights based on the data: - **50/30/20 Rule Check**: Is the user spending ~50% on needs, 30% wants, 20% savings? - **Recurring charges**: Identify subscriptions and recurring payments - **Large/unusual transactions**: Flag transactions significantly above average - **Savings potential**: "Reducing dining by 20% would save ~$X/month" ### 5. Output - Print key findings as text - Save charts to `/tmp` with descriptive names - Reference file paths for download - If analysis produces a transformed dataset, save as CSV to `/tmp` ## Chaining - `code_interpreter` — runs the Python code - `transaction-history` — provides source transaction data - `file-sharing` — delivers charts and exports - `account-lookup` — context on account balances ## Constraints - Pre-installed libraries: pandas, numpy, matplotlib, faker. Additional libraries can be installed at runtime via pip. - Files must be written to `/tmp` - Max execution time: 30 seconds per code block
Voir sur GitHub