بنقرة واحدة
dev-engine-lesson
Add an engine/toolchain lesson — build systems, C fundamentals, debugging, project structure
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Add an engine/toolchain lesson — build systems, C fundamentals, debugging, project structure
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Add PBR texture loading with separate roughness/metallic support to an SDL GPU project using forge_scene.h
Add Cook-Torrance PBR shading with GGX, Schlick-GGX, and Schlick Fresnel to an SDL GPU project alongside forge_scene.h
Add instanced grass rendering with segmented blades, wind animation, LOD density rings, and terrain LOD with geomorphing to an SDL GPU project
Add procedural noise texture generation to the asset pipeline — C tool, Python plugin, web UI with live preview
Add an asset pipeline lesson — hybrid Python + C track for asset processing, procedural geometry, and web frontend
Add an audio lesson — sound playback, mixing, spatial audio, DSP effects, with SDL GPU scenes and forge UI
| name | dev-engine-lesson |
| description | Add an engine/toolchain lesson — build systems, C fundamentals, debugging, project structure |
| argument-hint | [number] [topic-name] [description] |
Create a new engine lesson teaching practical engineering skills — the build systems, C language features, debugging techniques, and project structure that make graphics applications work.
When to use this skill:
Smart behavior:
The user (or you) can provide:
If any are missing, infer from context or ask.
lessons/engine/NN-topic-name/
main.c)A small, focused C program that demonstrates the concept. Engine lessons differ from GPU lessons — the program might:
Requirements:
Template structure:
/*
* Engine Lesson NN — Topic Name
*
* Demonstrates: [what this shows]
*
* SPDX-License-Identifier: Zlib
*/
#include <SDL3/SDL.h>
int main(int argc, char *argv[])
{
(void)argc;
(void)argv;
/* SDL_Init(0) initializes no subsystems — just core SDL state and error
* handling. This gives us SDL_Log and SDL_GetError without pulling in
* video, audio, etc. Pass SDL_INIT_VIDEO when you need a window. */
if (!SDL_Init(0)) {
SDL_Log("SDL_Init failed: %s", SDL_GetError());
return 1;
}
/* Demonstrate the concept here */
SDL_Quit();
return 0;
}
Notes on the template:
SDL_Log instead of printf for consistent cross-platform outputSDL_Log, SDL_malloc, SDL_GetBasePath) that are used throughout
forge-gpuprintf-based
program is acceptableConsole output formatting:
-, =, *, |, ->, [OK], [!], "bytes", "offset"─, ═, •, ↓, →, ✓, ⚠ (may render as garbled text on
Windows)CMakeLists.txtadd_executable(NN-topic-name main.c)
target_include_directories(NN-topic-name PRIVATE ${FORGE_COMMON_DIR})
target_link_libraries(NN-topic-name PRIVATE SDL3::SDL3)
add_custom_command(TARGET NN-topic-name POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:SDL3::SDL3-shared>
$<TARGET_FILE_DIR:NN-topic-name>
)
Adapt as needed: Some engine lessons may need additional sources, headers,
or libraries depending on the topic. For example, a lesson on multi-file
projects would have multiple .c files.
README.mdStructure:
# Engine Lesson NN — Topic Name
[Brief subtitle explaining what this teaches]
## What you'll learn
[Bullet list of concepts covered]
## Why this matters
[1-2 paragraphs connecting this topic to real graphics/game development.
Explain when and why a learner will encounter this.]
## Result
[Brief description of what the example program demonstrates]
**Example output:**
```text
[Copy actual program output here]
```
**Important:** Copy output directly from running the program — don't manually
type it.
## Key concepts
[Bullet list of core takeaways:]
- **Concept 1** — Brief explanation
- **Concept 2** — Brief explanation
## The Details
[Main explanation of the topic, broken into subsections]
### [Subtopic 1]
[Explanation with code examples where appropriate]
### [Subtopic 2]
[Explanation with code examples where appropriate]
## Common errors
[This section is critical for engine lessons — show real error messages and
how to fix them]
### [Error description]
**What you see:**
```text
[Actual error message]
```
**Why it happens:** [Explanation]
**How to fix it:** [Solution]
## Where it's used
In forge-gpu lessons:
- [Link to GPU lesson] uses this for [purpose]
- [Link to math lesson] uses this for [purpose]
## Building
```bash
cmake -B build
cmake --build build --config Debug
# Windows
build\lessons\engine\NN-topic-name\Debug\NN-topic-name.exe
# Linux / macOS
./build/lessons/engine/NN-topic-name/NN-topic-name
```
## Exercises
1. [Exercise extending the concept]
2. [Exercise applying it differently]
3. [Exercise that deliberately breaks something so the learner can fix it]
## Further reading
- [Relevant engine/GPU/math lesson that builds on this]
- [External resource if helpful (official CMake docs, C reference, etc.)]
CMakeLists.txt (root): Add add_subdirectory(lessons/engine/NN-topic-name)
under an "Engine Lessons" section (create the section if it doesn't exist yet,
placed between Math Lessons and GPU Lessons)README.md (root): Add a row to the engine lessons table in the
"Engine Lessons (lessons/engine/)" section — follow the same format as the
existing rows (number, linked topic name, "What you'll learn" summary)lessons/engine/README.md: Add a row to the lessons tablePLAN.md: Note the engine lesson if relevantcmake -B build
cmake --build build --config Debug
./build/lessons/engine/NN-topic-name/NN-topic-name
Verify the example runs and produces expected output.
Before finalizing, launch a verification agent using the Task tool
(subagent_type: "general-purpose"). Give the agent the paths to the lesson's
README.md and main.c and ask it to audit every key topic for completeness.
The agent reads both files and returns a pass/fail report — no script or
external tool is required.
Inputs to the agent:
lessons/engine/NN-topic-name/README.mdlessons/engine/NN-topic-name/main.cFor each key topic / "What you'll learn" bullet, the agent must check:
main.c actually exercise
this concept with code and output?What to flag:
The lesson is incomplete until every key topic passes all three checks.
Use the /dev-markdown-lint skill to check all markdown files:
npx markdownlint-cli2 "**/*.md"
If errors are found:
npx markdownlint-cli2 --fix "**/*.md"npx markdownlint-cli2 "**/*.md"Task agents have a 32K output token limit per Write call. Any file over ~800
lines MUST be written in chunks — split into 3-4 parts (~400-600 lines each),
write each to /tmp/, then concatenate.
Recovery rule — if a writing agent fails with a token limit error:
See .claude/large-file-strategy.md
for the full strategy.
If this lesson requires textures or 3D assets for any reason, they MUST go through the asset pipeline. No ad-hoc asset loading.
Engine lessons cover the infrastructure of building graphics applications:
Engine lessons do not cover:
Engine lessons should be especially patient and encouraging. Build errors are one of the most frustrating parts of learning graphics programming. The goal is to turn "I have no idea what this error means" into "I know exactly what went wrong and how to fix it."
Many engine lessons benefit from an "error-first" approach:
This mirrors how learners actually encounter these topics — they hit an error and need to understand it.
Follow the same conventions as all forge-gpu code:
PascalCase for typedefs, lowercase_snake_case for localsUPPER_SNAKE_CASE for #define constants#define or enum everything.
In lesson files, inline numeric literals are acceptable when one-off
demonstration values improve readability (e.g. array sizes, sample
coordinates, test inputs)Find opportunities to create compelling diagrams and visualizations via the
matplotlib scripts — they increase reader engagement and help learners
understand the topics being taught. Use the /dev-create-diagram skill to add
diagrams following the project's visual identity and quality standards.
For flow/pipeline diagrams (build process, compilation stages, memory layout), use inline mermaid blocks — GitHub renders them natively:
```mermaid
flowchart LR
A[source.c] -->|compile| B[source.o] -->|link| C[program]
```
Mermaid is especially useful for engine lessons to show:
For visual diagrams (memory layout, struct padding), add a diagram function
to the appropriate file in scripts/forge_diagrams/:
DIAGRAMS dict in __main__.pypython scripts/forge_diagrams --lesson engine/NN to generate the PNGScenario: Learners keep asking why target_link_libraries is needed.
add_executable, linkinglessons/engine/01-cmake-fundamentals/Scenario: A learner doesn't understand why vertex buffer uploads work.
malloc/free, pointer arithmetic, sizeoflessons/engine/02-pointers-and-memory/offsetof,
demonstrate pointer arithmeticsizeofoffsetof pattern used throughoutIn these cases, update existing documentation or add a FAQ entry.