dev-math-lesson
Add a math concept - create lesson, update library, document usage
от Nebulavenus★ 51 звезда на GitHub
Установить dev-math-lesson в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Create a new math lesson and update the math library (common/math/forge_math.h).
When to use this skill:
- You need math functionality that doesn't exist in
forge_math.hyet - A GPU lesson requires new math operations
- You want to teach a foundational math concept
Smart behavior:
- Before creating a lesson, check if the math already exists in
forge_math.h - If it exists, just document it better or create a lesson for existing code
- If creating from a GPU lesson's needs, extract only the math (not GPU-specific code)
Arguments
The user (or you) can provide:
- Number: two-digit lesson number (e.g. 01, 02)
- Concept name: kebab-case (e.g. vectors, matrices, quaternions)
- Description: what this teaches (e.g. "Vectors, dot product, normalization")
If any are missing, infer from context or ask.
Steps
1. Analyze what's needed
- Check
common/math/forge_math.h: Does this math already exist? - Check existing math lessons: Is there already a lesson for this?
- Identify the scope: What specific operations/concepts are needed?
2. Create the lesson directory
lessons/math/NN-concept-name/
3. Create a demo program (main.c)
A small, focused C program that demonstrates the math concept visually or numerically.
Requirements:
- Standalone — Can run without GPU (uses SDL for window/input if visual, or just printf if not)
- Clear output — Shows the math in action (visualization or printed results)
- Well-commented — Explains what's happening and why
- Uses the math library —
#include "math/forge_math.h"
Examples:
- Vectors: print dot products, show perpendicular/parallel cases
- Matrices: print a rotation matrix, show before/after transformation
- Visual: use SDL to draw vectors, show transformations in a window
Template structure:
/*
* Math Lesson NN — Concept Name
*
* Demonstrates: [what this shows]
*
* SPDX-License-Identifier: Zlib
*/
#include <SDL3/SDL.h>
#include "math/forge_math.h"
int main(int argc, char *argv[])
{
(void)argc;
(void)argv;
if (!SDL_Init(SDL_INIT_VIDEO)) {
SDL_Log("SDL_Init failed: %s", SDL_GetError());
return 1;
}
/* Demonstrate the math concept here */
SDL_Quit();
return 0;
}
Console output formatting:
- Use ASCII-only characters for console output (cross-platform compatibility)
- Avoid Unicode box-drawing, symbols, or special characters that may not render on Windows Terminal
- Good:
-,=,*,|,->,[OK],[!], "degrees", "in", "+/-" - Bad:
─,═,•,↓,→,✓,⚠,°,∈,±(may render as garbled text on Windows)
4. Create CMakeLists.txt
add_executable(NN-concept-name main.c)
target_include_directories(NN-concept-name PRIVATE ${FORGE_COMMON_DIR})
target_link_libraries(NN-concept-name PRIVATE SDL3::SDL3)
add_custom_command(TARGET NN-concept-name POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:SDL3::SDL3-shared>
$<TARGET_FILE_DIR:NN-concept-name>
)
5. Create README.md
Structure:
# Math Lesson NN — Concept Name
[Brief subtitle explaining what this teaches]
## What you'll learn
[Bullet list of math concepts covered]
## Key concepts
[Bullet list of core takeaways:]
- **Concept 1** — Brief explanation
- **Concept 2** — Brief explanation
- **Formula/operation** — What it does and when to use it
## The Math
[Explain the concept clearly, with intuition before formulas]
### [Subconcept 1]
[Explanation, formula, geometric meaning]
### [Subconcept 2]
[Explanation, formula, geometric meaning]
## Where it's used
Graphics and game programming uses this for:
- [Use case 1]
- [Use case 2]
**In forge-gpu lessons:**
- [Link to GPU lesson] uses `function_name()` for [purpose]
- [Link to GPU lesson] uses `function_name()` for [purpose]
## Building
```bash
cmake -B build
cmake --build build --config Debug
# Windows
build\lessons\math\NN-concept-name\Debug\NN-concept-name.exe
# Linux / macOS
./build/lessons/math/NN-concept-name/NN-concept-name
```
[Brief note on what the demo shows]
## Result
[Brief description of expected demo output or what the program demonstrates]
**Example output:**
```text
[Copy actual program output here]
```
**Important:** Copy output directly from running the program—don't manually type it.
## Exercises
1. [Exercise extending the concept]
2. [Exercise applying it differently]
3. [Exercise combining with other concepts]
## Further reading
- [Relevant math lesson that builds on this]
- [External resource if helpful]
6. Update common/math/forge_math.h
Add the new math functions following the library's conventions:
- Documentation: Summary, parameters, returns, usage example, geometric intuition
- Naming:
typeN_verb(e.g.,vec3_dot,mat4_rotate_x) - Implementation: Clear, readable, matches textbook descriptions
- Inline: Use
static inline
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл dev-math-lesson?
Add a math concept - create lesson, update library, document usage
Как установить скилл dev-math-lesson?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл dev-math-lesson запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
AnthropicUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
xlsx
AnthropicUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
pptx
AnthropicUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…