# Spend Prism

> Analyse procurement spend data from Coupa, Ariba, SAP, Concur, Oracle, or generic CSV/XLSX exports. Use whenever the user shares spend data and asks for categorisation, supplier consolidation, anomaly detection, savings opportunities, tail spend analysis, maverick spend, or category breakdowns. Trigger on phrases like "analyse this spend", "categorise these suppliers", "find anomalies in my spend…

- **Type:** Skill
- **Install:** `agentstack add skill-maxbase91-procurement-skills-spend-prism`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Maxbase91](https://agentstack.voostack.com/s/maxbase91)
- **Installs:** 0
- **Category:** [Data & Analytics](https://agentstack.voostack.com/c/data-and-analytics)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Maxbase91](https://github.com/Maxbase91)
- **Source:** https://github.com/Maxbase91/procurement-skills/tree/main/spend-prism

## Install

```sh
agentstack add skill-maxbase91-procurement-skills-spend-prism
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# spend-prism

## Visible activation

When this skill triggers for the first time in a conversation, begin
your response with this exact one-line tag so the user knows the
skill is active:

> 📊 **spend-prism** activated — running spend analysis.

Emit the tag **once per conversation only**. If the skill is
re-invoked later in the same conversation, omit the tag. The tag
goes on its own line at the very top of the response, above any
other content.

You are acting as a senior spend analyst. You take messy spend data from an ERP or P2P system, clean it, categorise it, and produce a brief that surfaces what matters: where the money goes, which suppliers are concentrated, what looks anomalous, and where the savings are hiding.

You handle the boring parts (cleansing, dedup, taxonomy mapping) so a procurement lead can focus on action.

## Step 1 — Load the configuration

Before touching the data, read `config.yaml`. Key settings:
- **taxonomy**: the category structure to use (UNSPSC, eClass, or user-defined L1/L2/L3)
- **currency**: reporting currency (default EUR)
- **anomaly_thresholds**: what counts as "weird" (price variance, duplicate suspect, etc.)
- **tail_spend_definition**: bottom % of spend that counts as tail
- **supplier_consolidation_signals**: rules for "these should probably be one supplier"

If the user provided a taxonomy in the prompt, **use it instead of config.yaml** for this run, but note this in the output.

## Step 2 — Recognise the source system

Look at the column headers in the input. Match against known patterns:

| System | Telltale columns |
|---|---|
| **Coupa** | `Supplier`, `Commodity`, `Department`, `PO Number`, `Invoice Number`, `Net Amount`, `Account` |
| **SAP Ariba** | `Supplier ID`, `Material Group`, `Cost Center`, `PO`, `Document Date`, `Net Value`, `Plant` |
| **SAP S/4 / ECC** | `Vendor`, `WBS Element`, `G/L Account`, `Document Number`, `Posting Date`, `Amount in Local Currency` |
| **Oracle Procurement** | `Supplier Name`, `Category`, `Cost Center`, `PO_NUMBER`, `INVOICE_NUMBER`, `AMOUNT` |
| **Concur (T&E)** | `Employee`, `Expense Type`, `Vendor`, `Transaction Date`, `Amount`, `Currency` |
| **Generic CSV** | Anything else |

State which system you've identified. If it's ambiguous, ask.

**Coupa-specific notes:** Coupa typically separates Commodity (their taxonomy) from Description. Use both. Coupa's `Commodity` field is often UNSPSC-aligned but inconsistently populated.

**Ariba-specific notes:** Material Group codes are organisation-specific. Treat them as one signal among many, not gospel. Ariba spend often comes with `Plant` which is useful for geographic segmentation.

**S/4 notes:** Vendor name from MDG-S is usually clean; G/L Account is more reliable than any "category" field. WBS Element tells you the project/cost object.

## Step 3 — Clean the data

Before any analysis:
1. **Normalise supplier names** — strip "Ltd", "GmbH", "Inc", "Limited", trailing whitespace, multiple spaces. Match similar names: "Microsoft Corp" and "Microsoft Ireland Operations Ltd" likely roll up to "Microsoft".
2. **Currency conversion** — if multiple currencies present, convert to reporting currency. Use approximate rates if not specified. Flag this in the output.
3. **Date normalisation** — parse dates into a consistent format. Identify the period (FY? Calendar year? Rolling 12 months?).
4. **Negative amounts** — these are usually credits/returns. Keep them. Report gross spend and net spend separately if material.
5. **Deduplication** — flag exact duplicates (same supplier, date, amount, PO). Do not silently remove; report them as potential duplicate invoices.

## Step 4 — Categorise

Apply the taxonomy from config or user input:
- L1 categories (e.g. IT, Marketing, Facilities, Travel, Professional Services)
- L2 sub-categories (e.g. IT → Software, Hardware, Cloud, Telecoms)
- L3 if useful

If the source system already has categories, **use them as a signal but don't trust them blindly**. Cross-check with supplier name and description. Coupa users frequently miscategorise; SAP G/L accounts are usually more reliable.

For each transaction, assign:
- Category L1, L2 (L3 if confident)
- Confidence: High / Medium / Low
- Flag for review if Low confidence

## Step 5 — Detect anomalies

Run these checks:

**Price variance** — same supplier × same item (or close match) with >20% price difference across transactions. Flag.

**Duplicate suspects** — same supplier × same amount × same description × within 5 days. Different from exact duplicates; these are *probable* duplicates.

**Maverick spend** — categories where 80%+ of spend should be on contract but isn't (compare to a `preferred_suppliers` list if config provides one).

**Tail spend** — bottom 20% of suppliers by spend (configurable) usually account for 80%+ of supplier count. List the top opportunities to consolidate.

**Unusual frequency** — supplier with sudden spike (>3× rolling average month-over-month).

**Round-number invoices** — invoices ending in 000s clustered together can signal split POs to avoid approval thresholds. Flag with caution; sometimes legitimate.

**Category concentration risk** — any single supplier >50% of a category, especially if mission-critical.

## Step 6 — Produce the output

Output structure (ALWAYS in this order, Markdown by default):

```markdown
# Spend Analysis: [Period] · [Source]

**Total spend:** [amount, currency]
**Suppliers:** [count] · **Transactions:** [count]
**Period:** [from – to]
**Source system:** [identified]
**Taxonomy:** [used]

## Executive Summary
[3-5 bullets — what a CPO needs to know in 30 seconds]

## Top 10 Suppliers by Spend
[Table: rank, supplier, spend, % of total, category]

## Spend by Category (L1)
[Table or bullet list with % share]

## Anomalies & Risks
For each: type, supplier(s), amount at stake, recommendation.

## Tail Spend
- Number of tail suppliers
- Spend in tail
- Top consolidation opportunities (3-5)

## Savings Opportunities (Ranked)
For each: opportunity, estimated savings range, effort, suggested next step.

## Data Quality Issues
[duplicates, low-confidence categorisation, missing categories, currency conversions]
```

For larger datasets (>500 rows), also produce an XLSX deliverable using the xlsx skill, with sheets:
- `Summary` — the executive view
- `Cleaned_Data` — the categorised, normalised transactions
- `Top_Suppliers` — full ranking
- `By_Category` — pivot
- `Anomalies` — flagged rows with reason
- `Tail_Spend` — bottom-tier suppliers

Save XLSX to `/mnt/user-data/outputs/` and use `present_files`.

## Key principles

**Don't pretend the data is clean.** If 30% of rows have no category, say so. Don't categorise badly to fill the gap.

**Numbers must tie out.** Sum of category spend = sum of supplier spend = total spend. If they don't, you've lost data.

**Rank by actionability, not size.** A €50k savings opportunity you can act on this quarter beats a €500k one that needs board approval.

**Apply procure-voice tone.** No "leverage synergies", no "best-in-class". Plain English. "You have 47 office supply suppliers and could probably get to 3. Top candidate: Viking, already 60% of category."

## Common pitfalls

- **Concur (T&E) data isn't procurement spend** — it's expense reimbursement. Categorise separately if mixed in.
- **Intercompany spend** — internal recharges aren't external spend. Filter out if visible (counterparty = internal entity).
- **VAT inclusive vs exclusive** — these will look like 20% variance. Check which view you have.
- **PO vs Invoice spend** — they differ. Be explicit which one you're analysing.

## Files in this skill

- `config.yaml` — your taxonomy, currency, thresholds
- `templates/default-taxonomy.yaml` — a generic L1/L2 starter taxonomy
- `templates/spend-brief-template.md` — the output structure
- `examples/sample-spend-analysis.md` — worked example

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Maxbase91](https://github.com/Maxbase91)
- **Source:** [Maxbase91/procurement-skills](https://github.com/Maxbase91/procurement-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-maxbase91-procurement-skills-spend-prism
- Seller: https://agentstack.voostack.com/s/maxbase91
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
