Replit Ghostwriter interface in browser showing AI code completions and chat panel
# ai coding tools# replit

Replit Ghostwriter Tutorial: AI Coding in Your Browser

Replit Ghostwriter is Replit's integrated AI coding assistant. It lives inside the Replit browser IDE and provides AI completions, chat assistance, code explanation, and bug fixing — all without leaving your browser or setting up a local development environment.

This tutorial covers how Ghostwriter works, how to get the most out of it, and how it fits into a real development workflow.

What Is Replit Ghostwriter?

Ghostwriter is the AI layer built into Replit's IDE. It's distinct from Replit AI Agent — Ghostwriter assists you as you write code, while Agent takes autonomous actions. Think of Ghostwriter as your AI pair programmer and Agent as an autonomous developer you can delegate tasks to.

Ghostwriter includes:

  • Code completion — real-time suggestions as you type
  • Ghostwriter Chat — a panel for asking questions and getting code-aware help
  • Explain Code — select any code and get a plain-English explanation
  • Transform Code — describe a change and Ghostwriter rewrites the selected block
  • Generate Code — describe what you want and Ghostwriter writes it

Getting Started

Ghostwriter is available on Replit's paid plans. Once you're in a Repl, you'll see the Ghostwriter panel in the right sidebar. Enable completions from the settings if they're not already on.

If you're new to Replit itself, see what is Replit for an introduction to the platform.

Code Completion

As you type, Ghostwriter suggests completions in greyed-out text. Press Tab to accept. The suggestions are context-aware — Ghostwriter reads your open file and understands what you're building.

Tips for better completions:

  • Write a descriptive comment before a function you're about to write — Ghostwriter reads the comment and tailors the completion
  • Accept partial completions and keep typing to refine them
  • If the suggestion is close but not quite right, keep typing to direct it
// Fetch users from the database, filter by active status, sort by created date
async function getActiveUsers() {
  // Ghostwriter will suggest the implementation here

Ghostwriter Chat

Press the chat icon or use the keyboard shortcut to open the chat panel. You can ask questions about your code, request changes, or get explanations.

Example prompts:

  • "Explain what this middleware does and why the order matters"
  • "This function is supposed to calculate the total price including tax — what's wrong with it?"
  • "Write a function that validates an email address without using regex"
  • "What are the security implications of using eval() here?"

Ghostwriter can see the code in your open file, so responses are relevant to what you're actually working on.

Explain Code

Select any block of code, right-click, and choose "Explain Code" (or use the shortcut). Ghostwriter gives you a plain-English breakdown of what the code does, step by step.

This is particularly valuable when:

  • Working with code you didn't write
  • Reviewing AI-generated code before using it
  • Learning a new language or framework by examining examples

Transform Code

Select code and use the Transform feature to describe a change:

  • "Add input validation that throws an error if any value is null"
  • "Convert this callback-based code to use async/await"
  • "Add JSDoc comments to all function parameters"
  • "Optimise this loop — it's running O(n²)"

Ghostwriter rewrites the selected block. Review the change before accepting — like any AI output, it can introduce errors, especially on complex transformations.

Generate Code

Use Generate when you want Ghostwriter to write something from scratch based on a description:

Generate a middleware function for Express that:
- Reads a Bearer token from the Authorization header
- Validates it against the ADMIN_TOKEN environment variable
- Returns 401 if missing or invalid
- Passes to next() if valid

The more detail you include in the description, the closer the generated code will be to what you actually need.

Language Support

Ghostwriter supports all the languages available on Replit — JavaScript, TypeScript, Python, Go, Ruby, PHP, Java, C++, and many more. The quality of suggestions varies by language (JavaScript and Python get the most training data), but it's useful across all of them.

Ghostwriter vs Replit Agent

Use Ghostwriter when you want to write code yourself with AI assistance — completions, targeted refactoring, quick answers.

Use Replit Agent when you want to describe a complete feature or app and let AI build it autonomously.

Most productive Replit workflows use both — Agent for scaffolding and building, Ghostwriter for day-to-day coding and fixes.

Deploying and Monitoring

Once your project is ready, Replit's one-click deployment gets it live quickly. See our Replit AI deployment guide for what to do after you deploy.

Your deployed app needs monitoring. Domain Monitor checks your Replit app every minute and alerts you if it goes down. Our guide to monitoring your published Replit app walks through the setup.

More posts

What Is Generative AI? How It Works and What It Creates

Generative AI creates new content — text, images, code, and more. This guide explains how it works, what tools are available, and where it's genuinely useful versus overhyped.

Read more
What Is Cursor AI? The AI Code Editor Explained

Cursor AI is an AI-powered code editor built on VS Code. Learn what it does, how it works, and whether it's the right tool for your development workflow.

Read more
What Is Claude Opus? Anthropic's Most Powerful Model Explained

Claude Opus is Anthropic's most capable AI model, built for complex reasoning and demanding tasks. Learn what it does, how it compares, and when to use it.

Read more

Subscribe to our PRO plan.

Looking to monitor your website and domains? Join our platform and start today.