ecotrack
Skill338 starsChanged 2 months agoApache-2.0View on GitHub
EcoTrack platform integration for CodFlow — one API shared by 82 Algerian couriers (DHD, Conexlog, MSM Go, Packers, World Express...). Use when connecting an EcoTrack courier, auditing or fixing the adapter, verifying behavior against the official API, handling tracking/status issues, or extending EcoTrack support.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- codebase-designSkill
- code-reviewSkill
- codflow-setupSkill
- codflow-updateSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- implementSkill
- improve-codebase-architectureSkill
- meta-adsSkill
- prototypeSkill
- route-builderSkill
- storefront-vercelSkill
- tddSkill
- to-specSkill
- to-ticketsSkill
- wayfinderSkill
- whatsapp-otpSkill
- zr-expressSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 5 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
Read API-REFERENCE.md before writing any adapter code.
- Distinctive: line 52
Create the delivery company with:
- Very specific: line 60
Run stop-desk sync (admin action → getStopDesks() → get/communes filtered to has_stop_desk === 1, code_postal becomes the Station Code).
- Distinctive: line 62
Verify: token check, one test dispatch, label proxy, tracking pull.
- Distinctive: line 68
Check response-shape handling for every endpoint you touch — EcoTrack shapes are NOT uniform (see Hard Rules #3).
- Very specific: line 70
If you changed TypeScript: cd cod-server && npm run typecheck.
- Very specific: line 71
If you changed behavior: cd cod-server && npm test — and note the EcoTrack adapter has NO test file (yalidine/noest/zr_express all have …
- Very specific: line 85
Keep every response-shape guard defensive (Array.isArray, ??
- Distinctive: line 89
Add tests. Run typecheck + tests.
- Very specific: line 128
Always serve through proxyShipmentLabel (server-side fetch), never expose the token to the browser.
- Very specific: line 133
Status wording drifts per tenant: Never treat French display labels as stable identifiers.
- Very specific: line 155
Every param name matches API-REFERENCE.md exactly (French, snake_case).
- Distinctive: line 156
Every response parse handles the endpoint's actual shape (rule #3).
- Very specific: line 160
No credentials, tokens, or tenant URLs in code or tests — only in wrangler secrets / .dev.vars.
≈ “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.
Files
EcoTrack Integration
EcoTrack is not a courier. It is the white-label platform a large slice of
Algeria's regional couriers run on: DHD, Conexlog, MSM Go, World Express,
Packers and ~80 others each expose the SAME API on their own *.ecotrack.dz
domain. One adapter, 82 companies. The companies differ (fleet, pricing,
delivery rate); the API does not.
Resources in this folder
| File | What it holds |
about.md | dzship's EcoTrack guide — the 82-courier key table + per-tenant quirks |
postman_collection.json | The OFFICIAL API docs (Postman export) — the source of truth |
API-REFERENCE.md | Every endpoint distilled from the Postman collection |
CODEBASE-MAP.md | Where our integration lives, data flow, DB shape |
CONFORMANCE.md | Verified audit: implemented ✓ / missing / wrong, verification checklist |
PLAN.md | The slice-by-slice rollout plan for all 82 couriers — follow it top to bottom and keep its status table current |
Read API-REFERENCE.md before writing any adapter code. Read CONFORMANCE.md
before assuming current behavior is correct. For the 82-courier rollout work,
PLAN.md is the operational document: pick the first slice marked NOT STARTED,
follow its checklist, verify green, mark it DONE.
The mental model
delivery_companies row (code: "dhd_ecotrack", apiEndpoint: "https://dhd.ecotrack.dz", apiToken: "…")
│
▼
isEcotrackCompany(code) → EcotrackProvider(apiToken, baseUrl)
│
▼ one adapter, any *.ecotrack.dz tenant
POST /api/v1/create/order (query params, Bearer auth)- Company code MUST be
ecotrackor end in_ecotrack— that suffix is what routes the company to this adapter (registry.ts:32). apiEndpointholds the tenant base URL. There is no central EcoTrack host.apiUserGuidis unused (NOEST-only field).autoValidatedefaults to false for the EcoTrack family — parcels wait as Dispatched until someone calls manual validation.
Workflow A — Connect a new EcoTrack courier
- Find the courier key in
about.md's 82-courier table (e.g.dhd,conexlog,msmgo). - Create the delivery company with:
code={key}_ecotrack(or plainecotrackfor a generic tenant)apiEndpoint=https://{key}.ecotrack.dz(the pattern; verify with the courier if unsure — generic fallback requires a*.ecotrack.dzhost)apiToken= token from that courier's dashboard (write-only; never logged)name/nameArper the courier's branding
- Decide
autoValidatedeliberately (default false for EcoTrack family — manual validation keeps control of when the parcel enters courier flow). - Run stop-desk sync (admin action →
getStopDesks()→get/communesfiltered tohas_stop_desk === 1,code_postalbecomes the Station Code). - Verify: token check, one test dispatch, label proxy, tracking pull.
Workflow B — Audit / verify the integration
- Open
CONFORMANCE.md— read the "Verified correct" and "Discrepancies" lists. - Diff
adapter.ts+types.tsagainstAPI-REFERENCE.md, endpoint by endpoint. - Check response-shape handling for every endpoint you touch — EcoTrack shapes are NOT uniform (see Hard Rules #3).
- If you changed TypeScript:
cd cod-server && npm run typecheck. - If you changed behavior:
cd cod-server && npm test— and note the EcoTrack adapter has NO test file (yalidine/noest/zr_express all haveadapter.test.ts); when you touch the adapter, add/extend one using the same fetch-mock pattern. - Live API verification only when the user explicitly provides a sandbox tenant
and token. Never commit credentials.
.dev.varsonly.
Workflow C — Extend the adapter
- Copy the exact param names / response shape from
API-REFERENCE.md— do not guess, do not copy from another provider. EcoTrack uses French param names and three different response styles. - Single-order endpoints take query params, no JSON body. Only
create/orders(bulk) andvalid/returnstake a JSON body. - Keep every response-shape guard defensive (
Array.isArray,?? []) — tenants drift. - Register nothing in the registry unless a new company family appears —
*_ecotrackcodes already route here. - Add tests. Run typecheck + tests.
Hard rules (traps that bite)
- Auth is Bearer everywhere — EXCEPT
GET /api/v1/get/orders/status, which authenticates via anapi_tokenquery param. If you send only the Bearer header there, you get an auth error. - Rate limit: 50 requests/minute → HTTP 429
{"message": "Too Many Attempts."}. Auto-validate flows make 2 calls per order (create + valid) — a bulk dispatch of 25+ orders can hit the ceiling. Surface 429 distinctly; pace or back off. - Response shapes are not uniform. Memorize:
get/maj→ plain JSON arrayget/tracking/info→ object withactivityarrayget/communes→ object keyed by index (never assume array)get/wilayas,get/ordersdata → plain array / paginated objectget/desks→{ my_desk: {...}, other_desks: [...] }- bulk
create/ordersresults → keyed byreferencewhen the order had one, else by index string - Single create errors → HTTP 200 with
{success: false, error: 1000x}OR HTTP 422 Laravelerrorsbag. Handle BOTH.
montantis the COD amount INCLUDING delivery fees (official param doc). CodFlow currently sendsorder.price(product subtotal) atdispatch.tscreateShipment call — see CONFORMANCE.md before shipping a fix; confirm merchant intent (delivery fee charged to customer ⇒ must be included).typeparam: 1=Livraison, 2=Échange, 3=PICKUP, 4=Recouvrement. Our adapter always sends1.capabilities.tsclaimingcanExchange: falsecontradicts the official docs — all four types are allowed.- Update semantics: officially all params optional, but Packers (one
tenant) rejects calls missing
type, wilaya, commune, adresse, montant, tel. The caller must pre-fill ALL fields from the order, then apply overrides — the route handler already does this; keep it that way. - Update after validation is a silent no-op: EcoTrack answers
success: truebut ignores the change (Packers-confirmed). We guard client-side (status must bedispatched). Never trust a post-validation update response. - Delete only works pre-validation (error 10001 after). Post-validation,
the only carrier-side actions are
ask/for/order/return(courier may IGNORE it) andvalid/returns(confirming received returns). - Labels are raw PDF bytes behind Bearer auth — the URL is never public.
Always serve through
proxyShipmentLabel(server-side fetch), never expose the token to the browser. - No webhooks. Tracking is pull-only:
get/tracking/info(single) andget/trackings/info(bulk, ≤100). The/orders/:id/trackingendpoint is the only freshness source for EcoTrack orders. - Status wording drifts per tenant. Never treat French display labels as
stable identifiers. The stable vocabulary is the
activityenum keys and the status enum keys (both listed in API-REFERENCE.md). An unknown label must surface as-is, never be guessed into a status. - Tracking queries answer list-style — a lazy "take the first row" client can attach the wrong parcel's status. Always query with the exact tracking number and match exactly.
- Validation limits: phone 9–10 digits numeric; wilaya code 1–58 integer;
every string field max 255 chars.
communeis a NAME (string), matched against the tenant's enabled commune list — a wrong/misspelled commune name is a 422, and a disabled wilaya returns error 10002. - Bulk endpoint reliability is per-tenant: Packers'
create/ordersreturned HTTP 500 (server-side bug, documented indispatch.ts). Verify on the specific tenant before relying on bulk dispatch; fall back to sequential single creates. - The
_ecotracksuffix is load-bearing: adapter selection, the autoValidate default, and the update guard all key offisEcotrackCompany(code). A company code without the suffix silently loses all three.
What "done right" looks like
- Every param name matches
API-REFERENCE.mdexactly (French, snake_case). - Every response parse handles the endpoint's actual shape (rule #3).
- 429 and
success:false+ error-code responses are surfaced with their codes. npm run typecheckandnpm testpass in cod-server.- The adapter test file covers create/validate/update/delete/remarks/tracking.
- No credentials, tokens, or tenant URLs in code or tests — only in
wrangler secrets/.dev.vars.
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.

