Claude Code ยท Python
Build a Calculator with Claude Code
Prerequisites
- โ Claude Code CLI installed (npm install -g @anthropic-ai/claude-code)
- โ Git installed
- โ Qmmit installed (curl -fsSL qmmit.dev/install.sh | bash)
- โ A Qmmit account with CLI token
Create the project
Create a new folder and initialize git. This is where your calculator app will live.
mkdir calculator-app cd calculator-app git init echo "# Calculator App" > README.md git add README.md git commit -m "initial commit"
Set up Qmmit tracking
Initialize Qmmit in this repo. It will detect Claude Code, install git hooks, and connect to your dashboard.
qmmit init # Paste your CLI token when prompted
What Qmmit does here
Creates .qmmit/ directory, installs post-commit and pre-push hooks, detects Claude Code as an available tool.
Start Claude Code and ask for the calculator
Launch Claude Code in your project directory. Ask it to build a calculator.
claude # In Claude Code, type: # "Create a Python calculator with add, subtract, multiply, divide functions. # Include input validation and a main loop that asks the user for operations."
Claude Code saves every conversation as a JSONL file at ~/.claude/projects/. Qmmit reads these files automatically.
Review and save the code
Claude Code will generate calculator.py. Review the code, let Claude apply it to your project.
# Claude creates calculator.py with: # - add(a, b), subtract(a, b), multiply(a, b), divide(a, b) # - Input validation (handles non-numeric input) # - Main loop with menu # Test it: python calculator.py
Ask Claude to add tests
Ask Claude Code to write unit tests for the calculator.
# In Claude Code: # "Write pytest unit tests for all calculator functions including edge cases # like division by zero and non-numeric input"
What Qmmit does here
This is your second prompt. Qmmit will capture both prompts and link them to the next commit.
Commit your code
Stage everything and commit. The post-commit hook fires automatically and captures your Claude Code prompts.
git add . git commit -m "feat: calculator with tests" # You should see: # [qmmit] 2 prompt(s) tracked (claude-code) โ abc1234
What Qmmit does here
The post-commit hook reads ~/.claude/projects/*.jsonl, finds your 2 prompts, matches them to this commit by timestamp and file overlap, and stores them locally.
Push and check your dashboard
Push to GitHub. The pre-push hook syncs your prompts to your Qmmit profile.
git remote add origin https://github.com/YOU/calculator-app.git git push -u origin main # You should see: # [qmmit] 2 prompt(s) synced โ qmmit.dev/yourusername # Now visit: https://www.qmmit.dev/yourusername # You will see: # - calculator-app project card # - 2 prompts with claude model badge # - Commit SHA linking to your GitHub commit # - Activity heatmap with today highlighted