Add Carrier Adapter
Source:
custom-skills/add-carrier-adapter/SKILL.md
Extend Parcel Path with a new carrier without breaking existing adapters.
Table of Contents
Add carrier adapter
Extend Parcel Path with a new carrier without breaking existing adapters.
Before you start¶
- Read
AGENTS.md— one vertical slice at a time. - Run
npm testto confirm a green baseline. - Check whether the carrier has a documented API or you must use fixtures only (v0: fixtures preferred).
Steps¶
- Define types — extend
src/carriers/types.tsif the carrier exposes fields other adapters do not share (prefer reusingTrackingEventandCarrierAdapter). - Create the adapter — add
src/carriers/<carrier-id>.tsimplementingCarrierAdapter:fetchTracking(id: string): Promise<TrackingEvent[]>- Map raw carrier statuses to internal enums before formatting.
- Register the adapter — wire it in the CLI carrier registry (follow the pattern used by existing adapters).
- Add fixtures — put offline JSON under
tests/fixtures/<carrier-id>/for unit tests; never hit the network in tests. - Table-driven status tests — one test row per carrier status → expected next-action copy.
- Update README — document the carrier id flag and any carrier-specific options.
Naming conventions¶
- File:
src/carriers/<kebab-case-id>.ts - Export:
create<CamelCase>Adapter()factory - Fixture id for demos:
DEMO-<carrier>-1001
Definition of done¶
- Happy path + one failure path tested with mocks/fixtures
- No PII in logs (tracking tokens and addresses redacted)
- Exit codes unchanged:
0success,1validation,2carrier/runtime failure