Cursor Rules Template for Beauty & Wellness Customer Feedback Analysis
Cursor Rules Template for building beauty and wellness customer feedback analysis tools with Cursor AI, targeting a Python FastAPI + PostgreSQL stack.
Target User
Backend developers and AI engineers building customer feedback analytics for beauty & wellness brands
Use Cases
- Sentiment analysis on product reviews
- Topic modeling and trend extraction from consumer feedback
- NLP-driven scoring and ranking of products
- Voice of customer data ingestion and normalization
Markdown Template
Cursor Rules Template for Beauty & Wellness Customer Feedback Analysis
// Cursor Rules Template: Beauty & Wellness Feedback (Cursor Rules Template)
// Cursor Rules Template for Python FastAPI + PostgreSQL (Beauty & Wellness)
Framework: Python
Runtime: Python 3.11+
Stack: FastAPI, PostgreSQL, SQLAlchemy
Domain: Beauty & Wellness Customer Feedback Analysis
Framework Role & Context
You are Cursor AI acting as backend engineering assistant for building a beauty & wellness customer feedback analysis tool. Provide code scaffolds, model definitions, and API designs. Outputs must be valid Python modules and SQL statements.
Code Style and Style Guides
Follow PEP 8, type hints, docstrings, and Black formatting. Use descriptive names and modular code.
Architecture & Directory Rules
Use a clean, modular structure: src/app, src/core, src/models, src/api, src/services, src/repositories, src/schemas. Minimize global state and ensure explicit dependency wiring.
Authentication & Security Rules
Implement OAuth2 with JWT tokens, bcrypt password hashing, secure cookies for sessions, and CSRF protection on forms. Enforce TLS in production and rotate secrets.
Database and ORM patterns
SQLAlchemy ORM with explicit sessions and transactions. Define clear models for Product, Review, User, Sentiment, Topic, and Metrics. Use Alembic for migrations and avoid eager-only patterns that hinder analytics.
Testing & Linting Workflows
Pytest for unit/integration tests, mypy for type checks, and pre-commit hooks. Include tests for data pipelines, API endpoints, and model validations.
Prohibited Actions and Anti-patterns for the AI
Do not perform real network calls or access secrets in prompts. Do not bypass authentication, modify migrations without review, or generate unsafe SQL. Do not assume non-existent models or endpoints. Do not output code that relies on unavailable libraries not in this template.Overview
The Cursor Rules Configuration is a copyable, stack-specific profile that guides Cursor AI through the development of a Beauty & Wellness customer feedback analysis tool. This template targets a Python FastAPI backend with PostgreSQL as the data store and SQLAlchemy as the ORM. It defines role, context, architecture, and safety constraints to produce reliable, auditable AI-assisted development outcomes for Cursor AI users.
Direct answer: Use this Cursor Rules Template to generate backend components, data models, and API designs for sentiment, topic, and feature extraction on beauty and wellness reviews, using Cursor AI to accelerate implementation while enforcing security and quality constraints.
When to Use These Cursor Rules
- If you are building a sentiment analysis workflow for product reviews from cosmetics, skincare, and wellness brands.
- When you need a clear data model for feedback (products, reviews, users, sentiments, topics) and robust API contracts.
- During data pipeline development for ingestion, cleaning, normalization, and storage in PostgreSQL.
- When you require a safe AI-assisted approach with strict access control, auditing, and testable code generation.
- For regenerating code scaffolds, API endpoints, and ORM patterns with Cursor AI guidance.
Copyable .cursorrules Configuration
// Cursor Rules Template: Beauty & Wellness Feedback (Cursor Rules Template)
// Cursor Rules Template for Python FastAPI + PostgreSQL (Beauty & Wellness)
Framework: Python
Runtime: Python 3.11+
Stack: FastAPI, PostgreSQL, SQLAlchemy
Domain: Beauty & Wellness Customer Feedback Analysis
Framework Role & Context
You are Cursor AI acting as backend engineering assistant for building a beauty & wellness customer feedback analysis tool. Provide code scaffolds, model definitions, and API designs. Outputs must be valid Python modules and SQL statements.
Code Style and Style Guides
Follow PEP 8, type hints, docstrings, and Black formatting. Use descriptive names and modular code.
Architecture & Directory Rules
Use a clean, modular structure: src/app, src/core, src/models, src/api, src/services, src/repositories, src/schemas. Minimize global state and ensure explicit dependency wiring.
Authentication & Security Rules
Implement OAuth2 with JWT tokens, bcrypt password hashing, secure cookies for sessions, and CSRF protection on forms. Enforce TLS in production and rotate secrets.
Database and ORM patterns
SQLAlchemy ORM with explicit sessions and transactions. Define clear models for Product, Review, User, Sentiment, Topic, and Metrics. Use Alembic for migrations and avoid eager-only patterns that hinder analytics.
Testing & Linting Workflows
Pytest for unit/integration tests, mypy for type checks, and pre-commit hooks. Include tests for data pipelines, API endpoints, and model validations.
Prohibited Actions and Anti-patterns for the AI
Do not perform real network calls or access secrets in prompts. Do not bypass authentication, modify migrations without review, or generate unsafe SQL. Do not assume non-existent models or endpoints. Do not output code that relies on unavailable libraries not in this template.
Recommended Project Structure
project-root/
├── src/
│ ├── app/
│ │ ├── api/
│ │ │ └── v1/
│ │ │ ├── endpoints.py
│ │ │ └── deps.py
│ │ ├── core/
│ │ │ ├── config.py
│ │ │ └── security.py
│ │ ├── models/
│ │ │ ├── product.py
│ │ │ ├── review.py
│ │ │ └── user.py
│ │ ├── repositories/
│ │ │ └── review_repo.py
│ │ ├── schemas/
│ │ │ ├── review_schema.py
│ │ │ └── user_schema.py
│ │ └── main.py
│ ├── tests/
│ │ ├── test_api.py
│ │ └── test_models.py
│ ├── requirements.txt
│ └── alembic/
│ ├── env.py
│ └── versions/
└── .gitignore
Core Engineering Principles
- Clarity over cleverness: keep prompts and code structure readable and well-documented.
- Data privacy and security by default: encrypt sensitive fields, limit data exposure, and audit access.
- Reliable foundations: strict typing, validation, and deterministic outputs for reproducibility.
- Observability: structured logging, metrics, and traces for all critical paths.
- Change-safe: idempotent migrations, versioned APIs, and reversible changes.
- Modular design: single-responsibility components with explicit interfaces.
Code Construction Rules
- Use Pydantic models for input validation and FastAPI schemas.
- Organize code by feature with clear separation of concerns (api, core, models, repositories, services, schemas).
- Follow dependency injection (DI) patterns in FastAPI to decouple components.
- Prefer parameterized queries and ORM relationships to avoid SQL injection.
- Keep business logic in services layers; keep API handlers thin.
- Document data models with type hints and docstrings for maintainability.
- Lint strictly (PEP8) and format with Black; run tests in CI.
- Do not hard-code secrets; read from environment/config securely.
Security and Production Rules
- Use OAuth2 with JWT tokens for API authentication; store tokens securely.
- Hash passwords with bcrypt; enforce strong password policies.
- Enable TLS in production; configure secure cookies and CSRF protection for web apps.
- Validate and sanitize all inputs; avoid dynamic SQL; use parameterized queries.
- Implement rate limiting and IP-based throttling where appropriate.
- Audit data access and maintain an immutable audit log for sensitive operations.
Testing Checklist
- Unit tests for models, validators, and utilities.
- Integration tests for API endpoints and database interactions.
- Data pipeline tests for ingestion, normalization, and sentiment scoring.
- End-to-end tests simulating real-world feedback flows.
- CI checks: lints, type checks, test coverage, and migrations validation.
Common Mistakes to Avoid
- Skipping migrations or relying on ad hoc schema changes in production.
- Overusing global state in the API layer, causing race conditions.
- Neglecting input validation or trusting external data sources blindly.
- Introducing unsafe SQL or bypassing parameterization for speed.
- Underestimating data privacy and auditability in analytics pipelines.
Related implementation resources: AI Agent Use Case for Restaurants Using Customer Reviews to Identify Menu Improvement Opportunities and AI-driven neighborhood safety analysis for planners.
FAQ
What is the purpose of this Cursor Rules Template?
This template provides a copyable .cursorrules block and structured guidance to build a beauty & wellness customer feedback analytics tool using Cursor AI, focusing on a Python FastAPI + PostgreSQL stack.
Which stack does this template target?
The template targets Python 3.11+, FastAPI for APIs, PostgreSQL as the data store, and SQLAlchemy ORM, with Cursor AI assisting backend development and data processing.
How do I use the copyable .cursorrules block?
Copy the block from the Content section and paste into a .cursorrules file at your project root. It defines roles, architecture, and safety constraints tailored to the Beauty & Wellness domain.
How do I customize for my brand?
Modify the data models, endpoints, and sentiment categories to reflect your products and review sources. Keep the AI safety constraints, and adjust authentication scales and data retention policies.
Where can I find related templates?
See the Cursor Rules Templates collection for other stacks and adapt patterns to your architecture, ensuring alignment with Cursor AI rules.