Overview
This prompt guides analysis and extension of a backend codebase with specific modules. Developers working on this system will benefit from structured explanations and code.
Prompt Overview
Purpose: To manage backend logic for consultations, reminders, messaging, and database operations.
Audience: Developers extending or maintaining a structured TypeScript backend system.
Distinctive Feature: Uses modular services with centralized utilities and Prisma for data access.
Outcome: A scalable system for handling scheduled reminders and multi-channel messaging.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Development Tools & DevOps, Productivity & Workflow, General Business Operations
- Techniques: Role/Persona Prompting, Structured Output, Decomposition
- Models: GPT-4, Claude 3 Opus, DeepSeek-Coder V2
- Estimated time: 5-10 minutes
- Skill level: Beginner
Variables to Fill
- [consultationId] – Consultationid
- [reminderTimestamp] – Remindertimestamp
Example Variables Block
- [consultationId]: cons_12345abcde
- [reminderTimestamp]: 1735689600000
The Prompt
You are provided with a detailed project directory structure for a backend system involving consultations, reminders, messaging, common utilities, and Prisma integration. Your task is to analyze, explain, or extend the functionality within this codebase based on the provided directory and files.
**Details:**
– The `consultations` module handles consultation-related logic with DTOs for creating and updating consultations.
– The `reminders` module is responsible for scheduling, rescheduling, and canceling reminders, using SchedulerRegistry and setTimeout, with utility functions for job name and delay calculations.
– The `messaging` module manages dispatching messages across SMS, WhatsApp, and Email, with localized templates supporting dynamic placeholders.
– The `common` folder contains centralized logging and retry utilities.
– The `prisma` folder holds the Prisma schema and service for database access.
When asked for explanations, code implementations, or extensions, reason step-by-step about dependencies and functionality before producing output.
**Steps:**
1. Understand the functionality implied by the directory and file names.
2. For coding tasks, identify the relevant module and files to modify or create.
3. Consider related utilities or services that support the requested feature.
4. If required, ensure internationalization/localization for messaging templates.
5. Follow best practices for modularity and maintainability.
**Output Format:**
– Provide explanations in clear paragraphs.
– Provide code snippets with appropriate TypeScript syntax.
– Use comments in code snippets to clarify functionality.
– Structure answers logically with headings or bullet points if multiple parts.
**Examples:**
**Example 1:**
Q: “Explain how reminders.scheduler.ts might use SchedulerRegistry and setTimeout() to schedule jobs.”
A: “The reminders.scheduler.ts likely manages reminder jobs by registering them with SchedulerRegistry, which keeps track of active scheduled jobs. It uses setTimeout() to delay execution of reminder tasks. When a reminder is scheduled, a timeout is set with setTimeout(), and the job is added to the SchedulerRegistry with a designated job name. If rescheduling or cancellation occurs, the scheduler can find and clear the timeout via SchedulerRegistry. This approach allows dynamic management of scheduled reminders.”
**Example 2:**
Q: “Implement a function in reminder.utils.ts that generates unique job names based on consultation IDs and reminder times.”
A:
“`typescript
export function generateJobName(consultationId: string, reminderTimestamp: number): string {
return `reminder-$[consultationId]-$[reminderTimestamp]`;
}
“`
**Notes:**
– Always verify code integrates properly with existing modules.
– Maintain consistent naming conventions and file organization.
– Preserve localization support in messaging templates when adding features.
– Ensure logging and retry mechanisms are used appropriately in service logic.
Screenshot Examples
[Insert relevant screenshots after testing]
How to Use This Prompt
- consultationId: Unique identifier for a consultation session.
- reminderTimestamp: Scheduled time for a reminder trigger.
- jobName: Unique identifier for a scheduled reminder job.
- messageTemplate: Localized content blueprint for notifications.
- dynamicPlaceholders: Variables for personalizing message content.
- channelType: Communication medium (SMS, WhatsApp, Email).
- retryAttempts: Number of retries for failed operations.
- prismaClient: Database query and transaction interface.
Tips for Best Results
- Centralize Job Management: Use SchedulerRegistry to store and retrieve timeout references, enabling precise control for dynamic rescheduling or cancellation of reminders.
- Leverage Retry Utilities: Wrap external API calls in messaging and reminder services with the common retry utility to gracefully handle transient failures and improve reliability.
- Utilize Dynamic Templates: When extending messaging, use the existing template system with locale-specific files and placeholder replacement for consistent, multilingual user communication.
- Enforce DTO Validation: Apply class-validator decorators to all consultation DTOs to ensure data integrity before any business logic or database operation is performed.
FAQ
- How does the reminders module schedule and manage reminder jobs?
It uses SchedulerRegistry to track active jobs and setTimeout() for delayed execution. Each job gets a unique name, and the module can reschedule or cancel reminders by finding and clearing timeouts. - What is the purpose of the messaging module’s localized templates?
They support dynamic placeholders and multiple languages, allowing personalized messages across SMS, WhatsApp, and Email channels with proper localization. - How does the common folder support other modules?
It provides centralized logging and retry utilities, ensuring consistent error handling and reliability across consultations, reminders, and messaging services. - What role does Prisma play in this backend system?
Prisma handles database access with a schema defining data models and a service layer for CRUD operations, integrating with all modules needing data persistence.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (March 2026): Initial release.


