Logo
Getting Started

Developer Docs

Framework-specific prompting strategies for Next.js, Python, Gradio, and Streamlit development. Accelerate your development with proven AI prompts.
Framework-Focused Prompts: Specialized prompt patterns for Next.js, Python, Gradio, and Streamlit development. Copy, modify, and use these templates to build better applications faster.

Overview

This library provides targeted prompting strategies for specific development frameworks. Each section contains proven patterns, best practices, and ready-to-use prompts tailored to the unique characteristics of each technology stack.

Pro Tip: These prompts are designed to work with any AI coding assistant. Adapt the examples to your specific project needs.

Frameworks

Next.js Development

Full-stack React framework with SSR, API routes, and modern tooling.

React TypeScript Full-Stack

Python Development

Backend services, data processing, and general-purpose applications.

Backend Data Science APIs

Gradio Development

Rapid ML model deployment and interactive data science applications.

ML/AI Interactive Prototyping

Streamlit Development

Data apps and dashboards with Python-first development approach.

Data Apps Dashboards Analytics


Next.js Development

Modern React framework with server-side rendering, API routes, and optimized performance.

Project Setup & Architecture

Create a new Next.js 14 application with the following specifications:

**Tech Stack:**
- Next.js 14 with App Router
- TypeScript for type safety
- Tailwind CSS for styling
- Prisma with PostgreSQL for database
- NextAuth.js for authentication

**Project Structure:**
- `/app` directory structure with proper layouts
- `/components` for reusable UI components
- `/lib` for utilities and database configuration
- `/types` for TypeScript definitions

**Initial Features:**
- Landing page with hero section and navigation
- User authentication (sign up, login, logout)
- Protected dashboard route
- Responsive design with dark mode support

Set up the basic project structure and create placeholder components for each feature.

API Routes & Server Components

Create Next.js 14 API route handlers for a [describe resource] with:

**Endpoints:**
- GET /api/[resource] - List all items with pagination
- GET /api/[resource]/[id] - Get single item
- POST /api/[resource] - Create new item
- PUT /api/[resource]/[id] - Update existing item
- DELETE /api/[resource]/[id] - Delete item

**Requirements:**
- TypeScript with proper request/response typing
- Input validation using Zod schemas
- Error handling with appropriate HTTP status codes
- Database operations with Prisma ORM
- Authentication middleware integration
- Rate limiting for production use

Include proper error responses and success messages.

Authentication & Security

Implement authentication using NextAuth.js v5 with:

**Providers:**
- Email/password authentication
- Google OAuth integration
- GitHub OAuth integration
- Magic link email authentication

**Database Integration:**
- User model with Prisma
- Session management
- Account linking
- Role-based access control

**Security Features:**
- CSRF protection
- Secure session cookies
- Password hashing with bcrypt
- Email verification flow

**UI Components:**
- Login/signup forms with validation
- Password reset functionality
- Profile management page
- Protected route middleware

Include the complete auth configuration and key components.

Performance & SEO

Implement Next.js image optimization for a [describe app type]:

**Image Component Usage:**
- Responsive images with proper sizing
- Lazy loading with intersection observer
- Placeholder blur effects
- Art direction for different breakpoints

**Performance Optimization:**
- WebP/AVIF format conversion
- Proper width and height specifications
- Priority loading for above-the-fold images
- Image caching strategies

**Implementation:**
- Gallery component with optimized images
- Avatar upload with automatic resizing
- Product image carousel
- Background images with Next.js Image

Include examples of different image use cases with proper configuration.

Python Development

Versatile programming language for backend services, data processing, and automation.

Web APIs & Backend Services

Create a FastAPI application for [describe purpose] with:

**Project Structure:**
- Modular architecture with separate routers
- Database models with SQLAlchemy
- Pydantic models for request/response validation
- Dependency injection for database sessions
- Authentication and authorization system

**Features:**
- CRUD operations for [main entities]
- User authentication with JWT tokens
- File upload and processing
- Background tasks with Celery
- API documentation with automatic OpenAPI

**Database:**
- PostgreSQL with asyncpg driver
- Alembic migrations
- Connection pooling
- Database indexing strategy

Include the main application file, models, and key router examples.

Data Processing & Analysis

Create a data processing pipeline using pandas for [describe data type]:

**Data Ingestion:**
- Read from multiple sources (CSV, JSON, API, database)
- Handle different file formats and encodings
- Data validation and quality checks
- Error handling for malformed data

**Data Transformation:**
- Clean and standardize data formats
- Handle missing values appropriately
- Create derived columns and calculations
- Aggregate data for analysis
- Merge and join datasets

**Data Export:**
- Export to different formats (CSV, Excel, Parquet)
- Database bulk operations
- API data posting
- Data quality reports

**Performance:**
- Chunk processing for large datasets
- Memory optimization techniques
- Parallel processing where applicable

Include the complete pipeline script with error handling.

Automation & Scripting

Create a robust web scraping system for [describe target]:

**Scraping Framework:**
- Scrapy spiders with custom pipelines
- BeautifulSoup for HTML parsing
- Selenium for JavaScript-heavy sites
- Requests with session management
- Proxy rotation and rate limiting

**Data Extraction:**
- CSS selectors and XPath expressions
- Dynamic content handling
- Form submission and interaction
- File download and processing
- Multi-page navigation

**Robustness:**
- Error handling and retry logic
- Captcha detection and handling
- User-agent rotation
- Respect for robots.txt
- Monitoring and alerting

**Data Storage:**
- Database integration
- File export in multiple formats
- Data deduplication
- Incremental updates

Show the complete scraper with proper error handling.

Gradio Development

Rapid deployment of machine learning models with interactive web interfaces.

ML Model Interfaces

Create a Gradio interface for an image classification model:

**Model Integration:**
- Load pre-trained model (PyTorch/TensorFlow/Hugging Face)
- Image preprocessing pipeline
- Batch prediction support
- Confidence score display
- Class probability visualization

**Interface Features:**
- Image upload with drag-and-drop
- Webcam capture option
- Example images for testing
- Real-time prediction updates
- Results export functionality

**Visualization:**
- Confidence bar charts
- Confusion matrix display
- Feature activation maps
- Prediction history tracking
- Model performance metrics

**Advanced Features:**
- Multiple model comparison
- Custom image augmentation
- Batch processing interface
- Model explanation with LIME/SHAP

Include the complete Gradio app with proper error handling.

Interactive Demos

Build a Gradio app to compare multiple [type] models:

**Model Management:**
- Load multiple pre-trained models
- Model metadata and descriptions
- Performance benchmarks display
- Model switching interface
- Version comparison

**Comparison Features:**
- Side-by-side predictions
- Performance metrics comparison
- Inference time measurement
- Accuracy/quality scoring
- Visual difference highlighting

**Interactive Elements:**
- Parameter adjustment sliders
- Real-time updates
- A/B testing interface
- User preference voting
- Feedback collection

**Results Analysis:**
- Statistical significance testing
- Performance trend analysis
- User preference analytics
- Model recommendation system

Show the complete multi-model comparison interface.

Production Deployment

Deploy a Gradio app to Hugging Face Spaces:

**Deployment Setup:**
- requirements.txt with exact versions
- app.py with proper Gradio configuration
- README.md with app description
- Dockerfile for custom environments
- Environment variables configuration

**Performance Optimization:**
- Model caching strategies
- Memory management
- GPU utilization (if available)
- Concurrent user handling
- Request queuing

**User Experience:**
- Loading states and progress bars
- Error handling and user feedback
- Mobile-responsive design
- Accessibility features
- Usage analytics

**Monitoring:**
- Error logging and tracking
- Performance metrics
- User interaction analytics
- Resource usage monitoring

Include the complete deployment configuration.

Streamlit Development

Python-first framework for building data applications and interactive dashboards.

Data Dashboards

Create a comprehensive analytics dashboard using Streamlit:

**Data Sources:**
- Multiple data source connections (CSV, database, API)
- Real-time data refresh capabilities
- Data caching for performance
- Error handling for data loading
- Data validation and cleaning

**Dashboard Layout:**
- Multi-page application structure
- Sidebar navigation and filters
- Responsive grid layout
- Customizable date ranges
- Export functionality

**Visualizations:**
- KPI metrics with st.metric()
- Interactive charts with Plotly
- Data tables with filtering/sorting
- Geographic visualizations
- Time series analysis

**Interactivity:**
- Dynamic filtering and drill-down
- Cross-chart interactions
- Real-time updates
- User preference saving
- Dashboard customization

Include the complete multi-page dashboard with caching.

Machine Learning Apps

Build a Streamlit app for machine learning model training:

**Data Management:**
- Dataset upload and validation
- Data preprocessing options
- Feature engineering interface
- Data visualization and exploration
- Train/test split configuration

**Model Configuration:**
- Algorithm selection interface
- Hyperparameter tuning controls
- Cross-validation setup
- Feature selection options
- Model comparison framework

**Training Process:**
- Real-time training progress
- Live metric updates
- Early stopping controls
- Resource usage monitoring
- Training history tracking

**Results Analysis:**
- Model performance metrics
- Feature importance plots
- Confusion matrices
- ROC curves and precision-recall
- Model interpretability (SHAP)

**Model Deployment:**
- Model serialization
- Prediction interface
- Batch prediction capabilities
- Model versioning
- Performance monitoring

Show the complete ML training application.

Interactive Tools

Create an interactive data exploration tool:

**Data Loading:**
- Multiple file format support
- Database connections
- API data fetching
- Large file handling
- Data preview and sampling

**Exploration Features:**
- Automated data profiling
- Missing value analysis
- Distribution visualizations
- Correlation analysis
- Outlier detection

**Interactive Visualizations:**
- Dynamic chart creation
- Filter and drill-down capabilities
- Custom plot configurations
- Multi-dimensional analysis
- Export visualizations

**Data Transformation:**
- Column operations
- Data cleaning tools
- Feature engineering
- Data export options
- Transformation history

Include comprehensive data validation and error handling.

Best Practices Across Frameworks

Universal principles that apply to all development frameworks.

Code Quality & Maintenance

Documentation

  • Write clear docstrings and comments
  • Maintain README files with setup instructions
  • Document API endpoints and parameters
  • Include usage examples and tutorials

Testing

  • Write unit tests for core functionality
  • Implement integration tests for APIs
  • Add end-to-end tests for user workflows
  • Set up continuous integration pipelines

Security

  • Validate all user inputs
  • Implement proper authentication
  • Use environment variables for secrets
  • Follow framework security best practices

Performance

  • Optimize database queries
  • Implement caching strategies
  • Monitor application performance
  • Use profiling tools to identify bottlenecks

Development Workflow

  1. Planning & Design
    Start with clear requirements and architecture design
  2. Iterative Development
    Build features incrementally with regular testing
  3. Code Review
    Implement peer review processes for code quality
  4. Deployment & Monitoring
    Set up automated deployment with proper monitoring

Getting Started

Ready to start building? Choose your framework and begin with the appropriate prompt templates. Remember to adapt these examples to your specific project needs.

Quick Start Checklist

  • Identify your project requirements and constraints
  • Choose the appropriate framework for your use case
  • Start with a basic project setup prompt
  • Iterate with specific feature implementation prompts
  • Apply best practices for code quality and security
  • Set up proper testing and deployment workflows

Need Help?

These prompts are starting points. Feel free to modify them based on your specific requirements, and don't hesitate to break complex tasks into smaller, more manageable prompts.

Pro Tip: Combine multiple prompts for complex applications, building one feature at a time.