# Farmacia

> Query pharmacy catalogs (Farmacity Argentina, VTEX) from the terminal. Use when the user wants to search medicine or skincare prices, check stock at Farmacity, look up a product by EAN barcode, compare pharmacy prices, or asks "cuanto sale X en farmacity", "busca Y en la farmacia", "hay stock de Z". Read-only catalog; no purchases.

- Skill: `crafter-station/farmacia` (Agent Skill)
- Install (CLI): `npx skillmds@latest add crafter-station/farmacia`
- Raw SKILL.md: https://api.skillmd.com/api/skills/crafter-station/farmacia/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: crafter-station (https://skillmd.com/u/crafter-station)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/crafter-station/farmacia

---


# farmacia

Agent-first CLI over VTEX pharmacy catalogs. First store: Farmacity (AR). A store is config, not code.

## Setup

```bash
cd ~/Programming/railly/farmacia && bun link   # exposes `farmacia`
```

## Commands

```bash
farmacia search <term> [--limit 1-50] [--page N] [--sort price-asc|price-desc] [--store farmacity]
farmacia product get <productId>
farmacia product ean <barcode>
farmacia schema        # full machine-readable surface, versioned
```

`farmacia search` is shorthand for `farmacia product search`.

## Contract

- **stdout**: one JSON envelope `{ ok, command, store, data, meta }` (JSON is automatic when piped; `--json` forces it). Human tables when TTY.
- **stderr**: NDJSON `{type:"next-step", command, description}` hints + notes. Never data.
- **Errors**: `{ ok:false, code, error, hint }` on stdout in JSON mode. Exit 0 ok / 1 user error / 2 system.
- **Product**: `id, name, brand, url, ean, price, listPrice, currency, available, stock, saleType, category, promos`. `price` is `null` when unavailable.
- **saleType**: `otc` | `prescription` | `general`, derived from the VTEX category tree (`Medicamentos Venta Libre` / `Venta Bajo Receta`).

## Gotchas the agent should know

- Prices/stock come from a CDN cache up to **300s old** (`meta.cacheMaxAgeSeconds`). Do not promise real-time stock.
- Pagination: window max 50, offset max 2500 (VTEX hard limits, enforced client-side with typed errors `WINDOW_LIMIT` / `PAGINATION_LIMIT`). Refine the term instead of paging deep.
- `stock` 99999 means "not tracked per unit", not literal inventory.
- This CLI reads a public catalog. It cannot buy, reserve, or check per-branch stock.

## Composition

```bash
farmacia search ibuprofeno --sort price-asc --limit 5 --json | jq '.data[0]'
farmacia product ean "$(barcode)" --json | jq -r '.data.url'
```

