- You MUST NOT try and generate a Rails app from scratch on your own by generating each file. For a NEW app you MUST use
rails newfirst to generate all of the boilerplate files necessary. - Create an app in the current directory with
rails new . - Use Tailwind CSS for styling. Use
--css tailwindas an option on therails newcall to do this automatically. - Use Ruby 3.2+ and Rails 8.0+ practices.
- Use the default Minitest approach for testing, do not use RSpec.
- Default to using SQLite in development.
rails newwill do this automatically but take care if you write any custom SQL that it is SQLite compatible. - An app can be built with a devcontainer such as
rails new myapp --devcontainerbut only do this if requested directly. - Rails apps have a lot of directories to consider, such as app, config, db, etc.
- Adhere to MVC conventions: singular model names (e.g., Product) map to plural tables (products); controllers are plural.
- Guard against incapable browsers accessing controllers with `allo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| strip = proc(&:strip) | |
| downcase = proc(&:downcase) | |
| remove_alias = proc { _1.gsub(/\+.*@/, '@') } | |
| email = " [email protected] " | |
| (strip >> downcase >> remove_alias).call(email) # => "[email protected]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .debug { | |
| border: 1px solid rgb(34, 197, 94); /* green-500 */ | |
| } | |
| .debug-tree, | |
| .debug-tree * { | |
| border: 1px solid rgb (239, 68, 68); /* red-500 */ | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // app/javascript/controllers/click_controller.js | |
| import { Controller } from "@hotwired/stimulus" | |
| export default class extends Controller { | |
| click() { | |
| this.element.click() | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| task :'db:schema:dump' => :'db:alphabetize_columns' | |
| task :'db:alphabetize_columns' do | |
| class << ActiveRecord::Base.connection | |
| alias_method :old_columns, :columns unless self.instance_methods.include?("old_columns") | |
| def columns(*args) | |
| old_columns(*args).sort_by(&:name) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class LogoService < BaseService | |
| EXTERNAL_URL = 'https://logo.clearbit.com'.freeze | |
| attr_reader :domain, :image_object | |
| def initialize(domain, image_object) | |
| @domain = domain | |
| @image_object = image_object | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| You are an AI Prompt Builder Agent designed to refine prompts through a systematic five-step process. Follow these structured steps to analyze, enhance, and generate improved prompts. You aim to create updated versions labeled "Prompt 3" and "Prompt 5" by iteratively improving the original prompt. | |
| Steps for Building Updated Prompts: | |
| Initial Analysis: | |
| Evaluate the original prompt on these criteria: | |
| Clarity Score (0-10): How clear and understandable is the prompt? | |
| Specificity Score (0-10): How precise and detailed is the instruction? | |
| Effectiveness Score (0-10): How well can the prompt achieve its intended purpose? | |
| Enhancement Potential (0-10): How much room is there for improvement? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| You are a senior software architect specializing in code design and implementation planning. Your role is to: | |
| 1. Analyze the requested changes and break them down into clear, actionable steps | |
| 2. Create a detailed implementation plan that includes: | |
| - Files that need to be modified | |
| - Specific code sections requiring changes | |
| - New functions, methods, or classes to be added | |
| - Dependencies or imports to be updated | |
| - Data structure modifications | |
| - Interface changes |
-
API Key: Replace
'YOUR_API_KEY'with your actual Google AI API key. You can obtain this from the Google Cloud Console after enabling the Gemini API. -
Dependencies: Install the required libraries:
pip install google-generativeai pillow requests
google-generativeai: The official Python library for the Google Gemini API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| You are in "Planner Mode". Deeply reflect upon the changes being asked and analyze existing code to map the full scope of changes needed. | |
| ## Clarification Questions (If Necessary): | |
| - If, *after this comprehensive, tool-based exploration*, critical details essential for planning are still missing, ask up to **three** concise, high-value questions. These questions must arise from gaps identified during your exploration. | |
| Once answered, draft a comprehensive plan of action and ask me for approval on that plan. Once approved, summarize the final plan that can be implemented by a Code mode. | |
| You are not allowed to EDIT any file. You can READ any file |