Sponsor Suno AI Music arrow_forward
Slash Command

Prompt Template Gen

Generate reusable prompt templates with variables and best practices

Type
Slash Command
GitHub stars
2.8k
License
MIT
Repo last updated
Sep 27, 2026
Version
1.0.0
Author
Jeremy Longshore

What Prompt Template Gen is

Prompt Template Gen is a slash command published in the jeremylongshore/tons-of-skills-marketplace repository on GitHub, which has about 2.8k stars. The repository describes itself as: “Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.”

A slash command is a reusable prompt saved as a markdown file and run by typing its name after a slash. In Claude Code, custom commands have been merged into skills: a file in .claude/commands/ and a skill folder in .claude/skills/ both create the same kind of command, and existing command files keep working.

Prompt Template Gen gives you a repeatable way to run the same instructions without retyping them, optionally with arguments.

How to install Prompt Template Gen

Claude Code

  1. Download prompt-template-gen.md from the repository.
  2. Save it to ~/.claude/commands/ (all projects) or .claude/commands/ (one project). As a skill, you can instead save it as ~/.claude/skills/<name>/SKILL.md.
  3. Run it by typing / followed by its name.

Claude Cowork

  1. Turn the command into a skill: create a folder with the file saved as SKILL.md and zip it.
  2. In Customize → Skills, click +, then upload the ZIP.
  3. Run it from any task with / and the skill name.

New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.

Inside the source file

An excerpt from plugins/packages/ai-ml-engineering-pack/plugins/01-prompt-engineering/commands/prompt-template-gen.md, shared under the repository's MIT license. Read the full file on GitHub.

Generate production-ready prompt templates with variable substitution, type validation, and optimization best practices built-in.

What You'll Get

When you run this command, you'll receive:

  1. Prompt template with variable placeholders
  2. Python implementation with type hints and validation
  3. TypeScript implementation for Node.js projects
  4. Usage examples showing how to use the template
  5. Testing utilities for quality validation
  6. Cost estimation based on expected token usage

Usage

/prompt-template-gen <task_description>

Examples:

  • /ptg "Generate product descriptions from features"
  • /ptg "Extract structured data from customer reviews"
  • /ptg "Classify support tickets by urgency and category"
  • /ptg "Summarize meeting notes with action items"

Generated Output

Example: Product Description Generator

Input:

/ptg "Generate product descriptions from features"

Output:

1. Prompt Template

PRODUCT_DESCRIPTION_TEMPLATE = """Generate an engaging product description for e-commerce.

Product Name: {product_name}
Category: {category}
Features: {features}
Target Audience: {target_audience}

Style: {tone}
Length: {word_count} words

Focus on benefits, not just features. Use persuasive language appropriate for {target_audience}.

Output format: Single paragraph, {word_count} words, no bullet points.
"""

2. Python Implementation

from typing import Literal, Optional
from dataclasses import dataclass
import anthropic

@dataclass
class ProductDescriptionInput:
    """Type-safe input for product description generation."""
    product_name: str
    category: str
    features: list[str]
    target_audience: str
    tone: Literal["professional", "casual", "enthusiastic", "luxury"] = "professional"
    word_count: int = 150

    def __post_init__(self):
        """Validate inputs."""
        if not self.product_name:
            raise ValueError("product_name cannot be empty")
…

3. TypeScript Implementation

import Anthropic from "@anthropic-ai/sdk";

interface ProductDescriptionInput {
  productName: string;
  category: string;
  features: string[];
  targetAudience: string;
  tone?: "professional" | "casual" | "enthusiastic" | "luxury";
  wordCount?: number;
}

interface GenerationResult {
  description: string;
  tokensUsed: {
    input: number;
    output: number;
  };
  cost: number;
…

4. Testing Framework

import pytest
from product_description_generator import ProductDescriptionGenerator, ProductDescriptionInput

class TestProductDescriptionGenerator:
    """Test suite for product description generator."""

    @pytest.fixture
    def generator(self):
        """Create generator instance."""
        return ProductDescriptionGenerator(
            api_key="test-key",
            model="claude-3-haiku-20240307"
        )

    def test_valid_input(self, generator):
        """Test generation with valid input."""
        input_data = ProductDescriptionInput(
            product_name="Test Product",
…

5. Cost Estimation

def estimate_monthly_cost(
    requests_per_month: int,
    avg_word_count: int = 150,
    model: str = "claude-3-haiku-20240307"
):
    """Estimate monthly LLM costs for product descriptions.

    Args:
        requests_per_month: Expected API calls per month
        avg_word_count: Average description length
        model: Claude model to use

    Returns:
        dict with cost breakdown
    """
    # Approximate token counts
    avg_input_tokens = 150  # Template + product info
    avg_output_tokens = avg_word_count * 1.3  # Words to tokens ratio
…

6. Optimization Tips

# Tip 1: Batch processing for better throughput
async def batch_generate(generator, products: list[ProductDescriptionInput]):
    """Generate descriptions for multiple products efficiently."""
    import asyncio

    tasks = [generator.generate(product) for product in products]
    results = await asyncio.gather(*tasks)
    return results

# Tip 2: Caching for similar products
from functools import lru_cache
import hashlib

@lru_cache(maxsize=1000)
def get_cached_description(product_hash: str):
    """Cache descriptions for identical products."""
    # Implementation...
    pass
…

Template Variations

The command can generate templates for common tasks:

Classification Template

/ptg "Classify customer support tickets by urgency and category"

Extraction Template

/ptg "Extract structured contact information from business cards"

Summarization Template

/ptg "Summarize academic papers with key findings and methodology"

Analysis Template

/ptg "Analyze customer sentiment from product reviews"

Translation Template

/ptg "Translate marketing copy while preserving tone and cultural context"

Best Practices Built-In

Every generated template includes:

  1. Type Safety: Strong typing in both Python and TypeScript
  2. Input Validation: Catch errors before API calls
  3. Cost Tracking: Monitor spending per request
  4. Error Handling: Graceful failure and retries

Before you install

  • Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
  • Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
  • Try it in a test project or a copy of your files before pointing it at real work.
  • Pin the version you tested, and review changes before updating.
  • Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.

FAQ

What is Prompt Template Gen?

Prompt Template Gen is a slash command for Claude Code and Claude Cowork from the jeremylongshore/tons-of-skills-marketplace repository on GitHub. Generate reusable prompt templates with variables and best practices

How do I install Prompt Template Gen in Claude Code?

Download prompt-template-gen.md from the repository. Save it to ~/.claude/commands/ (all projects) or .claude/commands/ (one project). As a skill, you can instead save it as ~/.claude/skills/<name>/SKILL.md. Run it by typing / followed by its name.

Can I use Prompt Template Gen in Claude Cowork?

Turn the command into a skill: create a folder with the file saved as SKILL.md and zip it. In Customize → Skills, click +, then upload the ZIP. Run it from any task with / and the skill name.

Is Prompt Template Gen safe to install?

It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.

Similar resources

Browse all skills, subagents, and plugins →

Listing data comes from the public GitHub repository and was last checked in September 2026. Excerpts are © their authors and shared under MIT. This directory is independent and not affiliated with Anthropic or the resource's authors.