jpskill.com
🛠️ 開発・MCP コミュニティ

planning-guidelines

Portfolio Buddy 2の開発における機能実装や修正、リファクタリングの計画時に、コードの保全、モバイル・デスクトップ最適化、要件の徹底的な洗い出しを確実に行うための基本原則を適用するSkill。

📜 元の英語説明(参考)

Core planning principles for Portfolio Buddy 2 development. Use when: planning any feature implementation, modification, or refactoring. Ensures code preservation, mobile/desktop optimization, and thorough requirement gathering.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Portfolio Buddy 2の開発における機能実装や修正、リファクタリングの計画時に、コードの保全、モバイル・デスクトップ最適化、要件の徹底的な洗い出しを確実に行うための基本原則を適用するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o planning-guidelines.zip https://jpskill.com/download/16752.zip && unzip -o planning-guidelines.zip && rm planning-guidelines.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/16752.zip -OutFile "$d\planning-guidelines.zip"; Expand-Archive "$d\planning-guidelines.zip" -DestinationPath $d -Force; ri "$d\planning-guidelines.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して planning-guidelines.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → planning-guidelines フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Portfolio Buddy 2 の計画ガイドライン

コア原則

Portfolio Buddy 2 の機能を計画および実装する際は、常に以下の基本原則に従ってください。

  1. 既存のコードを維持する - 置き換えるのではなく、拡張することを基本とする
  2. モバイルとデスクトップ向けに最適化する - すべての機能は両方で適切に動作する必要がある
  3. 明確化のための質問をする - 実行前に完全なコンテキストを収集する
  4. シームレスに統合する - 新しいコードは既存のコードベースにネイティブに感じられるようにする

コード維持戦略

デフォルトの動作: 常に維持する

ルール: 明示的にリファクタリングまたは書き換えの指示がない限り、既存のコードを維持します。

新しい機能や修正を実装する場合:

  • ✅ 既存のコンポーネントを拡張する
  • ✅ 既存の関数の横に新しい関数を追加する
  • ✅ 既存のパターンと規約を維持する
  • ✅ 後方互換性を維持する
  • ❌ 「なんとなく」という理由だけで動作するコードをリファクタリングしない
  • ❌ 正当な理由なく新しいパターンを導入しない

例外: 大幅に優れた選択肢

以下のすべての条件が満たされる場合にのみ、既存のコードの改善を提案できます。

  1. 非常に低いリスク - 変更は隔離されており、十分に理解されており、簡単に元に戻せる
  2. 大きなメリット - 重大な利点 (正確性、パフォーマンス、保守性)
  3. 不要な複雑さがない - ソリューションはより単純であるか、同程度の複雑さである
  4. 明確な正当性 - 例外が適用される理由を説明できる

例外が適用される場合、以下を必ず行う必要があります。

  • 現在の実装の問題点を説明する
  • 提案された改善点を示す
  • 上記の3つの基準をすべて満たしていることを示す
  • 実装前にユーザーの承認を得る

実例: 年間成長率の修正

状況: Trading Days のアップデートの実装中に、年間成長率の計算が数学的に正しくないことが判明しました。

現在の (誤った) コード:

const tradingPeriodDays = uniqueTradingDates.size || 1;  // 150 days
const annualGrowthRate = (totalPnl / startingCapital / tradingPeriodDays) * 365 * 100;
// Result: Inflated by mixing trading days (denominator) with calendar day annualization (365)

例外が適用された理由:

  1. 非常に低いリスク

    • 隔離された計算 (1行)
    • 理解しやすい (暦日と取引日)
    • 間違っている場合は簡単に元に戻せる
  2. 大きなメリット

    • 正しくない財務指標を修正する (正確性が重要)
    • リターンが約2.4倍に膨らんでいた
    • 金融業界の標準に準拠する
  3. 不要な複雑さがない

    • 9行追加 (暦日の計算)
    • より明確で、より正しいロジック
    • 新しい依存関係はない

結果: 例外の基準が明確に満たされていたため、ユーザーはすぐに修正を承認しました。


モバイルとデスクトップの最適化

すべての機能は、モバイルとデスクトップの両方のエクスペリエンスに合わせて最適化する必要があります。

クイックリファレンスチェックリスト

レスポンシブな Tailwind クラスを使用する

  • モバイル用の基本スタイル (プレフィックスなし)
  • sm: スモールスクリーン (640px以上)
  • md: ミディアムスクリーン (768px以上)
  • lg: ラージスクリーン (1024px以上)

タッチターゲット

  • すべてのインタラクティブ要素に対して最小44x44ピクセル
  • より良いタッチ応答のために touch-manipulation CSS クラスを使用する

両方のビューポートをテストする

  • レイアウトが完了前にモバイルとデスクトップで動作することを確認する
  • テキストが小さな画面で読みやすいことを確認する
  • ボタン/入力が適切なサイズであることを確認する

従うべき既存のパターン

Portfolio Buddy 2 には、すでに優れたレスポンシブパターンがあります。以下を参照してください。

例1: レスポンシブなテキストサイズ

className="text-xs sm:text-sm"        // Smaller on mobile
className="text-base sm:text-lg"      // Larger on desktop

例2: レスポンシブなスペーシング

className="gap-1 sm:gap-2"           // Tighter gaps on mobile
className="px-2 sm:px-4 py-2 sm:py-3" // Smaller padding on mobile

例3: レスポンシブなレイアウト

className="flex flex-col sm:flex-row"  // Stack on mobile, row on desktop

例4: レスポンシブな表示/非表示

<span className="hidden sm:inline">Total Margin</span>  // Hide text on mobile, show on desktop

参照: アプリケーション全体のレスポンシブパターンの包括的な例については、src/components/PortfolioSection.tsx を参照してください。


明確化のための質問フレームワーク

質問をするタイミング

以下の場合、実行前に明確化のための質問をしてください。

  • 要件が曖昧である
  • 複数の有効なアプローチが存在する
  • 決定がアーキテクチャまたはユーザーエクスペリエンスに影響を与える
  • ユーザーのリクエストが複数の方法で解釈される可能性がある
  • ビジネスロジックまたはドメイン知識に関するコンテキストが必要である

質問形式テンプレート

すべての明確化のための質問に、この構造を使用してください。

## 明確化のための質問: [トピック]

[質問する必要がある理由に関する簡単なコンテキスト]

**オプション A: [アプローチ名]** ✅ (推奨)
- [アプローチに関する詳細]
- [主な特徴]
- **メリット:** [利点]
- **デメリット:** [トレードオフ]
- **専門家がこれを好む理由:** [ドメイン専門家の視点からの技術的な理由]

**オプション B: [代替アプローチ]**
- [アプローチに関する詳細]
- [主な特徴]
- **メリット:** [利点]
- **デメリット:** [トレードオフ]
- **トレードオフ:** [これが最良の選択肢ではない理由]

**オプション C: [別の代替案]** (該当する場合)
- [アプローチに関する詳細]
- [主な特徴]
- **メリット:** [利点]
- **デメリット:** [トレードオフ]
- **トレードオフ:** [これが最良の選択肢ではない理由]

主要な要件

  1. 最良のオプションをマークする - ✅ を使用して、専門家が推奨する選択肢を示す
  2. 理由を説明する - 「専門家がこれを好む理由」セクションは必須
  3. 偏りのないオプション - すべてのオプションを公平に提示し、マークで優先度を示す
  4. 完全なコンテキスト - ユーザーは追加の調査なしにトレードオフを理解できる必要がある

実例: Trading Days の計算

Trading Days の計算方法に関する今日の会話から:

## 明確化のための質問 2: 日付フィルターを使用した Trading Days の計算

ユーザーがカスタム日付範囲 (開始日/終了日) を設定した場合、Trading Days は以下を表す必要がありますか:

**オプション A: 選択した日付範囲内の暦日数** ✅ (推奨)
- 例: 1月
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Planning Guidelines for Portfolio Buddy 2

Core Principles

When planning and implementing features for Portfolio Buddy 2, always follow these fundamental principles:

  1. Preserve Existing Code - Default to extending rather than replacing
  2. Optimize for Mobile & Desktop - Every feature must work well on both
  3. Ask Clarifying Questions - Gather complete context before execution
  4. Integrate Seamlessly - New code should feel native to the existing codebase

Code Preservation Strategy

Default Behavior: Always Preserve

Rule: Preserve existing code unless explicitly instructed to refactor or rewrite.

When implementing new features or fixes:

  • ✅ Extend existing components
  • ✅ Add new functions alongside existing ones
  • ✅ Preserve existing patterns and conventions
  • ✅ Maintain backward compatibility
  • ❌ Don't refactor working code "just because"
  • ❌ Don't introduce new patterns without justification

Exception: Massively Better Options

You MAY propose improvements to existing code ONLY when ALL conditions are met:

  1. Very Low Risk - Change is isolated, well-understood, easily reversible
  2. Massive Upside - Significant benefit (correctness, performance, maintainability)
  3. No Unnecessary Complexity - Solution is simpler or equal complexity
  4. Clear Justification - Can explain why exception applies

When exception applies, you MUST:

  • Explain the problem with current implementation
  • Show the proposed improvement
  • Demonstrate why it meets all three criteria
  • Get user approval before implementing

Real Example: Annual Growth Rate Fix

Situation: During implementation of Trading Days update, discovered Annual Growth Rate calculation was mathematically incorrect.

Current (incorrect) code:

const tradingPeriodDays = uniqueTradingDates.size || 1;  // 150 days
const annualGrowthRate = (totalPnl / startingCapital / tradingPeriodDays) * 365 * 100;
// Result: Inflated by mixing trading days (denominator) with calendar day annualization (365)

Why exception applied:

  1. Very Low Risk

    • Isolated calculation (one line)
    • Easy to understand (calendar days vs trading days)
    • Easily reversible if wrong
  2. Massive Upside

    • Fixes incorrect financial metric (accuracy critical)
    • Returns were inflated by ~2.4x
    • Aligns with financial industry standards
  3. No Unnecessary Complexity

    • Added 9 lines (calendar day calculation)
    • Clearer, more correct logic
    • No new dependencies

Result: User approved fix immediately because exception criteria were clearly met.


Mobile & Desktop Optimization

Every feature must be optimized for both mobile and desktop experiences.

Quick Reference Checklist

Use Responsive Tailwind Classes

  • Base styles for mobile (no prefix)
  • sm: for small screens (640px+)
  • md: for medium screens (768px+)
  • lg: for large screens (1024px+)

Touch Targets

  • Minimum 44x44 pixels for all interactive elements
  • Use touch-manipulation CSS class for better touch response

Test Both Viewports

  • Verify layout works on mobile and desktop before completion
  • Check that text is readable on small screens
  • Ensure buttons/inputs are appropriately sized

Existing Patterns to Follow

Portfolio Buddy 2 already has excellent responsive patterns. Reference these:

Example 1: Responsive Text Sizing

className="text-xs sm:text-sm"        // Smaller on mobile
className="text-base sm:text-lg"      // Larger on desktop

Example 2: Responsive Spacing

className="gap-1 sm:gap-2"           // Tighter gaps on mobile
className="px-2 sm:px-4 py-2 sm:py-3" // Smaller padding on mobile

Example 3: Responsive Layout

className="flex flex-col sm:flex-row"  // Stack on mobile, row on desktop

Example 4: Responsive Visibility

<span className="hidden sm:inline">Total Margin</span>  // Hide text on mobile, show on desktop

See: src/components/PortfolioSection.tsx for comprehensive examples of responsive patterns throughout the application.


Clarifying Questions Framework

When to Ask Questions

Ask clarifying questions BEFORE executing when:

  • Requirements are ambiguous
  • Multiple valid approaches exist
  • Decision affects architecture or user experience
  • User's request could be interpreted multiple ways
  • You need context about business logic or domain knowledge

Question Format Template

Use this structure for ALL clarifying questions:

## Clarifying Question: [Topic]

[Brief context about why you need to ask]

**Option A: [Approach Name]** ✅ (Recommended)
- [Detail about approach]
- [Key characteristics]
- **Pros:** [Benefits]
- **Cons:** [Trade-offs]
- **Why experts prefer this:** [Technical reasoning from domain expert perspective]

**Option B: [Alternative Approach]**
- [Detail about approach]
- [Key characteristics]
- **Pros:** [Benefits]
- **Cons:** [Trade-offs]
- **Trade-offs:** [Why this isn't the top choice]

**Option C: [Another Alternative]** (if applicable)
- [Detail about approach]
- [Key characteristics]
- **Pros:** [Benefits]
- **Cons:** [Trade-offs]
- **Trade-offs:** [Why this isn't the top choice]

Key Requirements

  1. Mark Best Option - Use ✅ to indicate expert-recommended choice
  2. Explain Reasoning - "Why experts prefer this" section required
  3. Unbiased Options - Present all options fairly, let marking indicate preference
  4. Complete Context - User should understand trade-offs without additional research

Real Example: Trading Days Calculation

From today's conversation about how to calculate Trading Days:

## Clarifying Question 2: Trading Days Calculation with Date Filters

When the user sets a custom date range (Start Date/End Date), should Trading Days represent:

**Option A: The number of calendar days in the selected date range** ✅ (Recommended)
- Example: Jan 1 to Jan 31 = 31 days
- **Pros:** Simple, matches user's mental model of "days in range"
- **Cons:** Doesn't account for non-trading days
- **Why experts prefer this:** For portfolio analysis, calendar days provide accurate time-based performance metrics and match financial industry standards for annualized returns.

**Option B: The number of actual trading days (days with trades) within the date range**
- Example: Jan 1 to Jan 31 = only count days where trades occurred (e.g., 18 days)
- **Pros:** Reflects actual market activity
- **Cons:** Can be misleading - a strategy might not trade every day by design
- **Trade-offs:** Better for measuring trading frequency, not time-based performance

Outcome: User chose Option B, demonstrating how clear options enable informed decisions.


Decision Criteria

When to Preserve vs Improve

Use this decision tree:

Is the code broken or incorrect?
├─ YES → Fix it (with explanation)
└─ NO → Is there a massively better option?
    ├─ YES → Does it meet ALL exception criteria?
    │   ├─ YES → Propose improvement (get approval)
    │   └─ NO → Preserve existing code
    └─ NO → Preserve existing code

Risk Assessment Checklist

Before proposing any change to existing code, verify:

  • [ ] Change is isolated to specific files/functions
  • [ ] No ripple effects on other features
  • [ ] TypeScript compilation succeeds
  • [ ] No breaking changes to interfaces
  • [ ] Existing tests still pass (if tests exist)
  • [ ] Can be reverted with single git revert

Complexity Evaluation

Avoid unnecessary complexity:

  • ❌ Adding new libraries when existing ones suffice
  • ❌ Introducing new patterns when existing patterns work
  • ❌ Over-engineering simple features
  • ❌ Premature optimization
  • ✅ Using existing utilities and components
  • ✅ Following established patterns
  • ✅ Simple, readable solutions

Integration with Other Skills

This skill works alongside other Portfolio Buddy 2 skills:

  • Use with planning-framework - Apply Musk's 5-step algorithm and ICE scoring for feature planning
  • Reference coding-standards - Follow React 19 and TypeScript standards during implementation
  • Check architecture-reference - Understand component hierarchy and existing patterns before adding code
  • Consult migration-tracker - Verify feature parity and check for known issues before starting
  • Load portfolio-context - Get tech stack and architectural constraints context

Workflow:

  1. Load planning-guidelines (this skill) → Understand principles
  2. Load planning-framework → Plan the feature approach
  3. Check architecture-reference → Find where code goes
  4. Apply coding-standards → Write the code correctly
  5. Update migration-tracker → Document what was added

Real Portfolio Buddy 2 Examples

Example 1: Risk-Free Rate Default (Code Preservation)

Task: Set Risk-Free Rate default to 4%

Approach: Pure preservation

  • Found existing code: useState<number>(0)
  • Changed ONLY the default value: useState<number>(4)
  • Preserved everything else: input field, validation, usage in Sortino Ratio
  • Result: One line changed, zero risk

Example 2: Trading Days Update (Code Preservation)

Task: Make Trading Days recalculate when date range changes

Approach: Extend existing calculation

  • Kept existing tradingPeriodDays variable and display
  • Added new logic to count unique dates from filtered trades
  • Preserved all downstream usage (Annual Growth Rate, etc.)
  • Result: Extended, didn't replace

Example 3: Total Margin Button (Seamless Integration)

Task: Add "Set to Total Margin" button for Starting Capital

Approach: Mobile/desktop optimized integration

  • Added button next to existing Starting Capital input
  • Used existing Portfolio Buddy 2 responsive patterns:
    • className="flex items-center gap-1 sm:gap-2" (responsive spacing)
    • <span className="hidden sm:inline">Total Margin</span> (hide text on mobile)
    • className="h-3 w-3 sm:h-3.5 sm:w-3.5" (smaller icon on mobile)
    • touch-manipulation class for better mobile interaction
  • Matched existing blue theme and styling
  • Only appears when portfolioData exists (conditional rendering)
  • Result: Feels native, works on both viewports

Example 4: Annual Growth Rate Fix (Exception Case)

Task: Originally just fixing Trading Days calculation

Discovery: Found Annual Growth Rate calculation was mathematically incorrect

Exception Applied:

  • Very Low Risk: Isolated calculation, 9 lines added, clear logic
  • Massive Upside: Fixed inflated returns (was ~2.4x too high), critical for financial accuracy
  • No Complexity: Simpler logic (calendar days vs trading days), more maintainable

Approach:

  1. Explained the problem clearly
  2. Showed incorrect vs correct formula with examples
  3. Demonstrated exception criteria were met
  4. Got user approval
  5. Implemented fix

Result: User approved immediately because criteria were objective and clearly met.


Summary

Always:

  • Preserve existing code by default
  • Optimize for mobile AND desktop
  • Ask clarifying questions with ✅ marked recommendations
  • Integrate seamlessly with existing patterns

Only when ALL criteria met:

  • Propose improvements (low risk + massive upside + no added complexity)
  • Get user approval before implementing

Never:

  • Refactor working code without justification
  • Add complexity unnecessarily
  • Guess at requirements when you could ask
  • Ignore mobile or desktop experience

This skill ensures Portfolio Buddy 2 remains maintainable, consistent, and user-friendly across all devices while preserving the stability of working code.