haru01

cga-programming

0
0
# Install this skill:
npx skills add haru01/order_skills_sample --skill "cga-programming"

Install specific skill from multi-skill repository

# Description

Implement features autonomously using Test-Driven Development (TDD). Follows RED-GREEN-REFACTOR cycle with Tidy First? assessment. Ensures 80%+ test coverage and quality gates. Use when user asks to "implement using TDD", "follow the plan at doc/plans/", "implement the feature", "write tests first", or after planning phase is complete.

# SKILL.md


name: cga-programming
description: Implement features autonomously using Test-Driven Development (TDD). Follows RED-GREEN-REFACTOR cycle with Tidy First? assessment. Ensures 80%+ test coverage and quality gates. Use when user asks to "implement using TDD", "follow the plan at doc/plans/", "implement the feature", "write tests first", or after planning phase is complete.
allowed-tools: Task Read Glob Grep Edit Write Bash AskUserQuestion TodoWrite
disable-model-invocation: true


いつ使うか

  • プランニングが確定し、プログラミングを開始するとき
  • バグ修正時にリグレッションテストを追加して修正するとき
  • リファクタリング前にテストで保護してから変更するとき

いつ使わないか

  • プランニングが未確定のとき(先に /cga-explore-planning でプランニングする)
  • 技術調査・ライブラリ選定フェーズ
  • 設計レビューのみが必要なとき(/cga-review を使う)

何をするか

  1. TIDY?: 構造の整理が必要か判断 → 必要なら /cga-tf-refactoring を実行
  2. RED: 失敗するテストを書く
  3. GREEN: 最小限の実装で通す
  4. REFACTOR: コードを整理
  5. GATE: npm run review:json を実行して指摘事項ゼロを確認

中断条件

以下の場合は実装を中断し、開発者に状況を報告して /cga-explore-planning に戻る:

  • テスト5回連続失敗: 同一テストが5回修正しても通らない場合
  • プランニング外の想定外事象: プランニングに記載のない前提条件の不整合や、プランでは実現不可能と判断した場合

使用例

/cga-programming doc/plans/cancel-order.md に従ってプログラミングして
/cga-programming 在庫チェック機能を実装して

ワークフロー位置

/cga-explore-planning → /cga-tf-refactoring → /cga-programming → /cga-review
        ↑                                          │
        └──────────── 中断(プランニングに戻る) ───────────┘

トラブルシューティング

テストが5回連続で失敗する

症状: 同じテストケースが何度修正しても通らない

対処:
1. 中断条件に該当 - 実装を停止
2. 試みた修正内容とエラーを整理
3. 変更をWIPコミットまたはスタッシュ
4. /cga-explore-planning でプランニングを再検討

カバレッジが80%に到達しない

症状: テストを書いても目標カバレッジに届かない

対処:
1. カバレッジレポートで未カバー箇所を確認
2. エッジケース・異常系のテストケースを追加
3. 除外ファイル設定を確認(不要なファイルを除外)
4. ドメインモデルの純粋関数部分を重点的にカバー

Tidy First? の判断に迷う

症状: テストを書く前にリファクタリングが必要か判断できない

対処:
- リファクタリングすべき: 責務が混在、テスト困難な構造、複雑な依存関係
- そのまま実装: テスト可能な構造、単一責任が明確
- 迷ったら /cga-tf-refactoring の判断基準を参照
- 迷ったら AskUserQuestionを使って開発者と対話

実装計画と実際のギャップが発生

症状: プランニング通りにプログラミングできない、想定外の依存関係が発覚

対処:
1. 中断条件に該当 - 実装を停止
2. ギャップの内容を明確化(何が想定外か、なぜ実現不可能か)
3. 変更をWIPコミットまたはスタッシュ
4. /cga-explore-planning でプランニングを修正

詳細

guide.md を参照

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.