agentleFS
nonlinear-xyznonlinear-xyz/factory-kit/skills/factory-stack/SKILL.md

factory-stack

Skill9 starsChanged 4 months agoMITView on GitHub

Cross-build locked stack decisions and decision criteria for divergent choices. Read at the start of any new project. Covers runtime, language, ORM, auth provider, component library, deployment, and observability — what's a hard pick, what depends on context, and the criteria for context-driven picks.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Pitfall: don't import both. Pick a side per project.

    line 42

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Factory stack

Locked decisions (no per-project relitigation)

LayerChoiceWhy
RuntimeNext.js App RouterConvergent across all customer repos; ecosystem fit for tRPC / server actions / Vercel deploy
LanguageTypeScriptConvergent; non-negotiable
ValidationZodPairs with both tRPC and server actions; field registry pattern depends on it
Server stateTanStack QueryConvergent across all repos that need server state
DBPostgres via Neon (dev branches) or RDS (compliance)Convergent
Formsreact-hook-form + Zod via resolverConvergent
EmailResendConvergent
LintingESLint + Prettier + ESLint Drizzle rules where applicableConvergent
Env varst3-oss/env-nextjs (Zod-validated, server/client split)Convergent

Decision-criteria choices (pick per project; document in project's CLAUDE.md or DECISIONS.md)

ORM — Drizzle vs Supabase auto-types vs raw pg

  • Drizzle — default. Schema partitioning by domain (_shared.ts, <domain>.ts) + shared timestamps helper. pgTableCreator() for prefixing if the DB is shared.
  • Supabase auto-generated types — when Supabase Auth + RLS is already doing real work. RLS policies are the contract; auto-types are a free byproduct.
  • Raw pg — never for new projects. Migrate if encountered.

Auth — Better Auth + orgs vs Supabase Auth + RLS vs Clerk

  • Better Auth + organization plugin — default. Org + RBAC + 2FA out of the box; pairs with Drizzle.
  • Supabase Auth + RLS — when RLS pays for itself (multi-role partner/distributor model, deeply branched authz at row level).
  • Clerk — consumer/SSO-heavy, or when managed auth UI components matter.

The wrapper interface is the same regardless: requireAuth(), requireRole(), withOrgContext(). See factory-auth.md (Phase B) for the canonical wrapper shape.

API style — server actions vs tRPC

  • Server actions — default for feature-folder-colocated apps with one frontend consumer. Pairs with TanStack Query (useMutation wrapping the action).
  • tRPC — when typed RPC contracts add leverage: ≥3 entities with cross-feature queries, multiple consumers, or a public API surface.
  • Pitfall: don't import both. Pick a side per project.

Component library — Mantine vs shadcn

  • Mantine — CRUD-heavy / form-table dense / internal-tool surfaces. Built-in date pickers, multiselects, notifications save weeks. Pair with mantine-form-zod-resolver.
  • shadcn — design flexibility / marketing-adjacent / unified Tailwind styling with a landing site. Pair with react-hook-form + zodResolver.
  • Same project, one choice. Mixing leads to design drift.

Deploy

  • Web (Next.js): Vercel. PR previews via Neon dev branches in GitHub Actions.
  • Python services: Cloud Run. CLI / Cloud Run API / Pub/Sub handler — see factory-data-pipelines.md.
  • Infra-as-code: Terraform with environments/modules layout when AWS/RDS or HIPAA/FDA compliance is in play; skip when Vercel + Neon is sufficient.

Observability

  • PostHog + Sentry from day one. Non-negotiable. Easiest to start early, most expensive to backfill.
  • Tag events by tool/feature so per-tool usage is queryable later.
  • See factory-observability.md (Phase B) for activity logging and trace ID patterns.

How to use this skill

  1. At project kickoff, read this file end-to-end.
  2. For decision-criteria choices, make the pick explicitly in the project's CLAUDE.md or a one-page DECISIONS.md (one line per decision).
  3. Refer back when the project considers changing course — the criteria are the basis for that conversation.

Pitfalls referenced elsewhere

See factory-pitfalls.md for the anti-patterns digest indexed across all factory-*.md skills.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.