PowerShell Code Quality Deep Dive 🔍
Description
This prompt provides a comprehensive, multi-stage analysis of PowerShell scripts, evaluating them against key software development best practices. It uses a structured evaluation framework covering readability, error handling, performance, security, modularity, and documentation, delivering a detailed assessment of a script's quality. The analysis yields a final score, specific recommendations, and a summary section ready to be shared with developers to facilitate direct, actionable improvements to their PowerShell code, ultimately leading to more robust, efficient, secure, and maintainable scripts.
Prompt
Evaluate the provided PowerShell code for quality and adherence to best practices using a three-stage analytical approach.
**Stage 1 - Initial Analysis:** Conduct a preliminary assessment of the code based on the criteria listed below. Do not present the results of this initial assessment.
**Stage 2 - In-Depth Analysis:** Perform a deeper analysis, considering the insights gained from the initial assessment. Do not present the results of this secondary assessment.
**Stage 3 - Final Synthesis:** Synthesize insights from both previous analyses to present a comprehensive evaluation. This final analysis will be the basis of your response.
**Evaluation Framework:** Present your final analysis using the following structure:
1. **Category Evaluation:** Evaluate the code across these categories:
a. Readability and Formatting (clarity, consistent style, naming conventions)
b. Error Handling and Logging (robustness, capture and handling of errors, informative logging)
c. Performance and Efficiency (resource utilization, execution speed, optimized logic)
d. Security and Best Practices (protection against vulnerabilities, adherence to secure coding principles)
e. Modularity and Reusability (organized into reusable components, limited code duplication)
f. Documentation and Comments (clear/concise code comments, appropriate use of documentation)
2. **Category Scoring:** Assign a score (1-10) to each category:
* 1-3: Poor
* 4-6: Adequate
* 7-8: Good
* 9-10: Excellent
3. **Category Feedback:** For each category, provide:
* a brief explanation of the assigned score
* specific strengths and weaknesses observed in the provided code
* actionable suggestions for improvement
4. **Overall Score Calculation:** Calculate an overall score by averaging the individual category scores.
**Summary Section:** Include a final summary section formatted as follows:
```
---
Overall Score: [Average of category scores]
PowerShell Code Quality Assessment Summary
Key Strengths:
- [Bullet point list of key strengths observed in the analysis]
Priority Improvements:
N. [Concise, actionable improvement point.]
- [Brief explanation or example.]
General Recommendations:
- [Bullet points with general recommendations for code enhancement]
---
```
Ensure the summary is concise, clear, self-contained, and can easily be copied and shared with a developer. The summary should provide a quick overview of the quality and highlight actionable improvement points. Do not include any conversational sections, only results.How to Use
1
Copy the prompt
Click the copy button above to copy the entire prompt to your clipboard
2
Open AI model
Go to your preferred AI model or any compatible AI assistant
3
Paste & customize
Paste the prompt into the chat and modify it for your specific needs
4
Send & enjoy
Send the prompt and wait for the AI to generate a response
Comments (0)
to join the discussion
No comments yet
Be the first to share your thoughts!