PromptBase
Upgrade
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
(claude-5-sonnet)
Token size
2,033
Example input
[DELETE THIS TEXT AND PASTE YOUR CODING TASK — language/framework, what you're building or fixing, any constraints. At least 10 words.]: I need a Python function that validates email addresses using regex, should return True/False and handle edge cases, will be used in a Django form validator
Example output
--- MODE: Standalone LANGUAGE: English CODING TASK TYPE: FEATURE-BUILD YOUR READY-TO-USE PROMPT: Write a Python function that validates whether a string is a properly formatted email address, intended for use inside a Django form validator (e.g., called from a `clean_<field>` method or a custom `django.core.exceptions.ValidationError`-raising validator). Requirements: - Function signature: `def is_valid_email(email: str) -> bool:` - Use the `re` module (regex-based validation) rather than an external library like `email-validator` or Django's built-in `EmailValidator`, since the user specifically wants a standalone regex-based function. - Return `True` if the email is valid, `False` otherwise. - Handle common edge cases, including but not limited to: - Missing "@" symbol - Missing or malformed domain (e.g., no top-level domain) - Leading/trailing whitespace - Empty string or `None` input - Multiple "@" symbols - Special characters in the local part (e.g., `+`, `.`, `_`, `-`) - Consecutive dots in the domain or local part - Overly long strings (consider RFC 5321's 254-character limit) - Include inline comments explaining the regex pattern. - Include 3–5 example test cases in a `if __name__ == "__main__":` block showing both valid and invalid inputs and their expected output. - Note: assumed Python 3.8+ syntax since the Python version wasn't specified. - Note: assumed Django version compatibility isn't version-specific since this function is standalone and doesn't rely on Django internals — flag if the user needs it wired into a specific Django version's form/model validator pattern. - Flag any additional assumption made due to missing input as a separate technical note (e.g., "Note: assumed {detail} since it wasn't provided"). ℹ️ "This tool generates a prompt template for coding assistance — it is not a substitute for code review, security testing, or QA before production use; final decisions remain the user's responsibility. AI is a probabilistic system, so wording and scores may vary slightly between runs, and generated code may contain errors. We recommend testing thoroughly before deploying." Assumptions made: - CONTEXT: Assumed Python 3.8+ and a generic/unspecified Django version, since neither was stated. - DESIRED OUTPUT: Assumed a standard function name/signature (`is_valid_email`) since none was specified. - SUCCESS CRITERIA: Assumed a representative (not exhaustive) list of edge cases since "edge cases" wasn't enumerated. ❓ Clarifying questions (mandatory whenever any assumption was made; omit only if none): 1. What Python version and Django version are you targeting? 2. Do you have a preferred function/parameter name, or should it match an existing validator interface? 3. Are there specific edge cases (e.g., internationalized domains, plus-addressing) you need handled beyond the general list above? 💡 Want to take this further? Search "Client Request Auditor Optimizer" or "Auditor Optimizer" on PromptBase to audit and refine your coding queries or prompts to a professional, production-ready standard. 📊 Clarity Score: - GOAL — ✅: Clearly stated — build a regex-based email validator returning True/False. - CONTEXT — ⚠️: Python/Django versions not specified. - DESIRED OUTPUT — ⚠️: Function signature/name not specified. - CONSTRAINTS — ✅: Regex requirement and Django-validator use case both clear. - SUCCESS CRITERIA — ⚠️: "Edge cases" mentioned but not enumerated. Total deductions = 10 + 10 + 10 + 5 + 5 = 40 Final Clarity Score = 100 − 40 = 60% ⚙️ "This tool was built and validated on Claude Sonnet 5 only. Behavior on other models, versions, AI providers, or programming languages is untested — results may differ; use at your own discretion." Reply 'yes' to finalize as-is, answer the questions above to raise the score on the next pass, or 'revise' with your requested changes.
Claude

Coding Instruction Generator

Add to Cart
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
CLAUDE-5-SONNET
Tested icon
Guide icon
4 examples icon
Free credits icon
📊 Turn a coding task into a ready-to-use AI prompt — task classification, stack-aware brief, 🔒malicious-code screening, assumption-flagging, Clarity Score. ⚠️ Not liable for outcomes, not legal or professional advice. No confidential data; only content you own rights to. AI is probabilistic — review before use. Built for Claude Sonnet 5; compatibility with other AI models, providers, versions, and non-English input is untested. Use at your own discretion.
...more
Updated 3 weeks ago
Report
  • Reviews for this prompt (1)
Browse Marketplace