Planning framework

From aiskillstore/marketplace · View interactive version

Planning framework is an AI agent skill from the GitHub repository aiskillstore/marketplace. Apply structured thinking before coding. Use when: starting new features, making architectural decisions, refactoring large components, or evaluating implementation approaches. Includes Musk's 5-step algorithm and ICE scoring framework.

How to use this skill

Skill file

Planning Framework

When to Use

Before starting ANY significant coding task:

Musk's 5-Step Algorithm

Step 1: Make Requirements Less Dumb

Question everything:

Portfolio Buddy 2 Example:

Request: "Add sortable columns to metrics table"

Questions:

- Why? Users want to find best/worst performing strategies quickly

- Simpler solution? Just default sort by Sharpe Ratio (most important metric)

- Alternative? Add "Top 3" and "Bottom 3" highlight sections

Decision: Implemented full multi-column sorting via useSorting hook because:

- Different users care about different metrics (Sharpe vs Sortino vs Max DD)

- Sorting is O(n log n) - negligible for <100 strategies

- Reusable hook can be used in future tables

Step 2: Delete the Part or Process

What can we eliminate?

Rule: If you don't add back 10% of what you deleted, you didn't delete enough.

Portfolio Buddy 2 Example:

Discovery: Recharts library (11.5KB) installed but never imported

Questions:

- Is it used anywhere? NO - search reveals zero imports

- Why was it installed? Probably initial plan, switched to Chart.js

- Can we delete it? YES - nothing depends on it

Action: npm uninstall recharts (saves 11.5KB in bundle)

Result: Cleaner dependency tree, faster installs, smaller bundle

Step 3: Simplify or Optimize

Only after deleting:

Portfolio Buddy 2 Example:

Problem: PortfolioSection.tsx is 591 lines (3x the 200-line limit)

Before Optimization:

```typescript

function PortfolioSection() {

// 50 lines of contract multiplier logic

// 40 lines of date filtering logic

// 100 lines of Chart.js configuration

// 80 lines of statistics calculations

// 300+ lines of JSX rendering

}

```

After Simplification:

```typescript

// Extract hooks

const portfolio = usePortfolio(files, dateRange)

const contracts = useContractMultipliers(strategies)

// Extract components

<ContractControls {...contracts} />

<EquityChartSection data={portfolio.equity} />

<PortfolioStats metrics={portfolio.metrics} />

```

Result: Main component < 100 lines, logic encapsulated, reusable

Step 4: Accelerate Cycle Time

Portfolio Buddy 2 Example:

Before: Create React App build time: ~30 seconds

Action: Migrated to Vite

After: Vite build time: ~2 seconds (15x faster)

Impact: Developer can iterate 15x more per hour

Step 5: Automate

Last step only - automate what's proven necessary.

Portfolio Buddy 2 Example:

Don't automate yet: CI/CD pipeline

- Manual Cloudflare deployments work fine for now

- Only deploying 2-3x per month

- Setting up GitHub Actions would take 2-4 hours

- Wait until deployment frequency increases

Should automate: TypeScript checking on commit

- Would catch any type violations before merge

- Git pre-commit hook: tsc --noEmit

- Saves debugging time later

ICE Scoring Framework

Evaluate solutions using:

ICE Score = (Impact × Confidence × Ease) / 10

Portfolio Buddy 2 Examples

Example 1: Error Boundaries (High Priority)

Feature: Add React error boundaries around risky components

Decision: Should implement soon. Quick win, high impact.

Example 2: Export to Excel (Medium-High Priority)

Feature: Add Excel export button for metrics table

Decision: Worth implementing. Clear user value, reasonable effort.

Example 3: Refactor PortfolioSection (Medium Priority)

Feature: Split 591-line component into smaller pieces

Decision: Important for code health, but not urgent. Do after user-facing features.

Example 4: Real-time Price Updates via WebSocket (Low Priority)

Feature: Live market data updates in charts

Decision: Skip for now. Doesn't fit core use case (historical analysis).

Example 5: Remove Recharts Dependency (Quick Win)

Feature: Uninstall unused Recharts library

Decision: Easy quick win. Do it next time touching package.json.

Example 6: Sortino Ratio Calculation (Completed)

Feature: Add Sortino Ratio metric (already completed)

Result: Successfully implemented in commits 258ba3a & 9f25040.

ICE Score Interpretation

| ICE Score Range | Priority | Action |

|-----------------|----------|--------|

| 40+ | High | Do soon, within 1-2 sprints |

| 25-39 | Medium-High | Plan for next 2-3 sprints |

| 15-24 | Medium | Backlog, do when capacity available |

| 10-14 | Low | Consider if very easy or strategic |

| < 10 | Very Low | Probably skip unless requirements change |

Planning Checklist

Before coding:

After planning:

Portfolio Buddy 2 Planning Examples

Example: Adding Sortino Ratio (Completed Feature)

Step 1 - Requirements:

Step 2 - Delete:

Step 3 - Simplify:

ICE Score: 50.4 (High Priority)

Approach:

  1. Add calculateSortino() to dataUtils.ts
  2. Include Sortino in metrics calculation
  3. Add risk-free rate input to PortfolioSection
  4. Add Sortino column to MetricsTable
  5. Test with sample data

Time Estimate: 3-4 hours

Result: Completed successfully, but found calculation bug (commit 9f25040 fixed it).

Implementation Note: Sortino was implemented inline in PortfolioSection.tsx (lines 133-158) rather than in dataUtils.ts. This decision was made because:

Example: Refactoring PortfolioSection (Future Work)

Step 1 - Requirements:

Step 2 - Delete:

Step 3 - Simplify:

ICE Score: 19.2 (Medium Priority)

Approach:

  1. Create EquityChartSection component (150 lines)
  2. Create PortfolioStats component (80 lines)
  3. Create ContractControls component (100 lines)
  4. Refactor main PortfolioSection to <100 lines
  5. Test all functionality still works

Time Estimate: 4-6 hours (tedious but straightforward)

Risks:

Decision: Medium priority. Do after more urgent user-facing features.

Example: Vitest Testing Setup (Future Work)

Step 1 - Requirements:

Step 2 - Delete:

Step 3 - Simplify:

ICE Score: 24 (Medium Priority)

Approach:

  1. Install Vitest: npm install -D vitest
  2. Add test script to package.json
  3. Create dataUtils.test.ts
  4. Write tests for critical calculations
  5. Run tests in CI eventually

Time Estimate: 6-8 hours (learning curve + writing tests)

Tests to Write:

Red Flags to Watch For

During Planning

During Implementation

Portfolio Buddy 2 Lessons

Framework in Action

When you're about to start coding, ask:

  1. What am I building? (clear requirement)
  2. Why am I building it? (real problem to solve)
  3. What can I delete? (remove unnecessary parts)
  4. What's the simplest version? (MVP approach)
  5. How confident am I? (ICE scoring)
  6. What's the time estimate? (be realistic, multiply by 2)

Then write your plan as:

Finally:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.