Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Nov 28, 2025

Summary

This PR adds support for JSON-formatted prompts alongside the existing TEXT prompt type. The webpage now dynamically displays prompts with appropriate formatting based on their type, with a JSON icon for JSON prompts and no badge for TEXT prompts.

Changes

CSV Structure:

  • Added a new type column to prompts.csv with values TEXT or JSON
  • All existing prompts default to TEXT type
  • Added 3 new JSON prompt examples: API Response Generator, Code Review Assistant, Data Transformer

Frontend (script.js):

  • Rewrote parseCSV() with a state-machine parser to properly handle quoted fields containing commas (fixes JSON content parsing)
  • Added formatJsonWithHighlighting() for JSON syntax highlighting with color-coded keys, strings, numbers, booleans, and null values
  • Added isValidJson() helper function
  • Updated createPromptCards() to render JSON prompts in <pre> tags with syntax highlighting
  • Updated showModal() to display JSON prompts with prettified/colored formatting (skips variable substitution for JSON)
  • Added JSON icon (curly braces SVG) for JSON prompts only; TEXT prompts show no badge
  • Updated buildPrompt() to append structured JSON preferences for JSON prompts instead of plain text
  • Fixed card copy button to pass raw JSON content for JSON prompts

Styling (style.css):

  • Added CSS for JSON icon with amber color
  • Added JSON content container styles with monospace font
  • Added syntax highlighting colors for JSON elements (keys=blue, strings=green, numbers=pink, booleans=blue)
  • Includes dark mode support for all new styles

CI/Linting:

  • Updated .github/workflows/csv_linter.yml to validate the new 4-column structure and validate type values (must be TEXT or JSON)

Documentation:

  • Added JSON prompt examples to README.md using blockquote format (consistent with existing prompts)

Updates Since Last Revision

  • Fixed CSV parsing bug: Replaced regex-based parser with state-machine parser to correctly handle JSON content containing commas
  • Removed TEXT badges: TEXT prompts now show no badge/icon (cleaner UI)
  • Added JSON icon: JSON prompts display a small curly braces {} icon instead of a text badge
  • Fixed modal JSON display: Modal now shows prettified, multi-line JSON with syntax highlighting
  • Fixed pipe character parsing: Escaped pipe characters (\|) in README JSON content to prevent Jekyll's markdown parser from interpreting them as table delimiters (was breaking the Code Review Assistant prompt)
  • Structured JSON preferences: For JSON prompts, language/tone/audience preferences are now appended as a structured JSON object ({"preferences": {"language": "...", "tone": "...", "for_developers": true/false}}) instead of plain text
  • Fixed card copy button for JSON prompts: The inline onclick handler now passes raw JSON content (not processed through updatePromptPreview) so that buildPrompt() correctly detects and handles JSON prompts

Human Review Checklist

  • Verify Gemfile.lock changes are acceptable (appear to be environment-related, not intentional)
  • Verify JSON icon displays correctly on JSON prompt cards (should show {} icon)
  • Verify TEXT prompts show NO badge or icon
  • Test JSON prompt rendering in browser (light and dark modes)
  • Verify existing TEXT prompts still render correctly
  • Check JSON syntax highlighting displays properly in modal view (multi-line, colored)
  • Verify the Code Review Assistant prompt renders correctly (pipe characters should display as high|medium|low, not as table cells)
  • Confirm CSV linter passes with new structure
  • Verify JSON prompts get structured preferences object when copied from CARD (not plain text)
  • Verify JSON prompts get structured preferences object when copied from MODAL (not plain text)
  • Verify TEXT prompts still get plain text preferences appended ("Reply in {language} using {tone} tone...")

Checklist

  • I've confirmed the prompt works well
  • I've added Contributed by: [@f](https://github.com/f) for new prompts
  • I've added to the README.md
  • I've added to the prompts.csv
    • Escaped quotes by double-quoting them
    • No spaces after commas after double quotes
    • Removed "Act as" from the title on CSV

Link to Devin run: https://app.devin.ai/sessions/c6825fd6dbfd4a86b6f479e586c68d9c
Requested by: Fatih Kadir Akın ([email protected]) / @f

devin-ai-integration bot and others added 2 commits November 28, 2025 09:06
Co-Authored-By: Fatih Kadir Akın <[email protected]>
- 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]>
@devin-ai-integration
Copy link
Contributor Author

Original prompt from Fatih Kadir Akın
Implement support for JSON prompts, alongside the existing TEXT prompt type. The webpage should dynamically display prompts as either JSON or TEXT based on their type.

- Add a mechanism to distinguish between JSON and TEXT prompt types.
- Modify the webpage to render prompts appropriately based on their identified type (e.g., using a JSON viewer for JSON prompts and plain text for TEXT prompts).
- Also README file should show prompts as JSON or TEXT as well.
- Add few simple JSON prompt example to README and the csv file.

To submit your work, please create a pull request. Test locally and use computer use to test.

You only need to look in the following repo: f/awesome-chatgpt-prompts

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@f f merged commit 9e8e579 into main Nov 29, 2025
5 checks passed
@f f deleted the devin/1764321159-json-prompt-support branch December 10, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants