agentleFS
bighadj22bighadj22/codflow/.agents/skills/zr-express/SKILL.md

zr-express

Skill338 starsChanged 2 months agoApache-2.0View on GitHub

ZR Express delivery platform integration for CodFlow — all 129 public API endpoints (catalog, claims, customers, orders/parcels, delivery pricing, hubs, supplier, treasury, users, webhooks), organized per domain. Use when connecting ZR Express as a delivery company, auditing or fixing the zr_express adapter in cod-server, verifying behavior against the official API, pulling tracking/state, registering webhooks, or extending ZR Express support.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Start at references/ in this folder — do not guess from the raw swagger.

    line 17
  2. Very specific:

    Every request also carries Accept/Content-Type application/json.

    line 60
  3. Distinctive:

    All IDs (parcel, customer, address, claim, etc.) are UUIDs — any other format is an error or a legacy/alias field.

    line 85
  4. Very specific:

    Create the delivery company with code: "zr_express", apiToken = ZR API key, apiUserGuid = ZR tenant Id.

    line 90
  5. Very specific:

    Verify: token check → create a test parcel (POST /parcels, POST /customers/individual first) → GET /parcels/{id} returns the tracking …

    line 92
  6. Very specific:

    Read the relevant references/{domain}.md + schemas/{domain}.json.

    line 101
  7. Distinctive:

    Keep every header name, path, query param, and body field exactly as the reference spells them (the generated files are verbatim from …

    line 103
  8. Very specific:

    Never commit ZR API keys or tenant IDs.

    line 108

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ZR Express Delivery Integration

ZR Express is an Algerian cash-on-delivery delivery platform (https://api.zrexpress.app, dashboard zrexpress.app). Its REST API covers the full supplier flow: parcels/orders (create, bulk, exchange, refund, labels, state updates), catalog (products, stock, receipts), customers (individual + company, addresses, imports), claims, delivery pricing (rates per territory), treasury (payments, payment requests, balance), users (profile, API keys), hubs, and webhooks (programmatic registration).

Start at references/ in this folder — do not guess from the raw swagger. Read CONFORMANCE.md before assuming the current adapter behavior is correct — it lists live-verified bugs (tracking 404, delete 405, address update 400, stop-desk hub 404, geo naming) that the code comments below may not reflect.

Reference files (in this skill folder)

FileWhat it holds
endpoints-index.mdMaster index — all 129 endpoints, per-domain, with auth notes
CONFORMANCE.mdVerified audit (2026-09-10, live-tested): what works / what's broken / fix order — read before assuming current behavior is correct
references/catalog.mdProducts, stock movements, receipts, categories, catalog reports (17)
references/claims.mdClaim categories, claims, comments, workflows (11)
references/customers.mdIndividual/company customers, addresses, imports/exports (15)
references/orders.mdParcels, pickup bags, modification requests, territories, labels, reports (50)
references/delivery-pricing.mdRates, service pricing, price lists (5)
references/hubs.mdHubs (2)
references/supplier.mdSupplier profile, blocking, price-list assignments (3)
references/treasury.mdSupplier payments, payment requests, treasury reports (15)
references/users.mdProfile, API-key management (4)
references/webhooks.mdWebhook endpoint CRUD (7)
schemas/*.jsonFull request/response schemas per domain (verbatim from swagger)

Path prefix is /api/v1/… (version defaults to 1). Read the domain reference + its schemas/{domain}.json before writing adapter code.

Codebase

  • cod-server/src/endpoints/delivery-companies/providers/zr_express/ — the adapter (adapter.ts, types.ts, capabilities.ts) implementing the DeliveryProvider interface used by dispatch.ts.
  • cod-server/src/endpoints/delivery-companies/providers/registry.ts — routes company code zr_express to the adapter; apiToken = ZR API key, apiUserGuid = ZR tenant Id.
  • cod-server/src/endpoints/delivery-companies/webhook-handlers.ts — programmatic webhook registration (registerZrWebhook) against /api/v1/webhooks/endpoints.
  • cod-server/src/endpoints/webhooks/zr-status-mapper.ts — maps ZR state names to CodFlow statuses.

Auth

  • Headers: X-Api-Key: {secretKey} + X-Tenant: {tenantId} (the adapter uses these consistently; the swagger also lists Bearer).
  • Every request also carries Accept/Content-Type application/json.

Gotchas (verified against the live integration)

  1. No separate validation step — ZR auto-activates parcels on creation; validateShipment is a no-op.
  2. Single create returns a parcel UUID; the tracking number only comes back from GET /parcels/{id}. Bulk create (POST /parcels/bulk) returns the tracking number directly. maxBulkCreate = 100.
  3. Territories are UUIDs (city + district), not wilaya_id/commune strings — resolve them via POST /territories/search and cache the city per wilaya.
  4. Auth is X-Api-Key + X-Tenant — do not switch to Authorization: Bearer just because examples show it; the stored apiToken is an API key.
  5. State names are free text (data.state.name), not a fixed enum: only "Out for Delivery", "In Transit" and "At Hub" are documented defaults. Unknown names must surface as unmapped — never guessed into a status.
  6. Label URLs expire (~1 hour, SAS-token based) — from create you get a deferred label token (CodFlow uses DEFERRED_LABEL_MARKER); serve labels server-side, never expose a signed URL to the browser.
  7. Update semantics — PATCH /parcels/{id}/amount, /customer and /deliveryAddress apply while canUpdateAfterValidation: true.
  8. Delete is unreliable (HTTP 405 in tests) — canDeleteBeforeValidation/ AfterValidation are both false; prefer state updates/refund flows.
  9. Webhook registration is API-driven — POST /webhooks/endpoints with X-Api-Key + X-Tenant; the registered URL is CodFlow's /webhooks/zr_express.
  10. All IDs (parcel, customer, address, claim, etc.) are UUIDs — any other format is an error or a legacy/alias field.

Workflow A — Connect ZR Express

  1. Create the delivery company with code: "zr_express", apiToken = ZR API key, apiUserGuid = ZR tenant Id.
  2. Verify: token check → create a test parcel (POST /parcels, POST /customers/individual first) → GET /parcels/{id} returns the tracking number → POST /parcels/labels/individual → tracking pull (GET /parcels/{id}/state-history).
  3. Register the webhook (registerZrWebhook → POST /webhooks/endpoints) and configure webhook_status_mapping for any non-default state names.

Workflow B — Audit / fix the integration

  1. Read the relevant references/{domain}.md + schemas/{domain}.json.
  2. Diff adapter.ts / types.ts endpoint-by-endpoint against the reference.
  3. Keep every header name, path, query param, and body field exactly as the reference spells them (the generated files are verbatim from swagger).

Security

Never commit ZR API keys or tenant IDs. They live in wrangler secrets / .dev.vars only (repo convention).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.