Teaching Claude Code to Write and Grow Its Own Skills: A Self-Replicating Agent Environment A developer built a self-replicating agent environment for Claude Code that automatically discovers and accumulates reusable procedures as skills. Over several months, the system generated 64 auto-generated skills stored in ~/.claude/skills/auto/, using in-session generation and nightly batch harvesting with a curator to prevent overproduction and manage skill lifecycle. Last time I wrote about splitting Claude Code's memory into four layers https://zenn.dev/bokuwalily/articles/f534402187bd07 . This is the follow-up: a setup where Claude Code itself discovers "reusable procedures" and accumulates them as skills over time. After running this for a few months, ~/.claude/skills/auto/ now holds 64 auto-generated skills. In this article I'll cover the design of that self-replication, the mechanisms that prevent overproduction, and the generation curve I observed while operating it. Claude Code is capable, but across sessions it forgets "how I got around this error last time." How to fix launchd 's exit 78, the steps to bake a favicon with png-to-ico , how to trim the RSC payload in Next.js — these procedures I should have already solved once were being rebuilt from scratch every single time. I could hand-write additions to CLAUDE.md, but that turns into a "whoever notices, writes it" workflow, and that doesn't last. So I flipped the idea around and decided to make Claude do the work of finding the procedures too . Skill generation is split into two tiers. | Tier | Timing | Cost | Owner | |---|---|---|---| | In-session generation | Any time during work | Free / instant | Claude itself, following CLAUDE.md instructions | | Nightly batch generation | Daily cron at 3:30 | Consumes Max quota | skill-harvest.sh claude -p headless | Then a Curator skill-curate.sh runs weekly to periodically organize the accumulated skills. The key is separating generation and organization into different processes. CLAUDE.md says this excerpt . スキル自己生成(auto-skills) 作業の中で再利用価値のある手順を見つけたら、頼まれなくても自分でスキル化する。 ただし乱造はしない。 生成トリガー(いずれか該当時のみ) - 5回以上ツールを使う非自明なタスクを最後までやり切った - エラー・行き止まりにぶつかった後、動く回避策を見つけた - ユーザーにアプローチを修正された(同じ修正を繰り返さないため) - 再利用できる手順・コマンド列・ワークフローを発見した The crux is " but don't overproduce ," plus narrowing the triggers down to four. Without writing this, Claude turns everything into a skill and the space fills up with noise almost immediately. Procedures that never got written down during a session get picked up from the conversation logs by a nightly batch. The skill-harvest.sh pipeline looks like this. .harvest-watermark the previous processing position raw/conversations/ .md claude -p