Cursor Rules TemplatesCursor Rules Template

Cursor Rules Template: Node.js Quiz Generator from Corporate Slide Decks

Cursor Rules Template for building a quiz generator app from corporate training slide decks using Node.js + React + PostgreSQL. Includes a copyable .cursorrules block and stack-specific guidance.

.cursorrules templatecursor-rules-templatenodejsreactpostgresqlquiz-generationcorporate-trainingCursor AI rulesslide decksquiz-api

Target User

Developers building quiz generation apps from corporate slide decks

Use Cases

  • Ingest slide decks (PPTX), extract slide text
  • Summarize content and generate multiple-choice questions
  • Store quizzes in PostgreSQL with normalized schema
  • Expose REST API for frontend quiz UI

Markdown Template

Cursor Rules Template: Node.js Quiz Generator from Corporate Slide Decks

framework: Node.js (TypeScript) + React + PostgreSQL
role: 'You are Cursor AI configured to generate quizzes from corporate slide decks using a Node.js backend, React frontend, and PostgreSQL for persistence.'
context: 'Ingest PPTX slide decks, extract slide text, summarize sections, generate 5-10 questions per deck, and store questions with options, correctAnswerIndex, and metadata.'
style: TypeScript, ESLint, Prettier; strict mode; documented prompts.
architecture:
  backend/
  src/
  controllers/
  services/
  models/
  routes/
  db/
  tests/
  frontend/
  src/
  components/
  pages/
  hooks/
  services/
authentication: 'JWT-based authentication for protected API endpoints; verify tokens in middleware; refresh tokens recommended.'
database: 'PostgreSQL with tables: decks, slides, quizzes, questions, options, responses. Use parameterized queries via pg. Prefer migrations over ad-hoc changes.'
promptTemplates: 'Ingest slides -> extract content -> summarize -> generate questions (5-10) with A/B options. Return JSON structure: {quizId, title, questions:[{id,text,options:[{text,isCorrect}],difficulty,tags}]}.'
testing: 'Jest unit tests; Supertest for API endpoints; ESLint + Prettier; GitHub Actions CI.'antiPatterns: ['Do not hardcode secrets or API keys in code','Do not call OpenAI from frontend','Do not bypass auth','Do not assume slide content is clean','Do not produce unsafe content','Do not store raw PPTX in memory']

Overview

Cursor rules configuration for building quiz generation apps from corporate training slide decks on a Node.js + React + PostgreSQL stack. This template defines how Cursor AI should interact with the stack, including slide ingestion, prompt design, data modeling, and output formatting for quizzes used in internal training programs.

When to Use These Cursor Rules

  • When building an internal training quiz application that converts PPTX slide decks into interactive quizzes.
  • When you require a strict data model and predictable prompts for quiz generation.
  • When the backend is Node.js (TypeScript) with PostgreSQL and the frontend is React.
  • When you need to enforce authentication, data privacy, and auditable outputs.

Copyable .cursorrules Configuration

framework: Node.js (TypeScript) + React + PostgreSQL
role: 'You are Cursor AI configured to generate quizzes from corporate slide decks using a Node.js backend, React frontend, and PostgreSQL for persistence.'
context: 'Ingest PPTX slide decks, extract slide text, summarize sections, generate 5-10 questions per deck, and store questions with options, correctAnswerIndex, and metadata.'
style: TypeScript, ESLint, Prettier; strict mode; documented prompts.
architecture:
  backend/
  src/
  controllers/
  services/
  models/
  routes/
  db/
  tests/
  frontend/
  src/
  components/
  pages/
  hooks/
  services/
authentication: 'JWT-based authentication for protected API endpoints; verify tokens in middleware; refresh tokens recommended.'
database: 'PostgreSQL with tables: decks, slides, quizzes, questions, options, responses. Use parameterized queries via pg. Prefer migrations over ad-hoc changes.'
promptTemplates: 'Ingest slides -> extract content -> summarize -> generate questions (5-10) with A/B options. Return JSON structure: {quizId, title, questions:[{id,text,options:[{text,isCorrect}],difficulty,tags}]}.'
testing: 'Jest unit tests; Supertest for API endpoints; ESLint + Prettier; GitHub Actions CI.'antiPatterns: ['Do not hardcode secrets or API keys in code','Do not call OpenAI from frontend','Do not bypass auth','Do not assume slide content is clean','Do not produce unsafe content','Do not store raw PPTX in memory']

Recommended Project Structure

backend/src/
  controllers/
  services/
  models/
  routes/
  db/
  tests/
frontend/src/
  components/
  pages/
  hooks/
  services/
shared/types/

Core Engineering Principles

  • Principle of least privilege: protect data with strict access controls.
  • Data modeling first: design quizzes, questions, and options before code.
  • Idempotent, auditable prompts: prompts should be deterministic and testable.
  • Testable prompts: separate prompt design from execution.
  • Security by default: validate, sanitize, and monitor inputs and outputs.

Code Construction Rules

  • Use parameterized queries for all DB calls; never concatenate SQL strings.
  • Validate slide content length before prompting; truncate or summarize long inputs.
  • Prompt design must specify required fields: text, options, correctIndex, difficulty, tags.
  • Never send PII to OpenAI; mask or redact sensitive content.
  • Frontend should never call OpenAI APIs; all generation happens in the backend service.
  • Implement robust error handling and retry strategies for external calls.
  • Keep prompts in version-controlled templates with clear intent and safety guards.

Security and Production Rules

  • JWT-based authentication with short-lived access tokens and refresh tokens.
  • Environment variables for secrets; do not commit keys to repo.
  • HTTPS in production; disable verbose error messages in production logs.
  • Input validation and output filtering to prevent injection and unsafe content.
  • Audit logging for quiz generation events and data access.

Testing Checklist

  • Unit tests for parsing, prompting logic, and data validation.
  • Integration tests for API endpoints (create deck, generate quiz, fetch quiz).
  • End-to-end tests for the quiz generation flow with sample slide data.
  • Lint and type-check in CI; run tests on PRs.

Common Mistakes to Avoid

  • Over-promising AI capabilities; failing to validate prompts and outputs.
  • Embedding OpenAI API calls on the frontend.
  • Neglecting data privacy or logging sensitive information.
  • Ignoring edge cases in slide ingestion (non-text content, corrupted PPTX).

Related implementation resources: AI Use Case for Software Agencies Using Github Copilot To Accelerate Boilerplate Code Generation for New Client Mvps and Designing production-grade sub-domain routing to load unique tenant database slices.

FAQ

What is this Cursor Rules Template for?

This template provides concrete Cursor AI instructions to build a quiz generator from corporate slide decks using a Node.js + React + PostgreSQL stack, including prompts, data models, security rules, and testing guidance.

Which stack is this template designed for?

A full-stack Node.js (TypeScript) backend with a React frontend and PostgreSQL for persistence, designed to produce structured quizzes from slide content.

How does slide ingestion work in practice?

Slides are parsed to extract text and metadata; the system summarizes sections and prompts Cursor AI to generate multiple-choice questions. Output is stored in a normalized DB schema and served via a REST API to the frontend quiz UI.

How do I test and deploy this template?

Use Jest and Supertest for API tests, lint with ESLint/Prettier, and set up a CI pipeline that runs tests, builds, and deploys to staging first, then production.

What about security and data privacy?

Use JWTs for authentication, keep secrets in environment variables, avoid sending PII to OpenAI, and implement content filtering and audit logging.