// Standards and best practices for generating educational code examples. Ensures consistency, readability, and pedagogical value in all code snippets.
| name | code-generation |
| description | Standards and best practices for generating educational code examples. Ensures consistency, readability, and pedagogical value in all code snippets. |
| version | 1.0.0 |
| tags | ["coding","standards","education","python","best-practices"] |
This skill defines the standards for generating code examples in educational content. The goal is to produce code that is not just functional, but exemplary—teaching best practices by example.
user_age instead of a, total_price instead of tp.i, j) in generic contexts, but prefer for item in items.x = x + 1 # Increment xretry_count += 1 # Track attempts to prevent infinite looptry...except (Python) or empty catch blocks.ValueError, FileNotFoundError).if status == 4:READY_STATUS = 4; if status == READY_STATUS:def calculate_total(price: float, tax_rate: float) -> float:
"""Calculates total price including tax."""
return price * (1 + tax_rate)
% formatting or .format().const by default, let only when reassignment is needed. Never var.async/await over raw Promises.When teaching a better way to do something, show the "naive" approach first (labeled as such), then the "professional" approach.
Start with a minimal working example. Add complexity (error handling, edge cases) in subsequent steps.
Ensure code snippets are self-contained and runnable whenever possible. Include necessary imports.
Before finalizing any code snippet, verify: