Cursor Rules TemplatesCursor Rules Template

Vet Consultation Cursor Rules Template for Veterinary Care Instructions

Cursor Rules Template for building veterinary care instruction generators from consultation notes using Cursor AI on a Python FastAPI + PostgreSQL stack.

.cursorrules templatevet-consultationveterinary carecursor rulescursor-aipython fastapipostgresqlsqlalchemyhipaa-liketesting

Target User

Developers building AI-powered veterinary care instruction generators

Use Cases

  • Transform veterinary consultation notes into standardized care instructions
  • Generate treatment plans with dosing, meds, and follow-up steps
  • Enforce data privacy and safe AI-assisted development

Markdown Template

Vet Consultation Cursor Rules Template for Veterinary Care Instructions

Overview


Cursor rules configuration for veterinary care instruction generators. This template targets a Python FastAPI + PostgreSQL stack using Cursor AI to convert anonymized consultation notes into structured, clinician-ready care plans. It emphasizes data privacy, validation, and safe AI prompts. Direct answer: This Cursor rules template provides a proven, paste-ready configuration to transform notes into actionable veterinary instructions while enforcing security and output quality.


When to Use These Cursor Rules



  - When converting free-text veterinary consultation notes into standardized care instructions.

  - When you need consistent dosing, treatment, and follow-up sections in generated docs.

  - When enforcing HIPAA-like safeguards and redaction for patient identifiers in notes.

  - When integrating with a Python FastAPI backend and PostgreSQL database via SQLAlchemy.


Copyable .cursorrules Configuration


// Cursor Rules Template for Veterinary Care Instruction Generator
Framework Role & Context:
  - Role: Cursor AI assistant that transforms veterinary consultation notes into actionable care instructions for clinicians
  - Context: Stack: Python 3.11, FastAPI, PostgreSQL, SQLAlchemy, Alembic, Pydantic, OAuth2/JWT, Pytest, flake8/ruff, Black, isort. Data sources: anonymized consultation notes. Output: structured veterinary care instructions with sections for diagnosis, treatment, meds, dosing, follow-up
Code Style and Style Guides:
  - Use PEP8, Black formatting, isort
  - Type hints mandatory; strict validation with Pydantic
  - No trailing whitespace; consistent naming
Architecture & Directory Rules:
  - Monorepo layout: app/, tests/, migrations/, config/
  - Database models in app/models/, services in app/services/
  - Endpoints under app/api/routes/
Authentication & Security Rules:
  - OAuth2 with JWT tokens; access tokens expire in 15 minutes; refresh tokens rotate
  - Secrets in environment variables; using AWS Secrets Manager
  - Input validation and output sanitization; do not log PII
Database and ORM patterns:
  - PostgreSQL; SQLAlchemy ORM; Alembic migrations
  - Use declarative models; session management with context manager
  - Separate read/write databases if needed
Testing & Linting Workflows:
  - pytest with coverage; pre-commit with black, ruff, isort
  - CI runs on PRs; run unit and integration tests locally
Prohibited Actions and Anti-patterns for the AI:
  - Do not train or extract patient data; do not output raw notes into patient-facing docs without redaction
  - Do not use unsafe eval, web-scraped data, or server-side file writes without validation
  - Do not bypass authorization checks, or leak secrets
Recommended Project Structure


vet-care-ai/
├── app/
│   ├── api/
│   │   └── routes/
│   ├── core/
│   ├── models/
│   ├── services/
│   ├── schemas/
│   └── main.py
├── alembic/
├── tests/
├── requirements.txt
├── pyproject.toml
Core Engineering Principles



  - Type-safe data flow with pydantic and SQLAlchemy models

  - Explicit boundary between data sources, domain logic, and API layers

  - Idempotent, auditable prompts and deterministic outputs where possible

  - Secure by default: least privilege access, secrets management, encrypted channels

  - Clear separation of concerns for app services and database access


Code Construction Rules



  - Endpoints must validate inputs with Pydantic models; errors return structured responses

  - ORM models follow a single source of truth for field names and constraints

  - All prompts are pre-validated and sanitized before sending to Cursor AI

  - Code paths must be covered by unit tests; migrations handled with Alembic

  - Do not embed raw consultation notes in generated outputs without redaction


Security and Production Rules



  - Use TLS for all endpoints; rotate secrets; store in environment or secret manager

  - Audit logs must mask PII; never log raw patient identifiers

  - Implement role-based access control for clinicians and staff

  - Validate and sanitize all inputs; enforce output schema for generated care instructions


Testing Checklist



  - Unit tests for data transformers and validators

  - Integration tests for API endpoints and DB interactions

  - Migration tests to verify Alembic upgrade/downgrade behavior

  - Static analysis with ruff; formatting with Black and isort

  - Security tests for input sanitization and access control


Common Mistakes to Avoid



  - Assuming notes are already sanitized and skip redaction steps

  - Overusing unsafe dynamic evaluation in prompts or handlers

  - Ignoring API input validation; leaking PII in outputs

  - Coupling business logic to framework specifics leading to hard migrations



Related implementation resources: AI Agent Use Case for Veterinary Clinics Using Consultation Notes to Generate Care Instructions for Pet Owners and Using Skill Files to Stop SQL Injection in Generated Backend Code.




FAQ


What is the purpose of this Cursor Rules Template?


This template provides a ready-to-paste Cursor rules configuration to reliably transform veterinary consultation notes into structured care instructions while enforcing data privacy, validation, and safe AI prompts on a Python FastAPI + PostgreSQL stack.


Which stack does this template target?


The template targets Python 3.11, FastAPI, PostgreSQL with SQLAlchemy, Alembic for migrations, Pydantic for data validation, and Cursor AI for rule-based instruction generation.


What outputs will Cursor AI produce from consultation notes?


Outputs include diagnosis summaries, treatment plans, medication dosing and schedules, follow-up steps, and warnings or redactions to protect patient identifiers in notes.


How is security addressed in the rules?


Security is enforced via OAuth2/JWT, token rotation, encryption in transit and at rest, environment-based secrets, input validation, and PII redaction in all outputs.


How do I extend or customize this template for other veterinary domains?


Extend by updating domain models in app/models, refining prompts in the Cursor rules block, and adjusting the output schema to include veterinary-specific sections such as diagnostics and vaccines, while keeping HIPAA-like safeguards.


What tests should I add to verify correctness?


Add unit tests for data transformation and validation, integration tests for API endpoints and DB interactions, and end-to-end tests that verify the full pipeline from note ingestion to instruction generation with redaction checks.

Overview

Cursor rules configuration for veterinary care instruction generators. This template targets a Python FastAPI + PostgreSQL stack using Cursor AI to convert anonymized consultation notes into structured, clinician-ready care plans. It emphasizes data privacy, validation, and safe AI prompts. Direct answer: This Cursor rules template provides a proven, paste-ready configuration to transform notes into actionable veterinary instructions while enforcing security and output quality.

When to Use These Cursor Rules

  • When converting free-text veterinary consultation notes into standardized care instructions.
  • When you need consistent dosing, treatment, and follow-up sections in generated docs.
  • When enforcing HIPAA-like safeguards and redaction for patient identifiers in notes.
  • When integrating with a Python FastAPI backend and PostgreSQL database via SQLAlchemy.

Copyable .cursorrules Configuration

// Cursor Rules Template for Veterinary Care Instruction Generator
Framework Role & Context:
  - Role: Cursor AI assistant that transforms veterinary consultation notes into actionable care instructions for clinicians
  - Context: Stack: Python 3.11, FastAPI, PostgreSQL, SQLAlchemy, Alembic, Pydantic, OAuth2/JWT, Pytest, flake8/ruff, Black, isort. Data sources: anonymized consultation notes. Output: structured veterinary care instructions with sections for diagnosis, treatment, meds, dosing, follow-up
Code Style and Style Guides:
  - Use PEP8, Black formatting, isort
  - Type hints mandatory; strict validation with Pydantic
  - No trailing whitespace; consistent naming
Architecture & Directory Rules:
  - Monorepo layout: app/, tests/, migrations/, config/
  - Database models in app/models/, services in app/services/
  - Endpoints under app/api/routes/
Authentication & Security Rules:
  - OAuth2 with JWT tokens; access tokens expire in 15 minutes; refresh tokens rotate
  - Secrets in environment variables; using AWS Secrets Manager
  - Input validation and output sanitization; do not log PII
Database and ORM patterns:
  - PostgreSQL; SQLAlchemy ORM; Alembic migrations
  - Use declarative models; session management with context manager
  - Separate read/write databases if needed
Testing & Linting Workflows:
  - pytest with coverage; pre-commit with black, ruff, isort
  - CI runs on PRs; run unit and integration tests locally
Prohibited Actions and Anti-patterns for the AI:
  - Do not train or extract patient data; do not output raw notes into patient-facing docs without redaction
  - Do not use unsafe eval, web-scraped data, or server-side file writes without validation
  - Do not bypass authorization checks, or leak secrets

Recommended Project Structure

vet-care-ai/
├── app/
│   ├── api/
│   │   └── routes/
│   ├── core/
│   ├── models/
│   ├── services/
│   ├── schemas/
│   └── main.py
├── alembic/
├── tests/
├── requirements.txt
├── pyproject.toml

Core Engineering Principles

  • Type-safe data flow with pydantic and SQLAlchemy models
  • Explicit boundary between data sources, domain logic, and API layers
  • Idempotent, auditable prompts and deterministic outputs where possible
  • Secure by default: least privilege access, secrets management, encrypted channels
  • Clear separation of concerns for app services and database access

Code Construction Rules

  • Endpoints must validate inputs with Pydantic models; errors return structured responses
  • ORM models follow a single source of truth for field names and constraints
  • All prompts are pre-validated and sanitized before sending to Cursor AI
  • Code paths must be covered by unit tests; migrations handled with Alembic
  • Do not embed raw consultation notes in generated outputs without redaction

Security and Production Rules

  • Use TLS for all endpoints; rotate secrets; store in environment or secret manager
  • Audit logs must mask PII; never log raw patient identifiers
  • Implement role-based access control for clinicians and staff
  • Validate and sanitize all inputs; enforce output schema for generated care instructions

Testing Checklist

  • Unit tests for data transformers and validators
  • Integration tests for API endpoints and DB interactions
  • Migration tests to verify Alembic upgrade/downgrade behavior
  • Static analysis with ruff; formatting with Black and isort
  • Security tests for input sanitization and access control

Common Mistakes to Avoid

  • Assuming notes are already sanitized and skip redaction steps
  • Overusing unsafe dynamic evaluation in prompts or handlers
  • Ignoring API input validation; leaking PII in outputs
  • Coupling business logic to framework specifics leading to hard migrations

Related implementation resources: AI Agent Use Case for Veterinary Clinics Using Consultation Notes to Generate Care Instructions for Pet Owners and Using Skill Files to Stop SQL Injection in Generated Backend Code.

FAQ

What is the purpose of this Cursor Rules Template?

This template provides a ready-to-paste Cursor rules configuration to reliably transform veterinary consultation notes into structured care instructions while enforcing data privacy, validation, and safe AI prompts on a Python FastAPI + PostgreSQL stack.

Which stack does this template target?

The template targets Python 3.11, FastAPI, PostgreSQL with SQLAlchemy, Alembic for migrations, Pydantic for data validation, and Cursor AI for rule-based instruction generation.

What outputs will Cursor AI produce from consultation notes?

Outputs include diagnosis summaries, treatment plans, medication dosing and schedules, follow-up steps, and warnings or redactions to protect patient identifiers in notes.

How is security addressed in the rules?

Security is enforced via OAuth2/JWT, token rotation, encryption in transit and at rest, environment-based secrets, input validation, and PII redaction in all outputs.

How do I extend or customize this template for other veterinary domains?

Extend by updating domain models in app/models, refining prompts in the Cursor rules block, and adjusting the output schema to include veterinary-specific sections such as diagnostics and vaccines, while keeping HIPAA-like safeguards.

What tests should I add to verify correctness?

Add unit tests for data transformation and validation, integration tests for API endpoints and DB interactions, and end-to-end tests that verify the full pipeline from note ingestion to instruction generation with redaction checks.