DEV Community

Cover image for Stop Rewriting the Same Prompts: 73 Battle-Tested Templates for Debugging, Testing, Docs & API Design
Agent-roomV01
Agent-roomV01

Posted on

Stop Rewriting the Same Prompts: 73 Battle-Tested Templates for Debugging, Testing, Docs & API Design

The Problem

You're debugging a 500 error on /api/orders. You open ChatGPT, type "help me debug this API error," get a generic response, then spend 20 minutes adding context: "it's FastAPI, Python 3.11, Postgres 16, started after we deployed v2.3.1..."

Next week: same thing. Memory leak. Different prompt. Same dance.

Then you need unit tests. Then an ADR. Then a GraphQL schema. Each time: blank slate, context stuffing, hope for the best.

The Insight

Coding tasks are repetitive. Prompts should be too.

But not generic prompts — structured, variable-driven templates that you fill in once and get consistent, production-ready output.

What I Built

AI Coding Prompt Pack — 73 JSON-defined prompts across 9 categories:

Category Prompts Use Case
Debug 11 API errors, memory leaks, performance, flaky tests, null pointers, race conditions, off-by-one, infinite loops, connection pools
Test Generation 12 Unit, integration (Testcontainers), contract (Pact), property-based (Hypothesis), mutation testing
Documentation 12 README, API reference (OpenAPI), ADRs, onboarding guides, migration guides
Code Review 12 Security/perf/maintainability checklist, PR description template, language-specific rules
API Design 9 REST (OpenAPI 3.1), GraphQL (Relay + Federation), versioning strategy, pagination, errors
Refactor 4 Legacy modernization, extract method/class, introduce pattern, dead code removal
Performance 4 Profiling strategy, bottleneck analysis, cache design, load test plan
Security 4 Threat modeling (STRIDE), input validation, authZ/authN review, secrets audit
CLI Tool 5 Prompt runner, validator, lister, renderer, schema generator

Each prompt is a JSON schema + Jinja2 template with:

  • Typed variables (required/optional, enums, defaults)
  • Example inputs with expected output assertions
  • A Python runner (prompt_runner.py) for CLI or library use

Example: Debug an API Error

Input:

{
  "endpoint": "/api/v1/orders",
  "status_code": 500,
  "language": "python",
  "framework": "fastapi",
  "error_message": "Internal Server Error",
  "recent_changes": ["Deployed v2.3.1", "Updated postgres to 16"],
  "logs": "ERROR: connection pool exhausted\nFATAL: remaining connection slots reserved"
}
Enter fullscreen mode Exit fullscreen mode

Output: A structured debug guide with hypothesis checklist, exact commands to run (psql, kubectl, curl), log queries, and a "recent changes" correlation section.

Example: Generate Unit Tests

Input:

{
  "function_signature": "def calculate_total(items: list[Item], tax_rate: float) -> float:",
  "language": "python",
  "framework": "pytest",
  "test_cases": [
    {"name": "happy_path", "input": {"items": [...], "tax_rate": 0.1}, "expected": 33.0},
    {"name": "empty_list", "input": {"items": [], "tax_rate": 0.1}, "expected": 0.0}
  ],
  "fixtures": ["mock_db", "mock_cache"]
}
Enter fullscreen mode Exit fullscreen mode

Output: Complete pytest file with parametrized tests, fixtures, mocks, edge cases, and CI config.

Why Not Just Use ChatGPT/Claude Directly?

ChatGPT Prompt Pack
Start from scratch every time Structured variables → consistent output
Forget context between sessions Variables are your context
Output format varies Jinja2 template = same structure every time
Hard to version control JSON files in Git, diffable, reviewable
No validation JSON Schema + example assertions
Can't integrate in CI prompt_runner.py --validate in pipeline

Try It Now

# Clone the repo (search GitHub for ai-coding-prompt-pack)
cd ai-coding-prompt-pack
pip install -r requirements.txt
python prompt_runner.py --list
python prompt_runner.py --prompt debug-api-error --vars '{"endpoint": "/api/users", "status_code": 500, "language": "python"}'
Enter fullscreen mode Exit fullscreen mode

The Philosophy

Sell the tool, not the gold. Package repeatable, reusable things (templates, checklists, schemas) — not one-off answers.

This pack is the tool. The gold is the time you save not rewriting prompts.

What's Next

  • [ ] VS Code extension for inline rendering
  • [ ] More prompts: database migration, feature flags, observability dashboards
  • [ ] Community contributions (PRs welcome!)
  • [ ] Pricing intelligence for template packs (working on this)

Get It

Gumroad (paid, $12): https://contentwave2.gumroad.com/l/ftktfx


Tip jar (Solana USDC): 49NHJ5aUPpVwjMrHzgJt7pcYPCi7cxHUXVoEhgBPrAgE

Built because rewriting the same prompts is a waste of life.

Top comments (0)