Six Months of Intense Coding and 300,000 Lines Written! A Programmer Spent ¥1,400 Monthly Pushing Claude Code to the Limit, Joking It May Have Shortened His Life by Five Years
# Six Months, 300,000 Lines Refactored — Lessons from Claude Code
> Six months of real-world project work.
> 300,000 lines of code rewritten.
> It sounds like fiction — but for **JokeGold5455**, it was reality.
---
## Overview
Developer **JokeGold5455** single‑handedly undertook the refactoring of a complex TypeScript microservices project. Determined to impress his boss, he promised delivery within six months — then turned to **Claude Code**, training it into a powerful assistant.
- **Budget:** $200/month (~1,422 RMB) on Claude Code Max 20x plan
- **Project Growth:** Refactored ~100,000 original lines to a clean 300,000–400,000 lines
- **Goal:** Replace an outdated university‑intern‑written webapp with a new, robust system
GitHub showcase repo: [diet103/claude-code-infrastructure-showcase](https://github.com/diet103/claude-code-infrastructure-showcase)
Original Reddit post: [Claude Code Is a Beast — Tips From 6 Months of Use](https://www.reddit.com/r/ClaudeAI/comments/1oivjvm/claude_code_is_a_beast_tips_from_6_months_of/)

---
## Background & Motivation
With seven years of web app development experience, the author embraced AI not as a threat, but as an accelerator:
- **Faster feature builds**
- More efficient demos
- Integration of Claude & GPT‑5 Thinking into product workflows
Proposed to **redesign and refactor** an internal app — inheriting **heavy technical debt**, poor developer experience, and *zero* test coverage.
### Frontend Technology Upgrade
| Old | New |
|-----|-----|
| React 16 (JS) | React 19 (TypeScript) |
| React Query v2 | TanStack Query v5 |
| React Router v4 (HashRouter) | TanStack Router (File Routing) |
| Material UI v4 | MUI v7 |
---
## AI Efficiency — The Catch
> **AI well-used:** doubled efficiency
> **AI poorly-used:** just more overtime
To **unlock Claude Code’s potential**, the author heavily fine‑tuned prompts, tools, and environment — building a **dedicated infrastructure** for skills, hooks, and agents.
Key takeaway: *AI’s effectiveness depends on how you guide, integrate, and iterate with it.*
---
## Claude Code Infrastructure Highlights
**Core Systems:**
- **Skills System:** Auto‑activates guidance modules on relevant tasks
- **Development Documentation Workflow:** Preserves context, keeps work on track
- **PM2 + Hooks:** Process management & “no errors left behind”
- **AI Task Force:** Agents for review, testing, and architecture
---
## Quality & Consistency Lessons
- **Claude improves with a tuned workflow**
- Prompt clarity is critical — small wording changes can drastically shift output
- Don’t hesitate to **step in manually** to fix bugs when human intuition is faster
---
## Skills Auto‑Activation — Game Changer
Introduced with [Anthropic Skills](https://www.anthropic.com/news/skills):
**Problem:** Claude didn’t auto‑trigger skills despite prompt keywords.
**Solution:** Built **custom hooks** in TypeScript to detect intent and inject skill activation reminders before Claude sees the prompt.
Example:
> 🎯 SKILL ACTIVATION CHECK — Use `project-catalog-developer` skill
Skills reference reusable task instructions & best practices, keeping output consistent across a large codebase.
---
## Hooks System — Error-Free by Design
### Hook #1 — UserPromptSubmit
Identifies relevant skills based on:
- Keywords
- Regex intent patterns
- File path/content triggers
Then injects skill activation reminders.
### Hook #2 — Stop Event
- Post‑reply scan for risky code patterns (try‑catch, DB calls)
- Gentle reminders to self‑check
### Hook #3 — Build Checker
- Checks all edited repos for TS errors post‑reply
- Auto‑invokes **error‑resolver agent** if > 5 errors
### Hook #4 — Prettier Formatter *(later removed to save tokens)*
---
## Skill Configuration Example
{
"backend-dev-guidelines": {
"type": "domain",
"enforcement": "suggest",
"priority": "high",
"promptTriggers": {
"keywords": ["backend", "controller", "API"],
"intentPatterns": ["(create|add).*?(route|endpoint)"]
},
"fileTriggers": {
"pathPatterns": ["backend/src/*/.ts"],
"contentPatterns": ["router\\.", "export.*Controller"]
}
}
}
---
## Documentation System — Preventing AI Amnesia
Claude can lose track mid‑task — solved by a **three‑file task doc structure**:
1. `[task]-plan.md` — Approved plan
2. `[task]-context.md` — Key files, decisions
3. `[task]-tasks.md` — Checklist
**Benefit:** Resettable context, consistent execution on long tasks.
---
## PM2 Process Management
For 7 backend microservices:
- **Auto‑restart** on crash
- **Real‑time logs** Claude can read (`pm2 logs service --lines N`)
- **Resource monitoring** (`pm2 monit`)
// ecosystem.config.js
module.exports = {
apps: [
{ name: 'form-service', script: 'npm', args: 'start', cwd: './form' }
]
};
---
## Agents, Hooks, Slash Commands — The Trifecta
### Agents
Specialized roles like `code-architecture-reviewer`, `auth-route-tester`, `strategic-plan-architect`.
### Hooks
Glue for:
- Auto skill activation
- Post‑reply error checks
- Preventing style drift
### Slash Commands
Compact trigger prompts:
- `/dev-docs` — Create strategic plan
- `/code-review` — Architecture review
- `/build-and-fix` — Fix errors across repos
---
## Tools & Scripts
- **SuperWhisper** — Speech input on Mac
- **BetterTouchTool** — Speed navigation & context sharing
- Utility scripts for:
- Mock data generation
- Auth route testing
- Database reset/seeding
---
## Prompting Tips
- Be **specific** — avoid vague “is this good?” questions
- Allow Claude to propose multiple solutions for evaluation
- Use *planning mode* before coding — even for small features
---
## Conclusions & Essential Practices
**Essentials:**
1. **Plan everything** with `strategic-plan-architect`
2. **Skills + Hooks** for consistent best practices
3. Documentation system to lock context
4. Code review for higher output quality
5. PM2 for manageable backend debugging
**Optional Enhancements:**
- Dedicated agents for recurring tasks
- Slash commands for repeated workflows
- Utility scripts bound to skills
- Memory MCP for architectural decision logging
---
> *Workflow takeaway: Combine automated skill triggers with human oversight.
> Use agents and hooks to maintain quality, and document context religiously.*
