Skip to content

Instantly share code, notes, and snippets.

@stefanofago73
Created July 17, 2025 21:14
Show Gist options
  • Select an option

  • Save stefanofago73/6f08fe7453b44a67fcf1d5c4455f15a7 to your computer and use it in GitHub Desktop.

Select an option

Save stefanofago73/6f08fe7453b44a67fcf1d5c4455f15a7 to your computer and use it in GitHub Desktop.
This guide helps you build effective prompts, reusable context blocks, and structured templates for use in ChatGPT or other LLMs.
# πŸ“˜ Prompting Guide & Reusable Prompt Template (Generic)
This guide helps you build effective prompts, reusable context blocks, and structured templates for use in ChatGPT or other LLMs.
# =========================================
# 🎯 GOALS
# =========================================
- Create concise, reusable prompts
- Maintain low token usage
- Enable restoration of context in future sessions
- Structure prompt data for humans and LLMs alike
# =========================================
# 🧱 BASIC PROMPT TYPES
# =========================================
## 1. Instruction Prompt
```
Give me a step-by-step explanation of how a jet engine works.
```
## 2. Role-based Prompt
```
Act as a senior backend engineer. Review the code below for performance issues.
```
## 3. Format-specific Prompt
```
Output the following as a Markdown table with columns: Name, Description, Status.
```
## 4. Contextual Prompt with Knowledge Block
```
CTX_ID: auth_api_v1
- JWT token required for all endpoints
- Refresh tokens expire after 7 days
- Admin routes use RBAC model
Use CTX_ID: auth_api_v1 to design a logout endpoint.
```
# =========================================
# 🧠 REUSABLE PROMPT TEMPLATE
# =========================================
## MASTER INDEX
List of context blocks by topic:
- CTX_ID: my_proj_api β†’ REST API structure for MyProject
- CTX_ID: ux_guidelines β†’ Usability and UI/UX standards
- CTX_ID: devops_ci_cd β†’ Deployment and build pipeline notes
---
## CTX_ID: my_proj_api
- RESTful endpoints
- JWT authentication, RBAC authorization
- `/users`, `/projects`, `/settings`
- Use async/await and pagination for all list endpoints
## CTX_ID: devops_ci_cd
- CI: GitHub Actions with Docker build
- CD: Deploy to AWS via Terraform
- Secrets managed via Vault
---
# =========================================
# πŸ” REUSE IN NEW SESSIONS
# =========================================
Paste this to restore:
```
Use CTX_ID: my_proj_api. Add a new endpoint for project duplication.
```
Or:
```
Restore CTX_ID: ux_guidelines. Continue with mobile UI for onboarding.
```
# =========================================
# βœ… BEST PRACTICES
# =========================================
- Keep blocks under 400 tokens
- Use CTX_IDs consistently
- Store in plain `.txt` or `.md` files
- Prefer bullet points over prose
- Avoid embedding full docs or PDFs β€” extract key knowledge only
---
# 🧩 TIP: Structure prompts clearly
βœ… Clear
```
Act as a DDD expert. Using context CTX_ID: ddd_vo, model a Money value object.
```
❌ Unclear
```
Tell me something about value objects.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment