File size: 19,652 Bytes
af66d50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import os
import json

prompts_data = [
    # --- Coding ---
    {
        "id": "coding-1", "category": "coding", "title": "Code Refactoring & Optimization",
        "instruction": "Act as a Senior Software Engineer. Refactor the following code for better readability, performance, and adherence to DRY principles. Explain the time and space complexity optimizations.\n\n```python\n[CODE_SNIPPET]\n```",
        "template": "CODE_SNIPPET: def calc(n):\n  r=[]\n  for i in range(n):\n    if i%2==0:\n      r.append(i)\n  return r",
        "difficulty": "Intermediate", "best_model": "Claude 3.5 Sonnet / GPT-4o", "use_case": "Improving existing code quality",
        "tags": ["coding", "refactoring", "optimization", "clean-code"],
        "output_mock": "Here is the refactored code using a list comprehension, which is more Pythonic and slightly faster:\n\n```python\ndef calc(n):\n    return [i for i in range(n) if i % 2 == 0]\n```\n\n**Time Complexity**: O(N) - We still iterate through `n` elements once.\n**Space Complexity**: O(N) - The resulting list contains N/2 elements."
    },
    {
        "id": "coding-2", "category": "coding", "title": "Security Vulnerability Scanner",
        "instruction": "Act as a Lead Security Engineer. Analyze this code for potential vulnerabilities (SQL Injection, XSS, CSRF, etc.). Provide a detailed report and a secure version of the code.\n\n```javascript\n[CODE_SNIPPET]\n```",
        "template": "CODE_SNIPPET: app.get('/user', (req, res) => {\n  db.query(`SELECT * FROM users WHERE id = ${req.query.id}`);\n});",
        "difficulty": "Advanced", "best_model": "GPT-4o", "use_case": "Security and bug fixing",
        "tags": ["coding", "security", "qa", "vulnerabilities"],
        "output_mock": "**Vulnerability Found: SQL Injection (SQLi)**\n\nThe code directly concatenates user input (`req.query.id`) into the SQL query string. An attacker could pass `1 OR 1=1` to expose all users.\n\n**Secure Code (Using Parameterized Queries):**\n```javascript\napp.get('/user', (req, res) => {\n  db.query('SELECT * FROM users WHERE id = ?', [req.query.id], (error, results) => {\n    // handle results\n  });\n});\n```"
    },
    {
        "id": "coding-3", "category": "coding", "title": "Comprehensive Unit Test Generator",
        "instruction": "Write comprehensive unit tests for the following function using [TESTING_FRAMEWORK]. Include happy paths, edge cases, and expected exceptions. Ensure maximum coverage.\n\n```\n[CODE_SNIPPET]\n```",
        "template": "TESTING_FRAMEWORK: pytest\nCODE_SNIPPET: def divide(a, b): return a / b",
        "difficulty": "Intermediate", "best_model": "Claude 3.5 Sonnet", "use_case": "Test-driven development",
        "tags": ["coding", "testing", "tdd", "unit-tests"],
        "output_mock": "```python\nimport pytest\nfrom my_module import divide\n\ndef test_divide_happy_path():\n    assert divide(10, 2) == 5.0\n\ndef test_divide_negative_numbers():\n    assert divide(-10, 2) == -5.0\n    assert divide(-10, -2) == 5.0\n\ndef test_divide_by_zero():\n    with pytest.raises(ZeroDivisionError):\n        divide(10, 0)\n```"
    },
    {
        "id": "coding-4", "category": "coding", "title": "Database Schema Architect",
        "instruction": "Act as a Database Architect. Design a relational database schema for a [APP_DESCRIPTION]. Provide the SQL `CREATE TABLE` statements, identify Primary and Foreign Keys, and suggest appropriate indexes for performance.",
        "template": "APP_DESCRIPTION: E-commerce platform handling users, products, orders, and reviews.",
        "difficulty": "Advanced", "best_model": "GPT-4o", "use_case": "System Design",
        "tags": ["coding", "database", "sql", "architecture"],
        "output_mock": "Here is the schema for the e-commerce platform:\n\n```sql\nCREATE TABLE Users (\n    id UUID PRIMARY KEY,\n    email VARCHAR(255) UNIQUE NOT NULL,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n);\n\nCREATE TABLE Products (\n    id UUID PRIMARY KEY,\n    name VARCHAR(255) NOT NULL,\n    price DECIMAL(10, 2) NOT NULL\n);\n\n-- Recommended Indexes\nCREATE INDEX idx_users_email ON Users(email);\n```"
    },

    # --- Prompt Engineering ---
    {
        "id": "pe-1", "category": "prompt-engineering", "title": "Chain of Thought (CoT) Reasoning",
        "instruction": "Solve the following problem. Before giving the final answer, show your step-by-step reasoning process. Think out loud, explain each deduction, and break down your logical steps clearly. Problem: [PROBLEM]",
        "template": "PROBLEM: If John has 5 apples and buys 3 more, then gives half his total to Mary, how many does he have?",
        "difficulty": "Advanced", "best_model": "Claude 3.5 Sonnet / GPT-4o", "use_case": "Complex problem solving",
        "tags": ["prompt-engineering", "cot", "reasoning"],
        "output_mock": "Let's break this down step-by-step:\n1. John starts with 5 apples.\n2. He buys 3 more. 5 + 3 = 8 apples total.\n3. He gives half of his total to Mary. Half of 8 is 4.\n4. Therefore, John keeps 8 - 4 = 4 apples.\n\n**Final Answer:** John has 4 apples left."
    },
    {
        "id": "pe-2", "category": "prompt-engineering", "title": "System Prompt Creator",
        "instruction": "You are an expert AI Architect. Your task is to write a highly detailed 'System Prompt' that configures an AI to act as a [ROLE]. Include their persona, rules, constraints, and output formatting instructions.",
        "template": "ROLE: Senior Legal Tech Assistant",
        "difficulty": "Expert", "best_model": "Claude 3 Opus", "use_case": "Creating AI Agents",
        "tags": ["prompt-engineering", "system-prompt", "agents"],
        "output_mock": "```text\n**Role**: You are Lexi, a Senior Legal Tech Assistant.\n**Persona**: Professional, precise, and highly analytical.\n**Rules**:\n1. NEVER provide definitive legal advice (always include a disclaimer).\n2. Cite relevant case law jurisdiction when asked.\n3. Keep responses under 3 paragraphs unless summarizing a document.\n**Output Format**: Use markdown headers for 'Summary', 'Key Clauses', and 'Risk Analysis'.\n```"
    },
    {
        "id": "pe-3", "category": "prompt-engineering", "title": "Self-Critique & Refinement (Reflection)",
        "instruction": "Generate a solution for [TASK]. Once generated, critique your own work by identifying at least 3 potential flaws, biases, or weaknesses. Finally, provide a revised version that addresses these criticisms.",
        "template": "TASK: Write a short cold email for a marketing agency.",
        "difficulty": "Advanced", "best_model": "Claude 3.5 Sonnet", "use_case": "High-quality content generation",
        "tags": ["prompt-engineering", "reflection", "self-critique"],
        "output_mock": "**Initial Draft**: Hi, we are a marketing agency. We can boost your sales. Call us!\n\n**Critique**:\n1. Too generic, lacks personalization.\n2. No clear value proposition or social proof.\n3. The Call to Action is too aggressive.\n\n**Revised Draft**: Hi [Name], noticed [Company] is launching a new product. We helped [Competitor/Similar Co] increase conversions by 20% using targeted ads. Open to a 5-min chat next Tuesday?"
    },
    {
        "id": "pe-4", "category": "prompt-engineering", "title": "ReAct (Reasoning and Acting)",
        "instruction": "Answer the following question using the ReAct framework. Use the format:\nThought: [Your reasoning]\nAction: [The tool or action to take, e.g., Search(query)]\nObservation: [The result of the action]\n... (Repeat until you have the answer)\nThought: I now know the answer.\nFinal Answer: [Answer]\nQuestion: [QUESTION]",
        "template": "QUESTION: Who is the current CEO of Microsoft and how old is he?",
        "difficulty": "Expert", "best_model": "GPT-4o", "use_case": "Agentic workflows",
        "tags": ["prompt-engineering", "react", "agents", "logic"],
        "output_mock": "Thought: I need to find out who the current CEO of Microsoft is.\nAction: Search(Microsoft current CEO)\nObservation: Satya Nadella is the CEO of Microsoft.\nThought: Now I need to find Satya Nadella's age.\nAction: Search(Satya Nadella age)\nObservation: Satya Nadella was born on August 19, 1967 (age 56 years).\nThought: I now know the answer.\nFinal Answer: The current CEO of Microsoft is Satya Nadella, and he is 56 years old."
    },

    # --- AI Art ---
    {
        "id": "art-1", "category": "ai-art", "title": "High-Fidelity Cinematic Portrait",
        "instruction": "A hyper-realistic cinematic portrait of [SUBJECT], detailed skin texture, dramatic rim lighting, shot on 85mm lens, f/1.8, bokeh background, 8k resolution, highly detailed, masterpiece --ar 16:9 --style raw --v 6.0",
        "template": "SUBJECT: An elderly cyberpunk mechanic with glowing neon eyes",
        "difficulty": "Intermediate", "best_model": "Midjourney v6", "use_case": "Character generation",
        "tags": ["ai-art", "midjourney", "portrait", "cinematic"],
        "output_mock": "[Midjourney generates a stunning, photorealistic 8k image of an elderly cyberpunk mechanic. The depth of field is incredibly shallow, completely blurring the neon city background.]"
    },
    {
        "id": "art-2", "category": "ai-art", "title": "Vector Logo Design Template",
        "instruction": "Minimalist vector logo for a [COMPANY_TYPE] named '[COMPANY_NAME]', featuring a [SUBJECT], flat colors, clean lines, white background, corporate identity, dribbble style --no text, realistic details --ar 1:1",
        "template": "COMPANY_TYPE: Tech Startup\nCOMPANY_NAME: CloudSync\nSUBJECT: abstract cloud interlocked with a gear",
        "difficulty": "Beginner", "best_model": "Midjourney / Flux", "use_case": "Branding",
        "tags": ["ai-art", "logo", "vector", "branding"],
        "output_mock": "[Flux returns a super clean, flat-color vector logo of a cloud and gear interlocking. The white background makes it look perfectly corporate and ready for a pitch deck.]"
    },
    {
        "id": "art-3", "category": "ai-art", "title": "Isometric 3D Room",
        "instruction": "An adorable isometric 3D render of a [ROOM_TYPE], [COLOR_PALETTE] color palette, soft clay render style, tilt-shift, bright ambient occlusion, blender, octane render, trending on artstation --ar 4:5",
        "template": "ROOM_TYPE: cozy indie game developer bedroom with dual monitors and posters\nCOLOR_PALETTE: pastel purple and warm yellow",
        "difficulty": "Intermediate", "best_model": "Midjourney / DALL-E 3", "use_case": "Concept Art",
        "tags": ["ai-art", "isometric", "3d", "concept"],
        "output_mock": "[DALL-E 3 generates an absolutely adorable, pastel-colored 3D isometric bedroom layout. The lighting feels like a soft clay render, exactly as asked!]"
    },

    # --- Business & Marketing ---
    {
        "id": "biz-1", "category": "business", "title": "Executive Summary Generator",
        "instruction": "Write a compelling 1-page Executive Summary for a business plan. The company is [COMPANY_NAME], providing [PRODUCT/SERVICE] to [TARGET_MARKET]. Highlight the problem, solution, monetization strategy, and a 3-year vision.",
        "template": "COMPANY_NAME: EcoDrive\nPRODUCT: Electric vehicle charging network\nTARGET_MARKET: Urban apartment complexes",
        "difficulty": "Beginner", "best_model": "Claude 3.5 Sonnet", "use_case": "Pitch Decks",
        "tags": ["business", "executive-summary", "strategy"],
        "output_mock": "**Executive Summary: EcoDrive**\n\n**The Problem**: Urban EV owners lack accessible charging infrastructure at home.\n**The Solution**: EcoDrive installs and manages scalable EV charging hubs in apartment parking garages.\n**Monetization**: Subscription model for residents + revenue share with building management.\n**3-Year Vision**: Expand to 500+ buildings across 3 major metropolitan areas."
    },
    {
        "id": "marketing-1", "category": "marketing", "title": "The AIDA Copywriting Framework",
        "instruction": "Write a high-converting email campaign for [PRODUCT] using the AIDA framework:\n- **Attention**: Catchy hook.\n- **Interest**: Fascinating facts/benefits.\n- **Desire**: Emotional appeal and FOMO.\n- **Action**: A clear, low-friction CTA.",
        "template": "PRODUCT: A new AI-powered noise-canceling headset for remote workers.",
        "difficulty": "Intermediate", "best_model": "GPT-4o", "use_case": "Email Marketing",
        "tags": ["marketing", "copywriting", "aida", "email"],
        "output_mock": "**Subject:** Silence the chaos. Focus on what matters.\n\n**Attention**: Barking dogs? Lawn mowers? Kids playing? Remote work is loud.\n**Interest**: Meet the Zenith Headset. It uses an onboard AI chip to filter out 99.8% of background noise before it ever reaches your microphone.\n**Desire**: Imagine presenting to the CEO with crystal-clear audio, completely stress-free. No more apologizing for the noise.\n**Action**: [Pre-order today] and get 20% off for the next 24 hours."
    },
    {
        "id": "marketing-2", "category": "marketing", "title": "SEO Blog Post Structure",
        "instruction": "Create a comprehensive SEO-optimized outline for a blog post titled '[TITLE]'. Include a meta description, an H1, multiple H2s and H3s, and indicate where to naturally inject these keywords: [KEYWORDS].",
        "template": "TITLE: The Ultimate Guide to Prompt Engineering\nKEYWORDS: LLM, AI prompts, ChatGPT tips, machine learning",
        "difficulty": "Beginner", "best_model": "Claude 3.5 Sonnet", "use_case": "Content SEO",
        "tags": ["marketing", "seo", "blogging", "content"],
        "output_mock": "**Meta Description**: Master the art of communicating with AI. Learn the best ChatGPT tips, LLM frameworks, and prompt engineering techniques to 10x your productivity.\n\n**H1**: The Ultimate Guide to Prompt Engineering\n- **H2**: What is an LLM? (Keyword: LLM, machine learning)\n- **H2**: Core AI Prompts and Structures (Keyword: AI prompts)\n  - **H3**: Zero-Shot vs Few-Shot\n- **H2**: Top 5 ChatGPT Tips for Beginners (Keyword: ChatGPT tips)"
    },

    # --- Real-World AI Use Cases ---
    {
        "id": "usecase-1", "category": "real-world-use-cases", "title": "SaaS Customer Support Agent (JSON Output)",
        "instruction": "You are a customer support triage agent for a SaaS. Read the following user ticket: [TICKET]. \nCategorize it (Bug, Feature Request, Billing, Question), determine the priority (Low, Med, High), and draft a short, empathetic reply. Return ONLY a valid JSON object.",
        "template": "TICKET: I've been charged twice this month for my pro subscription! Help!!",
        "difficulty": "Advanced", "best_model": "GPT-4o", "use_case": "Automated Ticket Triage",
        "tags": ["use-cases", "saas", "automation", "json"],
        "output_mock": "{\n  \"category\": \"Billing\",\n  \"priority\": \"High\",\n  \"draft_reply\": \"Hi there, I am so sorry to hear you were charged twice! I've escalated this to our billing team immediately to process a refund for the duplicate charge. You should see it resolved in 1-2 business days.\"\n}"
    },
    {
        "id": "usecase-2", "category": "real-world-use-cases", "title": "Automated CRM Data Extraction",
        "instruction": "Extract the contact information (Name, Company, Email, Phone, Role) from this email signature and format it into a CSV row. Email signature: [SIGNATURE]",
        "template": "SIGNATURE: Best, Sarah Jenkins | VP of Sales at TechCorp | s.jenkins@techcorp.com | (555) 123-4567",
        "difficulty": "Beginner", "best_model": "Gemini 1.5 Pro", "use_case": "Data Entry Automation",
        "tags": ["use-cases", "crm", "data-extraction", "automation"],
        "output_mock": "Name,Company,Email,Phone,Role\nSarah Jenkins,TechCorp,s.jenkins@techcorp.com,(555) 123-4567,VP of Sales"
    },

    # --- Productivity & Learning ---
    {
        "id": "prod-1", "category": "productivity", "title": "Eisenhower Matrix Prioritization",
        "instruction": "I have the following to-do list: [TASKS]. Categorize them using the Eisenhower Matrix (Urgent & Important, Important not Urgent, Urgent not Important, Neither). Suggest a plan of action.",
        "template": "TASKS: 1. Fix critical server bug. 2. Buy groceries. 3. Read a book on leadership. 4. Reply to casual Slack messages.",
        "difficulty": "Beginner", "best_model": "Claude 3.5 Sonnet", "use_case": "Time Management",
        "tags": ["productivity", "matrix", "time-management"],
        "output_mock": "**Urgent & Important (Do Now)**: 1. Fix critical server bug.\n**Important, Not Urgent (Schedule)**: 3. Read a book on leadership.\n**Urgent, Not Important (Delegate/Batch)**: 2. Buy groceries.\n**Neither (Delete/Minimize)**: 4. Reply to casual Slack messages."
    },
    {
        "id": "learning-1", "category": "learning", "title": "Socratic Method Tutor",
        "instruction": "Act as a Socratic tutor. I want to learn about [TOPIC]. DO NOT give me the direct answers. Instead, ask me probing questions one at a time to help me arrive at the conclusions myself. Start with your first question.",
        "template": "TOPIC: How the stock market works",
        "difficulty": "Advanced", "best_model": "GPT-4o", "use_case": "Deep Learning",
        "tags": ["learning", "socratic", "education", "tutor"],
        "output_mock": "Welcome! I'd love to help you explore how the stock market works. Let's start with a foundational idea: If you own a small lemonade stand and want to expand it into a big store, but you don't have enough money, how might you get the funds to do so?"
    }
]

def generate_files():
    directories = [
        "prompts", "prompts/coding", "prompts/ai-art", "prompts/business",
        "prompts/marketing", "prompts/productivity", "prompts/learning",
        "prompts/content-writing", "prompts/health", "prompts/career",
        "prompts/prompt-engineering", "prompts/real-world-use-cases",
        "datasets", "images"
    ]
    for d in directories:
        os.makedirs(d, exist_ok=True)

    # 1. Dataset JSON
    dataset_json = [{"instruction": p["instruction"], "output": p["output_mock"]} for p in prompts_data]
    with open("datasets/dataset.json", "w", encoding="utf-8") as f:
        json.dump(dataset_json, f, indent=2)

    # 2. Dataset JSONL
    with open("datasets/prompts.jsonl", "w", encoding="utf-8") as f:
        for p in dataset_json:
            f.write(json.dumps(p) + "\n")

    # 3. Categorized MDs
    from collections import defaultdict
    category_prompts = defaultdict(list)
    for p in prompts_data:
        category_prompts[p["category"]].append(p)

    for category, prompts in category_prompts.items():
        md_path = f"prompts/{category}/README.md"
        with open(md_path, "w", encoding="utf-8") as f:
            f.write(f"# {category.replace('-', ' ').title()} Prompts\n\n")
            for p in prompts:
                f.write(f"## {p['title']}\n\n")
                f.write(f"**Difficulty:** {p['difficulty']} | **Best Model:** {p['best_model']} | **Use Case:** {p['use_case']}\n\n")
                f.write(f"**Tags:** {', '.join(p['tags'])}\n\n")
                f.write(f"### Prompt:\n```text\n{p['instruction']}\n```\n\n")
                if p["template"]:
                    f.write(f"### Variables/Template Example:\n```text\n{p['template']}\n```\n\n")
                f.write(f"### Example Output:\n```text\n{p['output_mock']}\n```\n\n")
                f.write("---\n\n")

    print(f"Awesome! Just generated {len(prompts_data)} training-ready prompts and built the dataset.")

if __name__ == "__main__":
    generate_files()