Overview
This prompt aims to guide software developers in modifying a mail sending API with minimal disruption. Developers working on API enhancements will benefit from clear instructions on integrating new features.
Prompt Overview
“`python
class ForwardMailListModelIn:
# Existing fields…
cover_letter_content: Optional[str] = None # New optional field
def send_mail(forward_mail_data: ForwardMailListModelIn):
# Existing mail sending logic…
if forward_mail_data.cover_letter_content:
attach_cover_letter(forward_mail_data.cover_letter_content) # New attachment logic
“`
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Development Tools & DevOps, General Business Operations, Property Development
- Techniques: Decomposition
- Models: Claude 3.5 Sonnet, Gemini 2.0 Flash, GPT-4o, Llama 3.1 70B
- Estimated time: 5-10 minutes
- Skill level: Beginner
Variables to Fill
No inputs required — just copy and use the prompt.
Example Variables Block
No example values needed for this prompt.
The Prompt
You are a skilled software developer tasked with modifying an existing mail sending API function.
The goal is to minimally impact the current function implementation while adding support for an optional new field.
**Specifically:**
– Add a new optional string field named `cover_letter_content` inside the `ForwardMailListModelIn` input model.
– If this field is present in the input, the content should be included as an attachment to the mail being sent.
**Instructions:**
– Provide only the modified parts of the code necessary to implement this addition.
– Avoid rewriting or altering other parts of the function.
– Ensure the new logic integrates cleanly and respects the existing code style.
**Steps:**
1. Identify where `ForwardMailListModelIn` is defined and add the optional `cover_letter_content` field.
2. Modify the mail sending logic to check if `cover_letter_content` exists.
3. If present, attach it to the mail appropriately.
4. Return only the modified segments of code reflecting these changes.
**Output Format:**
Return a snippet containing just the code modifications needed to support the optional `cover_letter_content` field and its handling in the mail sending process.
Screenshot Examples
How to Use This Prompt
- Copy the prompt.
- Identify the `ForwardMailListModelIn` definition location.
- Add the `cover_letter_content` optional field to the model.
- Modify the mail sending logic to check for the new field.
- Attach `cover_letter_content` to the mail if present.
- Return only the modified code segments.
Tips for Best Results
- “`python
- class ForwardMailListModelIn:
- # Existing fields
- cover_letter_content: Optional[str] = None # Step 1: Add optional field
- def send_mail(input_model: ForwardMailListModelIn):
- # Existing mail sending logic
- if input_model
- cover_letter_content: # Step 2: Check for cover_letter_content
- attach_cover_letter(input_model
- cover_letter_content) # Step 3: Attach if present
- “`
FAQ
- What is the new field added to ForwardMailListModelIn?
The new optional field is `cover_letter_content`, a string. - How should cover_letter_content be handled in the mail function?
If `cover_letter_content` is present, it should be attached to the mail. - Where do I define the new field in the code?
Define `cover_letter_content` in the `ForwardMailListModelIn` input model. - What should I do if cover_letter_content exists?
Check for its presence and attach it to the mail before sending.
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 (February 2026): Initial release.


