Files
erp/.claude/skills/dolibarr-thirdparty-completeness/SKILL.md
Gabriel Radureau 1c0ba8ea75 add bin/arcodange CLI and dolibarr-tva-summary skill
Two changes that go together: now operators can run every read-only
workflow without going through Claude. The skills (SKILL.md files)
remain the source of behaviour documentation and Claude triggers;
bin/arcodange is the human-facing entry point.

bin/arcodange:
- Bash dispatcher at the project root. Subcommands per domain:
  tva {collect, collect-detail, deductible, deductible-detail, summary},
  invoice {list, audit}, thirdparty {audit, audit-all},
  payments {state, timeline, by-month},
  templates {list, inspect},
  snapshot, whoami, ping, curl, help.
- Locates the project root via `git rev-parse` so it works from any
  CWD (including from a worktree).
- Per-subcommand `help` text. Unknown commands exit 2 with a hint.
- Reuses the existing per-skill scripts under .claude/skills/<name>/
  scripts/ via `exec` (zero behaviour drift, full credit to the
  existing tested code).

dolibarr-tva-summary:
- Composes dolibarr-tva-reconciliation (TVA collectée customer-side)
  and dolibarr-tva-deductible (TVA déductible supplier-side) into a
  single CA3-ready monthly summary with per-month net verdict
  (TVA à reverser / crédit de TVA / équilibre) and a cumulative line.
- Live baseline: Arcodange en crédit de TVA de 223.22 € cumulé
  (0 € collectée 259-1° CGI vs 223.22 € déductible).
- Exposed as `arcodange tva summary [--year|--since|--until]`.

Each existing skill's SKILL.md gets a one-line "CLI shortcut" near
the top so the human path is discoverable from any skill page.
The project root README.md gets a CLI section as the primary
operator entry point.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-29 11:30:18 +02:00

6.5 KiB

name: dolibarr-thirdparty-completeness description: Audit the completeness of any Arcodange Dolibarr thirdparty (client or supplier) against country-specific French / EU / extra-EU rules. Two workflows — (1) audit one thirdparty by socid (generalized from the V1 KissMetrics-only audit), with country-aware checklist : FR requires SIREN + SIRET + tva_intra (if VAT-registered), EU non-FR requires tva_intra for B2B autoliquidation, extra-EU requires a national tax id in idprof1; (2) audit ALL visible thirdparties in one shot, compact table showing each one's mandatory gaps and exit code reflecting whether the dataset is fully compliant. Use when the user asks "audit fiche client", "audit fiche fournisseur", "complétude des tiers", "qui n'a pas son SIRET / TVA intra", "qualité des données tiers Dolibarr". Supersedes the V1 dolibarr-invoice-audit/scripts/audit-km-thirdparty.sh (KM-hardcoded) by handling any socid and any country. Depends on the dolibarr skill. SKIP for write/correction tasks (use the Dolibarr UI), for invoice-side mandatory mentions (handled by dolibarr-invoice-audit), and for TVA computation (handled by dolibarr-tva-reconciliation / dolibarr-tva-deductible). requires: bins: ["curl", "jq", "python3"] auth: true

dolibarr-thirdparty-completeness — generalized thirdparty audit

CLI shortcuts: bin/arcodange thirdparty audit <socid> · bin/arcodange thirdparty audit-all

Replaces the V1 KM-only dolibarr-invoice-audit/scripts/audit-km-thirdparty.sh with a generalized, country-aware audit that scales as Arcodange adds more clients and suppliers.

Depends on the dolibarr base skill.

The country-aware checklist

Country Mandatory Optional but useful
FR name, address, zip, town, country_code, SIREN (idprof1), SIRET (idprof2), tva_intra (if supplier or VAT-registered) APE (idprof3), email, phone, url, IBAN
EU non-FR name, address, zip, town, country_code, tva_intra (required for B2B autoliquidation under article 196 directive TVA) national registration id (idprof1), email, phone, url
Extra-EU name, address, zip, town, country_code, national tax id (idprof1 — EIN for US, equivalent elsewhere) idprof2, email, phone, url

The rules mirror the field a French accountant would expect to file on monthly TVA declarations and on the customer file as audit evidence.

Workflow 1 — Audit one thirdparty

./scripts/audit-thirdparty.sh 1     # KissMetrics (US, client)
./scripts/audit-thirdparty.sh 2     # Wise Europe SA (BE, supplier)
./scripts/audit-thirdparty.sh 5     # Medialex (FR, supplier)
echo "exit: $?"                     # 0 = complete, 1 = mandatory gap

Live output for the FR-supplier case (captured at examples/audit-thirdparty-5.txt):

================================================================================
 Thirdparty 5 — Medialex   [supplier, country=FR]
================================================================================
  [OK] name                   = 'Medialex'
  [OK] address                = '10 rue du Breil'
  [OK] zip                    = '35063'
  [OK] town                   = 'Rennes'
  [OK] country_code           = 'FR'
  [OK] idprof1 (SIREN)        = '353403074'
  [XX] idprof2 (SIRET)        = ''
  [OK] idprof3 (APE)          = '7312Z'   (optional)
  [XX] tva_intra (VAT)        = ''
  ...
  8 pass, 2 mandatory fail(s), 2 optional unset

Status codes:

  • [OK] — value present.
  • [XX] — mandatory and missing.
  • [--] — optional and unset.

Workflow 2 — Audit all visible thirdparties

./scripts/audit-all-thirdparties.sh                # everyone
./scripts/audit-all-thirdparties.sh --clients-only
./scripts/audit-all-thirdparties.sh --suppliers-only
echo "exit: $?"                                    # 0 if dataset is fully compliant

Live output (captured at examples/audit-all-thirdparties.txt) — 5 / 10 thirdparties have mandatory gaps:

 id  name                                cnty role             missing
--------------------------------------------------------------------------------------------------------------
  1  KissMetrics                         US   client           tax_id
  2  Wise Europe SA                      BE   supplier         tva_intra
  3  Greffe du tribunal de commerce Évry FR   supplier         (complete)
  4  YOLAW                               FR   supplier         (complete)
  5  Medialex                            FR   supplier         SIRET, tva_intra
  6  Qonto                               FR   supplier         SIRET
  7  OVH                                 FR   supplier         (complete)
  8  La Poste                            FR   supplier         (complete)
  9  Infogreffe                          FR   supplier         SIRET
 10  Darnis Operations                   FR   supplier         (complete)
--------------------------------------------------------------------------------------------------------------
# 10 thirdparties audited, 5 with mandatory gaps

The 5 gaps to surface to the cohort review / accountant:

  • KissMetrics: US tax id (EIN) — already known from V1, still pending.
  • Wise Europe SA: BE tva_intra missing (mandatory for intra-UE B2B autoliquidation; currently the FAF2026001 supplier invoice is recorded with TVA=0 but no tva_intra, which the accountant will flag).
  • Medialex: SIRET + tva_intra. SIREN is present so the SIRET should be derivable (SIRET = SIREN + 5-digit NIC). The tva_intra is FR + 2 chars + SIREN.
  • Qonto, Infogreffe: SIRET missing on otherwise-complete records.

Fixing these is a Dolibarr UI task — this skill is read-only.

Relationship with V1

The V1 dolibarr-invoice-audit/scripts/audit-km-thirdparty.sh is kept for backward compatibility but is now a special case of this skill. Recommendation: invoke ./scripts/audit-thirdparty.sh 1 from this skill instead of the V1 script for any new automation.

Out of scope

  • Writes / corrections. The API key is read-only. Fix via the Dolibarr UI.
  • VAT-number validation against the EU VIES service. Future enhancement: tva_intra could be looked up against https://ec.europa.eu/taxation_customs/vies/services/checkVatService to validate the number. Out of scope here (external API).
  • idprof normalization across forks of Dolibarr. The idprof1..6 slots can be reordered or relabeled by Dolibarr admins. This skill assumes the stock French Dolibarr mapping (idprof1=SIREN, idprof2=SIRET, idprof3=APE).