AI Pair Engineer by Sara MahranAI Pair Engineer by Sara Mahran

AI Pair Engineer

Sara Mahran

Sara Mahran

AI Pair Engineer

AI Pair Engineer is a lightweight AI-assisted code review tool that helps developers improve short code snippets before human review.
The application analyzes a piece of Python or JavaScript code and returns structured feedback including code quality issues, maintainability improvements, suggested test cases, and a refactored version of the code.
This project demonstrates how AI can act as a pair programming assistant, helping developers identify potential problems early and improve code quality before submitting changes for review.

Features

Code Quality Review Detects readability, structure, and maintainability issues in a snippet.
Three Targeted Improvements Returns exactly three meaningful suggestions to improve the code.
UX Awareness Highlights potential user-experience improvements when the code affects user interaction.
Suggested Test Cases Recommends practical tests developers should implement.
Technical Positive Note Includes one professional observation written like a senior engineer reviewing the code.
Refactored Version Generates a cleaner version of the submitted code.
Language Awareness The review adapts to the selected programming language (Python or JavaScript).
Fallback Review Mode If the OpenAI API is unavailable, the tool still provides a basic local review.

Demo

Paste a short function or component into the interface and click Review Code to receive structured feedback.
Example snippet:

Example feedback:

Tech Stack

Python
Streamlit – interactive UI for the tool
OpenAI API – AI code review generation
JSON structured responses – reliable parsing of AI output

Project Structure


Installation

Clone the repository:

Create a virtual environment:

Activate the environment:

Windows


Install dependencies:

OpenAI API Setup

Create an API key from:
Set the environment variable.

PowerShell


Then run the app:

Why This Project

Code review is one of the most valuable but time-consuming parts of software development.
This prototype explores how an AI assistant can act as a pre-review step, helping developers:
catch issues earlier
improve readability and maintainability
think about test coverage
produce cleaner code before human review
The goal is not to replace human review, but to augment developer workflows.

Future Improvements

Potential enhancements for this prototype include:
Code quality scoring system
Severity levels for detected issues
Before vs after code comparison
Support for additional programming languages
GitHub pull request integration
Automated test generation

Author

Sara Mahran Software Engineer | Coding Instructor
Like this project

Posted Apr 22, 2026

Contribute to SaraMahran/AI-Pair-Engineer development by creating an account on GitHub.