{"success":true,"name":"brimind-reusable-modules","description":"Every piece of code Dali writes on demand is built as a reusable component that future projects can call or recombine — never a one-off welded to one client or product. Use before writing any new code, when a request looks like \"build X for client Y\", when copying code from another folder, and before calling a build done.","category":"unitary","path":"unitary/brimind-reusable-modules/SKILL.md","file":"SKILL.md","content":"---\nname: brimind-reusable-modules\ndescription: Every piece of code Dali writes on demand is built as a reusable component that future projects can call or recombine — never a one-off welded to one client or product. Use before writing any new code, when a request looks like \"build X for client Y\", when copying code from another folder, and before calling a build done.\n---\n> Imported from [PRIVATE_HOST] `~/unitary/agents/s3a/skills/brimind-reusable-modules`. Paths are relative to `[PRIVATE_HOST]:[PATH]`; run commands there via `ssh [PRIVATE_HOST] 'cd ~/unitary && ...'`. Owner send rules from skill i7-remote-ops still apply.\n\n# Build it once, reuse it everywhere\n\n> « when coding, code things to be reusable for future projects, where the components can be recombined or called\n> in other future projects — make this a skill for Dali » — owner, 2026-09-24 21:35Z\n\n## Before writing\n1. **Search first**: is there already a module that does this or 80 % of it? (the catalogue below, `grep`, USAGE.md).\n   Extend it; never write a second one. This applies across repos too — before\n   building file storage/upload for a new BRIMIND app, grep sibling repos\n   (e.g. `pay-invoicer/lib/uploader.js`) for the shared\n   `storage.brimind.pro/upload.php` convention (multipart `file` field,\n   `platform`+`fileName` query params, fixed extension whitelist) and port that\n   pattern in, instead of inventing local-disk storage that the shared\n   infrastructure (backups, CDN, compression) doesn't know about.\n2. **Split the request**: the generic part (send an SMS wave, build a quote, scrape a listing, render a site, post to a\n   network) becomes a module; the client/product part is only config or a thin caller.\n\n## How a module is built\n- **One job**, named for the job (`sms-wave`, `quote-pdf`, `maps-scout`), not for the client (`tazmall-sms`).\n- **No client, product, phone, price or brand inside** — all of that comes in as parameters or a config file.\n- **Clear contract**: input, output, errors, exit codes written at the top of the file and in its README.\n- **Callable three ways when it makes sense**: an importable function, a CLI (`node <module> …`), an HTTP route.\n- **Own tests** (default-safe, loud failure — skill brimind-loud-failure), runnable alone.\n- **No hidden state**: paths, ports, credentials from env/config; data files under the caller's `data/`.\n\n## After building\n- Add one line to the **module catalogue** `MODULES.md` at the repo root: name · what it does · input → output · path ·\n  how to call · tests. A module not in the catalogue does not exist for the next project.\n- The commit message names the module and the first caller.\n\n## Done when\nA second project could use it tomorrow by importing or calling it, with no edit to the module itself.\n","linked_files":[],"origin":"brimind","owner_id":null,"source":"router"}