Resource Gathering

Resource Gathering

General Refactoring Sub use cases:

When/Why we refactor:

  1. Improve Code Readability

    1. Makes the code easier to understand for current and future developers.

    2. Uses clearer variable names, breaks up large functions, and simplifies logic.

  2. Reduce Technical Debt

    1. Cleans up "quick fixes" or poor design decisions made under time pressure.

    2. Prevents future bugs and development slowdowns.

  3. Make Code Easier to Test

    1. Encourages separation of concerns and modularity.

    2. Refactored code is often more unit-testable and reliable.

  4. Enable Reuse and Scalability

    1. Extracts duplicated logic into reusable components or utilities.

    2. Makes it easier to extend features without breaking existing functionality.

  5. Improve Performance

    1. Identifies and removes inefficient logic, memory leaks, or unnecessary computations.

    2. Not always the primary goal, but often a beneficial side effect.

  6. Prepare for New Features

    1. Refactoring before adding features ensures the architecture supports expansion.

    2. Helps avoid “spaghetti code” when introducing complexity.

  7. Fix Hidden Bugs or Prevent Future Ones

    1. Cleaning up messy or unclear code can reveal logic errors.

    2. Refactoring can proactively prevent bugs caused by unclear logic paths.

Sub-use cases of Refactoring:

  1. Partial refactor and Recommendations

    1. General refactor of parts of the application (for the reasons listed above)

  2. Complete rewrite

    1. to a new language

  3. Update framework/dependency versions

 

 

 

Scale measures

Scale

Description

Scale

Description

0

Could not perform task at all

1

Could perform task with a lot of guiding, context, and errors. Does not follow best practices, has multiple errors that must be resolved.

Has all of the following: errors, organization issues, lack cleanliness, etc.

2

Could perform task with a large amount assistance and guiding. Has errors and bugs.

Has most of the following: errors, organization issues, lack cleanliness, etc.

3

Could perform task well with a fair amount of guiding. Has some errors/bugs, but they can be resolved somewhat easily.

Has several of the following: errors, organization issues, lack cleanliness, etc.

4

Could perform task easily with some guiding but still has some outstanding issues.

May have some of the following: errors, organization issues, lack cleanliness, etc, but not all of those issues exist.

5

Could preform task with minimal difficulty/guiding, follows best practices, organized code, and correct typing.

May have one of the following: errors, organization issues, lack cleanliness, etc.

Tools

Tool

Description

Links

Rating

Tool

Description

Links

Rating

Copilot with Claude and GPT,

  • has free tier

The VSCode addon we know and love.

This is a great tool that has the ability to get the full context of the codebase since it is in VSCode

https://github.com/features/copilot

  • Partial Refactor/Recs: 5

  • Complete Rewrite:

  • Version Updates: 5

Q Developer (CodeWhisperer)

  • VSCode extension

  • has free tier

Can be used in-line and has a right-click menu, similar to Copilot. Uses Claude. Can have rules added directly from the sidebar, and context adding is simple.

image-20250710-172641.png

 

https://aws.amazon.com/q/developer/

  • Partial Refactor/Recs: 5

  • Complete Rewrite: 3

  • Version Updates: 4

SonarQube

  • 14 day trial

 

https://www.sonarsource.com/products/sonarqube/

  • Partial Refactor/Recs:

  • Complete Rewrite:

  • Version Updates:

CodeBuddy

  • VSCode extension

  • Has voice response option

 

https://codebuddy.ca/

  • Partial Refactor/Recs:

  • Complete Rewrite:

  • Version Updates:

Cursor

  • Trial period

 

https://cursor.com/en

  • Partial Refactor/Recs:

  • Complete Rewrite:

  • Version Updates:

Aider

Terminal based pair programming

https://aider.chat/

  • Partial Refactor/Recs:

  • Complete Rewrite:

  • Version Updates:

GPT-Migrate

Python app that runs in Docker.

https://medium.com/@fareedkhandev/gpt-migrate-convert-your-codebase-to-any-language-framework-cc1f846e4630

 

  • Complete Rewrite:

CLine

 

https://cline.bot/

  • Partial Refactor/Recs:

  • Complete Rewrite:

  • Version Updates:

 

Codebases for POC:

  • Staffing App

  • Status Reports

  • Angular Place My Order app?

  • React Native PMO?

 

Paths to consider

  • Measuring code quality with Code analysis tools

  • Identifying technical debt, and recommending changes

  • Custom GPT (There is already a devops one)

  • Complete rewrites: How to take a codebase in React and rewrite it in React Native (or insert two other frameworks here)

    • For this, I think it’s important first to understand the codebase.

    • 🧠✍️ Content idea: Understand a codebase with AI and then rewrite it with AI

Content for ideas:

General Refactoring

  • Approaches

    • Basic approach without giving full context: “Refactor this component to improve readability” in Copilot

      • GPT4

        • Removes eslint comments, but does not fix missing dependency.

      • Claude Sonnet 4

        • ignores existing eslint comments to keep a dependency out of a useEffect unless explicitly asked to keep.

    • The context builder:

      • Ask LLM to scan entire codebase, creating a Markdown document that explains the codebase in enough detail for a developer to understand.

      • Use that document for the LLM to reference as you begin prompting. The idea is that the LLM can reference the doc instead of the entire codebase each time.

  • Insights

    • Copilot has greater context for the code as it’s an extension of VS Code.

    • How to get LLMs appropriate context.

    • Add rules for LLMs to follow while refactoring

  • Takeaways

    • Copilot does a great job of taking reusability, separation of concerns, scalability, and readability into consideration.

    • Web-based Claude creates separate files, which is a nice feature.

      • Code may be over-engineered.

      • ignores existing eslint comments to keep a dependency out of a useEffect unless explicitly asked to keep.

    • Copilot can be good for adding features, and writing up user stories/PRD when given context.

    • Need to make sure that with any refactor work, the LLM has sufficient context to complete the task. Workflows should include initial context set up, rules configuration, and THEN attempts at problem solving, followed by tuning/refining the results.