β First off, thank you for considering contributing to this project! β
We welcome contributions from everyone. By participating in this project, you agree to abide by our Code of Conduct.
All project communication MUST happen on Discord. We do not pay attention to GitHub notifications.
- Join our Discord server before starting any work.
- Post your PR/issue updates in the relevant Discord channel (MANDATORY).
- All discussions, questions, and updates should be on Discord.
- GitHub is for code only - Discord is for communication.
- We use our own Gitcord bot to integrate Github and Discord. Please follow the steps in Discord to link your Github account with your Discord account.
PRs without Discord updates will not be reviewed or may face delays.
- How Can I Contribute?
- Coding with AI
- Getting Started
- Development Workflow
- Pull Request Guidelines
- Code Style Guidelines
- Debugging Pre-commit Hooks
- Community Guidelines
- Use the repo's issue tracker to submit bug reports or feature requests.
- See the issues that already exist and do not submit duplicate issues.
- When submitting a new issue, select the issue type (bug report or feature request) and fill the template appropriately.
For changes that require a significant amount of code, follow the steps below:
- Submit an Issue: Describe the bug that you would like to fix or the feature that you would like to implement as an issue in our issue tracker.
- Get Assigned: Preferably, wait to be assigned before starting. If there is no assignment and no active PRs for an issue for 2+ days, mention your intent under the issue and start working on the issue even without assignment.
- Submit Your PR: Once assigned, create a PR addressing the issue.
For simple changes that require only a small amount of code, steps 1 and 2 may be skipped. Submit the PR directly.
Pull requests unrelated to issues may be closed or take longer to review.
If you see poor-quality issues and PRs that should be closed, please inform the maintainers in the Discord channel.
If you see good-quality stale PRs that could be merged, please inform the maintainers in the Discord channel.
Do not submit spam issues or PRs. Make sure your contributions are valuable.
Various tools, bots, limit configurations and workflows are in use to automatically prevent the submission of spam issues and PRs or to automatically close them. If you believe any of these methods has incorrectly prevented your contributions, please notify the maintainers in Discord.
We accept the use of AI-powered tools (GitHub Copilot, ChatGPT, Claude, Cursor, etc.) for contributions, whether for code, tests, or documentation.
What we expect:
- Disclose AI usage: A simple note like "Used GitHub Copilot for autocompletion" or "Generated initial test structure with ChatGPT" is sufficient.
- Specify the scope: Indicate which parts of your contribution involved AI assistance.
- Review AI-generated content: Ensure you understand and have verified any AI-generated code before submitting.
- Node.js 20 or newer (with npm)
- Git
- A modern browser (Chrome, Edge, Firefox or Safari) to try the app
- No accounts, API keys or environment variables are needed: the app is fully local
-
Fork the Repository
# Click the 'Fork' button at the top right of this page -
Clone Your Fork
git clone https://github.com/YOUR_USERNAME/Memo-EducationalGame.git cd Memo-EducationalGame -
Add Upstream Remote
git remote add upstream https://github.com/AOSSIE-Org/Memo-EducationalGame.git
-
Install Dependencies
npm install # or yarn install # or pnpm install
-
Run the Project
npm run dev
Always work on a new branch, never on main or dev:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix- Write clean, readable code
- Follow the project's code style
- Add comments where necessary
- Update documentation if needed
Before opening a PR, make sure all of these pass:
npm run check # Svelte + TypeScript type checking
npm test # unit tests (Vitest): selection algorithm, streaks, IndexedDB layer
npm run build # production build, including the PWA service workerThen try your change in the browser with npm run dev (or npm run build && npm run preview to test the PWA/offline behaviour):
- Check the page never scrolls at desktop sizes (e.g. 1280Γ720) and on a phone in landscape (e.g. 844Γ390). Use your browser's device toolbar.
- Check both light and dark mode.
- Check all three difficulty levels (3, 6 and 9 options).
- If you change what is saved (the IndexedDB data in
src/lib/db.ts, the player files or backups insrc/lib/transfer.ts), players must never lose their progress:- First record a fixture of the current version in
src/lib/fixtures/(export-v<N>.json,backup-v<N>.json,cardset-v<N>.json; database versions are tested insrc/lib/db.test.ts), ideally from the deployed app: play a little, then copy what DevTools β Application β IndexedDB shows, or a downloaded file. - Bump the version, add a migration (
upgrade()indb.ts, or the import intransfer.ts) and document the new version in the comment above it. - Older files and databases must keep loading:
npm test(src/lib/compat.test.ts) opens every fixture with the new code, and fails if a version has no fixture. - Never remove or rename a saved field without migrating it; prefer adding fields with defaults (
src/lib/users.ts).
- First record a fixture of the current version in
Write clear, concise commit messages:
git add .
git commit -m "feat: add user authentication"
# or
git commit -m "fix: resolve navigation bug"Commit Message Format:
feat:for new featuresfix:for bug fixesdocs:for documentation changesstyle:for formatting changesrefactor:for code refactoringtest:for adding testschore:for maintenance tasks
git fetch upstream
git rebase upstream/main
# or upstream/dev depending on the projectgit push origin feature/your-feature-name- Your code follows the project's style guidelines
- You've tested your changes thoroughly
- You've updated relevant documentation
- Your commits are clean and well-organized
- You've rebased with the latest upstream changes
- You've thought from the reviewer's perspective and made your PR easy to review
- Go to the original repository on GitHub
- Click "New Pull Request"
- Select your fork and branch
- Fill out the PR template with:
- Clear description of changes
- Link to related issue(s)
- Screenshots (if UI changes)
- Testing steps
## Description
Brief description of what this PR does
## Related Issue
Closes #issue_number
## Screenshots/Video (if applicable)
Add screenshots here
## Testing(if applicable)
Steps to test the changes
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] Tests added/updated- Post your PR in the project's Discord channel for visibility(IMPORTANT)
- Respond to review comments promptly
- Make requested changes in new commits
- Be patient - maintainers will review when available
- Use
[WIP]in your PR title for incomplete PRs. Don't use this as a way to gatekeep; focus on one change until it gets merged.
- Instead of opening duplicate PRs, help review and improve existing ones.
- When reviewing, assess whether the change is actually necessary before diving into implementation details and functionality testing.
- The UI is for young children: prefer icons over text, keep text to a minimum, and give every icon-only button an
aria-labeland atitle. - Use the AOSSIE brand: colours from the CSS variables in
src/app.css(Golden Wallet#FFCD00, Baggy Green#00843D,#121212,#FFFFFF,#7A7A7A) and the Inter font. Do not hard-code new colours when a token exists. - Use Svelte 5 runes (
$state,$derived,$props,$effect). Shared state lives insrc/lib/app.svelte.ts. - Keep game logic in plain, testable TypeScript modules under
src/lib/and add tests next to them (*.test.ts). - The app must stay purely local: no network requests at runtime, no analytics, no external fonts or CDNs.
- Do not edit generated content by hand: change and re-run the scripts instead β
npm run build-shapes(public/cards/shapes/, drawn bysrc/lib/shapes.ts),npm run build-capitals(public/cards/capitals/, from Flag Quiz's photos) andnpm run build-credits(public/credits.html,public/credits-i18n/). - Built-in card sets are in
src/lib/sets.ts: a set is a name, topics and cards (picture + description), and every text must exist in every language (src/locales/<lang>.ts, and for the shapessrc/locales/shapes/<lang>.json).npm testchecks that. - Every photo must be freely licensed and credited: keep the author, licence and source of each one (the capitals script does this for Wikimedia Commons).
- Use meaningful variable and function names
- Keep functions small and focused
- Add comments for complex logic
- Remove console.logs before committing
- Avoid code duplication
- Avoid unnecessary complexity and minor over-optimization
- Use ES6+ syntax
- Prefer
constoverlet, avoidvar - Use arrow functions where appropriate
- Follow ESLint rules
- Follow PEP 8 style guide
- Use type hints where applicable
- Write docstrings for functions/classes
Pre-commit hooks help maintain code quality by running automated checks before each commit. This section helps you troubleshoot common issues.
If pre-commit is configured in this project, install it first:
pip install pre-commit
pre-commit installError:
Trim Trailing Whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook
Solution:
# Pre-commit automatically fixes this. Just re-stage and commit:
git add .
git commit -m "your message"Error:
Fix End of Files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook
Solution:
# Files are automatically fixed. Re-add and commit:
git add .
git commit -m "your message"Error:
Check Yaml..........................................Failed
- hook id: check-yaml
- exit code: 1
File .github/workflows/test.yml: mapping values are not allowed here
Solution:
# Fix the syntax error in the file (check line number in error)
# Common issues:
# - Incorrect indentation
# - Missing colons
# - Invalid characters
# Then commit againError:
detect-secrets...........................................................Failed
- hook id: detect-secrets
- exit code: 1
Potential secrets about to be added to git repo:
Secret Type: AWS Access Key
Location: config/settings.py:42
Solution:
# Option 1: Remove the secret and use environment variables
# Replace hardcoded secrets with:
# API_KEY = os.getenv('API_KEY')
# Option 2: If it's a false positive, update baseline:
# detect-secrets scan > .secrets.baseline
# git add .secrets.baselineError:
Mixed line ending........................................................Failed
- hook id: mixed-line-ending
- exit code: 1
- files were modified by this hook
Solution:
# Automatically fixed to LF. Re-add and commit:
git add .
git commit -m "your message"Error:
Check for added large files..............................................Failed
- hook id: check-added-large-files
- exit code: 1
large.zip (5.2 MB) exceeds 500 KB
Solution:
# Option 1: Remove large files
git rm --cached large.zip
# Option 2: Use Git LFS for large files
git lfs install
git lfs track "*.zip"
git add .gitattributes
# Option 3: Increase limit (not recommended)
# Edit .pre-commit-config.yaml:
# args: ['--maxkb=10000'] # 10MBError:
Check for merge conflicts................................................Failed
- hook id: check-merge-conflict
- exit code: 1
Merge conflict markers found in:
src/main.js:45
Solution:
# Open the file and remove conflict markers:
# <<<<<<< HEAD
# =======
# >>>>>>> branch-name
# Then commit againProblem: Commits go through without pre-commit checks
Solution:
# Reinstall pre-commit hooks
pre-commit uninstall
pre-commit install
# Verify installation
pre-commit run --all-filesProblem: Pre-commit is slow on every commit
Solution:
# Run only on changed files (default behavior)
git commit -m "message"
# Skip pre-commit for quick commits (use sparingly!)
git commit --no-verify -m "message"
# Update pre-commit hooks
pre-commit autoupdateError:
An error has occurred: InvalidManifestError:
=====> /path/to/.pre-commit-config.yaml does not exist
Solution:
# Ensure you're in the project root directory
cd /path/to/project/root
# Verify config file exists
ls -la .pre-commit-config.yaml
# Reinstall
pre-commit install# Skip pre-commit hooks for a single commit
git commit --no-verify -m "emergency fix"
# Or use the short flag
git commit -n -m "emergency fix"Note: This should be rare. If you need to bypass frequently, discuss with maintainers.
# Run all hooks on all files
pre-commit run --all-files
# Run a specific hook
pre-commit run trailing-whitespace --all-files
# Run on specific files
pre-commit run --files src/main.js src/utils.js# Update to latest versions
pre-commit autoupdate
# Clean and reinstall
pre-commit clean
pre-commit installIf you encounter issues not covered here:
- Check pre-commit documentation
- Review the error message carefully (it usually tells you what's wrong)
- Ask in the project's Discord channel
- Search for similar issues in the repository
Remember: Pre-commit hooks are there to help you maintain code quality. Don't fight them - fix the issues they find!
- Be respectful and inclusive
- Provide constructive feedback
- Help others when you can
- Ask questions - no question is too small!
- If your work is taking longer than expected, comment on the discord with updates
- Issues should be completed within 5-30 days depending on complexity
- If you can no longer work on an issue, let maintainers know on discord
- Check existing documentation first
- Search closed issues for similar problems
- Ask in Discord
- Tag maintainers if your PR is unattended for 1-2 weeks on discord
Thank you for contributing to Memo! Your efforts help make this project better for everyone. π