---
name: Prompt Factory
slug: prompt-factory
category: AI Engineering
description: Prompt Factory generates production-ready prompts for a chosen role, industry, and task using a required question flow, preset templates, and validation checks. Use it when you need a single prompt document for another model to execute.
github: "https://github.com/alirezarezvani/claude-code-skill-factory/tree/dev/generated-skills/prompt-factory"
language: Python
stars: 852
forks: 173
install: "npx degit https://github.com/alirezarezvani/claude-code-skill-factory/tree/dev/generated-skills/prompt-factory ~/.claude/skills/prompt-factory"
installs_to: ~/.claude/skills/prompt-factory
source_path: generated-skills/prompt-factory/SKILL.md
collection_size: 15
category_size: 2451
collection_url: "https://dirskills.com/collections/alirezarezvani/claude-code-skill-factory"
added: 2026-08-22T05:21:44.599Z
last_synced: 2026-08-22T05:21:44.599Z
canonical_url: "https://dirskills.com/skills/prompt-factory"
---

# Prompt Factory

Prompt Factory generates production-ready prompts for a chosen role, industry, and task using a required question flow, preset templates, and validation checks. Use it when you need a single prompt document for another model to execute.

**Install:**

```bash
npx degit https://github.com/alirezarezvani/claude-code-skill-factory/tree/dev/generated-skills/prompt-factory ~/.claude/skills/prompt-factory
```

## README

# Prompt Factory - World-Class Prompt Powerhouse

A comprehensive system for generating world-class, production-ready prompts in one shot, eliminating the need for iteration.

---

## ⚠️ CRITICAL CONSTRAINTS - READ FIRST

**This skill generates PROMPTS only. It does NOT implement the work described in the prompt.**

### What This Skill DOES:
✅ Generate a comprehensive PROMPT (text document in chosen format)
✅ **Ask 5-7 questions to understand requirements** (MANDATORY - no skipping)
✅ Validate prompt quality before delivery
✅ Output a SINGLE prompt document with token count
✅ Provide the prompt ready to copy and use elsewhere

### What This Skill DOES NOT DO:
❌ Implement the actual work (no code files, no diagrams, no APIs)
❌ Create architectural diagrams or technical implementations
❌ Write actual marketing campaigns or business strategies
❌ Build infrastructure or deploy anything
❌ Create multiple files or deliverables
❌ Execute the prompt after generating it

### Expected Workflow:
1. User asks for help creating a prompt
2. **Skill MUST ask 5-7 questions** (even if context seems obvious)
3. User answers questions with specific details
4. Skill generates ONE comprehensive prompt document
5. Skill announces token count (e.g., "Generated prompt: 4,200 tokens")
6. **STOP** - Do not implement anything from the prompt
7. Ask: "Would you like me to modify the prompt or create a variation?"

### Why This Matters:
- **Prevents scope creep**: You're making a prompt, not doing the work
- **Saves context**: One prompt document vs. dozens of implementation files
- **Clear deliverable**: User gets a prompt to use with any LLM
- **Reusability**: The prompt can be used multiple times

**If user says "now implement this":** Clarify they should use the generated prompt with a fresh conversation or different tool, as this skill only creates prompts.

---

## Overview

Transform any requirement into an optimized mega-prompt through:
1. **Mandatory 5-7 question flow** (MUST ask, even if context obvious) with example answers
2. **69 comprehensive presets** across 15 professional domains (technical, business, creative, legal, finance, HR, design, customer, executive, manufacturing, R&D, regulatory, specialized-technical, research, creative-media, specialized)
3. **Multi-format output** (XML/Claude/ChatGPT/Gemini)
4. **7-point quality validation** before delivery
5. **Contextual best practices** from OpenAI, Anthropic, Google
6. **Core & Advanced modes** for different needs
7. **Complete coverage** of role × industry × task combinations

---

## Relationship to PROMPTS_FACTORY_PROMPT.md

This skill works alongside the meta-prompt template:

- **prompt-factory skill (this file)**: Generates individual mega-prompts for specific roles using 69 presets
  - **Use when**: You need a single prompt for a common role (e.g., "Product Manager", "Full-Stack Engineer")
  - **Output**: One ready-to-use mega-prompt (~4-12K tokens)
  - **Example**: "Create a prompt for a Growth Hacker in B2B SaaS" → generates one prompt

- **PROMPTS_FACTORY_PROMPT.md**: Meta-prompt that generates domain-specific prompt builders
  - **Use when**: You want to create a new prompt generation system for a specific domain (e.g., Healthcare, FinTech, Legal)
  - **Output**: A complete prompt builder with 10-20 role presets for that domain
  - **Example**: "Generate a FinTech Prompt Builder" → creates a system with 10-20 FinTech role presets
  - **Location**: `documentation/templates/PROMPTS_FACTORY_PROMPT.md`

**Quick Decision**:
- Need one prompt now? → Use this skill (prompt-factory)
- Building a prompt system for a new domain? → Use PROMPTS_FACTORY_PROMPT.md

---

## Quick Start: Choose Your Path

### Path 1: Quick-Start Preset (Fastest)
**Use when:** You need a prompt for a common role

1. User says: "I need a prompt for [preset name]"
2. Show matching preset with customizable variables
3. Customize (optional) → Generate → Deliver

**Available Presets (69 total across 15 domains):**

**Technical (8):** Full-Stack Engineer, DevOps Engineer, Mobile Engineer, Data Scientist, Security Engineer, Cloud Architect, Database Engineer, QA Engineer

**Business (8):** Product Manager, Product Engineer, Product Owner, Project Manager, Operations Manager, Sales & Business Manager, Business Analyst, Marketing Manager

**Legal & Compliance (4):** Legal Counsel, Compliance Officer, Contract Manager, Regulatory Affairs Specialist

**Finance & Accounting (4):** Financial Analyst, CFO/Controller, Accountant/Tax Specialist, Investment Analyst

**Human Resources (4):** HR Manager, Talent Acquisition Specialist, Learning & Development Manager, Compensation & Benefits Analyst

**Design (4):** UI/UX Designer, Graphic Designer, Brand Designer, Product Designer

**Customer-Facing (4):** Customer Success Manager, Support Engineer, Account Manager, Customer Experience Manager

**Executive Leadership (7):** CEO/Founder, CTO/VP Engineering, Chief Strategy Officer, General Manager, Chief Product Officer, Chief Marketing Officer, Chief Operations Officer

**Specialized Technical (6):** Machine Learning Engineer, Blockchain Developer, Game Developer, Embedded Systems Engineer, Network Engineer, Site Reliability Engineer (SRE)

**Research & Analysis (3):** Research Scientist, Quantitative Analyst, Market Researcher

**Creative & Media (4):** Copywriter, Social Media Manager, SEO Specialist, Video Producer

**Manufacturing (4):** Manufacturing Engineer, Supply Chain Manager, Quality Engineer (Physical Products), Industrial Designer

**R&D - Research & Development (2):** Clinical Specialist (PhD-level), Senior AI R&D Expert

**Regulatory Affairs (1):** Quality Management Responsible Person (ISO 13485, MDR, ISO 27001)

**Specialized (1):** AEO Specialist (Answer Engine Optimization for LLMs)

### Path 2: Custom Prompt (5-7 Questions - MANDATORY)
**Use when:** Building a unique prompt from scratch

1. Detect intent from user request
2. **MUST ask 5-7 questions** with example answers (no skipping allowed)
3. Generate with contextual best practices
4. Validate quality → Deliver

**Note:** Even if the request seems clear (e.g., "product manager PRD prompt"), you MUST still ask questions to gather specifics, validate assumptions, and ensure a high-quality output.

---

## Workflow: Custom Prompt Generation

### Step 1: Intent Detection & Context Inference

Analyze user's request for trigger keywords:

**Role Triggers:**
- Technical: "engineer", "developer", "architect", "DevOps", "backend", "frontend", "full-stack", "ML", "data scientist"
- Business: "manager", "strategist", "analyst", "consultant", "executive", "director", "VP"
- Creative: "designer", "writer", "content", "UX", "brand", "marketing"
- Specialized: "healthcare", "fintech", "legal", "education", "security"

**Task Triggers:**
- Build: "create", "build", "develop", "implement", "code", "write"
- Analyze: "analyze", "review", "evaluate", "assess", "audit", "research"
- Optimize: "optimize", "improve", "refactor", "enhance", "fix"
- Plan: "strategy", "plan", "roadmap", "architecture", "design"

**Output Triggers:**
- "code", "documentation", "strategy", "analysis", "plan", "design", "report"

**Infer from context:**
- Primary role
- Domain/industry
- Task complexity (basic/intermediate/advanced/expert)
- Output type
- Technical depth needed

### Step 2: Smart 7-Question Flow

**MANDATORY: You MUST ask questions before generating any prompt.**

**Questioning Rules:**
- **MINIMUM: Ask at least 5 questions** (even if context seems clear)
- **MAXIMUM: Ask up to 7 questions** (skip only truly redundant ones)
- **Always ask for CONFIRMATION** of inferred details, don't just assume
- **Purpose:** Validate assumptions, gather specifics, ensure quality output

**When to skip a question:**
- ✅ ONLY if user explicitly provided that exact detail in their request
- ✅ Example: User says "React 18 with TypeScript" → skip tech stack question

**When to ask even if you think you know:**
- ✅ ALWAYS ask for domain/industry context (gets specifics)
- ✅ ALWAYS ask for constraints (budget, timeline, team size)
- ✅ ALWAYS ask for success criteria (measurable outcomes)
- ✅ Ask for confirmation: "I'm inferring [X], is that correct?"

**Question Bank (Select 5-7):**

#### Category 1: Role & Domain (Ask 2 max)

**Q1: What role should the AI assume?**
*Examples:*
- "Senior Backend Engineer"
- "Marketing Growth Strategist"
- "Data Analyst"
- "Product Manager"
- "UX Designer"

Your answer: `___`

**Q2: What domain or industry context?**
*Examples:*
- "FinTech / Payment Processing"
- "Healthcare SaaS"
- "E-commerce Platform"
- "B2B Marketing Agency"
- "Mobile Gaming"

Your answer: `___`

#### Category 2: Use Case & Output (Ask 2)

**Q3: What is the primary task or goal?**
*Examples:*
- "Build REST APIs for payment processing"
- "Create content marketing strategies"
- "Analyze user behavior data"
- "Design mobile app interfaces"
- "Optimize database performance"

Your answer: `___`

**Q4: What output format do you need?**
*Options:*
- `code` - Implementation code with tests
- `documentation` - Technical/user docs
- `strategy` - Strategic plans/roadmaps
- `analysis` - Data analysis/insights
- `design` - UI/UX designs
- `plan` - Project/implementation plans

Your answer: `___`

#### Category 3: Context & Constraints (Ask 1-2)

**Q5: Tech stack, tools, or methodologies to use/follow?**
*Examples:*
- "Python, FastAPI, PostgreSQL, AWS"
- "React, TypeScript, Next.js"
- "Agile/Scrum methodology"
- "SEO best practices, Google Analytics"
- "Figma, Design Systems, WCAG 2.1"

Your answer: `___`

**Q6: Any critical constraints or requirements?**
*Examples:*
- "HIPAA compliant, healthcare regulations"
- "Budget < $10k, 2-week timeline"
- "Must support 10k+ concurrent users"
- "PCI-DSS compliance for payments"
- "Mobile-first, accessibility AA"

Your answer: `___`

#### Category 4: Style & Format (Ask 1-2)

**Q7: Communication style and response format?**
*Options:*
- **Tone:** Professional / Technical / Casual / Academic
- **Style:** Concise / Detailed / Step-by-step / Conceptual
- **Format:** Prose / Bullets / Mixed / Code-heavy
- **Depth:** High-level / Moderate / Deep-technical / Implementation-ready

*Example:* "Technical tone, detailed style, mixed format, implementation-ready depth"

Your answer: `___`

---

**Smart Question Adaptation:**

- **If technical/coding detected:** MUST ask about tech stack, constraints, success criteria
- **If business detected:** MUST ask about KPIs, stakeholders, metrics
- **If creative detected:** MUST ask about brand voice, audience, distribution
- **If industry-specific:** MUST ask about compliance, regulations, standards

**Strict Minimum Requirements (Cannot Skip):**
- ✅ MUST ask at least 1 question about role/domain (even if "obvious")
- ✅ MUST ask at least 1 question about use case/task details
- ✅ MUST ask about constraints OR success criteria (at minimum one)
- ✅ MUST ask about output format preference
- ✅ MUST ask about mode (core vs. advanced)

**Total: MINIMUM 5 questions, MAXIMUM 7 questions**

**Example - Even for "Obvious" Requests:**

User: "Write a product manager prompt for creating a PRD"

You MUST still ask:
1. "I'm inferring role = Product Manager. What domain/industry? (e.g., B2B SaaS, Mobile Apps, Healthcare)"
2. "What type of PRD? (e.g., New Feature, Platform Migration, MVP Launch)"
3. "What are the constraints? (e.g., Team size, Timeline, Budget, Technical stack)"
4. "What are the success criteria? (e.g., Stakeholder approval, Dev handoff ready, Measurable KPIs)"
5. "What output format? (XML [default], Claude, ChatGPT, Gemini, All)"

**DO NOT skip questions just because you can infer answers. ALWAYS ask for validation and specifics.**

---

### Step 3: Output Format Selection

After gathering responses, ask:

**Select output format:**
1. `xml` - XML-structured markdown (optimal for LLM parsing) [DEFAULT]
2. `claude` - Claude-optimized system prompt format
3. `chatgpt` - ChatGPT custom instructions format
4. `gemini` - Google Gemini format
5. `all` - Generate all 4 formats

Your choice: `___` (or press enter for default)

---

### Step 4: Mode Selection

**Select generation mode:**
1. `core` - Prompt + usage instructions + 2-3 examples (~5K tokens) [DEFAULT]
2. `advanced` - Core + testing scenarios + variations + optimization tips (~12K tokens)

Your choice: `___` (or press enter for core mode)

---

### Step 5: Template Matching & Synthesis

**Check Quick-Start Presets:**
- Read `templates/presets/` for matching templates
- Match criteria: role (>80%), domain (>70%), output type (exact)

**Decision Logic:**
- **High match (>85%)**: Use preset, customize variables
- **Moderate match (60-85%)**: Use as base, significant modifications
- **Low match (<60%)**: Synthesize custom template using:
  - `references/best-practices/` (OpenAI/Anthropic/Google)
  - `references/prompt-patterns.md` (common patterns)
  - Contextual best practices for role/domain/task

---

### Step 6: Quality Validation (7-Point Gates)

Before output, validate:

1. ✓ **XML Structure** - All tags properly opened/closed (if XML format)
2. ✓ **Completeness** - All questionnaire responses incorporated
3. ✓ **Token Count** - Count tokens and verify reasonable size:
   - Core mode: 3,000-6,000 tokens (ideal ~4,500)
   - Advanced mode: 8,000-12,000 tokens (ideal ~10,000)
   - **Warning if >8K for core, >15K for advanced**
   - **ANNOUNCE token count in delivery message**
4. ✓ **No Placeholders** - All `[...]` filled with actual content
5. ✓ **Actionable Workflow** - Clear, executable steps
6. ✓ **Best Practices** - Contextually relevant practices applied
7. ✓ **Examples Present** - At least 2 examples demonstrating expected behavior

**If validation fails:** Fix issues before delivery.

**Token Count Announcement:**
After generating the prompt, count tokens and include in delivery message:
- "**Token Count:** ~4,200 tokens (Core mode - within optimal range ✅)"
- "**Token Count:** ~10,500 tokens (Advanced mode - comprehensive ✅)"
- "**Token Count:** ~7,800 tokens (Warning: Higher than typical Core mode)"

---

### Step 7: Generate Mega-Prompt

#### Core Mode Output Structure

Generate based on selected format:

##### Format 1: XML (Default)

```xml
<mega_prompt>

<role>
[Role title with expertise and domain specialization]
</role>

<mission>
[Primary objective and success criteria]
</mission>

<context>
  <domain>[Industry/field context]</domain>
  <expertise>[Specialized knowledge areas]</expertise>
  <tech_stack>[Technologies and tools if applicable]</tech_stack>
  <constraints>[Limitations and requirements]</constraints>
  <avoidance_rules>[What NOT to do]</avoidance_rules>
</context>

<workflow>
  <phase_1>
    [First phase name and steps]
  </phase_1>
  <phase_2>
    [Second phase name and steps]
  </phase_2>
  <phase_3>
    [Third phase name and steps]
  </phase_3>
  <phase_4>
    [Fourth phase name and steps]
  </phase_4>
</workflow>

<output_specifications>
  <format>[Expected output format]</format>
  <structure>[How to organize the output]</structure>
  <depth_level>[How detailed to be]</depth_level>
  <quality_criteria>[Success metrics]</quality_criteria>
</output_specifications>

<communication_guidelines>
  <tone>[Communication style]</tone>
  <audience>[Target reader level]</audience>
  <formatting>[How to format responses]</formatting>
  <examples_usage>[When and how to use examples]</examples_usage>
</communication_guidelines>

<best_practices>
[Contextually selected best practices for this role/domain/task]

[From OpenAI:]
- [Relevant OpenAI practice 1]
- [Relevant OpenAI practice 2]

[From Anthropic:]
- [Relevant Anthropic practice 1]
- [Relevant Anthropic practice 2]

[From Google:]
- [Relevant Google practice 1]
- [Relevant Google practice 2]

[Domain-Specific:]
- [Domain best practice 1]
- [Domain best practice 2]
- [Domain best practice 3]
</best_practices>

<critical_instructions>
  <priority_1>
    [Most important rules - must follow]
  </priority_1>
  <priority_2>
    [Important guidelines - should follow]
  </priority_2>
  <priority_3>
    [Supporting instructions - recommended]
  </priority_3>
</critical_instructions>

<examples>
## Example 1: [Scenario Name]
**User Request:** [Typical user request]

**Expected Response Structure:**
[Show how to structure the response]

## Example 2: [Scenario Name]
**User Request:** [Another typical request]

**Expected Response Structure:**
[Show the response pattern]
</examples>

<execution_trigger>
You are now fully configured as [Role] specialized in [Domain].

When the user provides a request:
1. Analyze their specific needs using the workflow above
2. Apply relevant best practices contextually
3. Generate output meeting quality criteria
4. Deliver complete solution in one comprehensive response

Begin assisting the user now with this configuration.
</execution_trigger>

</mega_prompt>
```

##### Format 2: Claude System Prompt

```markdown
# System Configuration: [Role]

You are [role with expertise and domain]. Your mission is to [primary objective].

## Your Expertise
[Domain and specialized knowledge areas]

## Your Workflow
When given a task:
1. [Phase 1 steps]
2. [Phase 2 steps]
3. [Phase 3 steps]
4. [Phase 4 steps]

## Output Standards
- Format: [specified format]
- Structure: [organization approach]
- Depth: [detail level]
- Quality bar: [success criteria]

## Communication Style
- Tone: [specified tone]
- Audience: [target level]
- Formatting: [format approach]

## Critical Rules
**Must follow:**
- [Priority 1 rules]

**Should follow:**
- [Priority 2 guidelines]

## Best Practices
[Contextually relevant practices for this role/domain]

## Response Examples
[2-3 examples showing expected behavior]

---

Execute your role now, following all guidelines above.
```

##### Format 3: ChatGPT Custom Instructions

```
**What would you like ChatGPT to know about you to provide better responses?**

I need you to act as [role with expertise and domain specialization].

My domain: [industry/field]
My tech stack: [if applicable]
My constraints: [if applicable]

**How would you like ChatGPT to respond?**

WORKFLOW:
1. [Phase 1 approach]
2. [Phase 2 approach]
3. [Phase 3 approach]
4. [Phase 4 approach]

OUTPUT REQUIREMENTS:
- Format: [specified format]
- Style: [tone and communication approach]
- Depth: [detail level]
- Include: [what to include]

CRITICAL RULES:
- [Priority 1 rules]
- [Important guidelines]

BEST PRACTICES TO FOLLOW:
[Contextually relevant practices]

Always provide [example format] and ensure [quality criteria].
```

##### Format 4: Gemini Format

```markdown
## Role Configuration
You are: [role with expertise and domain]

## Task Approach
[Workflow summarized for Gemini's style]

## Output Format
[Clear format specification]

## Quality Standards
[Success criteria]

## Examples
[2 concrete examples]

Apply this configuration to all responses.
```

---

#### Advanced Mode Additions

If user selected `advanced` mode, append these sections:

##### Testing Scenarios

```xml
<testing_scenarios>
## Test Case 1: [Simple Case]
**Input:** [Test input]
**Expected Behavior:** [What should happen]
**Success Criteria:** [How to verify]

## Test Case 2: [Edge Case]
**Input:** [Edge case input]
**Expected Behavior:** [How to handle]
**Success Criteria:** [Verification method]

## Test Case 3: [Complex Case]
**Input:** [Complex scenario]
**Expected Behavior:** [Expected handling]
**Success Criteria:** [Verification approach]

## Test Case 4: [Error Case]
**Input:** [Invalid/error input]
**Expected Behavior:** [Error handling]
**Success Criteria:** [How to validate]

## Test Case 5: [Performance Case]
**Input:** [High-load scenario]
**Expected Behavior:** [Performance expectations]
**Success Criteria:** [Performance metrics]
</testing_scenarios>
```

##### Prompt Variations

```xml
<prompt_variations>
## Variation 1: Concise (~3K tokens)
[Minimal version focusing on essential instructions]

## Variation 2: Balanced 
