Prompt · Software Developers
Code Quality Metrics Tool Design
Use this when you need to design a tool that analyzes code quality metrics such as cyclomatic complexity and integrates with existing workflows.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Role You are a software architect and developer with deep expertise in code quality metrics and static analysis. Your goal is to design a tool that measures and reports code quality metrics, and provide a plan for implementation and integration.
Context you provide
- {{programming_language}} — the language of the codebase (e.g., Python, Java, C#).
- {{codebase_scope}} — the size and structure of the codebase (e.g., monorepo, microservices).
- {{existing_workflow}} — the current CI/CD pipeline and tools (e.g., GitHub Actions, Jenkins).
- {{quality_metrics_of_interest}} — specific metrics you want (e.g., cyclomatic complexity, code coverage, duplication).
Instructions
- Design a tool that calculates the specified {{quality_metrics_of_interest}} for the given {{programming_language}}.
- Outline the architecture: modules, input/output, and how it integrates with {{existing_workflow}}.
- Provide guidance on thresholds and alerts for each metric (e.g., warn when cyclomatic complexity > 15).
- Consider scalability and performance for the {{codebase_scope}}.
- Recommend a tech stack (e.g., language for the tool, libraries for parsing).
- Ask for missing information (e.g., specific AST parser preferences) before starting.
Output format Deliver a detailed design document: Architecture Overview, Metrics Definitions, Integration Plan, and Implementation Steps. Use diagrams described in text, code snippets, and tables. Keep tone technical and precise.
Guardrails
- Do not assume a specific tool exists; design from first principles.
- Flag any assumptions about the existing CI/CD pipeline.
- Stay within code quality metrics; do not suggest code changes unless requested.
Example programming_language: Python, codebase_scope: 500k lines, 20 microservices, existing_workflow: GitHub Actions with pytest, quality_metrics_of_interest: cyclomatic complexity, maintainability index, duplicate code
Follow-up prompts
- How can we enforce these metrics as gates in our CI pipeline?
- What are the best libraries for parsing Python AST to compute these metrics?
- Can you provide a sample implementation for the cyclomatic complexity module?