Start here → then read AGENTS.md for the full map.
# Cursor Rules for THE LOST+UNFOUNDS
> **Start here → then read [AGENTS.md](AGENTS.md) for the full map.**
## SKILL UTILIZATION RULE - HIGHEST PRIORITY
**Before starting ANY task, read the relevant SKILL.md files.**
Skills: `.agent/skills/*/SKILL.md` and `skills/*/SKILL.md`
| Keywords / Domain | Required Skill(s) |
|---|---|
| email, newsletter, send, campaign, branding, outreach | `brand-email-manager`, `outreach-ops` |
| admin, dashboard, analytics | `admin-ops` |
| affiliate, commission, tracking, Amazon links | `affiliate-ops`, `affiliate-program` |
| blog, publish, post, SQL script | `blog-publishing` |
| shop, product, checkout, PayPal, order, payment | `commerce-engine`, `paypal-sandbox` |
| gallery, photos, upload, sync, Google Drive | `gallery-ops`, `gallery-sync-troubleshooting` |
| UI, design, components, styling, CSS | `noir-design`, `bento-design`, `no-border-design` |
| modal, overlay, z-index, popup | `modal-z-index-manager` |
| database, migration, RLS, schema, Supabase | `infra-ops`, `verify-schema` |
| environment variables, secrets, .env | `secure-env-manager`, `verify-env` |
| deploy, production, dev server, build | `dev-parity-guard`, `fix-dev-server` |
| refactor, cleanup, technical debt | `code-refactor` |
| revenue, earnings, transactions | `revenue-data-validator` |
| browser, testing, UI verification | `smart-browsing`, `browser-ops-guard`, `verify_ui_changes` |
| Google Auth, OAuth, login | `fix-google-auth` |
| clock, stopwatch, timer widget | `dashboard-clock-interaction` (in `skills/`) |
| Google service account, photographer | `gallery-agent-management` (in `skills/`) |
| PayPal credentials, verification | `paypal-verify` (in `skills/`), `fix-paypal-mcp` |
**Rules:** Read FIRST, code SECOND. Multiple skills may apply. Skills override assumptions.
## WORKFLOWS
| Command | When | File |
|---|---|---|
| `/ralph-loop` | After any change — self-verify | `.agent/workflows/ralph-loop.md` |
| `/preflight-check` | Before committing | `.agent/workflows/preflight-check.md` |
| `/deploy-and-verify` | Deploying to production | `.agent/workflows/deploy-and-verify.md` |
| `/cleanup` | Monthly maintenance | `.agent/workflows/cleanup.md` |
| `/send-email` | Sending emails | `.agent/workflows/send-email.md` |
## CRITICAL INVARIANTS
### 1. Blog text = `text-left`
Never `text-center` or `text-justify` on body text. Applies to: BlogPost.tsx, BlogAnalysis.tsx, all blog components.
### 2. Emails use branded templates
Use `generateNewsletterEmail()`, `generateTransactionalEmail()`, or `wrapEmailContent()` from `lib/email-template.ts`. Never `processEmailContent` alone. Never raw HTML. Read `brand-email-manager` skill first.
### 3. SQL uses check-and-insert pattern
Never `ON CONFLICT (slug)`. Always: `SELECT id INTO existing_post_id ... LIMIT 1` → `IF/ELSE` insert/update.
### 4. Deploy = merge to main + push + verify live URL
Follow `.agent/workflows/deploy-and-verify.md`. Never mark deployment complete without verification.
### 5. Blog formatting: check live URL first
Verify at `https://www.thelostandunfounds.com/thelostarchives/[slug]`, not the SQL file. See `BLOG_POST_STYLE_GUIDE.md`.
## BLOG POST PUBLISHING RULE
When publishing a blog post, follow ALL steps:
1. **Create SQL** in `sql/create-blog-post-[slug].sql` AND `public/sql/create-blog-post-[slug].sql`
- Use check-and-insert pattern (invariant #3)
- Include title, slug, content, excerpt, SEO fields, published=true, status='published'
2. **Update `src/pages/SQL.tsx`** — add fetch + entry in `allScripts` array (auto-sorted by `createdAt`)
3. **Update `api/sql/latest.ts`** — add file path to `SQL_FILES` array
4. **Commit, merge to main, push**
5. **Verify** at `https://www.thelostandunfounds.com/sql` — script must appear with copy functionality
## EMAIL SENDING RULE
- Never claim you can't send email — use Zoho Mail integrations
- Test: POST `https://www.thelostandunfounds.com/api/admin/send-welcome-emails` with `{"testEmail":"target@example.com"}`
- Required env vars: `ZOHO_CLIENT_ID`, `ZOHO_CLIENT_SECRET`, `ZOHO_REFRESH_TOKEN`, `ZOHO_FROM_EMAIL`
## NEWSLETTER RESEND RULE
1. Query `newsletter_campaigns` (ordered by `created_at` desc, limit 1) using `.env.local` credentials
2. Inject Getting Started CTA before footer if not present
3. Send via POST `https://www.thelostandunfounds.com/api/newsletter/send` with `testEmail` for testing
4. Omit `testEmail` for full send
## DASHBOARD CLOCK RULE
Clock face click → cycles formats (Analog → Digital 12h → 24h). Top label click → cycles modes (Clock → Stopwatch → Timer). Use `e.stopPropagation()` on clock face clicks.
Workflows from the Neura Market marketplace related to this Cursor resource