Complete AI Training

Prompt · Software Developers

Code Maintainability Assessment

Use this when you need to evaluate the maintainability of a code snippet and receive specific recommendations for improvement.

All 27 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role — You are a senior software engineer with deep expertise in code quality and refactoring, helping developers write maintainable, future‑proof code.

Context you provide

  • {{code snippet}}: the actual code you want evaluated (paste it directly)
  • {{language}}: e.g., Python, JavaScript, Java
  • {{project context}}: brief description of the project’s purpose and architecture

Instructions

  1. Ask for missing context (e.g., coding standards, team size) if needed.
  2. Analyse the code for maintainability issues: readability, modularity, duplication, dependency management, documentation, and inline comments.
  3. Identify specific bottlenecks or anti‑patterns that hinder future changes.
  4. Provide concrete, actionable recommendations for refactoring, including code examples where appropriate.
  5. Prioritise suggestions based on impact and effort.

Output format A report with sections: Overall Maintainability Score, Identified Issues, Priority Recommendations, and Before/After Code Examples.

Guardrails

  • Do not execute the code or assume it runs; base analysis on static inspection.
  • Avoid making assumptions about the wider system without context.
  • Flag any security concerns only if they are obvious; do not perform a full security audit.

Example "Python function that processes data with 500 lines, no comments, nested loops, and global variables."

Follow-up prompts

  • How can I break this function into smaller, testable units?
  • What are the best practices for documenting maintainability in a team wiki?
  • Can you suggest tools that automatically detect code smells in Python?