DEV Community

Cover image for Refactoring Text Like Code: The "Mother Tongue" Prompt Hack That Got My Book Published
lwgena
lwgena

Posted on

Refactoring Text Like Code: The "Mother Tongue" Prompt Hack That Got My Book Published

WeCoded 2026: Echoes of Experience 💜

This is a submission for the 2026 WeCoded Challenge: Echoes of Experience

It all started with a very personal, very human problem: I wanted to stop watching too much YouTube.

Instead of downloading a generic blocking app, I decided to build my own custom timer—one that would honestly extract the exact time I spent watching videos. To do this, I opened up Gemini and typed in my first prompt in my native Japanese:

YouTube見ているときに、時間をブラウザーに表示できませんか。
( Can I display the time on the browser while watching YouTube? )

That single prompt kicked off a journey that evolved from a simple coding experiment into a published book. Before diving into the trial and error of how I built it, here is the core concept of my approach:

In a Nutshell: The "Mother Tongue" Hack

  • The Misconception: That I just "generated" a book or code with AI.
  • The Actual Process: The human provides the core context in their native language → AI proposes a draft. The human dictates nuanced corrections → AI surgically refactors the text. It is a strictly human-led iteration.
  • The Reality: The final output language—whether it's JavaScript, English, or Japanese—is completely irrelevant. The true hack is bypassing the cognitive "translation tax" and using your native language to command the AI's logic engine at 10x speed.

Here is the story of how it happened.

Navigating the Chaos with AI

When I first asked the AI for help, it immediately jumped the gun and generated an over-engineered, monolithic block of code. I stopped it right there. I told it,

いや、ステップバイステップでやろう。
( No, let's do this step-by-step. )

We started by simply displaying the time the YouTube tab was open. Then, we added a popup display, saving functionality, and an options page to track non-YouTube sites. I had my Minimum Viable Product (MVP). But then, the unpredictable nature of the browser environment hit me:

  • Time Drift: The timer was slowly becoming inaccurate. So, I prompted the AI to calculate the time difference instead.
  • The Sleep Mode Ghost: When the PC went to sleep, the timer kept adding time.
  • Background Listening: I wanted to count the time when listening to music in another window, but not when just looking away.
  • Overnight Crashes: By the next morning, the extension would mysteriously stop working.

It wasn't always smooth sailing. There were times when the AI's logic would completely derail, spitting out nonsense that made me want to shout, "You idiot!" at the screen. When that happened, I had to abandon the corrupted conversation, open a fresh chat, and start over. I learned the hard way that AI isn't magic. To get high-quality output, you have to carefully and patiently build up the context step by step.

I solved these issues not by memorizing code, but by defining the core logic, breaking down the multifaceted issues into manageable steps, and carefully feeding that context into my prompts. Step-by-step, we ironed out the bugs until I successfully published the Watchtime Badge Chrome Extension to the store.

From Code to a Guidebook for Everyone

Once the extension was live, I realized the process of building it—the struggle against the browser's constraints using logic—was more valuable than the code itself. I pasted my code back into Gemini and said,

このプロセスについて本を書きたいんです。
( I want to write a book about this step-by-step process. )

I wanted to reach anyone who feels intimidated by programming. To make the concepts truly accessible, I decided to use high school students as my target persona. I fed the official Japanese high school guidelines for tech classes into the AI, along with a high-level outline of the book. I wanted to prove that school concepts like "Modeling" and "Algorithms" aren't just textbook theories—they are the exact weapons needed to defeat real-world problems.

The Human Touch: Guiding AI with Visuals

To make the concepts truly clear, I knew I needed architecture diagrams at the beginning of each chapter. This was something the AI couldn't conceptualize from scratch.

I had to draw them myself. Here is one of them:

The actual architecture diagram fed into Gemini, mixing logic, English, and Japanese UI

Then came the fun part. Instead of writing tedious explanations to translate my thought process, I just gave the AI this diagram. Despite the mix of Japanese, English, and visual logic, the AI understood exactly what I was trying to show.

From just this single image, it generated a solid first draft of the explanatory text to accompany the diagram. It wasn't perfect—I still had to step in and polish the nuances—but having the AI automatically translate this hybrid visual architecture into our "high-school textbook" tone saved me the headache of manually writing out how all these technical pieces connect. It gave me the perfect raw material to seamlessly integrate into the final chapters.

Text Refactoring: The "Git Diff" Hack

Even during the polishing phase, I treated the AI like a true co-editor. If a specific paragraph felt off, I didn't rewrite it manually. I would just tell the AI, "Tweak the nuance of this specific part," and it would surgically refactor the text. It could hold the context of an entire chapter (around 5,000 Japanese characters, or 2,500 English words) and update just the targeted section without breaking the rest of the flow—exactly like reviewing a clean Git diff in VS Code. This iterative "text refactoring" is what made writing a whole book realistically possible.

On the Japanese platform Zenn, this human-AI collaborative process resulted in my published book: Learning the Engineer's Mindset Through Chrome Extensions — The YouTube Timer "Creation Quest".

Beyond the Numbers: From Consumer to Creator

To be completely honest, if you look at the stats right now, my extension only has 3 installs, and my book has just 2 likes. Some might laugh and say, "Nobody is even reading it or using it!"

But that doesn't discourage me in the slightest. This is just Day One. The true victory wasn't about going viral; it was about crossing the line from being a passive "consumer" of technology to an active "creator." Planting that first seed is the hardest part, and I finally did it.

The Takeaway: The Ultimate Equalizer

Looking back, I realized that creating with AI isn't about letting the machine do all the work. The true process is exactly what I wrote in my book:

Hand a rough vision to the AI, define the core problem to carve away the noise, decompose the tangled reality into manageable logical steps, and finally build those refined pieces into the ideal shape.

I am sharing this story for the WeCoded challenge because I believe this mindset is the ultimate equalizer. You don't need an elite computer science background, and English doesn't have to be your primary language to build something globally meaningful.

If you have the willpower to define your problem, the logic to decompose it, and AI as your pair-programmer, anyone—including underrepresented voices—can become a creator.

Don't just memorize code. Hack your own life.

Top comments (0)