code-example-generator

Generate specification-driven, runnable code examples with validation.

Updated Dec 10, 2025
One-click install
npx skills add https://github.com/khanaleema/PhysicalAI-Book --skill code-example-generator-khanaleema
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-example-generator
Source: https://github.com/khanaleema/PhysicalAI-Book/tree/main/.gemini/skills/code-example-generator
Command: npx skills add https://github.com/khanaleema/PhysicalAI-Book --skill code-example-generator-khanaleema

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the time-consuming task of creating teaching examples by producing runnable, tested code samples.

Core Features & Use Cases

  • Spec-First Generation: Create examples based on approved specifications.
  • Show-Then-Explain Pattern: Present working code before explanations.
  • Use Case: Generate a @login_required decorator example that checks user authentication before executing functions.

Quick Start

Generate a Python decorator example for B1 level learners using the Spec→Prompt→Code→Validation workflow.

Frequently Asked Questions about code-example-generator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate runnable code examples for teaching programming concepts?

This Skill generates specification-driven, tested code examples tailored for learners. You provide a specification and learning level, and it produces isolated, executable samples with one concept per example, validated for syntax and test coverage.

Can I use spec-first code generation to create production-relevant teaching examples?

Yes. The Skill follows a spec-first workflow to generate examples that demonstrate production patterns while remaining pedagogically transparent. Each example is validated for correctness and includes bilingual support for diverse learners.

What's the best way to structure code examples for learners across different programming languages?

The Skill uses language-agnostic scaffolds and a Show-Then-Explain delivery pattern: present working code first, then explain its logic. This approach works across languages and ensures learners see executable patterns before diving into reasoning.

How do I validate that generated code examples are correct and ready to teach?

The Skill applies rigorous validation including syntax checking, execution testing, and test coverage verification. Validation planning is built into the spec-first workflow, ensuring every example is runnable and pedagogically sound before use.

Can I generate code examples that isolate single concepts for focused learning?

Yes. The Skill enforces one-concept-per-example pedagogy, generating isolated code samples that teach a single idea clearly without noise from unrelated patterns or advanced features.