def create_prompt()

in devai-cli/src/devai/commands/prompts.py [0:0]


def create_prompt(name: str, category: str, subcategory: str, description: str, tags: str):
    """Create a new prompt template."""
    # Always create in user's custom directory
    user_dir = get_user_prompts_dir()
    if not user_dir:
        click.echo("Error: Please set a custom prompts directory first using 'devai prompts config --set-path'")
        return
    
    category_dir = user_dir / category.lower()
    
    # Create category directory if it doesn't exist
    category_dir.mkdir(parents=True, exist_ok=True)
    
    # Create template file
    template_file = category_dir / f"{subcategory.lower()}.yaml"
    
    if template_file.exists():
        if not click.confirm(f"Template already exists at {template_file}. Overwrite?"):
            return
    
    template = {
        'metadata': {
            'name': name,
            'description': description,
            'version': '1.0',
            'category': category,
            'subcategory': subcategory,
            'author': 'DevAI',
            'last_updated': '2024-03-25',
            'tags': [tag.strip() for tag in tags.split(',')]
        },
        'configuration': {
            'temperature': 0.7,
            'max_tokens': 1024,
            'output_format': 'markdown'
        },
        'prompt': {
            'system_context': f"You are an expert in {category} with extensive experience in {subcategory}.",
            'instruction': "### Task Description ###\n\n### Focus Areas ###\n\n### Analysis Requirements ###\n\n### Output Format ###\n",
            'examples': [
                {
                    'input': 'Example input',
                    'output': 'Example output'
                }
            ]
        },
        'validation': {
            'required_sections': [],
            'output_schema': {},
            'quality_checks': []
        }
    }
    
    try:
        with open(template_file, 'w') as f:
            yaml.dump(template, f, default_flow_style=False)
        click.echo(f"Created new template at {template_file}")
    except Exception as e:
        click.echo(f"Error creating template: {str(e)}", err=True)