Cursor Rules TemplatesCursor Rules Template

Cursor Rules Template for FastAPI + PostgreSQL AI Interview Platform

Cursor Rules Template for building an AI interview preparation platform with mock interviews, scoring, feedback, and progress tracking on a Python FastAPI + PostgreSQL stack.

.cursorrules templatecursor-rules-templatecursor-rules-templatesfastapi cursor rulespython cursor rulesai interview platformmock interviewsscoringfeedbackprogress trackingCursor AI rules

Target User

Developers building an AI-driven interview preparation platform using Python FastAPI + PostgreSQL with mock interviews, scoring, feedback, and progress tracking.

Use Cases

  • AI interview practice with mock interviews
  • scoring and feedback generation
  • user progress tracking and analytics
  • integration with Cursor AI for rule enforcement
  • CI/CD validation of architecture and security

Markdown Template

Cursor Rules Template for FastAPI + PostgreSQL AI Interview Platform

Framework Role & Context
Framework: Python FastAPI
Context: You are Cursor AI assistant configured to build an AI interview prep platform with mock interviews, scoring, feedback, and progress tracking using FastAPI and PostgreSQL.

Code Style and Style Guides
CodeStyle: PEP8; Black; isort

Architecture & Directory Rules
Architecture: app/api/v1; app/core; app/db; app/models; app/services; tests; migrations

Authentication & Security Rules
Auth: OAuth2 with JWT tokens; password hashing with bcrypt; HTTPS in production; rotate secrets; use environment vars for secrets

Database and ORM patterns
DB: PostgreSQL; ORM: SQLAlchemy; migrations via Alembic; models for User, Interview, Score, Feedback

Testing & Linting Workflows
Testing: pytest; pytest-asyncio; httpx; lint: Ruff; Black; isort; run pre-commit; CI tests

Prohibited Actions and Anti-patterns for the AI
Prohibited: eval, os.system, dynamic code execution; avoid raw SQL; never bypass migrations; never store plaintext secrets in code.

Overview

Cursor rules configuration for a Python FastAPI + PostgreSQL based AI interview preparation platform. It covers mock interviews, scoring, feedback, and progress tracking, orchestrated by Cursor AI in your project root.

Direct answer: Use this Cursor Rules Template to guide the AI's behavior, enforce project-wide conventions, and produce deterministic outcomes for interview simulation, scoring, and feedback generation within this FastAPI-backed stack.

When to Use These Cursor Rules

  • When building an AI-backed interview platform that runs mock interviews with scoring and feedback.
  • When you require consistent architecture across API layers and a clear data model for users, interviews, scores, and feedback.
  • When you want Cursor AI to enforce security, testing, and deployment constraints in CI/CD.

Copyable .cursorrules Configuration

Framework Role & Context
Framework: Python FastAPI
Context: You are Cursor AI assistant configured to build an AI interview prep platform with mock interviews, scoring, feedback, and progress tracking using FastAPI and PostgreSQL.

Code Style and Style Guides
CodeStyle: PEP8; Black; isort

Architecture & Directory Rules
Architecture: app/api/v1; app/core; app/db; app/models; app/services; tests; migrations

Authentication & Security Rules
Auth: OAuth2 with JWT tokens; password hashing with bcrypt; HTTPS in production; rotate secrets; use environment vars for secrets

Database and ORM patterns
DB: PostgreSQL; ORM: SQLAlchemy; migrations via Alembic; models for User, Interview, Score, Feedback

Testing & Linting Workflows
Testing: pytest; pytest-asyncio; httpx; lint: Ruff; Black; isort; run pre-commit; CI tests

Prohibited Actions and Anti-patterns for the AI
Prohibited: eval, os.system, dynamic code execution; avoid raw SQL; never bypass migrations; never store plaintext secrets in code.

Recommended Project Structure

project/
├─ app/
│  ├─ api/
│  │  └─ v1/
│  │     ├─ endpoints/
│  │     │  ├─ interviews.py
│  │     │  └─ scores.py
│  │     └─ schemas/
│  ├─ core/
│  │  ├─ config.py
│  │  └─ security.py
│  ├─ db/
│  │  ├─ base.py
│  │  ├─ models.py
│  │  └─ session.py
│  └─ services/
│     └─ interviews_engine/
├─ tests/
└─ migrations/

Core Engineering Principles

  • Maintainable modular architecture with clear boundaries between API, business logic, and data access.
  • Type-safe data models with Pydantic; strong validation on input/output.
  • Secure by default: proper auth, secrets management, and no sensitive data in code.
  • Observability with structured logging, tracing, and metrics.
  • Deterministic CI/CD with automated tests and linting.

Code Construction Rules

Implement endpoints and services with dependency injection; favor pure functions for business logic; validate all inputs; avoid side effects in pure functions; document public interfaces with type hints.

Security and Production Rules

  • Use JWT-based authentication; store hashed passwords; enforce HTTPS; implement rate limiting; rotate tokens; restrict CORS in production.
  • Secret management via environment variables; never commit secrets; use secret store in deployment.

Testing Checklist

  • Unit tests for models and validators; integration tests for endpoints using httpx; end-to-end tests for mock interview flow; regression tests for scoring and feedback.
  • Run tests in CI; ensure tests pass on every merge; include coverage threshold.

Common Mistakes to Avoid

  • Overcomplicating ORM mappings; not seeding test data; ignoring migrations; bypassing security checks; poor input validation.

Related Cursor rules templates

Explore adjacent Cursor rules templates for similar stacks, workflows, and production constraints.

FAQ

What stack is this template designed for?

Python FastAPI with PostgreSQL using SQLAlchemy and Alembic. It includes a mock interview engine, scoring, feedback, and progress tracking integrated with Cursor AI rules.

Where do I paste the .cursorrules block?

Copy the large code block above into a file named .cursorrules at your project root. Cursor AI will read and enforce the rules during development and in CI checks.

How does scoring and feedback get evaluated?

The scoring engine uses deterministic rubrics tied to interview prompts and candidate responses. Feedback generation is rule-driven, pulling from model responses and stored rubric weights to produce actionable guidance.

How do I test this stack?

Use pytest for unit tests, pytest-asyncio for async endpoints, and httpx for integration tests. Run lint with Ruff and Black; integrate tests in CI to ensure coverage for mock interviews, scoring, and progress tracking.

Can Cursor AI enforce security in production?

Yes. The rules enforce JWT-based authentication, token expiry, environment-based secret management, and secure API patterns. Production should disable debug tools and enable secure headers, CORS restrictions, and rate limiting.