Cursor Rules TemplatesCursor Rules Template

Diagnostic Lab Scheduling Cursor Rules Template for Cursor AI

Clipboard-ready Cursor Rules Template for building diagnostic lab scheduling dashboards from test_request data on a Python FastAPI + PostgreSQL stack with Cursor AI guidance.

.cursorrules templatecursor-rules-templatecursor rulesCursor AI rulesdiagnostic lablab schedulingtest_requestpython fastapipostgresqlsqlalchemydata privacydashboard

Target User

Backend and data engineering teams building lab scheduling dashboards with Cursor AI

Use Cases

  • Create dashboards from test_request data
  • Enforce data access and security in dashboards
  • Prototype lab scheduling dashboards with Cursor AI

Markdown Template

Diagnostic Lab Scheduling Cursor Rules Template for Cursor AI

frameworkRoleAndContext: 'You are a backend data platform engineer building diagnostic lab scheduling dashboards using test_request data on a Python FastAPI + PostgreSQL stack with Cursor AI guidance.'
codeStyleAndStyleGuides: 'PEP8, Black, isort, mypy; type hints; consistent naming; lint on commit'
architectureAndDirectoryRules: '|
  Project root layout:
  app/
  dashboards/
  data/
  tests/
  configs/'
authenticationAndSecurityRules: '|
  Use OAuth2 with JWT for internal dashboards; avoid hard-coded secrets
  Secrets via env vars or vault; never log secrets
  Do not log PII'
databaseAndORMPatterns: '|
  ORM: SQLAlchemy with PostgreSQL
  Use parameterized queries
  Models: TestRequest, LabResource, DashboardConfig
  Use async sessions if endpoints are async'
testingAndLintingWorkflows: '|
  pytest for tests
  pre-commit with black, isort, flake8
  CI runs pytest --maxfail=1'
prohibitedActionsAndAntiPatternsForAI: '|
  Do not embed secrets in code or prompts
  Do not construct SQL via string concatenation
  Do not bypass authentication or RBAC
  Do not access external services from data-processing blocks without validation'

Overview

Direct answer: Paste the block below into your project root to configure Cursor AI for a Python FastAPI + PostgreSQL diagnostic lab scheduling dashboard using test_request data. The template defines the role, architecture, security, and testing constraints for safe AI-assisted development.

This Cursor rules configuration targets a Python + PostgreSQL stack with Cursor AI guidance and is intended to produce a copyable .cursorrules configuration that you can paste into your project root.

When to Use These Cursor Rules

  • Starting a new diagnostic lab scheduling dashboard that ingests test_request data.
  • Enforcing data access patterns, privacy, and RBAC in dashboards.
  • Validating architecture and testing practices in CI/CD for the stack.

Copyable .cursorrules Configuration

frameworkRoleAndContext: 'You are a backend data platform engineer building diagnostic lab scheduling dashboards using test_request data on a Python FastAPI + PostgreSQL stack with Cursor AI guidance.'
codeStyleAndStyleGuides: 'PEP8, Black, isort, mypy; type hints; consistent naming; lint on commit'
architectureAndDirectoryRules: '|
  Project root layout:
  app/
  dashboards/
  data/
  tests/
  configs/'
authenticationAndSecurityRules: '|
  Use OAuth2 with JWT for internal dashboards; avoid hard-coded secrets
  Secrets via env vars or vault; never log secrets
  Do not log PII'
databaseAndORMPatterns: '|
  ORM: SQLAlchemy with PostgreSQL
  Use parameterized queries
  Models: TestRequest, LabResource, DashboardConfig
  Use async sessions if endpoints are async'
testingAndLintingWorkflows: '|
  pytest for tests
  pre-commit with black, isort, flake8
  CI runs pytest --maxfail=1'
prohibitedActionsAndAntiPatternsForAI: '|
  Do not embed secrets in code or prompts
  Do not construct SQL via string concatenation
  Do not bypass authentication or RBAC
  Do not access external services from data-processing blocks without validation'

Recommended Project Structure

.
├── app/
│   ├── main.py
│   ├── api/
│   │   └── endpoints.py
│   ├── models.py
│   ├── services.py
│   └── config.py
├── dashboards/
│   └── lab_scheduling_dashboard.py
├── data/
│   ├── raw/
│   └── processed/
├── tests/
│   └── test_dashboard.py
├── requirements.txt

Core Engineering Principles

  • Data privacy by design and least-privilege data access in dashboards.
  • Observability: structured logging, metrics, and tracing for dashboard queries.
  • Explicit data contracts and clear API/schema boundaries.
  • Repeatable, testable pipelines with CI validation.
  • Secure defaults: no hard-coded credentials, TLS, and RBAC enforcement.

Code Construction Rules

  • Model inputs/outputs with Pydantic; validate all test_request fields.
  • Use SQLAlchemy ORM with parameterized queries; avoid raw string SQL.
  • Externalize configuration; do not commit secrets.
  • Write unit tests for data transformation and integration tests for dashboards.
  • Keep Cursor AI rules in a separate, paste-ready block for reproducibility.

Security and Production Rules

  • Enforce RBAC for all dashboard endpoints; restrict data based on user roles.
  • Encrypt data in transit with TLS; use secure cookies; rotate credentials.
  • Mask PII; redact test data when rendering dashboards.
  • Audit access and changes to dashboards and data sources.

Testing Checklist

  • Unit tests for data models and validators.
  • Integration tests for API endpoints and database interactions.
  • End-to-end tests for common lab scheduling scenarios.
  • Linting, type-checking, and CI checks on PRs.

Common Mistakes to Avoid

  • Using real patient data in dashboards; always mask or synthetic data during development.
  • Omitting input validation leading to runtime errors or security holes.
  • Hard-coding secrets or credentials in code or scripts.

FAQ

What stack is this Cursor Rules Template designed for?

This template targets a Python FastAPI + PostgreSQL stack using SQLAlchemy ORM and Cursor AI guidance for building diagnostic lab scheduling dashboards from test_request data.

How do I paste the .cursorrules block into my project?

Copy the code block under Copyable .cursorrules Configuration and paste it into the project root as your .cursorrules file. The rules define framework role, security, architecture, and testing constraints for Cursor AI.

What security considerations are included?

RBAC enforcement, TLS, secret management via environment vars or vault, and redaction of PII in dashboards. The rules also prohibit logging secrets or bypassing authentication.

How to validate this template in CI?

Run unit tests and integration tests, linting, and run Cursor AI to verify that generated artifacts follow the rules. Ensure the dashboard queries are parameterized and that no secrets are committed.

What constitutes a successful lab scheduling dashboard?

A successful dashboard accurately displays test_request throughput, appointment allocations, resource availability, SLA adherence, and alerting for conflicts while maintaining data privacy and compliance with Cursor AI rules.

Related implementation resources: AI Use Case for Software Agencies Using Github Copilot To Accelerate Boilerplate Code Generation for New Client Mvps and Using Skill Files to Stop SQL Injection in Generated Backend Code.