Identify and avoid Replit anti-patterns and common integration mistakes. Use when reviewing Replit code for issues, onboarding new developers, or auditing existing Replit integrations for best practices violations. Trigger with phrases like "replit mistakes", "replit anti-patterns", "replit pitfalls", "replit what not to do", "replit code review".
From replit-packnpx claudepluginhub nickloveinvesting/nick-love-plugins --plugin replit-packThis skill is limited to using the following tools:
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Details PluginEval's skill quality evaluation: 3 layers (static, LLM judge), 10 dimensions, rubrics, formulas, anti-patterns, badges. Use to interpret scores, improve triggering, calibrate thresholds.
Real gotchas when building on Replit's cloud development platform. Replit's ephemeral container model, Nix-based environment, and always-on hosting create specific failure patterns that differ from traditional deployment.
.replit and replit.nix configurationReplit containers reset on sleep. Files written outside persistent storage are lost.
# BAD: writing to local filesystem for persistence
with open("user_data.json", "w") as f:
json.dump(data, f) # GONE when container sleeps
# GOOD: use Replit's key-value database or external storage
from replit import db
db["user_data"] = json.dumps(data)
# Or use Replit Object Storage for files
from replit.object_storage import Client
client = Client()
client.upload_from_text("user_data.json", json.dumps(data))
Free and Hacker plans sleep after inactivity. Cold starts take 10-30 seconds.
# BAD: assuming server is always running
# Cron jobs and webhooks fail when container is asleep
# GOOD: use Replit Deployments for always-on, or handle cold starts
import time
startup_time = time.time()
@app.route('/health')
def health():
uptime = time.time() - startup_time
return {"status": "ok", "uptime_seconds": uptime}
# Use external cron (e.g., cron-job.org) to ping /health every 5 min
# Or upgrade to Always On / Deployments
Replit assigns ports dynamically. Hardcoding causes binding failures.
# BAD: hardcoded port
app.run(host='0.0.0.0', port=3000) # 3000: may conflict
# GOOD: use environment variable
import os
port = int(os.environ.get('PORT', 3000)) # 3 seconds in ms
app.run(host='0.0.0.0', port=port)
Missing system packages in replit.nix cause cryptic build failures.
# replit.nix - BAD: missing system deps for Python packages
{ pkgs }: {
deps = [ pkgs.python311 ]; # PIL/Pillow will fail to build
}
# GOOD: include system libraries
{ pkgs }: {
deps = [
pkgs.python311
pkgs.zlib
pkgs.libjpeg
pkgs.libffi
pkgs.openssl
];
}
Replit's built-in database has a 50MB limit. Large datasets need external storage.
from replit import db
# BAD: storing large blobs in Replit DB
db["images"] = base64_encoded_images # hits 50MB fast
# GOOD: use Replit DB for metadata, external storage for blobs
db["image_refs"] = json.dumps({"count": 100, "bucket": "s3://my-bucket"})
# Store actual files in Replit Object Storage or external S3
| Issue | Cause | Solution |
|---|---|---|
| Data lost on restart | Writing to ephemeral filesystem | Use Replit DB or Object Storage |
| Webhooks timing out | Container sleeping | Use Deployments for always-on |
| Port binding error | Hardcoded port number | Read from PORT env var |
| Build failures | Missing Nix system packages | Add to replit.nix deps |
| DB write failures | Exceeded 50MB limit | Migrate large data to external storage |
# .replit
run = "python main.py"
entrypoint = "main.py"
[env]
PYTHONPATH = "${REPL_HOME}"
[deployment]
run = "python main.py"
deploymentTarget = "cloudrun"