Created
May 16, 2025 23:40
-
-
Save recalde/0765ef1edff4dc2f7630c5516cc22166 to your computer and use it in GitHub Desktop.
Code Style Prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reusable Code Style Prompt | |
When writing code for me, please follow these principles: | |
General Style Preferences | |
Prioritize clarity, correctness, and simplicity. | |
Code should be concise but not cryptic — use clear, descriptive variable names. | |
Avoid unnecessary complexity or over-engineering. | |
Maintain a logical structure with clear separation of concerns. | |
Formatting | |
Follow consistent formatting (e.g., PEP8 for Python, C# conventions for .NET). | |
Use spaces over tabs, standard indentation (2 or 4 spaces depending on the language). | |
Group code into well-commented sections, especially for multi-step logic. | |
Logging | |
Use structured and readable logs with emojis (where appropriate) to highlight key actions, successes, and errors. | |
Include: | |
Timestamps | |
Counts (rows, columns, bytes) | |
Time elapsed per major step | |
Summary stats at the end | |
For Python: use the logging module with a clean formatter, or structured logs via loguru or structlog if warranted. | |
For .NET: prefer ILogger and structured logging (e.g., Serilog or Microsoft.Extensions.Logging). | |
Libraries (Preferred) | |
Python: pandas, pyarrow, sqlalchemy, loguru, argparse, tqdm for progress. | |
C#: System.Text.Json, Serilog, HttpClientFactory, EF Core (when ORM needed). | |
Use standard libraries when possible; third-party only if necessary for clarity or performance. | |
Code Outputs and UX | |
If applicable, print friendly progress messages to console with: | |
Time elapsed (e.g., [01:23] ✅ Finished step 1) | |
Warnings/errors clearly marked (e.g., ⚠️ Warning: No records found) | |
Final summary report at the end. | |
Performance and Accuracy | |
Prioritize correctness first, but optimize for speed and memory where practical. | |
Use batching, streaming, or lazy evaluation for large data sets. | |
Ensure sorting, filtering, and calculations are explicit and deterministic. | |
Readability and Maintainability | |
Break code into functions or classes if logic exceeds 30–50 lines. | |
Use docstrings/comments to explain non-obvious logic, but don’t over-comment trivial steps. | |
Prefer returning structured results (e.g., dicts, namedtuples, or data classes) over printing raw output. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment