AI agents

Social media caption and reply helper for local businesses

TypeScript AI agent drafts weekly per-platform captions, posting schedules, and simple comment replies for owner approval on one screen.

typescriptnextjszoddrizzlesqlitevitest

Built 1 time, downloaded 0 times.

Install from your terminal

Run this in your project folder. It signs you in, shows what changes and asks before it overwrites a file.

npx claude-lab add social-media-caption-and-reply-helper-for-local-businesses-ba7b19
10 filesDownload zip
CLAUDE.md
# the app

A TypeScript agent for local businesses. The owner uploads 5 photos a week, and the agent drafts captions per platform, proposes a posting schedule, and drafts replies to simple comments. The owner reviews everything on one approval screen. Flow: weekly photo upload, then captions per platform, then schedule, then draft comment replies, then a single approval screen. Nothing goes out until the owner approves it.

## Stack

- TypeScript in strict mode.
- Next.js (App Router) for the approval UI and API routes.
- Zod for validating all model output.
- Vitest for tests.
- SQLite through Drizzle for storage.
- If SPEC.md names a different database or hosting choice, follow SPEC.md and update this section.

## Commands

- `npm run dev`: start the local app.
- `npm test`: run Vitest.
- `npm run typecheck`: TypeScript check, no emit.
- `npm run lint`: ESLint.
- `npm run build`: production build.
- `npm run eval`: caption fixture checks against the sample businesses.
- `npx tsx scripts/smoke.ts`: run the agent on fixtures and print drafts.

## Folder map

- `src/agent/`: prompts, tools, and orchestration. Comment logic lives in `src/agent/comments/`.
- `src/platforms/`: one adapter per platform behind a common interface. Adapters are stubbed first. Each platform's length limits and tone rules sit in `src/platforms/<name>.ts` as constants.
- `src/app/`: approval UI and API routes.
- `src/db/`: Drizzle schema and SQLite file.
- `tests/fixtures/`: sample photos and fictional business profiles. No real data.
- `scripts/`: smoke run and helper scripts.

## Hard rules

- Nothing is posted or replied to automatically. Every caption, schedule slot, and reply is a draft until the owner approves it. Any code path that publishes must check that the status is `approved`.
- Comment replies are drafted only for simple factual questions (hours, address, phone, menu basics), and only from the business profile. Complaints, refunds, prices not in the profile, health, and legal topics are flagged `needs_owner`. They are never drafted.
- All model output is parsed with a Zod schema. On failure, retry once, then show an error. Never pass raw model text onward.
- Secrets come from environment variables (`ANTHROPIC_API_KEY`, platform tokens) loaded from `.env.local`. Never commit secrets. Docs use `YOUR_API_KEY` as the placeholder.
- Platform limits and tone rules belong in `src/platforms/<name>.ts`, not in prompts.

## Gotchas

- Strip EXIF location data from every uploaded photo before storing or sending it to the model.
- Cap uploads at 5 photos per week per business.
- Store all times in UTC. Save the business timezone separately and convert for display and scheduling.
- Schedule suggestions must not collide with existing slots. Check the business's likely open hours.
- The platform adapters are stubs in MVP. The stub logs to the console and does not call any network API.

## Working style

- Explore, then plan, then code, then verify. Use plan mode before Phase 2 and Phase 5.
- Run the `verify` skill before saying a change is done. If any step was skipped, say which one and why.
- Use `/clear` between unrelated tasks and `/compact` at natural breaks.
- Keep changes inside this project folder. Do not add dependencies without asking.
- For long output, delegate to the `test-runner` subagent.
- Phase work is tracked in PLAN.md. Each phase ends with a `/goal` check.

## Review

@REVIEW.md
Use for my project