Communityコーディング&開発github.com

インクリメンタル実装

変更を細かく検証可能なスライスに分割して段階的に適用します。複数ファイルにまたがる機能や変更を実装する際や、大きなタスクを一度に完了できない場合に使用します。

インクリメンタル実装 とは?

このスキルは、ソフトウェア開発において大きな変更や機能を「薄い垂直スライス」に分割し、1つのスライスごとに実装、テスト、検証、コミットを繰り返すインクリメンタル実装の規律を提供します。複数ファイルにまたがる変更、新機能の実装、リファクタリングなど、広範な変更が予想される場面で特に有効です。各スライスはシステムを作動可能かつテスト可能な状態に保つことを重視し、複数の懸念事項を混在させない「1度に1つのこと」ルールや、不完全な機能をメインブランチにマージするためのフィーチャーフラグ、ロールバックを容易にする設計指針を含みます。このスキルはClaude Code, Cursor, CodexなどのAIエージェントと連携し、作業指示の具体化とスコープの明確化を支援します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/alfathafp/portofolio-web-design/tree/HEAD/.agents/skills/incremental-implementation

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

インクリメンタル実装 は何をしますか?

概要

薄い垂直スライスで構築する — 1つのピースを実装し、テストし、検証し、それから拡張する。機能全体を一度に実装しない。各インクリメントはシステムを作動可能でテスト可能な状態に保つ。これは大規模な機能を管理可能にする実行規律である。

使用するタイミング

  • 複数ファイルにまたがる変更を実装する場合
  • タスク分解から新機能を構築する場合
  • 既存コードをリファクタリングする場合
  • テスト前に約100行以上書きたくなった場合

使用しないタイミング: 単一ファイル、単一関数の変更でスコープが既に最小限の場合。

インクリメントのサイクル

┌──────────────────────────────────────┐
│                                      │
│   実装 ──→ テスト ──→ 検証 ──┐      │
│       ▲                           │      │
│       └───── コミット ◄─────────────┘      │
│              │                       │
│              ▼                       │
│          次のスライス                  │
│                                      │
└──────────────────────────────────────┘

各スライスで:

  1. 実装 — 最小の完全な機能ピース
  2. テスト — テストスイートを実行する(またはテストがない場合は作成する)
  3. 検証 — スライスが期待通り動作することを確認する(テスト合格、ビルド成功、手動確認)
  4. コミット — 説明的なメッセージで進捗を保存する(アトミックコミットのガイダンスについては git-workflow-and-versioning を参照)
  5. 次のスライスに進む — 続けて進み、最初からやり直さない

スライス戦略

垂直スライス(推奨)

スタック全体を通る1つの完全なパスを構築する:

スライス 1: タスクを作成する (DB + API + 基本UI)
    → テスト合格、ユーザーはUIからタスクを作成できる

スライス 2: タスクを一覧表示する (クエリ + API + UI)
    → テスト合格、ユーザーはタスクを表示できる

スライス 3: タスクを編集する (更新 + API + UI)
    → テスト合格、ユーザーはタスクを変更できる

スライス 4: タスクを削除する (削除 + API + UI + 確認)
    → テスト合格、完全なCRUD完了

各スライスはエンドツーエンドで動作する機能を提供する。

契約ファーストスライシング

バックエンドとフロントエンドを並行開発する必要がある場合:

スライス 0: API契約を定義する (型、インターフェース、OpenAPI仕様)
スライス 1a: 契約に基づいてバックエンドを実装 + APIテスト
スライス 1b: 契約に一致するモックデータでフロントエンドを実装
スライス 2: 統合してエンドツーエンドでテストする

リスクファーストスライシング

最もリスクが高く、不確実な部分から先に取り組む:

スライス 1: WebSocket接続が動作することを証明する (最大リスク)
スライス 2: 証明された接続上でリアルタイムタスク更新を構築する
スライス 3: オフラインサポートと再接続を追加する

スライス1が失敗した場合、スライス2と3に投資する前に発見できる。

実装ルール

ルール 0: シンプルさ優先

コードを書く前に自問せよ:「機能する最もシンプルなものは何か?」

コードを書いた後、以下のチェックでレビューせよ:

  • より少ない行数で実現できないか?
  • これらの抽象化は複雑さに見合っているか?
  • スタッフエンジニアが見て「なぜ単に〜しなかったの?」と言わないか?
  • 仮想的な将来要件のためではなく、現在のタスクのために構築しているか?
シンプルさチェック:
✗ 1つの通知のためにミドルウェアパイプラインを備えた汎用EventBus
✓ 単純な関数呼び出し

✗ 2つの類似コンポーネントのための抽象ファクトリパターン
✓ 共有ユーティリティを持つ2つの単純なコンポーネント

✗ 3つのフォームのための設定駆動型フォームビルダー
✓ 3つのフォームコンポーネント

3行の類似コードは、時期尚早な抽象化よりも優れている。まず明白に正しい単純なバージョンを実装せよ。最適化はテストで正しさが証明されてから行う。

ルール 0.5: スコープの規律

タスクが必要とするものだけに触れる。

してはならないこと:

  • 変更の隣接コードを「整理整頓」する
  • 変更しないファイルのインポートをリファクタリングする
  • 完全に理解していないコメントを削除する
  • 「便利そうだから」という理由で仕様にない機能を追加する
  • 読み取り専用のファイルで構文をモダナイズする

タスクスコープ外で改善すべき点に気づいたら、それをメモし — 修正してはならない:

気づいたが触っていない:
- src/utils/format.ts に未使用のインポートがある(このタスクとは無関係)
- authミドルウェアのエラーメッセージは改善できる(別タスク)
→ これらに対してタスクを作成しましょうか?

ルール 1: 一度に一つのこと

各インクリメントは1つの論理的変更を行う。懸念事項を混在させてはいけない:

悪い例: 新しいコンポーネントの追加、既存コンポーネントのリファクタリング、ビルド設定の更新を1つのコミットで行う。

良い例: 各変更に対して3つの個別のコミット。

ルール 2: コンパイル可能な状態を維持

各インクリメント後、プロジェクトはビルド可能で、既存のテストは合格しなければならない。スライス間でコードベースを壊れた状態のままにしてはいけない。

ルール 3: 不完全な機能のためのフィーチャーフラグ

機能がユーザー向けに準備できていないが、インクリメントをマージする必要がある場合:

// 作業中の機能のフィーチャーフラグ
const ENABLE_TASK_SHARING = process.env.FEATURE_TASK_SHARING === 'true';

if (ENABLE_TASK_SHARING) {
  // 新しい共有UI
}

これにより、不完全な作業を公開せずに小さなインクリメントをメインブランチにマージできる。

ルール 4: 安全なデフォルト

新しいコードは安全で保守的な動作をデフォルトとする:

// 安全: デフォルトで無効、オプトイン
export function createTask(data: TaskInput, options?: { notify?: boolean }) {
  const shouldNotify = options?.notify ?? false;
  // ...
}

ルール 5: ロールバックフレンドリー

各インクリメントは独立して元に戻せるようにする:

  • 追加的な変更(新しいファイル、新しい関数)は元に戻しやすい
  • 既存コードへの変更は最小限かつ焦点を絞る
  • データベースマイグレーションには対応するロールバックマイグレーションが必要
  • 同じコミットで何かを削除し、それを置き換えることを避ける — 分離する

エージェントとの連携

AIエージェントにインクリメンタル実装を指示する場合:

「計画のタスク3を実装しましょう。

最初はデータベーススキーマの変更とAPIエンドポイントだけにしてください。
UIにはまだ触れないでください — それは次のインクリメントで行います。

実装後、リポジトリのテストとビルドコマンドを実行して、
何も壊れていないことを確認してください。」

各インクリメントでスコープに含まれるものと含まれないものを明確に指定する。

インクリメントチェックリスト

各インクリメント後、リポジトリ独自のコマンドで検証する(テスト駆動開発スキルの「最初にスタックを発見する」セクションを参照):

  • 変更は1つのことを行い、完全に完了している
  • すべての既存テストが合格する(リポジトリのテストコマンド: npm test, ./gradlew test, pytest, ...)
  • ビルドが成功する(リポジトリのビルドコマンド)
  • 型チェックに合格する(スタックに存在する場合: npx tsc --noEmit, mypy, ...)
  • リンターに合格する(リポジトリのlintコマンド)
  • 新しい機能が期待通り動作する
  • 変更が説明的なメッセージとともにコミットされている

注: 各検証コマンドは、そのコマンドに影響を与える可能性のある変更の後に実行する。一度成功したら、コードがその後変更されていない限り同じコマンドを繰り返さない — 変更のないコードで再実行しても新しい情報は得られない。

よくある正当化

正当化現実
「最後に全部まとめてテストする」バグは増幅する。スライス1のバグでスライス2〜5が台無しになる。各スライスをテストせよ。
「一度に全部やった方が速い」何かが壊れて500行の変更のうちどれが原因か特定できなくなるまでは速く感じる。
「これらの変更は小さすぎて個別にコミットできない」小さなコミットはコストフリー。大きなコミットはバグを隠し、ロールバックを困難にする。
「後でフィーチャーフラグを追加する」機能が完了していないなら、ユーザーに見えてはいけない。今フラグを追加せよ。
「このリファクタは十分小さいので含めても良い」リファクタと機能を混在させると、レビューとデバッグの両方が困難になる。分離せよ。
「念のためビルドコマンドをもう一度実行しよう」一度成功したら、コードが変更されていない限り同じコマンドを繰り返しても意味がない。後続の編集後に再度実行し、安心のために繰り返さない。

レッドフラグ

  • テストを実行せずに100行以上のコードを書いた
  • 単一のインクリメントに複数の無関係な変更が含まれている
  • 「これもすぐに追加しよう」というスコープ拡大
  • 高速化のためにテスト/検証ステップをスキップする
  • インクリメント間でビルドまたはテストが壊れている
  • コミットされていない大規模な変更が蓄積している
  • 3つ目のユースケースが要求する前に抽象化を構築している
  • 「ついでに」タスクスコープ外のファイルに触れている
  • 1回限りの操作のために新しいユーティリティファイルを作成している
  • コード変更を挟まずに同じビルド/テストコマンドを連続して2回実行する

検証

タスクのすべてのインクリメントを完了した後:

  • 各インクリメントは個別にテストされ、コミットされた
  • 完全なテストスイートが合格する
  • ビルドがクリーンである
  • 機能が仕様通りエンドツーエンドで動作する
  • コミットされていない変更が残っていない

関連情報

インクリメントごとの検証はローカルチェックである。タスク完了を宣言する前に、プロジェクト全体の「完了の定義」を最終ゲートとして適用すること。これはタスクに関係なくすべてのインクリメントがクリアする基準である。../../references/definition-of-done.md を参照。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

alfathafp/portofolio-web-design

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).

alfathafp/portofolio-web-design

Tests in real browsers via Chrome DevTools MCP. Use when building or debugging anything that runs in a browser. Use when you need to inspect the DOM, capture console errors, analyze network requests, profile performance, or verify visual output with real runtime data. Requires the chrome-devtools MCP server to be configured.

alfathafp/portofolio-web-design

Automates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.

alfathafp/portofolio-web-design

Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch. Use when asked to review a diff or a pull request, even when the diff is pasted inline.

alfathafp/portofolio-web-design

Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity.

alfathafp/portofolio-web-design

Establishes a project's quality bar as a written contract and stops agents quietly lowering it. Interviews the user on which dimensions matter, supplies sane default thresholds when they have no number in mind, records everything in CONSTRAINTS.md, and watches the diff for a weakened bar — new @ts-ignore or eslint-disable suppressions, skipped or deleted tests, assertions stripped out, unimplemented stubs, thresholds edited down. Use when no quality bar is written down, when the user says "set up constraints" or "define our standards", when the user wants dimensions they care about — accessibility, web performance, coverage — set up as enforced constraints, when an agent keeps silencing checks or skipping tests to get to green, when you need a coverage or performance threshold and don't know what number to pick, or when an agent writes more code than anyone will read.

alfathafp/portofolio-web-design

Optimizes agent context setup. Use when starting a new session, when agent output quality degrades, when switching between tasks, or when you need to configure rules files and context for a project.

alfathafp/portofolio-web-design

Guides systematic root-cause debugging. Use when tests fail, builds break, something that worked yesterday broke, behavior doesn't match expectations, or you encounter any unexpected error. Use when you need to figure out what broke and why — a systematic approach to finding and fixing the root cause rather than guessing.

alfathafp/portofolio-web-design

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

alfathafp/portofolio-web-design

Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.

alfathafp/portofolio-web-design

Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

alfathafp/portofolio-web-design

Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies

alfathafp/portofolio-web-design

Records decisions and documentation. Use when you need to document an architecture decision (ADR) or the reasoning behind a design choice, when changing public APIs, shipping features, or when you need to record context that future engineers and agents will need to understand the codebase.

alfathafp/portofolio-web-design

Subjects every non-trivial decision to a fresh-context adversarial review before it stands. Use when you want every assumption cross-examined before proceeding, when stress-testing a plan for hidden failure modes, when correctness matters more than speed, when working in unfamiliar code, when stakes are high (production auth, security-sensitive logic, a high-stakes migration, irreversible operations), or any time a confident output would be cheaper to verify now than to debug later.

alfathafp/portofolio-web-design

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

alfathafp/portofolio-web-design

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work

alfathafp/portofolio-web-design

Builds production-quality, accessible, responsive user-facing UIs. Use when building or modifying interfaces and pages, creating components, implementing layouts, meeting WCAG accessibility requirements, managing state, or when the output needs to look and feel production-quality rather than AI-generated.

alfathafp/portofolio-web-design

Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, splitting uncommitted work in a messy working tree into clean atomic commits, opening or reviewing a pull request (PR), pushing to a remote, or when you need to organize work across multiple parallel streams. Use when cutting a release, choosing a semantic version bump, tagging, or writing a changelog.

alfathafp/portofolio-web-design

Refines raw ideas into sharp, actionable concepts through structured divergent and convergent thinking. Use when an idea is still vague, when you need to stress-test assumptions before committing to a plan, or when you want to expand options before converging on one. Triggers on "ideate", "refine this idea", or "stress-test my plan".

alfathafp/portofolio-web-design

Guides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.

関連スキル