العودة إلى المشروع

دليل

كيف تساهمون في المشروع

ثلاثة أنواع من المساعدة، من الأصغر: درس، أو ترجمة، أو نوع تمرين جديد.

مدّة القراءة: 8 دقائقهذا الدليل بالإنجليزية فقطالمصدر على GitHub

المحتويات 8
  1. The rule above all: child privacy
  2. The rules every change keeps
  3. Add a lesson
  4. Add a translation
  5. Add a component
  6. Add a film look or effect
  7. Tests to run before a pull request
  8. Skills for assistants

Thank you for helping families. Three kinds of help, from the smallest:

  1. A lesson for one unit of a school book (no code).
  2. A translation of the words on screen.
  3. A component: a new kind of question (one folder of JavaScript and JSON).

The binding contract is docs/ARCHITECTURE.md. When this page and the contract disagree, the contract wins.

The rule above all: child privacy

  • Child data never leaves the family's device, except in a file or text the parent sends on purpose.
  • Never put a real child's name, photo, answers, marks or school papers in a lesson, a test, a fixture, an issue or a commit. Examples use التلميذ(ة) (or "the pupil", « l'élève »).
  • A lesson holds no profile, no results and no photos of the child. Scanned book pages and copied exam sheets are not allowed either (copyright): write the questions in your own words, and cite the book pages.
  • subjects/ and inbox/ are private and ignored by git. Do not force-add files from them.

The rules every change keeps

  • No build step, no npm packages, no ES modules, no fetch() of local files. app/index.html must work by double-click, on a static host and with python3 slk.py serve.
  • Every shipped script adds to one global, SLK. Pure logic (no DOM) lives in app/core/ and is tested in Node.
  • Python is 3.9, standard library only (numpy and Pillow only in the optional media tools, imported lazily).
  • Where JavaScript and Python share a rule, both are tested against the same files in tests/fixtures/.
  • Western digits 0-9 on screen, unless a lesson sets "digits": "eastern". Every screen works right-to-left.
  • Lesson texts and pasted answers are hostile input: escape them, and set text with textContent.
  • Screens: 360 px wide, touch, 44 px targets, 4.5:1 contrast. Words a parent sees: Lesson, Send to my assistant / Paste the answer, Alone / With help. Never: sync, pack, component, JSON, evidence.
  • tests/fixtures/components/ are frozen. app/components.js is generated: never edit it by hand.

Add a lesson

Follow these steps in order. Run every command from the kit's folder.

  1. Pick the unit. Open curricula/<profile>.json (Algeria: curricula/dz-primary.json) and find the unit under grades → your grade → subjects → your subject → units. Your lesson id is <country>/<grade>/<subject>/<unit id>, e.g. dz/3ap/science/m1-u2. The coverage board (site/coverage.html) shows the units with no lesson yet. A unit that is not listed: add it to the profile first, with its title and book pages.

  2. Read the format (short texts for a model): python3 slk.py card --lesson, then python3 slk.py card --index, then python3 slk.py card <names> for the kinds of question you use.

  3. Write the file at packs/<country>/<grade>/<subject>/<unit>/lesson.json with: "id" = the lesson id above; "curriculum", "grade", "subject", "unit" = the same parts; "version": "1.0.0"; "license": "CC-BY-SA-4.0"; your name or nickname in "authors" (an assistant writing for someone: that person's nickname, or "Study Loop Kit contributors"); "reviewed_by_teacher": true only when a teacher read it. Each skill's "pages" = the book pages it comes from, as printed in the book ("48-49", "20, 33"); no book at hand: the unit's pages from the profile. One skill per thing the teacher tests, with the book pages and the teacher's words; at least two kinds of question per skill. Instructions in the first person, as school books do (أُصَنِّفُ, « je classe », "I sort"), never "you", never a boy or a girl.

  4. Never put in a lesson: a child's name, answers, marks or photos (examples use التلميذ(ة)); scanned book pages; copied exam sheets. Write the questions in your own words and cite the book pages.

  5. Check it until each command prints OK:

    python3 slk.py check packs/<country>/<grade>/<subject>/<unit>/lesson.json
    python3 slk.py pack check packs/<country>/<grade>/<subject>/<unit>/lesson.json
    python3 slk.py registry build

    registry build adds the lesson to packs/index.json and to the gallery and coverage pages in site/.

  6. Send it: a pull request with the lesson folder and the files registry build changed. No git? Use the Offer a lesson form instead: in the app, Lessons → the lesson → More → Offer this lesson to other families saves the file and opens the form; attach the file there. A copy of the kit with no repository set in app/config.js (and not a git folder) cannot send anything itself: hand the lesson folder (or the file the app saves) to the person who gave you the kit. Only files the registry allows go under packs/: lesson.json and, in the lesson's assets/ folder, pictures (png, jpg, gif, webp) and .wav clips; never a page, a script, an SVG or a link (registry check refuses them).

Licences: lessons are shared under CC BY-SA 4.0 (others may copy and adapt them, with credit); the code is MIT (see LICENSE). To improve a lesson: never reuse an item id for different content, and raise the version. The repository address used by the Offer and Report forms is set in one place, app/config.js (repo, pages).

Add a translation

  • Words on screen live in app/ui/i18n.js: one table per language, in two parts (S and MORE). Copy the en entries of both and translate every key; the tests check that every language has the same keys.
  • A text may be { "m": …, "f": …, "n": … } for a boy, a girl, or not known yet. Use it wherever the language changes with the child's gender.
  • Each component's instruction verb is in its component.json (verb); words only one component needs live in that component's files.
  • Plain words, short sentences. No internal words (see above).

Add a component

A component is one folder, components/<name>/. Nothing outside the folder names it. Start it with python3 slk.py component new <name> (add --display for a box the child only reads): a working folder that passes the tests at once, with ONE drawing (draw.js) reused by the sheet, the app, the film and the lesson summary. The full guide, with "Your first module in 10 minutes", is components/README.md; in short:

FileHolds
component.jsonname, version, aliases, answer kind, marking, verb (ar/fr/en), schema of the fields, optional checks, the model card (≤ 11 lines), an example
paper.jspaper.render(v, ctx) and paper.key(v, ctx): HTML strings, no DOM
play.jsplay.mount(el, v, ctx, report): the interactive version, inside el only
sample.jsoptional: a fresh variant each time, from rng only
slide.jsslide.render(v, ctx, t): its slide in the film (every component has one)
summary.jsoptional: its revision view in the lesson summary (the answer shown; a table, a chain, a labelled picture)
style.cssoptional; rules prefixed with your own class (summary.css: the summary view's)
golden/<case>.jsonthe example cases the tests render and keep

Then:

python3 slk.py bundle                         # regenerate app/components.js
python3 slk.py card <name>                    # read your card as a model will
SLK_UPDATE_GOLDEN=<name> node tests/run.mjs   # write your goldens, then read them

The acceptance test of a component: a cheap model given only python3 slk.py card <name> writes a valid item on the first try. To list it on the front page, add assets/home/modules/<name>.webp (its film slide at t = 1) and its card in the three languages of index.html; tests/test_home.py then checks it is shown in all three.

Add a film look or effect

Also one folder: film/styles/<name>/ (a look: style.json, style.css, optional bg.js) or film/effects/<name>/ (effect.json, effect.js, optional effect.css, golden/). Start by copying film/effects/boxed/ or film/styles/notebook/; the full guide is film/README.md. In short: about (one English line, for the model's card) plus about_ar and about_fr (what parents read in the gallery); effect.js is a pure function of p (no clock, chance, timers or page: bundle reads its tokens and refuses them); Arabic words are never split and timelines run right to left.

python3 slk.py bundle                         # regenerate app/filmkit.js (and check your folder)
SLK_UPDATE_GOLDEN=<name> node tests/run.mjs   # write your goldens ("p": a list such as [0, 0.5, 1]), then read them
python3 slk.py film-gallery                   # site/film.html: see it move next to the others

A scene from a creative film that proved itself is the best start for a new effect (film/README.md).

Tests to run before a pull request

node tests/run.mjs
python3 -m unittest discover tests
python3 slk.py bundle --check

python3 slk.py test runs the first two. python3 slk.py ci runs everything the pull-request check runs (also registry check and a check of every shared lesson). Browser checks run headless only, never in a visible window. Name a test after the story it proves (the ids in feedback/master-feedback.md §15.1: A1, B2, …).

Skills for assistants

Skills live in skills/<name>/SKILL.md. skills/study-loop/SKILL.md is the router every assistant reads first: keep it about 2 KB, and put details in skills/study-loop/references/. Every other skill starts with one line pointing to the router. python3 slk.py install copies or links them for Claude Code, Codex, Cursor and Antigravity.