dev-gpu-lesson
Scaffold a new GPU lesson using forge_scene.h for the rendering baseline
от Nebulavenus★ 51 звезда на GitHub
Установить dev-gpu-lesson в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Create a new GPU lesson for the forge-gpu project. Every GPU lesson uses
forge_scene.h for the rendering baseline (shadow map, Blinn-Phong lighting,
grid floor, sky gradient, FPS camera, UI). The lesson focuses entirely on its
subject matter, not rendering plumbing.
The user will provide:
- Number: two-digit lesson number (e.g. 02)
- Name: short kebab-case name (e.g. first-triangle)
- Description: what the lesson teaches
If any of these are missing, ask the user before proceeding.
Steps
Start from a clean main branch:
Before creating any files, ensure we're working from the latest main:
git checkout main git pull origin mainThis avoids conflicts from stale branches and ensures the new lesson builds on top of the latest project state.
Determine what math is needed:
- Will this lesson use vectors (positions, colors, directions)?
- Will it use matrices (transformations, rotations)?
- Check if the math library (
common/math/forge_math.h) has what you need - If new math operations are needed, use
/dev-math-lessonto add them first
Create the lesson directory:
lessons/gpu/$ARGUMENTS[0]-$ARGUMENTS[1]/Create main.c using the SDL callback architecture:
#define SDL_MAIN_USE_CALLBACKS 1before includesAlways use
forge_scene.hfor the rendering baseline. See theforge-scene-rendererskill for the full API.Include required headers:
#include <SDL3/SDL.h> #include <SDL3/SDL_main.h> #include <stddef.h> /* offsetof */ #include "math/forge_math.h" #define FORGE_SCENE_IMPLEMENTATION #include "scene/forge_scene.h"SDL_AppInit— create GPU device, window, claim swapchain, allocate app_stateSDL_AppEvent— handle SDL_EVENT_QUIT (return SDL_APP_SUCCESS)SDL_AppIterate— per-frame GPU workSDL_AppQuit— cleanup in reverse order, SDL_free the app_stateUse
SDL_calloc/SDL_freefor app_state (not malloc/free)Every SDL GPU call gets error handling with
SDL_Logand descriptive messagesCheck every SDL function that returns
bool—SDL_SubmitGPUCommandBuffer,SDL_SetGPUSwapchainParameters,SDL_AcquireGPUSwapchainTexture, etc. all returnfalseon failure. Log a descriptive error (include the function name) and clean up or early-return. Never ignore a bool return value.Use
#define WINDOW_WIDTH 1280and#define WINDOW_HEIGHT 720(16:9). All lessons use this standard size for consistent screenshots.No magic numbers in production/library code —
#defineorenumeverything. In lesson files, inline numeric literals are acceptable when one-off demonstration values improve readability (e.g. vertex positions, color components, sample coordinates)Extensive comments explaining why and purpose, not just what — every pipeline setting, resource binding, and API call should have a brief comment stating why that choice was made (e.g. why CULLMODE_NONE, why TRIANGLELIST, why we push uniforms each frame). This is a recurring PR review requirement.
Use C99, matching SDL's own style
Use math library types for all math operations (see "Using the Math Library" below)
Create CMakeLists.txt:
add_executable(NN-name WIN32 main.c) target_include_directories(NN-name PRIVATE ${FORGE_COMMON_DIR}) target_link_libraries(NN-name PRIVATE SDL3::SDL3) forge_target_assets(NN-name) if(TARGET SDL3::SDL3-shared) add_custom_command(TARGET NN-name POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3::SDL3-shared> $<TARGET_FILE_DIR:NN-name> VERBATIM ) endif()Create
forge-assets.tomlnext to CMakeLists.txt declaring which processed assets the lesson needs:[assets] dirs = [ "fonts/liberation_mono", "models/ModelName = ModelName", ]See
pipeline/README.mdfor the full manifest reference.Create README.md following this structure:
# Lesson NN — Title## What you'll learn— bullet list of concepts## Result— screenshot/GIF first (captured in step 11), then describe what the reader will see## Key concepts— explain each new API concept introduced## Math— if the lesson uses math operations, link to relevant math lessons## Building— standard cmake build instructions## AI skill— mention the matching skill created in step 10, with a relative link to.claude/skills/<topic>/SKILL.md, the/skill-nameinvocation, and a note that users can copy it into their own projects## Exercises— 3-4 exercises that extend the lesson
Update the root CMakeLists.txt: add
add_subdirectory(lessons/gpu/NN-name)under
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл dev-gpu-lesson?
Scaffold a new GPU lesson using forge_scene.h for the rendering baseline
Как установить скилл dev-gpu-lesson?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл dev-gpu-lesson запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…