Replit AI Tips & Prompts — Code Faster

Replit has evolved from a simple online IDE into one of the most accessible AI-powered development platforms available. Its AI Agent can build entire applications from a natural language description, while Ghostwriter provides inline code completion, chat-based assistance, and code explanation as you work. The key to getting good results from Replit's AI is understanding that it works best with clear, specific project descriptions rather than vague ideas. Instead of "build me a todo app," try "Build a task management app with Next.js and SQLite. Include user authentication, task categories with color labels, due dates with calendar picker, and a drag-and-drop kanban board view. Use Tailwind CSS for styling with a dark mode toggle." The more specific you are upfront, the fewer iterations you need.

Replit Agent excels at project scaffolding and full-stack generation, but it works best when you break complex projects into phases. Start with the core data model and basic UI, verify that works, then ask the agent to add features incrementally. Trying to describe an entire complex application in one prompt often leads to inconsistencies that are harder to fix than building iteratively. For debugging, give the agent the exact error message, the file it occurred in, and what you expected to happen. Replit's agent can read your project files, so reference specific file names and function names when asking for help.

Ghostwriter's inline completions improve significantly when your code is well-structured with clear naming conventions and comments. If you write a descriptive comment before a function, Ghostwriter will use it as context for generating the implementation. For the chat feature, treat it like a knowledgeable pair programmer — ask it to explain unfamiliar code, suggest optimizations, or generate test cases. Save your best Replit prompts — the project descriptions that produced clean scaffolds, the debugging prompts that consistently identified issues, and the feature request formats that resulted in working code on the first try.

Copy-Ready Replit Prompts

Prompts optimized for Replit Agent and Ghostwriter. Copy, fill in your project details, and start building.

Project Scaffold

Build a {{project_type}} application with the following specifications:

**Tech stack:** {{tech_stack}}
**Core features:**
{{feature_list}}

**Requirements:**
- Set up the project structure with clear separation of concerns
- Include a README with setup instructions
- Add environment variable handling (.env with example file)
- Set up the database schema and seed data
- Include basic error handling and loading states
- Make it mobile-responsive from the start

Start with the data model and core CRUD operations, then build the UI on top. Use sensible defaults for styling. Do NOT add authentication yet — I'll request that separately.
project_typetech_stackfeature_list

Why it works: Replit Agent builds better scaffolds when given explicit architecture guidance. Telling it to start with the data model prevents the common failure of building UI first with no backend, and deferring auth avoids overcomplicating the initial generation.

Debugging Assistant

I'm getting this error in my Replit project:

**Error message:**
```
{{error_message}}
```

**File where it occurs:** {{file_path}}
**What I was trying to do:** {{intended_behavior}}
**What actually happens:** {{actual_behavior}}

Please:
1. Explain what's causing this error in plain language
2. Show me the exact fix (the specific lines to change)
3. Explain why the fix works
4. Tell me if there are related issues I should check for — this type of error often comes with other problems

Don't rewrite the entire file. Just show me the targeted changes needed.
error_messagefile_pathintended_behavioractual_behavior

Why it works: Replit Agent can read your project files, so giving it the exact error, file path, and expected vs. actual behavior lets it pinpoint the issue. Asking for targeted changes instead of full rewrites prevents the agent from introducing new bugs.

Deployment Checklist

My {{framework}} application on Replit is ready for deployment. Run through a pre-deployment checklist:

1. **Environment variables** — List all env vars the app needs and verify they're set in Replit Secrets
2. **Database** — Verify the database is configured for production (connection pooling, migrations applied)
3. **Security** — Check for: exposed API keys, CORS configuration, input validation, SQL injection risks, XSS vulnerabilities
4. **Performance** — Review for: N+1 queries, missing indexes, unoptimized images, bundle size
5. **Error handling** — Verify all API routes have proper error responses (not raw stack traces)
6. **SEO & Meta** — Check title tags, meta descriptions, Open Graph tags
7. **.replit config** — Verify the run command and ports are configured correctly

For each issue found, provide the exact fix. Prioritize by severity (critical > important > nice-to-have).
framework

Why it works: Deployment on Replit has unique configuration requirements (.replit file, Secrets management, port binding). This prompt walks through platform-specific checks that generic deployment checklists miss.

Database Setup

Set up a {{database_type}} database for my Replit project.

Application context: {{app_description}}

I need:
1. **Schema design** — Tables/collections with fields, types, relationships, and indexes. Include created_at/updated_at timestamps on all tables.
2. **Migration file** — SQL or ORM migration code to create the schema
3. **Seed data** — Realistic sample data (at least 5 records per table) for development
4. **Connection setup** — The database client configuration using Replit's database URL from environment variables
5. **CRUD helpers** — Basic create, read, update, delete functions for each main entity
6. **Type definitions** — TypeScript types/interfaces matching the schema

Use {{orm_or_driver}} for the database layer. Handle connection errors gracefully.
database_typeapp_descriptionorm_or_driver

Why it works: Database setup on Replit requires specific connection handling (environment-based URLs, connection pooling for serverless). Including seed data and type definitions from the start prevents the painful iteration of building these after the fact.

API Creation

Create a REST API for {{resource_name}} in my {{framework}} project on Replit.

Data model:
{{data_model}}

Build these endpoints:
- GET /api/{{resource_name}} — List all (with pagination: page, limit, sort)
- GET /api/{{resource_name}}/:id — Get one by ID
- POST /api/{{resource_name}} — Create new (with input validation)
- PUT /api/{{resource_name}}/:id — Update existing (partial updates allowed)
- DELETE /api/{{resource_name}}/:id — Soft delete (set deleted_at, don't remove)

For each endpoint include:
- Input validation with clear error messages
- Proper HTTP status codes (200, 201, 400, 404, 500)
- Consistent response format: { success: boolean, data: ..., error?: string }
- TypeScript types for request and response bodies

Add a simple test you can run with curl to verify each endpoint works.
resource_nameframeworkdata_model

Why it works: Specifying the exact response format, pagination pattern, and soft-delete strategy up front produces a consistent API. The curl test commands let you immediately verify the endpoints work in Replit's shell.

Collaborative Coding Session

I'm working on {{feature_description}} in my Replit project and I want you to act as my pair programmer.

Current state of the code:
- {{current_state}}

What I want to achieve:
- {{goal}}

Rules for our session:
1. Before writing any code, briefly explain your approach (2-3 sentences max)
2. Write code in small, testable chunks — not entire files at once
3. After each chunk, tell me how to verify it works
4. If you see existing code that should be refactored to support the new feature, ask before changing it
5. Flag any architectural decisions that have long-term implications
6. Use the existing code style and patterns — don't introduce new conventions

Let's start. What's your approach and what's the first chunk of code?
feature_descriptioncurrent_stategoal

Why it works: Treating Replit Agent as a pair programmer with explicit rules about chunk size and verification creates an iterative workflow. The "ask before refactoring" rule prevents the agent from rewriting working code unnecessarily.