Prompting & Workflows Intermediate Project 25 of 25

Build a Code Refactoring Tracker with AI

Build a smart tracker that chains AI tools to analyze, refactor, and document your code improvements in one organized workspace.

What You'll Build

A code analysis system that identifies refactoring opportunities and technical debt
AI-powered refactoring suggestions with before/after code comparisons
A learning notebook that captures refactoring patterns and best practices
Progress tracking with refactoring metrics and improvement scores
Workflow automation that chains multiple AI tools for comprehensive code analysis

What You'll Need

AI Assistant

Claude or ChatGPT for code analysis and refactoring suggestions

Text Editor

Any text editor or notes app for tracking your refactoring progress

1

Create the Code Analysis Framework

Start by building a systematic approach to analyze code quality. You'll create a framework that identifies common issues like long functions, repeated code, and poor naming conventions.

Prompt for AI Assistant

Help me create a code refactoring tracker. First, I need a code analysis framework that can identify refactoring opportunities.

Create a structured analysis template that includes:
1. Code quality metrics (function length, complexity, duplication)
2. Common refactoring patterns to look for
3. A scoring system (1-10) for different quality aspects
4. Priority levels for different types of improvements

Make it practical for analyzing real code snippets. I want to paste code and get actionable insights about what needs refactoring and why.

You should get a comprehensive analysis template with specific criteria for evaluating code quality, plus a scoring system that helps prioritize which refactoring tasks to tackle first.

2

Build the AI Refactoring Chain

Now you'll create a workflow that chains multiple AI prompts together. This creates a pipeline from code analysis to specific refactoring suggestions to improved code examples.

Prompt for AI Assistant

Create a 3-step AI workflow chain for code refactoring:

Step 1: Analysis Prompt - Analyzes code using our framework
Step 2: Suggestion Prompt - Takes analysis results and generates specific refactoring recommendations  
Step 3: Implementation Prompt - Takes suggestions and writes improved code with explanations

Each step should:
- Build on the previous step's output
- Have clear input/output formats
- Include specific instructions for the AI
- Work as copy-paste prompts

Make this workflow repeatable for any code snippet I want to improve.

The AI will give you three connected prompts that work together as a pipeline. You'll be able to run messy code through this chain and get structured analysis, actionable suggestions, and clean refactored code.

3

Design the Learning Notebook Structure

Create an organized system to capture what you learn from each refactoring session. This builds your personal knowledge base of patterns, techniques, and common improvements.

Prompt for AI Assistant

Design a learning notebook template for tracking code refactoring sessions. It should capture:

1. Session Overview (date, code type, main issues found)
2. Before/After Code Comparisons with key improvements highlighted
3. Refactoring Patterns Used (with explanations and when to apply them)
4. Lessons Learned (what worked, what didn't, insights gained)
5. Progress Metrics (improvement scores, time saved, readability gains)
6. Quick Reference Cards for common refactoring techniques

Make it structured enough to be searchable later, but flexible enough for different types of code. Include prompts to help me reflect on each refactoring session.

You'll get a comprehensive notebook template that helps you document refactoring sessions systematically. This becomes your personal knowledge base that grows more valuable with each project you improve.

4

Create Progress Tracking and Metrics

Build a system to measure your refactoring impact over time. You'll track improvements in code quality, learn which techniques work best, and see your skills developing.

Prompt for AI Assistant

Create a progress tracking system for my refactoring tracker that includes:

1. Quantifiable Metrics
   - Code quality scores (before/after each session)
   - Lines of code reduced through refactoring
   - Functions simplified or combined
   - Technical debt eliminated

2. Skill Development Tracking
   - Refactoring patterns I've mastered
   - Time taken per session (efficiency improvements)
   - Complexity of problems I can handle

3. Visual Progress Elements
   - Weekly/monthly refactoring summaries
   - Most improved code categories
   - Personal refactoring technique rankings

Make it motivating and show clear improvement over time. Include prompts to help me reflect on my growing skills.

The AI will create a comprehensive tracking system that turns refactoring into a measurable skill. You'll be able to see your progress clearly and identify which techniques give you the biggest improvements.

5

Build the Complete Workflow Integration

Connect everything together into one streamlined system. You'll create a master workflow that takes messy code through analysis, refactoring, and documentation in an organized, repeatable process.

Prompt for AI Assistant

Create the complete Code Refactoring Tracker workflow that integrates everything:

1. Master Checklist - Step-by-step process from messy code to documented improvement
2. Prompt Sequence - The exact AI prompts to use in order, with sample inputs/outputs
3. Notebook Entry Template - How to capture each session systematically
4. Weekly Review Process - How to analyze progress and plan next improvements
5. Troubleshooting Guide - What to do when refactoring gets stuck or AI suggestions don't work

Make this a complete system I can follow every time I want to improve code. Include time estimates for each step and tips for staying organized.

You'll receive a complete, integrated system that guides you through professional-level code refactoring. Everything connects together: analysis leads to improvements, improvements get documented, and documentation builds your skills over time.

Common Issues

AI gives vague refactoring suggestions

Be specific about your code's context and requirements. Include the programming language, project type, and performance needs in your analysis prompts.

Workflow steps don't connect properly

Make sure to copy the complete output from each step as input to the next. The AI needs the full context to maintain the chain of reasoning.

Progress tracking feels overwhelming

Start with just 2-3 key metrics (like before/after complexity scores). You can add more tracking elements as the habit develops.

Learning notebook gets messy

Use consistent headers and date formats. Create a simple tagging system (like #function-extraction, #naming-improvement) to find patterns later.

What You Learned

AI Workflow Chaining

Connected multiple AI prompts into a pipeline for complex code analysis and improvement tasks.

Structured Learning Documentation

Built an organized system to capture insights and track improvement over time.

Systematic Code Analysis

Created frameworks for identifying refactoring opportunities and measuring improvement impact.

Progress Tracking Integration

Combined multiple tools into one workflow that measures and documents skill development.

Tips for Going Further

Add Language-Specific Rules: Create specialized analysis prompts for different programming languages and their specific refactoring patterns.
Build Team Workflows: Extend the tracker to work with code reviews and team refactoring sessions with shared learning notebooks.
Create Refactoring Challenges: Use your tracker to work through classic refactoring exercises and build a portfolio of improvements.
Integration with Version Control: Connect your refactoring notes with git commits to track improvements over time in real projects.