Prompt

A shared tag with AI prompts and code snippets

From workspace: Replit

Team: AI Prompts

Total snippets: 79

Replit

Prompt

79 snippets

10. Deploy Finance Tracker App to Replit

Package and host full finance tracker with Flask and React on Replit.

Replit deployment steps: – Use Flask + React project setup – Move backend to `/backend`, frontend to `/frontend` – Add OpenAI key in `.env` – Run Flask + React servers – Validate app shows dashboard, accepts entries, and calls OpenAI

9. Enable Date Range Filtering in UI

Let users view expenses and summaries for custom date ranges.

Add date pickers in dashboard: – Filter shown expenses by start & end date – Update chart + AI summary accordingly Send selected range to `/expenses?from=...&to=...`

8. Display AI Weekly Summary in Dashboard

Show OpenAI-generated weekly spending summary in UI.

Add a new React section: – On load, call `/summary` endpoint – Show AI feedback (1–2 paragraphs) – Update automatically every Sunday

7. Use AI to Summarize Spending Behavior

Send expenses to OpenAI to get financial behavior feedback.

Create a new Flask endpoint `/summary`: – Reads `expenses.json` – Sends data to OpenAI Chat API with prompt: "Analyze this week's expenses. Highlight overspending, trends, and improvement tips." Return short paragraph summary.

6. Visualize Weekly Spending in React

Display all expenses grouped by category with totals.

Create a dashboard in React: – Show total spending this week – Show per-category totals – Use a chart or card layout Use `/expenses` endpoint to get data.

5. Store Expenses in Local JSON Format

Persist expenses on backend using a simple JSON file.

Update Flask logic to save submitted expenses to `expenses.json`. – On each POST: append to file – Add GET `/expenses` to return all Ensure file is created if not found.

4. Connect React Expense Form to Flask

Send submitted expenses from frontend to backend API.

Use Axios or Fetch to send expense data to `/expense`. Show: – Loading state while sending – Success confirmation – Reset form after submission

3. Create Flask Endpoint for Saving Expenses

Build a backend endpoint that receives and stores submitted expenses.

Create a Flask endpoint `/expense` that: – Accepts POST requests – Accepts JSON with amount, category, description – Stores in a local list or temporary variable – Returns confirmation response Enable CORS for localhost:3000.

2. Build Expense Input Form (React)

Create a form for users to add expense amount, category, and description.

Build a React component to add an expense. Fields: – Amount (number) – Category (dropdown: Food, Rent, Travel, Other) – Optional description – Submit button No backend integration yet.

1. Setup Finance Tracker Project Structure

Create frontend and backend folders for an AI-powered finance tracker app.

Create a project structure: /finance-tracker /frontend – React app /backend – Flask API Add a README: "Smart finance tracker that lets users input expenses, categorize them, and receive weekly AI-powered summaries."

9. Deploy Mental Journal App on Replit

Prepare and deploy the fullstack journaling app using Replit.

Guide for deploying to Replit: – Use Python + Node template – Set up `.env` with OpenAI key – Ensure Flask and React start properly – Use fetch with full paths or proxy – Test: Can user submit entry and see AI analysis?

8. Save Journal Entries Locally

Store past entries and feedback in localStorage for reflection.

Save each journal entry + mood + affirmations to localStorage. Show a sidebar list of past dates. When clicked, show full analysis again.

7. Render Sentiment Feedback in React

Display AI mood analysis and affirmations in the frontend.

After successful submission: – Show mood analysis – List emotional themes – Show AI-generated affirmations Use clean card layout and allow user to close feedback.

6. Generate Positive Affirmations

Use AI to generate daily affirmations based on journal themes.

Add OpenAI logic to return 2–3 affirmations based on journal tone/themes. Prompt format: "Generate 3 personalized affirmations for someone who feels {mood} about {themes}." Return as array of strings in JSON.

5. Analyze Sentiment and Tone with OpenAI

Use OpenAI API to analyze mood, tone, and themes of journal entry.

Extend the Flask endpoint to: – Use OpenAI's Chat API – Prompt: “Analyze this journal entry. Return mood, tone, and emotional themes.” – Return JSON like: { "mood": "Anxious but hopeful", "themes": ["uncertainty", "self-reflection", "growth"] }

5. Send Entry from React to Flask

Connect React form to Flask backend and send entry text.

Send journal entry to Flask `/entry` endpoint. Requirements: – Use Axios or Fetch with JSON body – Show 'sending' state – Confirm with success message after submission

3. Create Flask Endpoint to Receive Journal Entry

Build a Flask API to receive and store journal text for AI processing.

Create a Flask endpoint `/entry` that: – Accepts POST requests – Receives `entry_text` from JSON body – Logs it or saves to a temporary variable for now – Returns success JSON response Enable CORS for localhost:3000.

2. Build Journal Entry Form (React)

Create a React form for users to input daily journal entries.

Create a journal entry component in React. Features: – Textarea input with 500+ character limit – Submit button – Shows word count as user types Do not connect backend yet.

1. Setup Mental Health Journal App Structure

Create folder layout for React + Flask app for journaling and AI feedback.

Create a project directory with: /mental-journal /frontend – React app /backend – Flask API Add README with: "Mental Health Journal app that lets users write journal entries and receive AI-powered reflections and affirmations."

10. Deploy Resume Analyzer to Replit

Package and deploy full-stack app on Replit with environment variables.

Guide for deploying the Resume Analyzer on Replit: – Use Replit's Node + Python template – Move frontend into `/frontend` and backend in `/backend` – Add `.env` with OpenAI key – Use `flask run` + React dev server with proxy or manual fetch to...

9. Polish with Dark Mode & Branding

Add basic branding and light/dark mode toggle to the app.

Improve visual style of the Resume Analyzer app. – Add a logo – Add dark/light mode toggle – Use system preference by default – Apply consistent typography + spacing

8. Add Resume History & Local Storage

Store past resume feedback in local storage for quick access.

After each analysis, save the resume file name + feedback to localStorage. Display: – Recent resumes analyzed – Click to view past AI feedback without uploading again

7. Display AI Feedback in React

Render structured resume feedback in the frontend.

Add a feedback view in React that shows: – Strengths (bullet list) – Weaknesses (bullet list) – Suggested job roles Style the layout simply and show loading while waiting for AI response.

6. Send Resume Text to AI for Feedback

Send extracted resume text to OpenAI API and return summary.

Add AI analysis logic to Flask: – Use OpenAI's Chat API – Prompt: "Analyze this resume and give strengths, weaknesses, and job fit" – Use extracted text as input – Return feedback to frontend Keep API key secure in .env.

5. Add Resume Text Extraction in Flask

Extract text from uploaded .pdf or .txt file in Flask.

Extend the `/upload` Flask endpoint to: – If file is .txt → read with open() – If file is .pdf → extract text using `PyMuPDF` or `pdfminer.six` – Return extracted text in JSON: `{ text: "..." }`

4. Send Resume from React to Flask

Connect the React frontend to Flask backend for file uploads.

Using Axios or Fetch, send the uploaded file from React to Flask `/upload`. Requirements: – Use FormData – Show success or error message on response – Display loading state during upload

3. Create Flask API Endpoint for Resume Upload

Build a Flask endpoint to receive uploaded resume files.

Create a Flask endpoint `/upload` that: – Accepts POST requests – Accepts file via `request.files['resume']` – Saves file temporarily to disk – Returns success response with file name Enable CORS for localhost:3000 (React client).

2. Build Resume Upload Component (React)

Create a file input component in React for PDF or TXT resumes.

Build a React component for uploading a resume file. Requirements: – Accept only .pdf or .txt – Allow drag-and-drop and click-to-upload – Show filename preview once selected Do not yet send the file — just capture it.

1. Setup Resume Analyzer Project Structure

Create frontend and backend folders for a resume review app.

Create a new project directory with this structure: /resume-analyzer /frontend – React app /backend – Flask API Add a README.md with the project goal: "Analyze uploaded resumes using an AI backend and return job-fit suggestions."

Scan Bash Script for Insecure Practices

Check a Bash script for dangerous patterns or unsafe commands.

Review this Bash script. Find insecure command usage or practices. Script: #!/bin/bash FOLDER=$1 rm -rf $FOLDER

Validate JWT Usage in Auth Flow

Review use of JWTs for access control and storage strategy.

Review the security of this JWT usage. What’s good, what’s missing, what’s risky? Code: const token = jwt.sign({ id: user.id }, 'secret', { expiresIn: '1h' }); res.cookie('token', token);

Check for Insecure Password Storage

Review how passwords are stored and suggest secure practices.

Is this password storage safe? Suggest a secure alternative. Code: const users = []; function register(username, password) { users.push({ username, password }); }

Find XSS Vulnerability in Frontend Code

Check frontend code for potential XSS vectors and output sanitization.

Find potential XSS vulnerabilities in this code. Suggest fixes or best practices. Code: <input type="text" id="nameInput" /> <div id="greeting"></div> <script> const name = document.getElementById('nameInput').value; ...

Identify SQL Injection Risk

Detect and fix potential SQL injection in backend code.

Review this Python code for SQL injection risks. Suggest secure fixes using parameterized queries. Code: def get_user(email): query = f"SELECT * FROM users WHERE email = '{email}'" return db.execute(query)

Python Script to Rename Files in Bulk

Write a Python script to batch rename files with a prefix.

Write a script to: – Rename all `.txt` files in a folder – Add prefix 'renamed_' to each filename – Show before/after filenames Use pathlib or os.

Node CLI with Commander.js

Build a Node.js CLI tool using Commander.js.

Build a CLI in Node.js with Commander.js that: – Has a command `hello` that takes a `--name` flag – Prints `Hello, [name]!` Show install and run instructions too.

Write Shell Script to Monitor Disk Usage

Generate a shell script that sends a warning if disk usage exceeds 90%.

Create a shell script that: – Checks disk usage – Prints warning if > 90% – Can be run via cron Add comments for each part.

Python CLI with Argparse

Generate a Python CLI tool that accepts arguments using argparse.

Write a Python CLI that: – Accepts two numbers – Has a flag for addition or subtraction – Prints the result Use argparse for argument parsing.

Create Bash Script to Backup Folder

Write a Bash script to back up a folder into a timestamped archive.

Write a Bash script to: – Accept a folder path as an argument – Create a .tar.gz backup with a timestamp – Save it in a 'backups' directory Make the script safe and reusable.

Use Supabase JS to Insert a Row

Insert a new row using Supabase JavaScript client.

Use Supabase JavaScript client to insert a row. Table: profiles Fields: – id (auto) – username: 'alina' – website: 'https://snippets.ai' Include: – Setup client – Insert call – Handle result

Use BeautifulSoup to Scrape Links

Extract all hyperlinks from HTML using BeautifulSoup.

Use BeautifulSoup to extract all `<a href="">` links. HTML: <html> <body> <a href="https://example.com">Example</a> <a href="https://test.com">Test</a> </body> </html>

Use D3.js to Draw a Pie Chart

Draw a pie chart in D3.js with labels and colors.

Use D3.js to draw a simple pie chart. Data: [ {label: 'A', value: 30}, {label: 'B', value: 50}, {label: 'C', value: 20} ] Include: – Color legend – Percentage labels – SVG setup

Use SQLAlchemy to Define Models

Define a User and Post model using SQLAlchemy ORM.

Define SQLAlchemy models with relationships. Models: – User: id, name, email – Post: id, title, user_id (FK) Include: – Base class – One-to-many relationship – `__repr__` methods

Use TailwindCSS for Button Styles

Create a styled button using Tailwind utility classes.

Use Tailwind CSS to style a button. Style: – Blue background – White text – Rounded corners – Hover effect (darker blue) HTML: <button>Click Me</button>

Use Axios to Fetch API Data

Show how to fetch and log JSON data from an API with Axios.

Use Axios to: – Fetch data from https://jsonplaceholder.typicode.com/posts – Log first 3 post titles to the console – Handle fetch errors Explain each step.

Use Matplotlib to Plot Bar Chart

Plot a labeled bar chart using Matplotlib.

Use Matplotlib to create a bar chart. Data: products = ['A', 'B', 'C'] sales = [120, 300, 90] Chart should: – Show labels – Add title 'Product Sales' – Color bars Also show the final rendered chart.

Use Lodash to Manipulate Arrays

Demonstrate array filtering and transformation using Lodash.

Use Lodash to: – Remove falsy values – Sort array descending – Return only even numbers Input: [0, 1, false, 2, '', 3, 4]

Use Pandas to Clean a CSV

Show how to clean and transform a CSV using Pandas.

Show how to clean this CSV using Pandas. Tasks: – Remove rows with missing 'email' – Convert 'signup_date' to datetime – Filter users with 'active' == True Data: users.csv | id | email | signup_date | active...

Explain TypeScript Interface Usage

Describe what this TypeScript interface means and how it's used.

Explain this interface and how it might be used. Code: interface User { id: number; name: string; email?: string; } Include: – Optional fields – Common usage in function arguments

Explain Python List Comprehension

Explain how this list comprehension works and what it returns.

Explain what this list comprehension does. Code: nums = [1, 2, 3, 4, 5] squares = [x*x for x in nums if x % 2 == 0] Include: – How filtering works – Final result list

Explain What This Regex Does

Break down what this regex pattern matches and how.

Explain what this regex pattern does. Pattern: ^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$ Include: – Each group – Anchors – Common use case

Explain SQL Join Step by Step

Explain how this SQL query joins and filters the data.

Explain this SQL query step by step. Include: – What the JOIN is doing – How WHERE affects the result – Final output rows Query: SELECT u.name, o.total FROM users u JOIN orders o ON u.id = o.user_id WHERE o.total > 100;

Explain Async Function Behavior

Break down how an async JavaScript function executes.

Explain how this async function runs. Include: – What promises are doing – What is awaited and when – Final output order Code: async function fetchData() { const user = await getUser(); const posts = await getPosts(user.id); return {...

Explain Python Recursion Line by Line

Explain a recursive Python function line by line in plain English.

Explain this recursive function line by line. Goal: – Help beginners understand how recursion works – Include base and recursive case flow Code: def factorial(n): if n == 0: return 1 return n * factorial(n - 1)

Refactor Callback Hell to Async/Await

Convert deeply nested callbacks into async/await syntax.

This code uses nested callbacks. Refactor using async/await. Code: getUser(id, function(user) { getSettings(user, function(settings) { saveData(user, settings, function(response) { console.log('Done'); }); ...

Refactor Global State Into Class

Encapsulate global variables and functions into a class.

This code uses global state. Refactor by moving everything into a class. Code: settings = {'theme': 'dark'} def get_theme(): return settings['theme'] def set_theme(t): settings['theme'] = t

Convert For Loop to Map/Filter

Simplify a loop using functional programming methods.

Convert the loop to a functional style using `map` or `filter`. Code: names = ['Alice', 'Bob', 'Charlie'] upper = [] for name in names: if len(name) > 3: upper.append(name.upper())

Extract Method from Repeated Code

Identify repeated logic and move it to a separate method.

Refactor by extracting common logic into a new helper method. Code: public class Report { public void printDaily() { System.out.println("==== Report Start ===="); System.out.println("Date: " + today()); ...

Convert Nested If Statements to Guard Clauses

Refactor nested if conditions into cleaner early returns.

Refactor this function by replacing deep `if` nesting with guard clauses. Goal: reduce cognitive load and improve structure. Code: function processOrder(order) { if (order) { if (order.items.length > 0) { if...

Refactor Long Function to Smaller Functions

Split a long function into smaller, readable, reusable units.

Refactor this long function into smaller helper functions. Goals: – Improve readability – Make code easier to test – Avoid repetition Code: def process_user_data(user): if '@' not in user['email']: raise ValueError('Invalid email') ...

Add Edge Case Tests for Sorting Function

Add edge case tests for a sorting algorithm.

Add test cases for this sorting function. Cover: – Empty list – One item – Already sorted – Repeated values Code: def sort_numbers(arr): return sorted(arr)

Test Async Function in JavaScript

Write test cases for an async function that fetches data.

Write Jest tests for this async function. Mock `fetch()` and test: – Successful fetch – 404 or error case – Bad JSON structure Code: async function fetchUser(id) { const res = await fetch(`/api/users/${id}`); const data = await...

Test Validation Logic in Node.js

Create unit tests for backend validation logic in a Node.js function.

Write unit tests using `Jest` for this validation function. Test cases: – Missing fields – Invalid email – Age < 18 – Valid input Code: function validateForm(data) { if (!data.email.includes('@')) return false; if (data.age < 18) return...

Add Integration Test for Flask Route

Write an integration test for a Flask endpoint using Flask's test client.

Write an integration test for this Flask route using `app.test_client()`. Test: – Valid credentials – Wrong credentials – Status codes – JSON response Code: @app.route('/login', methods=['POST']) def login(): data = request.get_json() if...

Test SQL Query Edge Cases

List test cases to validate behavior of SQL logic for edge input.

You are testing the following SQL query. List: – Input scenarios to test (e.g. totals = 100, NULLs) – Edge logic that may fail – Verification method for expected results Query: SELECT * FROM orders WHERE total > 100 AND status = 'confirmed';

Test Coverage Suggestions

Review a function and suggest missing test cases.

You are reviewing this function for test coverage. Identify: – Edge cases not covered – Unexpected or null input – Suggestions for improved testing Code: def format_price(value): if value is None: return "N/A" return...

Unit Tests for Python Function

Generate comprehensive unit tests for a given Python function using

You are given a Python function. Write unit tests using `pytest`. Cover: – Valid input – Invalid input – Edge cases (e.g. empty lists, negative numbers) – Exceptions and assertions Code: def divide_numbers(a, b): return a / b

Avoid KeyError in Flask Form

Fix a Flask bug where missing form data causes a crash.

This line throws a KeyError if the 'username' field is missing. Make it safe while preserving access to the form. Code: username = request.form['username']

Fix Panic in Go Slice Access

Avoid panic due to accessing uninitialized slice in Go.

This Go code panics due to accessing an empty slice. Explain what causes it and rewrite it with a safe guard. Code: package main import "fmt" func main() { var arr []int fmt.Println(arr[0]) }

Handle None Input in Python

Fix function that crashes when input is None

This function crashes when given `None` instead of a list. Add type checking and make it safe for invalid input. Code: def find_even(numbers): for i in range(len(numbers)): if numbers[i] % 2 == 0: return i return...

Component Render Error

Fix undefined function error in a React component.

This React component throws an "undefined is not a function" error. Debug the root cause and rewrite to prevent runtime failure. Component: function MyComponent({ items }) { return ( <ul> {items.map(item =>...

Overfetching SQL Join Bug

Fix SQL join that returns more rows than expected.

This SQL query returns more rows than expected. Investigate: – Is there a join mismatch or missing constraint? – Are duplicates introduced via many-to-one? Rewrite the query to fetch only distinct user-order pairs. Query: SELECT users.name,...

Fix Closure Bug in JavaScript Loop

Diagnose a classic closure issue in a loop using setTimeout.

This JavaScript loop prints `5` five times instead of `0, 1, 2, 3, 4`. Explain why and rewrite it to fix the closure issue. Code: for (var i = 0; i < 5; i++) { setTimeout(() => console.log(i), 100); }

POST Route Crashing in Node.js

Find the issue causing an Express route to crash on POST request.

This Node.js Express route crashes when a POST request is made. Debug the issue and return a corrected, secure version. Check: – req.body may be undefined if middleware is missing – Handle missing input gracefully Code: app.post('/submit',...

Fix TypeError in Python Function

Debug a TypeError caused by incompatible data types in a function.

Analyze the following Python function that raises a `TypeError` during execution. Add inline explanation and rewrite the fixed version. Example: – Understand cause of failure from traceback – Suggest type-safe handling Code: def add_items(a,...

server-side logic

Set up the server-side logic. Implement user authentication (signup/login) and create an API endpoint to retrieve user profile data securely.

Add animation

Animate the main image on the landing page so it gently fades in when the page first loads to create a welcoming effect.

Refactor the data processing function

Refactor the data processing function to handle larger inputs more efficiently. Could we use a different algorithm or data structure?

Simple portfolio website

Create a simple portfolio website. It needs sections for Home, About Me, and a Contact Form. Use a clean, modern design theme and placeholder content.

Replit - Prompt - AI Prompts & Code Snippets | Snippets AI