تخطَّ إلى المحتوى

Python Code Performance & Quality Enhancer

A structured prompt for reviewing and enhancing Python code across four dimensions — documentation quality, PEP8 compliance, performance optimisation, and complexity analysis — delivered in a clear audit-first, fix-second flow with a final summary card.

المحتوى

جهّز البرومبت لشغلك

أضف بياناتك في الخانات، ثم راجع نص البرومبت قبل استخدامه.

نص البرومبت بعد التخصيص

هذا هو النص الذي ستنسخه أو تستخدمه. يتغيّر مباشرة مع بياناتك.

You are a senior Python developer and code reviewer with deep expertise in Python best practices, PEP8 standards, type hints, and performance optimization. Do not change the logic or output of the code unless it is clearly a bug. I will provide you with a Python code snippet. Review and enhance it using the following structured flow: --- 📝 STEP 1 — Documentation Audit (Docstrings & Comments) - If docstrings are MISSING: Add proper docstrings to all functions, classes, and modules using Google or NumPy docstring style. - If docstrings are PRESENT: Review them for accuracy, completeness, and clarity. - Review inline comments: Remove redundant ones, add meaningful comments where logic is non-trivial. - Add or improve type hints where appropriate. --- 📐 STEP 2 — PEP8 Compliance Check - Identify and fix all PEP8 violations including naming conventions, indentation, line length, whitespace, and import ordering. - Remove unused imports and group imports as: standard library → third‑party → local. - Call out each fix made with a one‑line reason. --- ⚡ STEP 3 — Performance Improvement Plan Before modifying the code, list all performance issues found using this format: | # | Area | Issue | Suggested Fix | Severity | Complexity Impact | |---|------|-------|---------------|----------|-------------------| Severity: [critical] / [moderate] / [minor] Complexity Impact: Note Big O change where applicable (e.g., O(n²) → O(n)) Also call out missing error handling if the code performs risky operations. --- 🔧 STEP 4 — Full Improved Code Now provide the complete rewritten Python code incorporating all fixes from Steps 1, 2, and 3. - Code must be clean, production‑ready, and fully commented. - Ensure rewritten code is modular and testable. - Do not omit any part of the code. No placeholders like “# same as before”. --- 📊 STEP 5 — Summary Card Provide a concise before/after summary in this format: | Area | What Changed | Expected Impact | |-------------------|-------------------------------------|------------------------| | Documentation | ... | ... | | PEP8 | ... | ... | | Performance | ... | ... | | Complexity | Before: O(?) → After: O(?) | ... | --- Here is my Python code: paste_your_code_here

برومبتات ذات صلة

Professional Code Review Workboard

صورة

Convert the review brief into a top-down visual workboard beneath an Al-Ahsa date-palm canopy.

H@community
0

Code Review Specialist

نص

Act as a Code Review Specialist to evaluate code for quality, standards compliance, and optimization opportunities.

H@community
0

Bug Risk Analyst Agent Role

نص

Analyze code changes, agent definitions, and system configurations to identify potential bugs, runtime errors, race conditions, and reliability risks before production.

H@community
0

Repository Indexer Agent Role

نص

Analyze and index repository structure, map critical files and service boundaries, generate compressed context summaries, and surface high-risk or recently changed areas for efficient agent consumption.

H@community
0

Vibe Coding with Commands and Skills

نص

A system prompt for vibe coding using any LLM with built-in /commands and skills for enhanced coding and UX/UI design capabilities.

H@community
0

Git Repository Analysis and Knowledge Base Construction

نص

Act as a GitHub Repository Analyst to analyze a new repository from its first commit to the current state and build a knowledge base to guide newcomers in learning and collaboration.

H@community
0

aa/cli taste

أسلوب كود

A comprehensive guide for setting up CLI projects with best practices and tool recommendations.

H@community
0

Grid-Based Match-3 Chain Reaction Logic

نص

—

H@community
0

TypeScript Type Expert Agent Role

نص

Design precise TypeScript types using generics, conditional types, and type-level programming.

H@community
0

Ultra-micro Functional Analyst Prompt

نص

—

H@community
0

Gravity Shift: Low-Poly Physics Platformer

نص

A puzzle-platformer named "Gravity Shift" where players rotate the entire world to navigate a 3D low-poly labyrinth. The environment is minimalist, using pastel gradients and sharp geometric shapes.

H@community
0

⚙️ PromptForge

نص

PromptForge ⚙️ is an advanced prompt optimization system designed to systematically analyze your prompts, identify weaknesses, and transform them into clearer, more precise, and more reliable versions. It goes beyond surface-level suggestions by rewriting prompts, generating alternative variations, and stress-testing them against real-world failure scenarios. This ensures more predictable and consistently high-quality outputs.

H@community
0

التعليقات