by TidyFactor
Production-Grade Multi-Tenant SaaS Architecture & Development Performance Engine
# Add to your Claude Code skills
git clone https://github.com/TidyFactor/NextNext is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by TidyFactor. Production-Grade Multi-Tenant SaaS Architecture & Development Performance Engine. It has 3 GitHub stars.
Next's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/TidyFactor/Next" and add it to your Claude Code skills directory (see the Installation section above). Next ships a SKILL.md manifest, so compatible agents can discover and load it automatically.
Next is primarily written in Python. It is open-source under TidyFactor on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh Next against similar tools.
No comments yet. Be the first to share your thoughts!
Unlocks once the catalog security scan passes (runs nightly).
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM is an informational directory and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
A command dispatcher for production multi-tenant SaaS on Next.js 16 and Supabase. This router declares commands and workflows without performing execution directly.
| User intent | Command | What it loads |
|---|---|---|
| Strategic SaaS Discovery & Baseline Architecture | references/commands/brief.md |
workflows/brief.md + memory/decision-points.md + memory/quality-bar.md |
| Scaffold a new multi-tenant project | references/commands/init.md |
workflows/init.md + memory/spec.md |
| Tenant resolution, context, lifecycle | references/commands/tenant.md |
workflows/tenant.md + memory/spec.md |
| RLS policy authoring, coverage audit, leak diagnosis | references/commands/rls.md |
workflows/rls.md + memory/rls-patterns.md |
| Auth, RBAC/ABAC | references/commands/auth.md |
workflows/auth.md + memory/auth-patterns.md |
| Schema, migrations, transactions, constraints | references/commands/data.md |
workflows/data.md + memory/decision-points.md |
| Buckets, signed URLs, tenant-scoped storage paths | references/commands/storage.md |
workflows/storage.md + memory/cache-storage-rules.md |
| Route handlers, server actions, API contracts | references/commands/api.md |
workflows/api.md + memory/client-server-boundaries.md + memory/react-perf-rules.md |
| App Router / React 19 patterns, RSC boundaries | references/commands/app.md |
workflows/app.md + memory/client-server-boundaries.md + memory/react-perf-rules.md |
| Unit/integration/RLS/E2E/security tests | references/commands/test.md |
workflows/test.md + memory/quality-bar.md |
| Logging, tracing, audit logs, health checks | references/commands/observe.md |
workflows/observe.md + memory/quality-bar.md |
| CI/CD, environments, secrets, rollback, backups | references/commands/deploy.md |
workflows/deploy.md + memory/spec.md |
| Dev & Runtime performance: waterfalls, bundles, RAM, HMR | references/commands/perf.md |
workflows/audit-dev-perf.md + memory/perf-optimization-rules.md + memory/react-perf-rules.md |
| Failure modes, retries, DR, recovery runbooks | references/commands/incident.md |
workflows/incident.md + memory/spec.md |
| Structural/architecture audit of the whole project | references/commands/audit.md |
workflows/audit.md + memory/quality-bar.md |
Read only the command file that matches the request. Do not load all commands simultaneously.
/brief or .tidyfactor/next-brief.md before emitting code.tenant_id uuid NOT NULL REFERENCES tenants(id) ON DELETE CASCADE.ENABLE ROW LEVEL SECURITY and FORCE ROW LEVEL SECURITY.SUPABASE_SERVICE_ROLE_KEY to client components or public API responses./* Pre-emit critique: P5 H5 E5 S5 R5 V5 D5 */.v1.4.0Give Google Antigravity, Claude Code, Cursor, OpenAI Codex, or Windsurf a locked, security-first architecture for Next.js 16 + React 19 + Supabase — so your agent stops improvising tenant isolation and starts enforcing it.
🚀 Quick Start • 🎯 Why TidyFactor/Next • 🔒 Tenant Isolation • ⚡ 15-Stage Lifecycle • 🚀 Perf Engine • ❓ FAQ • 📖 بالعربية
Most Next.js agent skills teach your AI how to write idiomatic code — App Router conventions, caching APIs, and bundle-size tweaks. That is necessary, but it does not stop an agent from shipping a query that accidentally leaks Tenant A's data into Tenant B's dashboard.
TidyFactor/Next sits one layer deeper: it is an architecture and hard security contract, not just a style guide.
| Dimension | Generic Next.js Skills | tidyfactor-next |
|---|---|---|
| What it teaches | Idiomatic App Router, React 19 RSC boundaries, caching | Multi-tenant architecture + non-negotiable Postgres RLS boundary |
| Scope | Breadth: Many small, composable coding snippets | Depth: One vertical (multi-tenant SaaS), owned end-to-end |
| Failure mode prevented | Slow client components, suboptimal bundles | Cross-tenant data leaks, forgotten WHERE tenant_id = ... clauses |
| Performance scope | Basic production advice | Dual engine: 8 runtime optimization tiers + 6 dev-environment bottleneck models |
| Governance score | Unverified | 100% Architect Score (passes all TidyFactor Skill Architect rules) |
| Use together? | ✅ | ✅ — Install both; they complement each other perfectly |
[!TIP] If you are building a SaaS where a cross-tenant data leak means a lawsuit,
tidyfactor-nextis the foundational guardrail layer your AI agent needs in addition to general React best practices.
# Interactive project wizard — scaffolds a new multi-tenant SaaS project
npx @alwkala/tidyfactor-next
# Or inject the skill directly into an existing Next.js repository
npx @alwkala/tidyfactor-next add-skill
| AI Agent | Workspace Skill Path |
|---|---|
| Google Antigravity | .agents/skills/tidyfactor-next/ or global ~/.gemini/config/skills/ |
| Claude Code | .claude-skill/skills/tidyfactor-next/ |
| Cursor / Codex / Windsurf | .agents/skills/tidyfactor-next/ |
Once installed, invoke /init or /brief inside your AI agent to discover project baselines and scaffold your ARCHITECTURE.md single source of truth!
graph TD
UserReq["🌐 Incoming Request"] --> Edge["🛡️ Edge Middleware<br/>(Fail-Closed Tenant Resolution)"]
Edge --> Context["📦 Tenant Context<br/>(tenant_id + JWT Claims)"]
Context --> App["⚡ Next.js 16 App Router<br/>(Server Components & Actions)"]
App --> Query["🔌 Pluggable Query Layer<br/>(Supabase JS / Drizzle / Prisma)"]
Query --> Postgres["🐘 PostgreSQL Database"]
Postgres --> RLS["🔒 Row Level Security (RLS)<br/>USING (tenant_id = auth.jwt() ->> 'tenant_id')"]
RLS --> Data["✅ Isolated Tenant Data"]
| For Fullstack Engineers | For SaaS Founders & CTOs | For AI Coding Agents |
|---|---|---|
Locked Tenant Isolation: Shared schema with tenant_id + Postgres RLS. No schema-per-tenant migration hell or multi-DB connection pooling chaos. |
Zero Data-Leak Guarantee: Hard security boundary at the database layer; application bugs cannot expose Tenant A's records to Tenant B. | Context-Efficient Dispatcher: Lightweight SKILL.md router loads only ~350 tokens at start, pulling memory only on demand. |
Pluggable Query Layer: Choose Supabase JS, Drizzle ORM, or Prisma once during init. All downstream code adheres strictly to your choice. |
Custom JWT Access Token Hook: Injects verified tenant_id and role server-side at token issuance—never trusted from client input. |
Deterministic Workflows: Every command runs against a strict, quantifiable validation checklist before shipping. |
| Fail-Closed Resolution: Edge middleware resolves tenant via subdomain, custom domain, or session claim, failing closed (404/403) on error. | Zero Lock-in Architecture: Pure Next.js App Router and PostgreSQL standards with zero black-box vendor runtime dependencies. | 100% Governance Compliance: Fully compliant (8/8) with the official TidyFactor Skill Architect governance specification. |
| Evidence-Based Perf Engine: Diagnoses RAM, CPU, and Disk bottlenecks before touching code; benchmark-backed DELTA verification. | Predictable Infrastructure Cost: Identifies bloated client bundles and server secret leaks before deployment. | SaaS Safety Boundary: Automatically prohibits performance optimizations that weaken RLS or tenant isolation. |
tidyfactor-next enforces strict, non-negotiable isolation rules across the entire lifecycle:
-- Standard Tenant Isolation Policy (Pattern 1)
ALTER TABLE public.organizations ENABLE ROW LEVEL SECURITY;
CREATE POLICY "organizations_tenant_isolation_select" ON public.organizations
FOR SELECT USING (tenant_id = (auth.jwt() ->> 'tenant_id')::uuid);
CREATE POLICY "organizations_tenant_isolation_insert" ON public.organizations
FOR INSERT WITH CHECK (tenant_id = (auth.jwt() ->> 'tenant_id')::uuid);
CREATE POLICY "organizations_tenant_isolation_update" ON public.organizations
FOR UPDATE USING (tenant_id = (auth.jwt() ->> 'tenant_id')::uuid)
WITH CHECK (tenant_id = (auth.jwt() ->> 'tenant_id')::uuid);
CREATE POLICY "organizations_tenant_isolation_delete" ON public.organizations
FOR DELETE USING (tenant_id = (auth.jwt() ->> 'tenant_id')::uuid);
WHERE tenant_id = ... is only a query-plan hint. If RLS is disabled, the system is defective by definition.service_role Key Isolation: Never exposed to client bundles or public endpoints. Used exclusively in server-only contexts with re-verified tenant context.The entire SaaS engineering lifecycle is structured into 15 deterministic commands with 100% operational coverage:
| Stage | Command | User Intent | What It Loads | Status |
|---|---|---|---|---|
| 0. Discovery | brief |
Pre-flight CDL discovery & baseline architecture cache | references/workflows/brief.md + decision-points.md + quality-bar.md |
✅ Built |
| 1. Foundation | init |
Scaffold new multi-tenant project & generate ARCHITECTURE.md |
references/workflows/init.md + spec.md + architecture-doc-skeleton.md |
✅ Built |
| 1. Foundation | tenant |
Tenant resolution, context propagation, lifecycle | references/workflows/tenant.md + references/memory/spec.md |
✅ Built |
| 2. Security | rls |
RLS policy authoring, 4-policy pattern, leak audit | references/workflows/rls.md + spec.md + rls-patterns.md |
✅ Built |
| 2. Security | auth |
Supabase Auth, custom JWT claim |