← Back to all products
$19
Prompt Engineering Kit
Python prompt template library with chain-of-thought scaffolding, few-shot management, and versioning.
JSONMarkdownPythonLLM
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 11 files
prompt-engineering-kit/
├── LICENSE
├── README.md
├── examples/
│ ├── basic_usage.py
│ └── custom_templates.json
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_project-structure.md
│ ├── 03_built-in-templates.md
│ └── 04_faq.md
├── index.html
└── src/
└── prompt_engineering_kit.py
📖 Documentation Preview README excerpt
Prompt Engineering Kit
Python prompt template library with variable injection, chain-of-thought scaffolding, few-shot example management, and prompt quality scoring. Zero dependencies.
Part of the AI Toolkit collection by [CodeVault](https://ai-toolkit.codevault.dev).
Features
- Template library — 8 battle-tested prompt templates for common tasks (summarize, code review, classify, extract, etc.)
- Variable injection —
{placeholder}syntax with automatic detection and validation - Chain-of-thought — Multi-step prompt chains that scaffold complex reasoning
- Few-shot examples — Attach input/output examples to any template
- Prompt scoring — Quality analyzer that rates prompts on length, specificity, structure, and clarity
- Strategy tagging — Templates tagged by strategy (zero-shot, few-shot, CoT, role-play, structured output)
- JSON export — Export the entire library as JSON for integration with any LLM pipeline
- CLI interface — List, preview, build, score, and chain prompts from the terminal
Quick Start
# List all available templates
python src/prompt_engineering_kit.py --list
# Build a prompt from a template
python src/prompt_engineering_kit.py --build summarize --vars '{"text":"Your text here","length":"3","style":"professional"}'
# Score a prompt for quality
python src/prompt_engineering_kit.py --score "Tell me about dogs"
# Run a multi-step chain
python src/prompt_engineering_kit.py --chain research --vars '{"topic":"AI safety","length":"3"}'
# Export the full library to JSON
python src/prompt_engineering_kit.py --export-library prompts.json
Project Structure
prompt-engineering-kit/
├── README.md
├── LICENSE
├── src/
│ └── prompt_engineering_kit.py # Core engine (~400 lines)
└── examples/
├── basic_usage.py # Programmatic usage example
└── custom_templates.json # Sample custom template library
CLI Reference
| Flag | Description |
|---|---|
--list | List all templates and chains |
--template NAME | Show a specific template |
--build NAME --vars JSON | Build a prompt from a template |
--chain NAME --vars JSON | Render a multi-step prompt chain |
--score "TEXT" | Score a prompt string for quality |
--score-file FILE | Score a prompt loaded from a file |
--export-library FILE | Export the full library to JSON |
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
src/prompt_engineering_kit.py
#!/usr/bin/env python3
"""
Prompt Engineering Kit — AI Toolkit (DataNest)
A complete prompt template library and builder with variable injection,
chain-of-thought scaffolding, few-shot example management, and prompt
optimization scoring. Zero external dependencies — Python 3.10+ stdlib only.
Usage:
python prompt_engineering_kit.py --list # list all templates
python prompt_engineering_kit.py --template summarize # show a template
python prompt_engineering_kit.py --build summarize --vars '{"text":"Hello world"}'
python prompt_engineering_kit.py --chain research --vars '{"topic":"AI safety"}'
python prompt_engineering_kit.py --score "Tell me about dogs"
python prompt_engineering_kit.py --export-library prompts.json
"""
from __future__ import annotations
import argparse
import json
import logging
import math
import re
import sys
import textwrap
from dataclasses import dataclass, field
from enum import Enum, auto
from pathlib import Path
from typing import Any
# ---------------------------------------------------------------------------
# Logging
# ---------------------------------------------------------------------------
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
)
logger = logging.getLogger("prompt_engineering_kit")
# ---------------------------------------------------------------------------
# Constants — tuning knobs for prompt quality scoring
# ---------------------------------------------------------------------------
MIN_PROMPT_LENGTH: int = 20 # prompts shorter than this score poorly
IDEAL_PROMPT_LENGTH: int = 200 # sweet spot for detail vs. brevity
MAX_PROMPT_LENGTH: int = 4000 # longer prompts get diminishing returns
SPECIFICITY_KEYWORDS: list[str] = [
"exactly", "specifically", "step by step", "in detail", "for example",
"format as", "output as", "return as", "must include", "do not",
"avoid", "ensure", "between", "at least", "at most", "no more than",
]
# ... 741 more lines ...