Recap of the Previous Article
In Part 3, we covered Git. This time, let's talk about the origin of the Kagemusha System: Google Apps Script (GAS).
What Is Google Apps Script — A Quick Overview
GAS = A free programming environment provided by Google.
It lets you programmatically control Google services like Google Sheets, Gmail, and Google Drive — all from your browser. No installation required.
The Kagemusha System was originally built entirely with GAS. Lesson data goes into a spreadsheet, GAS processes it automatically, generates a PDF, and sends it via email. All of this happens entirely within Google's ecosystem.
Why It Matters — The Perfect Entry Point for Beginners
If you tell a programming beginner to "set up a server" and "provision a database," they'll be completely lost.
With GAS:
- Server → Google provides one (for free)
- Database → A spreadsheet works as a substitute
- Authentication → Handled by your Google account
- Email sending → Gmail's API is available
In other words, you can offload all the tedious infrastructure to Google.
What Is clasp — A Tool for Managing GAS from Your PC
You can write GAS in the browser's script editor, but that comes with some inconveniences:
- Hard to manage as the number of files grows
- Can't track history with Git
- Can't edit with Claude Code
That's where clasp (Command Line Apps Script Projects) comes in. With clasp, you can manage your GAS code as local files on your PC.
Editing bit by bit in the browser's script editor. Files get disorganized as they multiply. No version history. Claude Code can't access it.
GAS code files sit in a folder on your PC. Version history managed with Git. Claude Code edits directly and deploys with clasp push.
Installation
clasp is installed via npm (Node.js required — see Part 2).
npm install -g @google/clasp
For the first time, log in with your Google account:
clasp login
# A browser window opens — authorize with your Google account
How I Use It — Just Two Commands: push and pull
In day-to-day use, clasp boils down to two commands:
# Deploy local code to GAS
clasp push
# Pull changes from GAS to your PC
clasp pull
My development workflow looks like this:
- Tell Claude Code "add this feature"
- Claude Code edits the GAS files on my PC
- Run
clasp pushto deploy to GAS - Test execution on the GAS side
clasp push overwrites the GAS side with your local code. If you've made edits directly in the browser's script editor, you need to run clasp pull first to sync those changes to your PC — otherwise they'll be lost. I've made this mistake more than once.
The Kagemusha System runs three GAS projects. Each customer gets their own setup GAS project, and managing all of this without clasp would have been impossible.
What I Actually Run on GAS
"Free programming environment" sounds great, but what can you actually build with it? Here's everything I run on GAS.
| Project Name | What It Does |
|---|---|
| Kagemusha Core | Tutor attendance tracking, invoice PDF generation, parent email notifications |
| Kagemusha Server | Remote code updates for customers' GAS projects |
| Kagemusha Setup | Automated environment provisioning in customers' Google accounts |
| Claude Mail | Monitors Gmail → AI auto-replies. Also handles Drive storage & file sharing |
| Claude Drive | File uploads & automated distribution via Google Drive |
| Weekly Mock Exams | Auto-generates mock exams for 5 middle school subjects → take exam → auto-grade |
| Personal Accounting | Double-entry bookkeeping via Zaim API, auto-generates blue return tax forms |
Seven GAS projects running simultaneously. And all of them are free.
The "Claude Mail" project is a particularly interesting setup. When an email with the [Claude] prefix arrives in Gmail, GAS detects it and hands processing off to the Claude Code CLI. The AI reads the email, drafts a reply, and sends it through Gmail via GAS. Essentially, I've built an AI-powered email receptionist with GAS.
"Personal Accounting" automatically pulls data from the Zaim household budgeting app's API and generates double-entry bookkeeping journal entries in a spreadsheet. It even auto-generates blue return tax declaration forms — no need for freee or similar services.
The Reality of clasp in Production — The Multi-Account Trap
There's one gotcha that trips people up in real-world use: switching between multiple Google accounts with clasp.
I run GAS under two Google accounts — one for business and one for personal use. clasp stores login credentials in a file called ~/.clasprc.json, but only one account can be logged in at a time.
The solution is simple: create backup files for each account and copy the right one when switching.
# When working on the business account
cp ~/.clasprc_business_backup.json ~/.clasprc.json
# When working on the personal account
cp ~/.clasprc_personal_backup.json ~/.clasprc.json
It's a low-tech fix, but without it, you'll run into the dreaded "I ran clasp push and it deployed to the wrong account" accident. It's happened to me more than once.
Always verify before running clasp push:
- Which account am I currently logged into? (Check the contents of
~/.clasprc.json) - Is the target project's Script ID correct? (Check
.clasp.json) - Did I run clasp pull to get the latest? (To avoid overwriting changes made on the GAS side)
Coming Up Next
GAS is an excellent starting point, but push it far enough and you'll hit its limits. Next time, we'll introduce Cloudflare Workers and wrangler — the tools we adopted to break through those limitations.
Part 2: Node.js & npm
Part 3: Git
Part 4: Google Apps Script & clasp
Part 5: Cloudflare Workers & wrangler
Part 6: Stripe CLI
Part 7: Python & Useful Libraries
Part 8: Putting It All Together — The Big Picture & How to Choose
Still managing tutor attendance manually?
Discover Kagemusha System