Skip to content

Commit a584a3a

Browse files
Add support for JSON prompts alongside TEXT prompt type
- Add 'type' column to prompts.csv to distinguish JSON vs TEXT prompts - Update script.js to render JSON prompts with syntax highlighting - Add JSON type badge to prompt cards - Update showModal to handle JSON prompts properly - Add CSS styles for JSON syntax highlighting and type badges - Add 3 JSON prompt examples (API Response Generator, Code Review Assistant, Data Transformer) - Update CSV linter workflow to validate the new 'type' column - Update README.md with JSON prompt examples using code blocks Co-Authored-By: Fatih Kadir Akın <[email protected]>
1 parent 9f788de commit a584a3a

File tree

5 files changed

+493
-233
lines changed

5 files changed

+493
-233
lines changed

.github/workflows/csv_linter.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,21 @@ jobs:
3737
with open("prompts.csv", "r", encoding="utf-8") as f:
3838
reader = csv.reader(f)
3939
headers = next(reader)
40-
if headers != ["act", "prompt", "for_devs"]:
41-
print("Error: CSV headers must be exactly [act, prompt, for_devs]")
40+
if headers != ["act", "prompt", "for_devs", "type"]:
41+
print("Error: CSV headers must be exactly [act, prompt, for_devs, type]")
4242
exit(1)
43-
for row_num, row in enumerate(reader, 3):
44-
if len(row) != 3:
45-
print(f"Error: Row {row_num} has {len(row)} columns, expected 2")
43+
valid_types = ["TEXT", "JSON"]
44+
for row_num, row in enumerate(reader, 2):
45+
if len(row) != 4:
46+
print(f"Error: Row {row_num} has {len(row)} columns, expected 4")
4647
exit(1)
47-
if not row[0] or not row[1] or not row[2]:
48+
if not row[0] or not row[1] or not row[2] or not row[3]:
4849
print(f"Error: Row {row_num} has empty values")
4950
exit(1)
51+
if row[3] not in valid_types:
52+
print(f"Error: Row {row_num} has invalid type \"{row[3]}\". Must be TEXT or JSON")
53+
exit(1)
54+
print("CSV format OK")
5055
'; then
5156
echo "::error::CSV format check failed"
5257
exit 1

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,6 +2788,85 @@ Contributed by: [@ErdagEge](https://github.com/ErdagEge)
27882788
> Your tone should be friendly, patient and curiosity-driven-making difficult topics feel
27892789
> intuitive, engaging and interesting.
27902790
2791+
## Act as API Response Generator (JSON)
2792+
2793+
Contributed by: [@f](https://github.com/f)
2794+
2795+
```json
2796+
{
2797+
"role": "API Response Generator",
2798+
"task": "Generate realistic API responses",
2799+
"input": {
2800+
"endpoint": "/api/users",
2801+
"method": "GET",
2802+
"description": "Return a list of users with pagination"
2803+
},
2804+
"output_format": {
2805+
"success": true,
2806+
"data": [],
2807+
"pagination": {
2808+
"page": 1,
2809+
"limit": 10,
2810+
"total": 0
2811+
}
2812+
},
2813+
"instructions": "Generate realistic mock data following this schema"
2814+
}
2815+
```
2816+
2817+
## Act as Code Review Assistant (JSON)
2818+
2819+
Contributed by: [@f](https://github.com/f)
2820+
2821+
```json
2822+
{
2823+
"role": "Code Review Assistant",
2824+
"context": {
2825+
"language": "JavaScript",
2826+
"framework": "React",
2827+
"focus_areas": ["performance", "security", "best_practices"]
2828+
},
2829+
"review_format": {
2830+
"severity": "high|medium|low",
2831+
"category": "string",
2832+
"line_number": "number",
2833+
"suggestion": "string",
2834+
"code_example": "string"
2835+
},
2836+
"instructions": "Review the provided code and return findings in the specified JSON format"
2837+
}
2838+
```
2839+
2840+
## Act as Data Transformer (JSON)
2841+
2842+
Contributed by: [@f](https://github.com/f)
2843+
2844+
```json
2845+
{
2846+
"role": "Data Transformer",
2847+
"input_schema": {
2848+
"type": "array",
2849+
"items": {
2850+
"name": "string",
2851+
"email": "string",
2852+
"age": "number"
2853+
}
2854+
},
2855+
"output_schema": {
2856+
"type": "object",
2857+
"properties": {
2858+
"users_by_age_group": {
2859+
"under_18": [],
2860+
"18_to_30": [],
2861+
"over_30": []
2862+
},
2863+
"total_count": "number"
2864+
}
2865+
},
2866+
"instructions": "Transform the input data according to the output schema"
2867+
}
2868+
```
2869+
27912870
## Contributors 😍
27922871

27932872
Many thanks to these AI whisperers:

0 commit comments

Comments
 (0)