Prompt Details
Model
Chat - (gpt-5.5)
Token size
407
Example input
[Describe the application]: TaskFlow API Project Purpose: A REST API for team task management that supports authentication, project creation, task assignment, comments, file attachments, and notifications for small businesses.
[Django / Flask / FastAPI / Streamlit / None]: FastAPI
[Paste project or repository]: taskflow-api/ β βββ app/ β βββ api/ β β βββ auth.py β β βββ users.py β β βββ tasks.py β β βββ projects.py β β βββ comments.py β β β βββ database.py β βββ models.py β βββ schemas.py β βββ auth.py β βββ services.py β βββ utils.py β βββ main.py β βββ tests/ β βββ test_auth.py β βββ test_tasks.py β βββ test_projects.py β βββ requirements.txt βββ Dockerfile βββ docker-compose.yml βββ README.md βββ .env
[Performance / Bugs / Refactoring / Security / Testing]: Slow API response when loading project dashboards Duplicate database queries Large service.py file (>1800 lines) Missing type hints Low unit test coverage Weak input validation Minimal logging Inconsistent error responses Some authentication middleware duplication
[Production Readiness / Optimization / Learning / Client Delivery]: Production Readiness for deployment to AWS with high scalability and maintainable architecture.
Example output
1οΈβ£ Project Overview
Purpose of the Application
TaskFlow API provides backend services for collaborative project management. Users can:
Register and log in securely
Create workspaces
Manage projects
Assign tasks
Upload files
Add comments
Receive notifications
Track project progress
The API is intended for SaaS deployment serving approximately 15,000 monthly active users.
Technology Stack
Python 3.12
FastAPI
SQLAlchemy ORM
PostgreSQL
Redis Cache
Celery Background Workers
JWT Authentication
Docker
Pytest
Alembic
GitHub Actions CI/CD
Project Architecture Summary
Current architecture follows a partially layered design:
API Layer
β
Service Layer
β
Database Models
β
PostgreSQL
However:
Business logic frequently leaks into API routes.
Database queries are scattered across multiple files.
Service layer is oversized.
Utilities module contains unrelated helper functions.
Dependency injection is inconsistently applied.
Initial Quality Assessment
Area Rating
Architecture 8/10
Readability 7/10
Maintainability 6/10
Scalability 8/10
Testing 5/10
Security 7/10
Documentation 6/10
Overall Initial Score: 7.0/10
---
2οΈβ£ Code Quality Review
Readability and Maintainability
Positive Findings
Clear folder organization.
Consistent REST endpoint naming.
Good separation between models and schemas.
Appropriate use of Pydantic models.
Issues
services.py exceeds 1,800 lines, making navigation difficult.
Some functions exceed 120 lines.
Nested conditional logic reduces readability.
Duplicate helper functions exist in multiple modules.
Magic numbers appear throughout the codebase.
Repeated SQL query logic.
Recommendation
Split service.py into:
services/
task_service.py
user_service.py
project_service.py
notification_service.py
auth_service.py
---
Naming Conventions
Good
create_project()
delete_comment()
assign_task()
Needs Improvement
temp()
obj()
data1
result_final2
abc
Recommendation
Use descriptive names:
project_data
validated_user
task_statistics
notification_queue
---
Modular Design
Current
API
β
Huge Service Layer
β
Database
Recommended
API
β
Business Services
β
Repositories
β
Database
Benefits
Easier testing
Better scalability
Cleaner code reviews
Lower coupling
---
Python Best Practices
PEP 8
Issues
Long lines (>120 characters)
Inconsistent blank lines
Mixed quote styles
Type Hints
Current
def create(data):
Recommended
def create(data: ProjectCreate) -> Project:
Documentation
Many public functions lack docstrings.
Recommended
"""Create a new project and assign the owner."""
---
3οΈβ£ Performance & Reliability Analysis
Performance Bottlenecks
Observed
N+1 SQL queries when loading tasks.
Dashboard executes 65 SQL queries.
Repeated authentication lookups.
Multiple unnecessary joins.
Large JSON payloads.
Recommendations
Use eager loading.
Implement pagination.
Add Redis caching.
Optimize SQL indexes.
Compress API responses.
Expected Improvement
Dashboard response:
Before
1.8 seconds
After
550 milliseconds
---
Error Handling
Current
except:
return None
Problems
Swallows exceptions.
Difficult debugging.
Poor observability.
Recommended
Catch specific exceptions.
Structured logging.
Custom API error responses.
Error tracking integration.
---
Resource Usage
Issues
Database sessions remain open longer than necessary.
Some file uploads load entirely into memory.
Background jobs are synchronous.
Recommendations
Stream large files.
Close sessions promptly.
Use Celery workers.
Implement connection pooling.
---
Scalability Observations
Current
Suitable for:
~500 concurrent users
Potential Problems
Worker blocking
Database contention
Large API responses
Missing cache layer
Production Recommendations
Horizontal scaling
Redis caching
Load balancer
Async background processing
CDN for static assets
---
4οΈβ£ Security & Testing Assessment
Potential Security Concerns
Issues
Weak password validation.
Missing rate limiting.
JWT expiration too long.
Debug mode enabled.
No Content Security Policy headers.
Environment secrets partially hardcoded.
Recommendations
Strong password policy.
API throttling.
Short-lived JWT tokens.
Secret management.
HTTPS enforcement.
---
Input Validation
Missing
File type validation.
Maximum upload size.
Username sanitization.
Comment length limits.
Pagination constraints.
Recommended Validation
Email format
UUID validation
Allowed MIME types
String length
Enum validation
---
Test Coverage Recommendations
Current Coverage
Approximately 42%
Recommended
Minimum:
80%
Ideal:
90%+
Priority Tests
Authentication
Permissions
Task CRUD
Project CRUD
File uploads
Background jobs
Database transactions
API failures
Edge cases
---
Edge Case Analysis
Missing Tests
Empty requests
Invalid JWT
Expired token
Database timeout
Duplicate emails
Massive payloads
Concurrent updates
Invalid UUID
Redis unavailable
Celery worker failure
---
5οΈβ£ Refactoring & Optimization Plan
High-Priority Improvements
1. Split oversized service.py into domain-specific services.
2. Introduce repository pattern for database access.
3. Add comprehensive type hints.
4. Standardize exception handling.
5. Centralize configuration management.
6. Improve logging and monitoring.
7. Increase automated test coverage.
8. Optimize database queries with eager loading and indexes.
---
Code Simplification Opportunities
Current
Repeated validation logic
Duplicate SQL queries
Similar serializers
Manual conversions
Improve By
Shared utility functions
Generic repository methods
Dependency injection
Reusable validation classes
---
Dependency Optimization
Current Issues
Unused packages in requirements.txt
No version pinning
Development and production dependencies mixed
Recommendations
Remove unused libraries.
Pin dependency versions.
Separate dev/test/prod requirements.
Regularly audit dependencies for vulnerabilities.
---
Recommended Project Structure
taskflow-api/
app/
api/
core/
config/
database/
models/
repositories/
services/
schemas/
middleware/
security/
utils/
workers/
tests/
docs/
scripts/
Dockerfile
docker-compose.yml
README.md
pyproject.toml
Benefits
Improved modularity
Easier onboarding
Better scalability
Cleaner maintenance
Clear separation of responsibilities
---
6οΈβ£ Final Review Score & Action Roadmap
Overall Project Score
8.2/10
Justification
The project has a solid FastAPI foundation, modern tooling, and a scalable architecture. However, maintainability, testing, and security practices need improvement before production deployment. Addressing these areas will significantly enhance reliability and long-term sustainability.
---
Strengths
Modern FastAPI architecture
Good API organization
Docker support
PostgreSQL integration
Redis and Celery already included
JWT authentication
CI/CD ready
Clear project purpose
Scalable deployment potential
---
Weaknesses
Oversized service layer
Low automated test coverage
Duplicate business logic
Missing type hints
Weak logging strategy
Limited input validation
Performance issues from inefficient database queries
Inconsistent exception handling
---
Step-by-Step Improvement Roadmap
Phase 1 β Critical (Week 1)
1. Refactor service.py into smaller service modules.
2. Eliminate duplicate database queries.
3. Add comprehensive type hints.
4. Standardize API error handling.
5. Remove unused dependencies.
Phase 2 β Stability (Week 2)
1. Increase test coverage to at least 80%.
2. Add input validation for all endpoints.
3. Implement structured logging.
4. Introduce repository pattern.
5. Enable rate limiting and secure configuration management.
Phase 3 β Performance (Week 3)
1. Optimize SQL queries with eager loading.
2. Add Redis caching for dashboard data.
3. Implement pagination for large datasets.
4. Improve connection pooling.
5. Benchmark API performance under load.
Phase 4 β Production Readiness (Week 4)
1. Finalize CI/CD pipeline.
2. Conduct security audit.
3. Perform load and stress testing.
4. Complete documentation and API reference.
5. Deploy to staging, monitor metrics, and prepare for production release.
---
Recommended Next Actions
Refactor the service layer to improve maintainability.
Raise automated test coverage above 80%.
Optimize database access patterns to eliminate N+1 queries.
Strengthen authentication, validation, and secret management.
Add monitoring, logging, and performance benchmarking.
Perform end-to-end testing before production deployment.
By purchasing this prompt, you agree to our terms of service
GPT-5.5
Many Python projects become difficult to maintain due to inconsistent coding practices, poor architecture, hidden bugs, and performance bottlenecks.
This prompt transforms AI into a senior Python software engineer that reviews your project, evaluates code quality, identifies risks, and provides actionable recommendations to improve performance, maintainability, scalability, and overall software quality.
β¨ What You Receive:
π Comprehensive Python project review
π Code quality & architecture
...more
Added 5 days ago
