Cursor Rules Template: Construction Delay Dashboard with Cursor AI
Cursor Rules Template for building construction delay prediction dashboards from project logs using Cursor AI. Copyable .cursorrules configuration for a Python FastAPI + PostgreSQL stack.
Target User
Developers building construction delay dashboards from project logs with Cursor AI
Use Cases
- Build dashboards to predict construction delays from project logs
- Integrate project logs into a prediction pipeline
- Enforce safe AI rules for data engineering and dashboard generation
Markdown Template
Cursor Rules Template: Construction Delay Dashboard with Cursor AI
// Cursor rules for construction delay dashboards (Python FastAPI + PostgreSQL)
// Framework Role & Context
framework: Python FastAPI + PostgreSQL
context: Build delay prediction dashboards from project logs with safe AI usage.
// Code Style and Style Guides
style:
formatter: black
linter: flake8
typeCheck: mypy
docstring: google
// Architecture & Directory Rules
architecture:
repoRoot: /
dirs:
- api/
- dashboards/
- core/
- data/
- logs/
- tests/
- config/
- .env
naming: snake_case
envs: .env.example
// Authentication & Security Rules
security:
auth: OAuth2 with JWT
transport: TLS (https) for all endpoints
secrets: vault or CI secrets; do not commit credentials
dataSecurity: mask PII in logs; use field-level redaction
// Database and ORM patterns
database:
engine: PostgreSQL
orm: SQLAlchemy
migrations: Alembic
patterns:
- repository pattern
- unitOfWork where appropriate
queries: parameterized; avoid string concatenation
// Testing & Linting Workflows
testing:
unitTests: pytest
integrationTests: pytest-django-style endpoints where applicable
dashboards: end-to-end checks with sample project logs
ci: GitHub Actions on PRs
coverage: enforce & fail if < 90%
// Prohibited Actions and Anti-patterns for the AI
antiPatterns:
- doNot: commit credentials or secrets
- doNot: perform network calls from Cursor AI inside production
- doNot: expose raw project logs in dashboards
- avoid: dynamic SQL without parameterization
- avoid: skipping tests or linting in CIOverview
This Cursor Rules Template targets building construction delay dashboard cohorts using Cursor AI. It covers a Python FastAPI + PostgreSQL stack with SQLAlchemy ORM, Pandas-based feature engineering, and Plotly-based dashboards. The release includes a copyable .cursorrules configuration to guide Cursor AI in safe, auditable data pipelines from project logs (e.g., schedules, weather, site reports). It emphasizes data governance, validation, and explainability for engineering dashboards.
Direct answer: This template provides concrete Cursor rules to assemble a delay-prediction dashboard pipeline using project logs, with explicit rules on architecture, data handling, and security to ensure reproducible, auditable results.
When to Use These Cursor Rules
- When you need a repeatable, auditable workflow to ingest project logs and produce delay predictions.
- When your stack uses Python FastAPI, PostgreSQL, and SQLAlchemy for data persistence and API endpoints.
- When dashboards rely on Plotly-based visualizations and Pandas-based data preparation.
- When you want strong governance: validation, tests, and anti-pattern safeguards baked into Cursor AI rules.
Copyable .cursorrules Configuration
// Cursor rules for construction delay dashboards (Python FastAPI + PostgreSQL)
// Framework Role & Context
framework: Python FastAPI + PostgreSQL
context: Build delay prediction dashboards from project logs with safe AI usage.
// Code Style and Style Guides
style:
formatter: black
linter: flake8
typeCheck: mypy
docstring: google
// Architecture & Directory Rules
architecture:
repoRoot: /
dirs:
- api/
- dashboards/
- core/
- data/
- logs/
- tests/
- config/
- .env
naming: snake_case
envs: .env.example
// Authentication & Security Rules
security:
auth: OAuth2 with JWT
transport: TLS (https) for all endpoints
secrets: vault or CI secrets; do not commit credentials
dataSecurity: mask PII in logs; use field-level redaction
// Database and ORM patterns
database:
engine: PostgreSQL
orm: SQLAlchemy
migrations: Alembic
patterns:
- repository pattern
- unitOfWork where appropriate
queries: parameterized; avoid string concatenation
// Testing & Linting Workflows
testing:
unitTests: pytest
integrationTests: pytest-django-style endpoints where applicable
dashboards: end-to-end checks with sample project logs
ci: GitHub Actions on PRs
coverage: enforce & fail if < 90%
// Prohibited Actions and Anti-patterns for the AI
antiPatterns:
- doNot: commit credentials or secrets
- doNot: perform network calls from Cursor AI inside production
- doNot: expose raw project logs in dashboards
- avoid: dynamic SQL without parameterization
- avoid: skipping tests or linting in CI
Recommended Project Structure
/
├── api/ # FastAPI endpoints (v1)
│ ├── main.py
│ └── v1/
│ ├── endpoints/
│ │ ├── delays.py
│ │ └── logs.py
│ └── dependencies.py
├── dashboards/ # Plotly/Dash-driven dashboards
│ ├── app.py
│ └── components/
├── core/ # Business logic and ML pipelines
│ ├── ml/
│ │ ├── train.py
│ │ └── predict.py
│ └── insights.py
├── data/ # Raw and processed project logs
├── logs/ # Structured logging and rotation configs
├── tests/ # pytest tests
├── config/ # Settings and environment configs
└── .env # Example environment file (not checked in)
Core Engineering Principles
- Data quality first: validate and sanitize all project logs before ingestion.
- Explicit contracts: API endpoints, data models, and dashboard outputs must have stable schemas.
- Auditability: keep lineage, versioned dashboards, and traceable model outcomes.
- Security by default: secret handling, access control, and encrypted storage.
- Testability: unit, integration, and end-to-end tests with CI coverage.
- Safe AI usage: enforce constraints that prevent leakage of secrets and unsafe actions.
Code Construction Rules
- Define data models with explicit types and constraints; use Pydantic for request/response models.
- Endpoints follow RESTful conventions and versioning (v1).
- Use repository pattern for data access; wrap DB calls in services with explicit error handling.
- Dashboards should fetch data through API endpoints, not direct DB access from the UI layer.
- Validation is enforced at every boundary; avoid silent data coercion.
- Document schemas and provide example queries for maintainability.
Security and Production Rules
- Enforce TLS, rotate credentials, and store secrets in a vault or CI secret store.
- Mask/avoid PII in logs and dashboards; implement field-level redaction.
- Protect endpoints with OAuth2/JWT; ensure proper scopes for dashboard access.
- Apply rate limiting and input validation to prevent abuse.
- Implement access controls on dashboards to restrict sensitive project data.
Testing Checklist
- Unit tests for data models, transformers, and utilities.
- Integration tests for API endpoints and DB interactions.
- End-to-end tests that simulate log ingestion and dashboard rendering.
- Linting with flake8/black and type checks with mypy.
- CI validation for PRs, including tests and security checks.
Common Mistakes to Avoid
- Ignoring data quality or logging sensitive information.
- Skipping tests or pushing unlinted code into production-like environments.
- Hardcoding secrets or using insecure authentication patterns.
- Assuming the UI can access the database directly; keep data access behind API boundaries.
Related implementation resources: AI Agent Use Case for Construction SMEs Using Project Logs to Predict Schedule Delays and Skill Files for Faster Market Testing: CLAUDE.md Templates for Founders.
FAQ
What is the Cursor Rules Template for construction delay dashboards?
This template provides a copyable .cursorrules configuration to guide Cursor AI when building dashboards that predict construction delays from project logs using a Python FastAPI + PostgreSQL stack. It enforces data governance, validation, and safe AI usage for engineering dashboards.
Which stack is assumed by this template?
The template assumes a Python FastAPI backend, PostgreSQL database via SQLAlchemy, Pandas for data processing, and Plotly-based dashboards. It includes guidelines on authentication, data models, and testing suitable for an engineering analytics pipeline.
How do I integrate project logs into the dashboards?
Project logs are ingested through a FastAPI endpoint, validated with Pydantic models, stored via SQLAlchemy in PostgreSQL, and surfaced through API calls that populate Plotly-based dashboards. Cursor rules enforce data sanitization, versioning, and access control throughout the flow.
How do I run the project locally with Cursor rules?
Install dependencies, set up a PostgreSQL instance, and run the FastAPI API plus dashboard app. Use the included .cursorrules to constrain Cursor AI actions, validate inputs, and ensure secure data handling. Run tests and linting before starting the services.
How can I extend or customize this template for other projects?
Adapt the project structure to match your data sources and dashboards, preserve the Cursor rules for safety and governance, and update the data models and endpoints accordingly. Maintain CI, tests, and documentation to ensure consistent, safe AI-assisted development.