Cursor Rules Template: Customer Success Platform with Health Scores, Renewals, NPS and AI Churn
Copyable Cursor rules template for building a Customer Success Platform with health scores, renewal tracking, NPS surveys, and AI churn prediction on a Node.js + TypeScript + PostgreSQL stack.
Target User
Developers building a customer success platform with Cursor AI
Use Cases
- Define customer health scoring — rules for weighting metrics (product usage, support interactions, renewal likelihood)
- Track renewal milestones and expirations in real-time
- Orchestrate NPS survey deployment and data ingestion for churn analysis
- Apply AI churn predictions to trigger proactive actions
- Enforce data access and security policies in AI-generated responses
Markdown Template
Cursor Rules Template: Customer Success Platform with Health Scores, Renewals, NPS and AI Churn
// Cursor Rules: Customer Success Platform (Cursor AI)
# Cursor Rules Template for Node.js + TypeScript + PostgreSQL stack
Framework Role & Context:
Role: Backend Engineering Advisor for a CS platform.
Context: Implement health scores, renewals, NPS, and AI churn within a scalable Node.js + TS + PostgreSQL system.
Code Style and Style Guides:
- ESLint + Prettier; TypeScript in strict mode; JSDoc for public APIs;
- Prefer functional patterns and clear typings; CI checks enforce linting.
Architecture & Directory Rules:
- src/
- src/api/controllers/
- src/api/routes/
- src/domain/models/
- src/domain/services/
- src/repositories/
- src/infrastructure/
- migrations/
- tests/
Authentication & Security Rules:
- JWT access/refresh tokens; OAuth for external APIs where applicable.
- Do not log PII; sanitize outputs; use parameterized queries.
- HALT on failed auth; enforce least privilege on data access.
Database and ORM patterns:
- PostgreSQL with TypeORM; Entities: Customer, HealthScore, Renewal, NPS, ChurnPrediction
- Use migrations for schema changes; define one source of truth for queries.
Testing & Linting Workflows:
- Jest with ts-jest; Supertest for API tests; ESLint + Prettier in CI.
- Add unit tests for health score calculations and churn predicates; integration tests for API routes.
Prohibited Actions and Anti-patterns:
- Do not use raw string queries without parameters; avoid dynamic SQL generation.
- Do not bypass input validation or authorization checks.
- Do not hard-code secrets in code or config files.Overview
Cursor rules configuration for Cursor AI provides a deterministic policy for AI behavior within a specific stack. This Cursor rules template targets building a Customer Success Platform with health scores, renewal tracking, NPS surveys, and AI churn prediction on a Node.js + TypeScript + PostgreSQL stack using Cursor rules template approach.
Direct answer: paste the .cursorrules block into your project root to govern AI actions, data access, and automation for CS workflows.
When to Use These Cursor Rules
- When designing an AI-assisted CS platform that must surface health signals and renewal risk.
- When you want consistent AI-driven actions across customer cohorts and lifecycle stages.
- When you need to enforce security policies for customer data and sensitive metrics.
- When integrating NPS surveys and churn models with real-time health scoring.
Copyable .cursorrules Configuration
// Cursor Rules: Customer Success Platform (Cursor AI)
# Cursor Rules Template for Node.js + TypeScript + PostgreSQL stack
Framework Role & Context:
Role: Backend Engineering Advisor for a CS platform.
Context: Implement health scores, renewals, NPS, and AI churn within a scalable Node.js + TS + PostgreSQL system.
Code Style and Style Guides:
- ESLint + Prettier; TypeScript in strict mode; JSDoc for public APIs;
- Prefer functional patterns and clear typings; CI checks enforce linting.
Architecture & Directory Rules:
- src/
- src/api/controllers/
- src/api/routes/
- src/domain/models/
- src/domain/services/
- src/repositories/
- src/infrastructure/
- migrations/
- tests/
Authentication & Security Rules:
- JWT access/refresh tokens; OAuth for external APIs where applicable.
- Do not log PII; sanitize outputs; use parameterized queries.
- HALT on failed auth; enforce least privilege on data access.
Database and ORM patterns:
- PostgreSQL with TypeORM; Entities: Customer, HealthScore, Renewal, NPS, ChurnPrediction
- Use migrations for schema changes; define one source of truth for queries.
Testing & Linting Workflows:
- Jest with ts-jest; Supertest for API tests; ESLint + Prettier in CI.
- Add unit tests for health score calculations and churn predicates; integration tests for API routes.
Prohibited Actions and Anti-patterns:
- Do not use raw string queries without parameters; avoid dynamic SQL generation.
- Do not bypass input validation or authorization checks.
- Do not hard-code secrets in code or config files.
Recommended Project Structure
cs-platform/
src/
api/
controllers/
routes/
domain/
models/
services/
infrastructure/
db/
migrations/
tests/
scripts/
config/
Core Engineering Principles
- Explicit data contracts and typed interfaces across services.
- Secure by default: least privilege, encryption at rest, token-based auth.
- Idempotent AI-driven actions with auditable traces.
- Separation of concerns: domain logic, persistence, and API layers.
Code Construction Rules
- Health score computation must be deterministic and testable with fixed seeds in tests.
- Renewal tracking should be modeled with a Renewal entity and a historical audit log.
- NPS survey data must map to customer segments and be stored with timestamps.
- AI churn predictions must be computed server-side and only surfaced as signals, not raw model data.
- Cursor AI prompts should reference only approved data sources and avoid leaking secrets.
Security and Production Rules
- Enable TLS everywhere; rotate keys; store secrets in a dedicated vault.
- Enforce API rate limits and request validation; monitor for anomalous patterns.
- Logging must mask PII and store logs in a non-revealing format.
- Use read-replica for analytics; keep transactional data isolated.
Testing Checklist
- Unit tests cover health score calculations and renewal logic.
- Integration tests verify API endpoints for health, renewals, and NPS data ingestion.
- End-to-end tests simulate a typical CS workflow from data ingestion to alerting.
- Security tests ensure auth, input validation, and data access rules pass.
Common Mistakes to Avoid
- Untyped AI outputs leaking into live user-facing decisions without validation.
- Mixing business logic with API layer; avoid barycentering domain logic in controllers.
- Ignoring migrations and relying on ad-hoc schema changes in production.
Related Cursor rules templates
Explore adjacent Cursor rules templates for similar stacks, workflows, and production constraints.
- Cursor Rules Template: Sales Pipeline SaaS with Lead Scoring, Email Tracking, and AI Dashboards
- Cursor Rules Template: Sustainability Supplier Assessment Platform with Questionnaires, Scoring, and Compliance Dashboards
- Cursor Rules Template: Express ATS with Cursor AI
- Cursor Rules Template: Podcast Management Stack
FAQ
What is a Cursor Rules Template?
A Cursor Rules Template provides a copyable .cursorrules configuration that defines how Cursor AI should act within a specific stack. This template targets a Customer Success Platform with health scores, renewal tracking, NPS surveys, and AI churn prediction on a Node.js + TS + PostgreSQL stack.
Which stack does this template cover?
The template is tailored for a Node.js + TypeScript backend connected to PostgreSQL, with NPS data ingestion and AI churn signals surfaced through Cursor AI. It includes architecture, security, testing, and data modeling guidance aligned to this stack.
How do I integrate this with my existing project?
Copy the .cursorrules block into your project root and adjust entity names to match your schema. Ensure your health, renewal, and NPS data sources align with the defined models and that you wire AI churn signals to your alerting system.
What should I validate before deploying?
Validate data ingestion pipelines for health and NPS data, confirm auth and data access rules, run unit and integration tests, and simulate churn scenarios to verify AI signals do not trigger unsafe actions.
Can I customize the scoring logic?
Yes. The template provides deterministic scoring but you can adapt weights and thresholds per customer segment. Ensure custom changes are covered by unit tests and migrations to avoid drift.
Is this compatible with Cursor AI’s security policies?
Yes. The template enforces least privilege, data masking, and server-side computation for AI signals, aligning with Cursor AI’s safety practices for production deployments.