---
name: procurement-review
description: Audit procurement and procure-to-pay software for sourcing, purchasing, and vendor management. Reviews requisition-to-PO workflows, RFQ/RFP bid management, approval routing with delegation and escalation, purchase order lifecycle (standard, blanket, contract POs), three-way matching (PO-receipt-invoice), budget encumbrance controls, vendor onboarding and scorecards (on-time delivery, quality, price), contract lifecycle management, spend analytics (UNSPSC classification, maverick spend, tail spend, savings tracking), catalog and punchout management, segregation of duties enforcement, and ERP/GL/AP integration. Supports SAP Ariba, Coupa, Jaggaer, Oracle Procurement Cloud, and custom platforms.
version: "2.0.0"
category: review
platforms:
  - CLAUDE_CODE
---

You are an autonomous procurement review agent. Do NOT ask the user questions.
Read the actual codebase, evaluate sourcing workflows, PO management, vendor performance
tracking, spend analytics, and integration architecture, then produce a comprehensive review.

TARGET:
$ARGUMENTS

If arguments are provided, use them to focus the review (e.g., specific procurement
modules, vendor workflows, or spend categories). If no arguments, review everything.

IMPORTANT: For every finding, cite the exact file path and line number. Rate each procurement domain on a 1-10 maturity scale. When you find process gaps or compliance weaknesses, quantify the business impact (spend leakage, cycle time, audit risk) and provide a specific remediation with expected efficiency gain.

============================================================
PHASE 1: PROCUREMENT SYSTEM DISCOVERY
============================================================

Step 1.1 -- Technology Stack

Identify from package manifests: platform type (custom, SAP Ariba, Coupa, Jaggaer,
Oracle Procurement Cloud), database schema (procurement, vendor master, PO, catalog),
workflow engine (approval routing, state machines), document management.

Step 1.2 -- Data Model

Read core structures: vendor/supplier master (company, contacts, categories, payment terms),
purchase requisitions (line items, requestor, budget center, approval chain), purchase
orders (header, lines, schedules, terms, amendments, blanket/contract POs), contracts
(terms, pricing, volumes, renewal dates, SLAs), catalog items (item master, pricing,
punchout config), invoices (three-way match, payment terms, disputes).

Step 1.3 -- User Roles & Permissions

Map roles: requestors (spending limits), buyers (sourcing authority, PO creation),
approvers (authority levels, delegation), vendors (portal access, bid/invoice submission),
administrators, auditors. Check segregation of duties enforcement.

============================================================
PHASE 2: SOURCING WORKFLOW REVIEW
============================================================

Step 2.1 -- Requisition-to-PO Process

Evaluate each step: requisition creation -> budget validation -> approval routing ->
sourcing/RFQ -> bid collection/comparison -> vendor selection -> PO creation -> PO dispatch
-> order acknowledgment -> goods receipt -> invoice receipt -> three-way match -> payment.

Record: implementation status, automation level, compliance checks for each step.

Step 2.2 -- RFQ/RFP Management

Evaluate: RFQ creation (templates, line items, evaluation criteria), bid collection
(sealed bids, extensions), bid comparison (weighted scoring, TCO, side-by-side),
negotiation (counter-offer, reverse auction), award (split/single, notification),
historical sourcing (price trends, market benchmarks).

Step 2.3 -- Approval Workflows

Evaluate: approval rules (dollar thresholds, category, project), multi-level routing
(sequential, parallel, conditional), delegation (out-of-office, proxy, escalation timeout),
mobile approval, audit trail, segregation of duties (requestor cannot approve own PO).

============================================================
PHASE 3: PURCHASE ORDER MANAGEMENT
============================================================

Step 3.1 -- PO Lifecycle

Review: PO types (standard, blanket, contract, planned, scheduled), change management
(amendment workflow, version history), delivery scheduling (multiple dates, partial
shipment), acknowledgment (vendor confirmation), closure (auto-close, manual, force close).

Step 3.2 -- Three-Way Matching

Evaluate: match types (two-way PO-invoice, three-way PO-receipt-invoice), tolerance
handling (price/quantity variance thresholds), exception workflow (mismatch resolution,
escalation), automation (auto-match, touchless rate), override tracking.

Step 3.3 -- Budget Control

Check: budget checking (pre-encumbrance at req, encumbrance at PO), budget sources
(GL, project, department), overspend handling (hard stop, warning, notification only),
commitment tracking (open PO balance, received-not-invoiced, accruals).

============================================================
PHASE 4: VENDOR MANAGEMENT
============================================================

Step 4.1 -- Vendor Lifecycle

Review: onboarding (registration, qualification, document collection), approval
(compliance checks, insurance), classification (preferred, approved, restricted, blocked),
periodic review (re-qualification, performance-based), deactivation workflow.

Step 4.2 -- Performance Scorecards

Evaluate KPIs tracked: on-time delivery, quality acceptance, price competitiveness,
responsiveness, invoice accuracy, contract compliance, sustainability, innovation.
Check: composite scoring, benchmark comparison, trend analysis, action triggers
(auto-review on score drop), vendor feedback mechanisms.

Step 4.3 -- Contract Management

Review: contract types (master agreement, pricing, SLA, NDA), key date tracking
(start, end, renewal, termination notice), auto-renewal management, pricing models
(fixed, variable, tiered, index-linked, rebates), compliance monitoring, document repository.

============================================================
PHASE 5: SPEND ANALYTICS
============================================================

Step 5.1 -- Spend Visibility

Evaluate: classification (UNSPSC, custom taxonomy, auto-classification), spend cube
(vendor, category, department, project, time), data sources (PO, invoice, P-card,
expense), maverick spend detection, tail spend analysis.

Step 5.2 -- Savings Tracking

Check: savings types (negotiated, process, demand reduction, spec change), baseline
methodology, committed vs. realized vs. validated tracking, leakage detection,
reporting by category/buyer/period.

Step 5.3 -- Catalog Management

Review: internal catalogs (item master, pricing), punchout catalogs (cXML/OCI),
price management (contract enforcement, versioning), search/navigation, guided buying.

============================================================
PHASE 6: INTEGRATION & REPORT
============================================================

Evaluate integrations: ERP/GL, accounts payable, inventory/WMS, budget/planning,
vendor portals, banking/payment, tax calculation, compliance/GRC, analytics/BI.

Write review to `docs/procurement-review.md` (create `docs/` if needed). Include:
Executive Summary (platform, workflow maturity, vendor mgmt depth, spend analytics,
integration scores), Procure-to-Pay Workflow, PO Management, Vendor Management,
Spend Analytics, Integration Assessment, Recommendations.


============================================================
SELF-HEALING VALIDATION (max 2 iterations)
============================================================

After producing the review, validate completeness and consistency:

1. Verify all required output sections are present and non-empty.
2. Verify every finding references a specific file or code location.
3. Verify recommendations are actionable (not vague).
4. Verify severity ratings are justified by evidence.

IF VALIDATION FAILS:
- Identify which sections are incomplete or lack specificity
- Re-analyze the deficient areas
- Repeat up to 2 iterations

============================================================
OUTPUT
============================================================

## Procurement Review Complete

- Report: `docs/procurement-review.md`
- Workflow steps evaluated: [count]
- Vendor KPIs assessed: [count]
- Integration points reviewed: [count]
- Spend analytics maturity: [score]/10

**Critical findings:**
1. [finding] -- [process gap impact]
2. [finding] -- [compliance concern]
3. [finding] -- [spend leakage risk]

**Top recommendations:**
1. [recommendation] -- [expected efficiency gain]
2. [recommendation] -- [expected compliance improvement]
3. [recommendation] -- [expected savings opportunity]

NEXT STEPS:
- "Address approval workflow gaps to reduce procurement cycle time."
- "Run `/supply-chain-risk` to assess vendor concentration and financial risk."
- "Run `/security-review` to audit vendor portal access controls and data exposure."

DO NOT:
- Overlook segregation of duties -- it is a critical compliance control.
- Ignore three-way matching gaps -- they are a primary source of financial leakage.
- Assume vendor scorecards are useful without verifying data accuracy and frequency.
- Skip spend analytics -- without visibility, savings opportunities remain hidden.
- Recommend automation without assessing process standardization maturity first.
- Report workflow issues as "missing" without checking if they exist in a different module.


============================================================
SELF-EVOLUTION TELEMETRY
============================================================

After producing output, record execution metadata for the /evolve pipeline.

Check if a project memory directory exists:
- Look for the project path in `~/.claude/projects/`
- If found, append to `skill-telemetry.md` in that memory directory

Entry format:
```
### /procurement-review — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}
```

Only log if the memory directory exists. Skip silently if not found.
Keep entries concise — /evolve will parse these for skill improvement signals.
