name: fullstack-tests
skill: fullstack
version: 1.0.0
cases:
  - id: shared-schema-not-duplicated
    description: Should recommend shared Zod schemas over duplicate type definitions
    prompt: I have a User type on my backend and a duplicate User interface on my frontend. They keep drifting. How should I fix this?
    expected:
      contains_any:
        - shared
        - Zod
        - single source
        - schema
        - infer
      min_length: 80
    tags: [core, types]

  - id: server-client-boundary
    description: Should flag importing DB client into client component
    prompt: "Can I import my Prisma db client in a React component to fetch data directly?"
    expected:
      contains_any:
        - server
        - server component
        - never
        - boundary
        - bundle
      not_contains:
        - "yes, you can"
        - that's fine
      min_length: 60
    tags: [core, boundaries]

  - id: api-validation-required
    description: Should require server-side validation even when frontend validates
    prompt: My frontend validates the form with Zod before submitting. Do I still need to validate on the server?
    expected:
      contains_any:
        - always
        - server-side
        - never trust
        - security
        - bypass
      min_length: 60
    tags: [core, security]

  - id: loading-error-states
    description: Should require loading and error states before a feature is complete
    prompt: I built the fetch and the happy path display. Is the feature done?
    expected:
      contains_any:
        - loading
        - error state
        - empty state
        - skeleton
        - incomplete
      min_length: 60
    tags: [core, ux]

  - id: e2e-for-critical-paths
    description: Should recommend E2E tests for full user journeys
    prompt: What kind of tests should I write for a user signup and checkout flow?
    expected:
      contains_any:
        - E2E
        - end-to-end
        - Playwright
        - Cypress
        - user journey
      min_length: 60
    tags: [core, testing]

  - id: coding-easy-shared-schema
    description: "Coding challenge (easy): Write a shared Zod validation schema used by both client and server"
    prompt: "Write a Zod schema for a CreatePost form that validates title (1-200 chars), body (1-10000 chars), tags (array of 1-5 strings), and publishAt (optional future ISO date). Export both the schema and the inferred TypeScript type. Show how the same schema is used in a Next.js API route handler and a React form component."
    expected:
      contains_any:
        - z.object
        - z.string
        - z.array
        - z.infer
        - safeParse
      contains:
        - export
      not_contains:
        - "I can't write"
      min_length: 100
    tags:
      - coding-easy

  - id: coding-medium-optimistic-update
    description: "Coding challenge (medium): Implement an optimistic update pattern"
    prompt: "Write a React custom hook called useOptimisticMutation that performs an optimistic update when mutating data. It should: immediately update the local UI state, send the request to the server, roll back to the previous state if the server returns an error, support a retry mechanism, and prevent race conditions when multiple mutations are in flight. Use TypeScript."
    expected:
      contains_any:
        - rollback
        - previous
        - optimistic
        - error
        - state
        - Promise
      contains:
        - function
      min_length: 200
    tags:
      - coding-medium

  - id: coding-hard-realtime-sync
    description: "Coding challenge (hard): Build a real-time data synchronization system"
    prompt: "Write a full-stack real-time sync system using WebSocket and a Next.js API route. The server should broadcast changes to all connected clients. The client hook should: maintain a local cache of items, apply optimistic updates, reconcile with server state on reconnection, handle conflict resolution (last-write-wins with vector clocks), and queue offline mutations for replay when connection is restored."
    expected:
      contains_any:
        - WebSocket
        - broadcast
        - reconnect
        - conflict
        - queue
        - offline
        - sync
      contains:
        - function
      min_length: 300
    tags:
      - coding-hard
