Python FastAPI CV Screening Cursor Rules Template
Cursor Rules Template for HR CV screening using Python FastAPI and PostgreSQL. Includes a copyable .cursorrules block and stack-specific guidance.
Target User
HR technical staff, AI workflow engineers, and development teams building CV screening pipelines
Use Cases
- Define and enforce consistent CV screening rules
- Align candidate scoring with job requirements
- Audit and reproduce screening decisions
- Integrate with HR data sources and job descriptions
Markdown Template
Python FastAPI CV Screening Cursor Rules Template
// Cursor Rules Template for HR CV screening (Python FastAPI + PostgreSQL)
Framework Role & Context:
- You are Cursor AI configured to build and enforce CV screening workflows for HR teams using Python FastAPI and PostgreSQL with SQLAlchemy ORM. Maps resumes to job requirements, provides scoring, and ensures auditable decisions.
Code Style and Style Guides:
- Python 3.11+, PEP8, Black, isort; type hints and strict linting; docstrings on public modules.
Architecture & Directory Rules:
- Project layout: app/, core/, models/, api/, services/, tests/; ORM via SQLAlchemy; migrations via Alembic; environment-driven configuration.
Authentication & Security Rules:
- Use JWT Bearer tokens; secrets in environment variables; never log PII; enforce role-based access for sensitive operations.
Database and ORM patterns:
- PostgreSQL; SQLAlchemy ORM models for Candidate, JobDescription, ScreeningResult; use parameterized queries; avoid dynamic SQL.
Testing & Linting Workflows:
- Pytest for unit/integration tests; Ruff for linting; Black formatting; CI gates for tests and linting.
Prohibited Actions and Anti-patterns:
- Do not call external AI services during screening without explicit prompts; Do not bypass auth; Do not hardcode secrets; Do not rely on brittle string matching for decisions.Overview
This Cursor Rules Template describes the end-to-end rules and guardrails for building CV screening workflows using job requirements. It targets a Python FastAPI + PostgreSQL stack and Cursor AI for deterministic candidate evaluation. It provides a copyable .cursorrules block you can paste into your project root to enforce consistent, auditable screening behavior.
When to Use These Cursor Rules
- Standardize resume evaluation against explicit job requirements and scoring rubrics.
- Enforce reproducible screening outcomes for audit and compliance in HR processes.
- Integrate with an API-driven job description repository and candidate data sources.
- Provide a safe, testable baseline before deploying AI-assisted ranking in production.
Copyable .cursorrules Configuration
// Cursor Rules Template for HR CV screening (Python FastAPI + PostgreSQL)
Framework Role & Context:
- You are Cursor AI configured to build and enforce CV screening workflows for HR teams using Python FastAPI and PostgreSQL with SQLAlchemy ORM. Maps resumes to job requirements, provides scoring, and ensures auditable decisions.
Code Style and Style Guides:
- Python 3.11+, PEP8, Black, isort; type hints and strict linting; docstrings on public modules.
Architecture & Directory Rules:
- Project layout: app/, core/, models/, api/, services/, tests/; ORM via SQLAlchemy; migrations via Alembic; environment-driven configuration.
Authentication & Security Rules:
- Use JWT Bearer tokens; secrets in environment variables; never log PII; enforce role-based access for sensitive operations.
Database and ORM patterns:
- PostgreSQL; SQLAlchemy ORM models for Candidate, JobDescription, ScreeningResult; use parameterized queries; avoid dynamic SQL.
Testing & Linting Workflows:
- Pytest for unit/integration tests; Ruff for linting; Black formatting; CI gates for tests and linting.
Prohibited Actions and Anti-patterns:
- Do not call external AI services during screening without explicit prompts; Do not bypass auth; Do not hardcode secrets; Do not rely on brittle string matching for decisions.
Recommended Project Structure
myhrcursor/
├── app/
│ ├── main.py
│ ├── api/
│ │ └── v1/
│ │ ├── endpoints/
│ │ │ └── screening.py
│ │ └── schemas/
│ │ └── screening_schema.py
│ ├── models/
│ │ ├── candidate.py
│ │ ├── job_description.py
│ │ └── screening.py
│ ├── services/
│ │ └── screening_engine.py
│ ├── core/
│ │ ├── config.py
│ │ └── security.py
│ └── tests/
│ ├── test_screening.py
│ └── conftest.py
├── alembic/
├── requirements.txt
├── .env.example
└── README.md
Core Engineering Principles
- Deterministic scoring with deterministic inputs and clearly defined job requirements.
- Privacy by design: no PII leakage, minimal data retention, and audit trails for decisions.
- Modular architecture with clear boundaries between API, domain logic, and data access.
- Testability: unit, integration, and end-to-end tests with CI gates.
- Observability: structured logs, metrics, and tracing for screening runs.
Code Construction Rules
- Endpoints must validate input via Pydantic models; avoid raw request body handling.
- All DB access uses ORM with parameterized queries; no string-interpolated SQL.
- Business rules live in services layer; API layer should be thin and idempotent.
- Job requirements are stored in a versioned description repository with immutable IDs.
- Use environment-based configuration for DB connections, secrets, and feature flags.
- Tests cover happy paths and key negative cases (missing fields, invalid data, unauthorized access).
Security and Production Rules
- Encrypt data at rest and in transit; store secrets in a vault or env-secured store.
- Implement role-based access control for HR staff and audit-only read permissions for sensitive results.
- Mask or tokenize PII in logs and exports; log only necessary metadata for auditability.
- Enable input validation to prevent injection; enforce strict schema for candidate data.
- Use immutable/mutable data boundaries; version job descriptions; track screening decisions for compliance.
Testing Checklist
- Unit tests for scoring functions with various resume-to-job mappings.
- Integration tests for API endpoints with mocked DB and auth.
- End-to-end tests that simulate CV submission, job matching, and audit logging.
- Linting and type checking in CI; run in pre-commit hooks locally.
Common Mistakes to Avoid
- Relying on brittle string matching for job requirement alignment; prefer structured features.
- Disabling authentication for speed; always enforce proper access control in production rules.
- Hardcoding thresholds; use configurable, versioned thresholds with audit trails.
- Inadequate test coverage for edge-case resume formats and abnormal inputs.
Related implementation resources: AI Use Case for Event Planners Using Eventbrite Data To Predict Ticket Sales Velocity and Adjust Pricing Tiers and Production-grade AI in regulated industries: practical templates and rules.
FAQ
What is a Cursor Rules Template for HR CV screening?
It is a copyable set of Cursor AI instructions that encode stack-specific rules to evaluate resumes against job requirements, ensuring consistent, auditable decisions across HR workflows.
Which tech stack does this template target?
This template targets a Python FastAPI + PostgreSQL stack using SQLAlchemy for ORM. It provides rules to map CV data to job requirements, score candidates, and support auditable screening results.
How do I customize the job requirements in the rules?
How is candidate scoring calculated and audited?
The scoring engine uses a deterministic scoring function with inputs from resume data and job requirements; results are stored in ScreeningResult with an audit trail for reproducibility.