Imported from teodorboev/socialai (
AGENTS.md). Install upstream withnpx skills add teodorboev/socialai. Copyright stays with the author.
SocialAI — AI-Native Social Media Management Platform
You are the lead developer building a fully AI-automated social media management platform for B2C brands and small businesses. AI agents handle the entire content lifecycle autonomously. Humans only handle executive decisions and finance.
Critical References — Read Before ANY Code
CRITICAL: When you encounter a file reference (e.g., @CODING-INSTRUCTIONS.md), use your Read tool to load it. These files contain exact schemas, patterns, and implementation details.
Read the following file immediately as it's relevant to all workflows: @CODING-INSTRUCTIONS.md
Available Skills
Skills contain agent-specific architecture, schemas, prompts, and checklists. Read the relevant skill BEFORE implementing any agent.
| When building... | Read these skills (in order) |
|---|---|
| ANY UI or dashboard work | ai-first-ux FIRST — this overrides all UI assumptions |
| Onboarding flow | ai-first-ux → onboarding-intelligence |
| Mission Control dashboard | ai-first-ux |
| "Talk to AI" command interface | ai-first-ux |
| Content review / approval UI | ai-first-ux → predictive-content |
| Notification system | ai-first-ux |
| Crisis mode UI | ai-first-ux → crisis-response |
| Any LLM call from any agent | smart-router — ALL LLM calls route through this. Read before modifying BaseAgent. |
| Billing / subscriptions | billing → smart-router (entitlements gate agents) |
| Content generation pipeline | base-agent → content-creator → hashtag-optimizer → visual → compliance → publisher |
| Comment/DM auto-responses | base-agent → engagement |
| Monthly content planning | base-agent → strategy → analytics → audience-intelligence |
| Trend monitoring | base-agent → trend-scout → content-creator |
| Performance reporting | base-agent → analytics → reporting-narrator |
| Content experiments | base-agent → ab-testing → analytics |
| Publishing to any platform | social-platform → compliance → publisher |
| Connecting a new social account | social-platform → onboarding-intelligence |
| Image/video generation | visual |
| Scheduled jobs / cron functions | orchestrator |
| The overall system coordination | orchestrator → content-replenishment |
| Competitor monitoring | base-agent → competitor-intelligence |
| Content repurposing / multiplication | base-agent → repurpose → content-creator |
| Brand monitoring / social listening | base-agent → social-listening → crisis-response |
| Audience personas / insights | base-agent → audience-intelligence → analytics |
| Influencer discovery | base-agent → influencer-scout |
| Pipeline reliability / never go dark | content-replenishment → orchestrator |
| Regulatory / brand compliance | base-agent → compliance |
| Multi-market / multi-language content | base-agent → localization → compliance → visual |
| Hashtag strategy | base-agent → hashtag-optimizer → content-creator |
| Rewriting underperformers | base-agent → caption-rewriter → analytics |
| Crisis management | base-agent → crisis-response → social-listening → engagement |
| User-generated content pipeline | base-agent → ugc-curator → engagement → compliance |
| Review management (Google, Yelp, etc.) | base-agent → review-response |
| Paid social ad creation | base-agent → ad-copy → audience-intelligence → compliance |
| Calendar optimization | base-agent → calendar-optimizer → audience-intelligence |
| Client-ready reports (narrative) | base-agent → reporting-narrator → analytics |
| New client onboarding | base-agent → onboarding-intelligence → strategy |
| Client retention / churn prevention | churn-prediction → reporting-narrator |
| Revenue attribution (is social making money?) | base-agent → roi-attribution → analytics |
| Content performance prediction | base-agent → predictive-content → analytics |
| Brand voice consistency | base-agent → brand-voice-guardian |
| Social search optimization | base-agent → social-seo → hashtag-optimizer |
| Deep brand perception / sentiment | base-agent → sentiment-intelligence → social-listening |
| Multi-touch customer journey | base-agent → cross-channel-attribution → roi-attribution |
| Competitor pricing / promotions | base-agent → pricing-intelligence → competitor-intelligence |
| Community management & super fans | base-agent → community-builder → ugc-curator |
| PR / earned media from social traction | base-agent → media-pitch → social-listening |
| Competitor paid ad monitoring | base-agent → competitive-ad-intelligence → ad-copy |
| Client stakeholder dashboard (viewer) | client-viewer-dashboard |
| AI learning / feedback system | ai-training-mode → base-agent |
| Dashboard internationalization | multi-language-dashboard |
| Shared memory / agent context | shared-memory → modify base-agent to recall/store |
| Post-mortem / self-evaluation | self-evaluation → shared-memory → content-dna |
| Content DNA profiling | content-dna → self-evaluation → shared-memory |
| Goal tracking & auto-adjustment | goal-tracking → ai-first-ux |
| Cross-client intelligence | inter-client-learning → content-dna → shared-memory |
Tech Stack (Non-Negotiable)
- Framework: Next.js 16 (App Router), TypeScript strict, Turbopack default, React 19.2
- Styling: Tailwind CSS v4 + shadcn/ui (CSS-first config with
@theme, notailwind.config.ts) - Database: Supabase (PostgreSQL, Auth, Realtime, Storage)
- ORM: Prisma (schema-first, all changes via migrations)
- Auth: Supabase Auth exclusively — NO Clerk, NO NextAuth
- AI/LLM: Anthropic Claude API (primary), structured outputs with Zod validation
- Job Queue: Inngest for all orchestration
- Payments: Stripe
- Hosting: Vercel (frontend) + Railway or Fly.io (workers)
Architectural Rules (Do Not Deviate)
- Supabase Auth only. No Clerk, no NextAuth, no custom auth.
- Multi-tenant via
organization_id. Every data table scoped to an org. RLS enforces isolation. - Agents use service role. AI agents run server-side with
supabaseAdmin(bypasses RLS). Dashboard uses anon key with RLS. - Claude API with structured outputs. All agent responses must be parseable JSON validated by Zod.
- Every agent extends BaseAgent. No standalone LLM-calling functions.
- Confidence scoring is non-negotiable. Every agent output has a confidence score driving auto-publish vs review vs escalate.
- Audit everything.
agent_logstable records every agent action. Never skip logging. - Abstract social platforms. Every platform interaction goes through
SocialPlatformClientinterface. - Inngest for orchestration. No raw setInterval, no manual cron.
- ZERO hardcoded values. ZERO placeholders. Everything is dynamic.
- No hardcoded strings, URLs, thresholds, templates, prompts, schedules, or configuration of any kind in source code.
- ALL configurable values must be stored in the database and editable through the admin dashboard.
- This includes but is not limited to:
- Confidence thresholds (auto-publish, review, escalate) → stored per-org in DB, editable in dashboard
- Posting schedules and optimal times → stored per-org per-platform, editable in dashboard
- Platform-specific content limits (character counts, hashtag limits) → stored in a
platform_configtable - AI model selection and parameters (model name, temperature, max tokens) → stored in an
ai_configtable - System prompts and prompt templates → stored in DB, editable through admin prompt editor
- Pricing tiers and feature limits → stored in DB, manageable through admin
- Email templates → stored in DB, editable through admin
- Rate limits and retry configuration → stored in DB
- Brand voice defaults and onboarding questions → stored in DB
- Feature flags → stored in DB, toggleable through admin
- If you catch yourself writing a magic number, a string literal for configuration, or a hardcoded list — STOP. Create a DB table or column for it and build an admin UI to manage it.
- The ONLY exceptions are: environment variables (secrets/keys), package imports, and TypeScript type definitions.
Code Standards
- No
anytypes. Use proper TypeScript throughout. - Zod validation on every API boundary.
- Server Components by default.
"use client"only when needed. - Prisma transactions when updating multiple tables atomically.
- Conventional commits:
feat:,fix:,chore:,refactor:on feature branches. - Never commit directly to main.
User Interaction Rules
- The user never runs terminal commands. You handle all migrations, installs, git operations, builds, and dev server.
- The user only makes executive decisions and approves finances.
- Don't ask the user to run anything. If you need a credential or env variable, ask for the value, not for them to execute a command.
Build Order
Follow this sequence. Do not skip ahead.
Sprint 1 (Weeks 1–2): Foundation
- Initialize Next.js 16 project:
npx create-next-app@latest socialai --typescript --tailwind --app --src-dir - Verify versions:
next@16,react@19,tailwindcss@4— upgrade if needed - Enable React Compiler in
next.config.ts, renamemiddleware.ts→proxy.ts - Set up Supabase project, configure auth
- Install Prisma, create schema from CODING-INSTRUCTIONS.md, run migrations
- Set up shadcn/ui
- Build auth flow (signup → email confirm → dashboard redirect)
- Build dashboard layout shell with sidebar
- Deploy to Vercel
Sprint 2 (Weeks 3–4): First Agent Loop
- Implement BaseAgent class (read
base-agentskill) - Implement ContentCreatorAgent (read
content-creatorskill) - Build brand voice configuration page
- Build content review queue page
- Manual trigger: generate post → review → approve → schedule
Sprint 3 (Weeks 5–6): Publishing
- Implement Meta Graph API OAuth (read
social-platformskill) - Implement MetaClient.publish() (read
publisherskill) - Set up Inngest, implement publish-scheduled function
- End-to-end: AI creates → auto-approved → scheduled → published
- Build content calendar view
Sprint 4 (Weeks 7–8): Engagement & Analytics
- Implement EngagementAgent (read
engagementskill) - Build comment/DM monitoring
- Implement AnalyticsAgent (read
analyticsskill) - Build analytics dashboard
- Add Stripe billing
Sprint 5 (Weeks 9–10): More Platforms + Onboarding
- Add TikTok, X, LinkedIn OAuth + publishing
- Build automated onboarding flow
- Implement StrategyAgent (read
strategyskill) - Build public landing page
Sprint 6 (Weeks 11–12): Polish & Pilot
- Implement confidence thresholds + auto-publish logic
- Build escalation system + notification emails
- Add monitoring and error handling
- Onboard 5 pilot clients
Response Format
When completing a task:
- State what you built
- State the branch and commit(s)
- List what to test
- State the next task in the sprint
Current Status
- Sprint: 1 (Foundation)
- Last completed: Fresh start
- Current branch: main
- Next task: Initialize project and set up infrastructure