| name | cohere-local-dev-loop |
| description | Configure Cohere local development with mocking, testing, and hot reload.
Use when setting up a development environment, configuring test workflows,
or establishing a fast iteration cycle with Cohere API v2.
Trigger with phrases like "cohere dev setup", "cohere local development",
"cohere dev environment", "develop with cohere", "mock cohere".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(pnpm:*), Grep |
| version | 1.5.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","ai","nlp","cohere"] |
| compatibility | Designed for Claude Code |
Cohere Local Dev Loop
Overview
Set up a fast, reproducible local development workflow with Cohere API v2 mocking, vitest testing, and hot reload.
Prerequisites
- Completed
cohere-install-auth setup
- Node.js 18+ with npm/pnpm
- TypeScript project with
tsx or ts-node
Instructions
Step 1: Project Structure
my-cohere-project/
โโโ src/
โ โโโ cohere/
โ โ โโโ client.ts # CohereClientV2 wrapper
โ โ โโโ chat.ts # Chat completions
โ โ โโโ embed.ts # Embedding operations
โ โ โโโ rerank.ts # Reranking operations
โ โโโ index.ts
โโโ tests/
โ โโโ chat.test.ts
โ โโโ embed.test.ts
โ โโโ fixtures/
โ โโโ responses.ts # Mock API responses
โโโ .env.local # Local secrets (git-ignored)
โโโ .env.example # Template for team
โโโ package.json
Step 2: Package Setup
{
"scripts": {
"dev": "tsx watch src/index.ts",
"test": "vitest",
"test:watch": "vitest --watch",
"test:integration": "COHERE_INTEGRATION=1 vitest --run"
},
"dependencies": {
"cohere-ai": "^7.0.0"
},
"devDependencies": {
"tsx": "^4.0.0"