小さく分割して正しく出荷する – コーディングエージェントのためのスキル
CyberAgent Developers Blog は、Claude Code のカスタムスキルシステムを活用し、複雑な機能開発を小規模な独立したタスクに分解・並列処理するワークフローの構築事例を紹介している。
キーポイント
Small PRs の原則と課題
2000 行を超える巨大な Pull Request はレビュー難易度が高くデプロイリスクとなるため、マルチレイヤー(Python/Go/gRPC/インフラ)にまたがる機能も小規模で独立したピースに分解するアプローチが推奨される。
従来の開発フローの非効率性
従来の計画・開発・検証のサイクルでは、サブイシューの作成から並列処理の欠如まで手作業が多く、要件見落としによる再作業が発生しやすい構造的問題を抱えている。
Claude Code スキルシステムによる自動化
GitHub の Issue からサブイシューへの分解、並列開発の実行、完全性の検証、そしてクリーンなコミット・PR 生成までを、Claude Code のカスタムスキルで自動化するワークフローを実装した。
実証された開発効率化
このアプローチにより、複雑な機能開発においても各ピースの完結性を保ちつつ、レビューとリリースのリスクを大幅に低減し、開発サイクル全体を最適化した。
AI を活用した課題の分解と階層化
「plan-task」スキルにより、複雑な機能を独立したサブ課題に自動分解し、GitHub の API を用いて実際の親子関係でリンクすることで進捗を一元管理します。
依存関係を考慮した並列開発の実現
「parallel-develop」スキルがタスク間の依存関係を解析し、独立した作業を複数の git worktree と tmux パンで同時に実行することで開発効率を最大化します。
実装の完全性とコミット履歴の洗練
「post-task-verification」スキルで要件への対応漏れを検出し、AI によるコミットも目的ごとに分割してリバーチ可能な形式に整形することで品質と追跡性を確保します。
影響分析・編集コメントを表示
影響分析
この記事は、AI エージェント(特に Claude Code)を実際のソフトウェア開発ライフサイクルに組み込む具体的な実践例を示しており、単なるツール紹介を超えて「開発プロセスの再設計」を提案しています。大規模なコード変更によるリスク管理と並列処理の実現により、エンジニアリングチームの生産性と品質保証の両立に向けた重要な指針となるでしょう。
編集コメント
AI エージェントが単なるコード生成ツールから、開発プロセス全体を管理・実行する「パートナー」へと進化している実例として注目すべき記事です。特に大規模なシステムにおけるリスク分散と並列処理の自動化は、現場の課題解決に直結する価値があります。
イントロダクション
小さなプルリクエスト(PR)は、レビューや巻き戻し、リリースが容易です。トランクベースのリリースサイクルにおいて、5 つのサービスにまたがる 2000 行にも及ぶ PR は、単にレビューが困難なだけでなく、デプロイ上のリスクとなります。私たちのチームはこの原則に従い、機能を小さく独立した部品に分解し、それぞれを個別にリリース可能な状態にします。ただし、プロジェクトは複数のレイヤーにまたがっています:Python/Go のマイクロサービス、gRPC 定義(gRPC definitions)、そしてクラウドインフラストラクチャです。1 つの機能でこれらすべてのレイヤーに影響を与える可能性があります。
それらを効率的に扱い、各部品を完結させ、コミットと PR をクリーンに保つこと、それが複雑な機能を扱う私たちの方法です。Claude Code のカスタムスキルシステムを活用して、GitHub 上で開発サイクル全体をカバーするワークフローを構築しました。これは、課題をサブ課題に分解することから始まり、複数の部品を並列に開発し、完全性を検証し、クリーンなコミットとプルリクエストを生成するまでを含みます。
従来の開発フローと課題
複雑な機能リクエストが GitHub のイシューとして着いた場合、通常は計画、開発、検証の 3 つのフェーズを経ます。計画フェーズでは、開発者が要件を読み込み、手動でサブイシューを作成し、スコープを特定し、記述を書き、GitHub でそれぞれ作成して親イシューにリンクします。この作業は各サブイシューに対して繰り返されます。開発フェーズでは、サブイシューは1 つずつ順次処理されます:実装、テスト、コミット、PR(プルリクエスト)、レビュー、マージを行い、その後次のものを順番に選びます。最後に、レビュアーが元のエピックに対して全体の納品内容を確認します。ギャップが見つかった場合(要件の抜け、見落としのあるエッジケースなど)、開発者は計画フェーズに戻り、サイクルが再スタートします。

*図:従来の開発フロー*
各フェーズには明確な摩擦点があります。計画は手動で反復的であり、サブイシューが独立している場合でも開発は逐次的です。また、検証は実装を元の要件に対して手動で照合することに依存しています。以下のセクションでは、Claude Code のカスタムスキルを用いてこれらの課題をどのように解決したかを説明します。
GitHub サブイシューの分割プロセス管理における AI の活用
プランタスクスキルは、GitHub のイシュー番号を受け取り、そのコンテキストを読み込みながらコードベースを探索し、関連するファイル、サービス、パターンを特定します。その後、各サブイシューが1つのレイヤーまたは関心領域に限定されるような一連のサブイシューを提案します。ここではプロトタイプ定義の変更があり、そこではバックエンドサービスの更新があり、段階的なロールアウトのための機能フラグがあり、インフラストラクチャの権限変更があります。各サブイシューには、説明、修正が想定されるファイル、チェックボックス形式の受入基準が含まれます。
提案は、何かが作成される前に人間の承認ゲートを経由します。タイトルは調整でき、サブイシューを統合したり追加したりすることもできます。確認されると、このスキルは GitHub 上ですべてを作成し、ラベル付けされ、割り当てられ、プロジェクトボードに追加され、GitHub のサブイシュー API を使用して親に対して構造的にリンクされます。デフォルトでは、ほとんどのコーディングエージェントは、サブイシュー本文に「Part of #123」のようなテキスト参照を使用して親イシューを参照しますが、これでは親から進捗を追跡する方法がなく、結果として各サブイシューを手動で確認して現状を確認することになります。これを解決するために、このスキルはスクリプトを通じて各サブイシューを親に明示的にリンクし、GitHub のサブイシュー API を呼び出して実際の親子関係を作成します(テキスト参照ではありません)。進捗は自動的に親に集約され、完全な内訳はプロジェクトボード上でツリーとして表示されます。

*図:ボード上の課題およびサブ課題の進捗追跡*
並行して課題を解決する能力の拡張
機能をサブ課題に分割した後、一部の作業は同時に実行できます。プロトコル定義とインフラストラクチャの調整は並列で実行可能です。プロトコルが定義された後、バックエンドの gRPC ハンドラ(gRPC handler)とクライアント実装も、同じ生成コードを基盤としているため並列で実行できます。これらを一つずつ処理するのではなく、独立した部分を別々のワーカーに手渡すことができます。
並列開発スキルはこの状況を変えます。開発者は作業するべき課題番号を /parallel-develop #203 #205 #206 のように渡します。これにより、3 つの git worktree と 3 つの tmux パンが生成され、それぞれが1つの課題に対応します。パンの数と渡された課題の数は一致します。各ワーカーは完全な隔離状態で実行されます:このスキルは独自のブランチを持つgit worktreeを作成し、tmux パンを開き、そのワークツリー内で Claude Code インスタンスを起動して、割り当てられた課題の作業開始を自動的に指示します。追加のコンテキストもインラインで渡すことができるため、各ワーカーは最初から必要な情報をすべて持っています。各ワーカーはプランモードで開始し、何かを実装する前に課題を分析し、承認のための計画を提示します。これにより開発者がコントロールを維持できます:コードが書かれる前に、各ワーカーの計画を確認し、承認したり調整したり、必要に応じて方向転換したりできます。その結果、コーディネーターとワーカーのレイアウトが実現されます:左側のメインパンは進行状況を監視する場所であり、ワーカー用のパンは右側に積み重ねられます。パン間の移動はキーボード操作1回で可能で、軌道から外れた場合はいつでも中断できます。

*図:tmux のメイン垂直レイアウトで並列パンを生成*
そのスキルは依存関係の認識能力を備えています。ワーカーを起動する前に、他の出力に依存する課題がないかを確認します。依存関係のある課題は順次実行されるようキューに入れられ、真に独立した課題のみが並列で実行されます。実際には、4〜6 件の並列処理が最適なバランスです。それ以上になると、各パネルの表示領域が小さくなりすぎて快適に読めなくなります。すべての PR がマージされた後のクリーンアップは簡単です:tmux のパネルを停止し、ワークツリーを削除し、ローカルブランチを削除するだけです。

*図:並列開発のクリーンアップ*
出荷前の完全性確認
小さな PR が真に有用なのは、それが実際に完成している場合に限られます。中途半端な小変更は、すべてを網羅した大規模変更よりも悪影響を及ぼします。それは進捗があるような誤った安心感を生み出しつつ、後で表面化するギャップを残すことになります。私たちはこの教訓を痛いほど学びました。新しい機械学習モデルの実装が完了した後、そのモデルがシステムのすべての関連部分に適用されるべきところを、実は1 つのモジュールのみに対して適用されていたことが判明しました。このギャップはレビューを通じて見逃され、モデルのパフォーマンス評価において2 週間の遅延というコストを発生させました。この incident をきっかけに、タスク完了後の検証スキルを構築することになりました。これは読み取り専用のチェックであり、実装が元の要件を完全に満たしているかを確認するものであり、変更が正式にリリースされる前のあらゆる時点で実行可能です。
このスキルは、GitHub のイシュー番号または PR 番号を受け取り、イシュー本文、コメント、現在のブランチの変更点をすべて取得します。その後、各要件が実際にコードでカバーされているか、後のコメントで追加された期待が満たされたか、変更がコードベース内の関連するすべての場所で一貫して適用されたかを確認します。また、変更されたファイルタイプに基づいてリンターとテストを実行し、各要件に対する合格/不合格のエビデンスを含むレポートを生成します。

*図:タスク完了後の検証レポート*
機能を小さなピースに分割する際、各ピースは単独で成立する必要があります。post-task-verification スキルは、「小さい」ことが「不完全」になることを防ぎます。これは機能がリリースされる前にギャップを捕捉するため、その機能の一部が異なるサブエージェントによって解決されている場合でも、開発者は AI に要件を見落とさないよう信頼できます。
ソースコントロール組み込みスキルの洗練
Claude Code は、標準でコミットやプルリクエストを作成できます。ただし、デフォルトの動作は、一般的なメッセージを持つ単一のコミットに傾きがちで、git の履歴をどのように見せたいかという私たちの希望とは一致しません。
コミットとリバージョン:すべてのコミットはチェックポイント
コミットは、セッション中に発生したすべてのことをダンプするのではなく、1 つの作業の有意義なスナップショットであるべきです。各コミットが焦点を絞ることで、git の履歴が読みやすくなり、各変更が独立して取り消し可能になります。これはコーディングエージェントにおいて特に重要です。AI エージェントがミスを犯した場合、クリーンなコミット履歴は、複数のファイルにまたがる誤った行を手動で特定して削除する代わりに、git revert <commit> という正確な取り消しメカニズムを提供します。
このコミットスキルは、未コミットの変更をすべて分析し、目的別にグループ化することでこれを強制します。リンティングの修正は機能変更から分離され、依存関係の更新はコード変更から分離されます。各グループが 1 つのコミットとなり、最も独立した順から最も従属的な順に並べられます:lint/docs → dependencies → tests → schema → refactoring → bug fixes → features。各コミットは厳格な形式に従います:<プレフィックス>: <短い説明>(conventional prefixes: feat, fix, chore, test, refactor などを使用)。1 つのセッションで以下のような結果が得られるかもしれません:
lint: fix import ordering in ai-service
chore: bump google.golang.org/api to v0.26x.x
test: add unit tests for user service
feat: add rate-limit feature to google API
代わりに、以下のように記述されるべきではありません:
Add rate-limit feature, fix imports, and update deps
これにより、すべてのコミットが個別にレビュー可能かつ取り消し可能になります。PR を推進するのと同じ原則が、1 つレベル深く適用されます。

*Fig. Rebuilt commit skill*
さらに改善する
ソースコードの追跡可能性を洗練させるにつれ、AI エージェントのセッションを追跡することも同様に重要であることに気づきました。AI コーディングエージェントと協働する際に予期せぬ結果をもたらす原因を特定するために、AI セッションのスナップショットを取得したいと考えています。最近、Entire.io というプラットフォームが紹介されました。これはオープンソースの CLI ツール と SaaS ダッシュボード を備えており、私たちが求めているものに対して非常に有望なものです。私たちはまもなく Entire.io の利用を開始し、そのレビューをフォローアップブログ記事で共有する予定です。更新情報をお楽しみに。
まとめ
この投稿全体を通じて共有してきた通り、私たちは開発サイクルの反復的な部分に AI を適用して自動化しました。具体的には、課題の計画と分解から、複数の部分を並行して実装すること、そして出荷前に何も見落としがないか検証することまでです。その過程で、出力をクリーンかつ追跡可能に保つために、コミットや PR の構成方法も洗練させてきました。これらのスキルが構築する価値があるのは、AI に任せる範囲を広げられるからです。単にコードを書くだけでなく、作業自体の計画まで任せられます。つまり、複雑な機能を小さくレビュー可能なピースに分解し、それぞれを一つの関心事に限定して、個別に出荷可能にするのです。各ピースが小さく明確に定義されているため、開発者はすべての段階で進捗を追跡できます。計画のレビュー、サブ課題への承認、検証結果の確認を行いながら、最終的に膨大な変更セットに圧倒されることなく作業を進められます。
これらのスキルは Claude Code プラグインとしてオープンソース化しました。インストールと使用方法の詳細については、cuongvd23/piecewise-workflow のソースコードをご覧ください。
原文を表示
Introduction
Small PRs are easier to review, revert, and ship. In a trunk-based release cycle, a 2000-line PR that touches five services isn’t just hard to review but also a deployment risk. Our team follows this principle: break features down into small, independent pieces, each shippable on its own. However, our project spans multiple layers: Python/Go microservices, gRPC definitions, and cloud infrastructure. A single feature can touch all of these layers.
Working on them efficiently, ensuring each piece is complete, and keeping commits and PRs clean, that is how we handle complex features. Using Claude Code’s custom skill system, we built workflows that cover the full development cycle on GitHub, from decomposing an issue into sub-issues to developing multiple pieces in parallel to verifying completeness to producing clean commits and pull requests.
Traditional development flow and challenges
When a complex feature request lands as a GitHub issue, it typically goes through three phases: planning, development, and verification. In the planning phase, the developer reads the requirements, manually creates sub-issues, identifies scope, writes descriptions, creates each one in GitHub, and links them to the parent, repeating this for every sub-issue. In the development phase, sub-issues are worked on one at a time: implement, test, commit, PR, review, merge, then pick the next one sequentially. Finally, reviewers check the overall delivery against the original epic. When gaps are found (a missed requirement, an overlooked edge case, etc.) the developer goes back to planning and the cycle restarts.

*Fig. Traditional development flow*
Each phase has a clear friction point: planning is manual and repetitive, development is sequential even when sub-issues are independent, and verification relies on manually cross-referencing the implementation against the original requirements. The following sections describe how we addressed each of these with Claude Code custom skills.
Utilizing AI in managing GitHub sub-issues breaking process
The plan-task skill takes a GitHub issue number, reads the issue context, and explores the codebase to identify which files, services, and patterns are involved. It then proposes a set of sub-issues, each scoped to one layer or concern. A proto definition change here, a backend service update there, a feature flag for gradual rollout, an infrastructure permission change. Each sub-issue includes a description, the files expected to be modified, and acceptance criteria as checkboxes.
The proposal goes through a human approval gate before anything is created. Titles can be adjusted, sub-issues merged, or added. Once confirmed, the skill creates them all in GitHub – labeled, assigned, added to the project board, and structurally linked to the parent using GitHub’s sub-issues API. By default, most coding agents reference the parent issue with something like “Part of #123” in the sub-issue body, which is just a text mention. It doesn’t give us a way to track progress from the parent, and we end up manually checking each sub-issue to know where things stand. To fix this, the skill explicitly links each sub-issue to the parent through a script that calls GitHub’s sub-issues API, creating actual parent-child relationships, not text references. Progress rolls up to the parent automatically, and the full breakdown is visible as a tree on the project board.

*Fig. Issue & Sub-issues progress track on the board*
Extending the ability to resolve issues in parallel
After breaking a feature into sub-issues, some pieces can run at the same time. A proto definition and an infrastructure tweak can run in parallel. Once the proto is defined, the backend gRPC handler and the client implementation can also run in parallel, since both build against the same generated code. Instead of working through them one at a time, you can hand independent pieces to separate workers.
The parallel-develop skill changes this. The developer passes the issue numbers to work on: /parallel-develop #203 #205 #206. This spawns three git worktrees and three tmux panes – one per issue. The number of panes matches the number of issues passed. Every worker runs in complete isolation: the skill creates a git worktree with its own branch, opens a tmux pane, and launches a Claude Code instance inside that worktree, automatically instructing it to start working on the assigned issue. Additional context can be passed inline, so each worker has what they need from the start. Each worker starts in plan mode – it analyzes the issue and presents a plan for approval before implementing anything. This keeps the developer in control: review each worker’s plan, approve, adjust, or redirect as needed before any code is written. The result is a coordinator-worker layout: the main pane on the left is where the developer monitors progress, while worker panes are stacked on the right. Navigation between panes is a keystroke away, and any worker can be interrupted if it goes off track.

*Fig. Spawn parallel panes in tmux main-vertical layout*
The skill is dependency-aware. Before spawning workers, it checks whether any issues depend on the other’s output. Dependent issues are queued to run sequentially – only truly independent issues run in parallel. In practice, 4-6 parallel issues are the sweet spot. More than that, the panes become too small to read comfortably. Once all PRs are merged, cleanup is straightforward: kill the tmux panes, remove the worktrees, and delete the local branches.

*Fig. Cleanup parallel development*
Verifying Completeness Before Shipping
A small PR is only useful if it’s actually complete. A half-done small change is worse than a large one that covers everything. It creates a false sense of progress while leaving gaps that surface later. We learned this the hard way. After finishing the implementation of a new machine learning model, we discovered that the model was only applied to one module instead of being applied across all relevant parts of the system. The gap went unnoticed through review, and it cost us two weeks of delay in evaluating the model’s performance. That incident prompted us to build the post-task-verification skill. It’s a read-only check that verifies whether the implementation fully satisfies the original requirements, and it can be run at any point before the change is officially released.
The skill takes a GitHub issue or PR number and fetches everything: the issue body, the comments, and the changes on the current branch. It then checks whether each requirement is actually covered in the code, whether expectations that were added in later comments got addressed, and whether the change was applied consistently across all the relevant places in the codebase. It also runs lint and tests based on the file types that were changed, and produces a report with pass/fail evidence for each requirement.

*Fig. Post-task verification report*
When breaking a feature into small pieces, each piece needs to stand on its own. The post-task-verification skill ensures that “small” doesn’t become “incomplete.” It catches the gaps before the feature is released, so developers can entrust their AI not to miss requirements even if parts of that feature are being resolved by different sub-agents.
Refining source control built-in skills
Claude Code can create commits and pull requests out of the box. But the default behavior tends toward a single commit with a generic message, which doesn’t match how we want our git history to look.
Commit & Revert: Every commit is a checkpoint
A commit should be a meaningful snapshot of one piece of work, not a dump of everything that happened during a session. When each commit is focused, the git history becomes readable and each change is independently revertible. This matters even more with coding agents. When an AI agent makes a mistake, a clean commit history gives it a precise undo mechanism: git revert <commit> instead of manually identifying and removing the wrong lines across multiple files.
The commit skill enforces this by analyzing all uncommitted changes and grouping them by purpose. Lint fixes stay separate from feature changes, and dependency updates stay separate from code changes. Each group becomes one commit, ordered from most independent to most dependent: lint/docs → dependencies → tests → schema → refactoring → bug fixes → features. Each commit follows a strict format: <prefix>: <short description> using conventional prefixes (feat, fix, chore, test, refactor, etc.). A single session might produce:
lint: fix import ordering in ai-service
chore: bump google.golang.org/api to v0.26x.x
test: add unit tests for user service
feat: add rate-limit feature to google APIInstead of:
Add rate-limit feature, fix imports, and update depsThis keeps every commit reviewable and revertible on its own. The same principle that drives our PRs applies one level deeper.

*Fig. Rebuilt commit skill*
Further Improvement
As we refined our source code traceability, we realized that keeping track of AI agent sessions is equally important. We want to have a snapshot of the AI session in order to identify the cause that can lead to unexpected outcomes when vibing with an AI coding agent. Recently, a platform called Entire.io – with an open-source CLI tool and a SaaS dashboard – has been introduced, and it looks very promising for what we’re looking for. We’re about to start utilizing Entire.io and will share our review in a follow-up blog post. Stay tuned for updates.
Summary
As we’ve shared throughout this post, we applied AI to automate the repetitive parts of our development cycle: from planning and decomposing issues, to implementing multiple pieces in parallel, to verifying that nothing was missed before shipping. Along the way, we also refined how commits and PRs are structured to keep the output clean and traceable. What made these skills worth building is that they let us entrust more to AI, not just writing code, but planning the work itself: breaking a complex feature into small, reviewable pieces, each scoped to one concern and shippable on its own. Because every piece is small and well-defined, the developer can keep up with progress at every step: reviewing plans, approving sub-issues, checking verification results, without getting overwhelmed by a massive changeset at the end.
We’ve open-sourced these skills as a Claude Code plugin. For installation and usage details, see the source at cuongvd23/piecewise-workflow.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み