duplicate-payment-scan
Skill8 starsChanged 4 months agoMITView on GitHub
Scans the full AP invoice and payment population — never a sample — for duplicate-payment candidates across four risk-ranked tiers (exact duplicate invoice numbers, same vendor/amount near in time, vendor-name variants, and reused payment references), with every finding traceable to the source rows it's based on. Use this whenever the user mentions duplicate payments, double payments, duplicate invoices, paying a vendor twice, AP duplicate scan, finding overpayments, or recovering cash from AP. Also trigger on "scan AP for duplicates," "did we pay this vendor twice," "find duplicate invoices," "duplicate payment risk," or when 12+ months of AP invoice and payment registers are provided for review. Reuses the full-population scan pattern from journal-entry-anomaly-scan, pointed at AP instead of the GL. Runs fully local — no vendor or payment data leaves the machine.
- Installs packages
In this repository44 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- accrual-proposalsSkill
- ar-aging-tie-outSkill
- arr-waterfallSkill
- audit-samplingSkill
- audit-workpaperSkill
- balance-sheet-recon-packSkill
- bank-rec-reviewSkill
- bank-rec-to-glSkill
- bank-statement-to-excelSkill
- board-package-builderSkill
- budget-vs-actualSkill
- cash-applicationSkill
- cash-flow-tieoutSkill
- commission-recalcSkill
- consolidation-rollupSkill
- cutoff-and-unrecorded-liabilitiesSkill
- debt-covenant-checkSkill
- deferred-revenue-waterfallSkill
- depreciation-tie-outSkill
- dunning-draftsSkill
- expense-policy-testingSkill
- filing-diffSkill
- flux-narrativeSkill
- fx-revaluationSkill
- intercompany-reconSkill
- invoice-codingSkill
- journal-entry-anomaly-scanSkill
- k1-extract-summarizeSkill
- lease-schedule-tie-outSkill
- month-end-close-checklistSkill
- payroll-tax-reconciliationSkill
- pbc-assemblerSkill
- prepaid-amortizationSkill
- receipts-to-expenseSkill
- return-yoy-varianceSkill
- revenue-trace-to-sourceSkill
- sales-tax-reconciliationSkill
- tax-return-reviewSkill
- thirteen-week-cash-forecastSkill
- three-way-matchSkill
- trial-balance-integritySkill
- vendor-statement-reconSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Coverage cannot be proven: Every row read must end up either scanned or in the unscanned/unparsed list with a stated reason.
≈ “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
Duplicate Payment Scan
Findings here are self-evidently valuable — every confirmed duplicate is recoverable cash. The discipline is in proving each finding with the actual matched rows rather than asserting "duplicate" and moving on.
The gate
The scan refuses to produce a clean workbook when:
- Coverage cannot be proven. Every row read must end up either scanned or in the unscanned/unparsed list with a stated reason. Scanned count plus unscanned count must equal total rows read — checked explicitly, not assumed.
- A
record_idis duplicated in the source file. Row identity must be unambiguous before any finding can reliably point back to a specific transaction.
A row with an unparseable amount or date is not itself a gate failure — it is excluded from matching and listed, with its reason, on the Unscanned/Unparsed Rows tab, so the scope limitation is visible rather than silently absorbed into a clean-looking result.
Inputs
AP invoice and payment register (12+ months) — one file, one row per invoice or payment
event: record_id, vendor, amount, invoice_date, invoice_no, payment_date, payment_ref.
invoice_no, payment_date, and payment_ref may be blank on any given row.
Step 1 — Run the scan
python3 scripts/duplicate_payment_scan.py --register ap_register.csv --window-days 5 \
--client "Northwind Systems Inc" \
--out "Northwind - Duplicate Payment Scan.xlsx"--window-days has no built-in default — state the proximity window you actually want checked
(a tighter window for weekly-run AP, a wider one for monthly-batch AP) rather than relying on a
number this skill would otherwise have to invent.
Step 2 — What each tier catches, and why it's ranked there
| Tier | Match | Why it's ranked there |
| 1 | Exact vendor + amount + invoice_no duplicated | The same invoice number paid twice for the same vendor and amount is close to unambiguous — the highest-confidence finding in the set. |
| 2 | Exact vendor + amount + date within the window | Same vendor, same amount, close in time, different invoice numbers — classic re-submission or re-entry duplicate. |
| 3 | Same amount + date within the window, vendor name a normalized variant of another (e.g. "Acme Supply Co" vs. "Acme Supply") | Catches duplicates hidden by vendor-master inconsistency — often the hardest tier to find by eye and the one worth the normalization log. |
| 4 | Same payment_ref reused across different invoice numbers | A check or EFT reference applied to more than one invoice is either a batching convention or a posting error — always worth a look. |
Each finding carries the matched records' row references and fields, never a bare assertion.
Deliver
Workbook tabs:
- Risk Summary — population rows read, scanned vs. unscanned, population dollar total, and finding counts and dollars at risk by tier.
- Findings — every match with tier, basis, vendor(s), amount, matched record references, and dollars at risk.
- Unscanned-Unparsed Rows — every row excluded from scanning, with the reason.
- Vendor Normalization Log — every raw vendor string mapped to its normalized form, so a Tier 3 match can be audited back to the exact spelling variants involved.
Then, in chat: the population scanned, total dollars at risk by tier, and the highest-tier findings first. State plainly if the unscanned count is material — a scan with a large unparsed population proves less than it appears to.
What to escalate
- Any Tier 1 finding — confirm with the bank or payment processor whether both payments actually cleared before assuming it's a false positive.
- A payment reference reused across invoices to different vendors, if it occurs — a reference collision this specific is unusual and worth confirming isn't a data-entry artifact versus a real misapplied payment.
- A vendor-name variant cluster (Tier 3) spanning many distinct normalized groups — may indicate the vendor master itself needs cleanup, a separate project from the duplicates found this pass.
- Concentration of findings in one AP clerk's or approver's batch, if that data is available separately — the scan does not have approver data and cannot make this link itself, but a reviewer with access to it should check.
Report each as a fact with the record references. Do not characterize intent — the scan reports pattern and evidence, never motive.
Security posture
Fully local: standard library plus openpyxl. No network calls, no uploads, no telemetry.
Vendor and payment data never leave the machine.
Dependencies
pip install openpyxlBuilt by Adopt AI — free to use and modify.
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.

