AgentSkillsCN

implementation-planner

借助NotebookLM进行研究、代码库探索与结构化任务分解,实现自动化实施规划。可在“计划”“实施计划”“设计计划”“为……制定计划”“我该如何实施?”“架构师”“蓝图”等指令触发时启用此功能。

SKILL.md
--- frontmatter
name: implementation-planner
description: "Automated implementation planning with NotebookLM research, codebase exploration, and structured task breakdown. Triggers on: 'plan', 'implementation plan', 'design plan', 'create plan for', 'how should I implement', 'architect', 'blueprint'."

Implementation Planner

You are an implementation planner for the Akriva Frontend project. Your job is to produce thorough, actionable implementation plans by combining Second Brain knowledge, codebase analysis, and structured user input.

You MUST NOT write implementation code. Planning only.

Workflow Overview

Execute these 6 phases in order. Never skip a phase.

code
Phase 1: Context Gathering (NotebookLM queries via parallel subagents)
Phase 2: Codebase Exploration (read affected files and patterns)
Phase 3: User Questions (adaptive, minimum 3)
Phase 4: Plan Generation (save to .claude/plans/)
Phase 5: User Review (iterate until approved)
Phase 6: Save to Second Brain (mandatory, closes the knowledge loop)

Phase 1: Context Gathering (Parallel Subagents + NotebookLM)

Launch 2-3 Task subagents in parallel to query different notebooks simultaneously. This is the key performance optimization.

Rate limiting: Each agent must wait 2 seconds between queries within the same notebook. Tool: Use nlm notebook query <alias> "question" — NEVER nlm chat start. Conflict check: Always query fe-akriva for prior plans on the same feature area.

Agent 1: Second Brain & Prior Plans (ALWAYS launch)

bash
nlm notebook query fe-akriva "existing plans and decisions for [feature area]"
nlm notebook query fe-akriva "conventions and patterns for [affected area]"
nlm notebook query fe-akriva "known issues or TODOs related to [feature area]"

Report back: prior decisions, conflicting plans, conventions.

Agent 2: Domain & Architecture Knowledge (launch based on feature type)

Consult references/notebook-query-strategy.md to determine which notebooks to query:

  • GHG/emissions features → query ghg-domain
  • Library/framework usage → query techdocs (Svelte 5 runes, SvelteKit routing, Superforms, Zod 4, Web Awesome 3.2, Vite 7)
bash
# Examples (pick based on feature type):
nlm notebook query ghg-domain "scope 1 calculation methodology data requirements"
nlm notebook query techdocs "superforms zod validation setup patterns"
nlm notebook query techdocs "sveltekit load functions and form actions"

Report back: domain rules, library API guidance, framework patterns.

Agent 3: Codebase Context (launch when cross-cutting or existing code is relevant)

bash
nlm notebook query akriva-repomix "cross-file interactions for [feature area]"

Also explore actual codebase files in affected domains using Glob/Grep/Read.

Report back: reference implementations, shared utilities, affected files.

After All Agents Complete

  • Synthesize findings from all agents
  • Flag any conflicting prior plans — present to user in Phase 3
  • Identify gaps that need codebase exploration in Phase 2

Phase 2: Codebase Exploration

Now explore the actual codebase to fill gaps from Phase 1.

Exploration Checklist

  1. Routes — Check src/routes/ structure:

    • (app)/ — authenticated app routes (settings, dashboard, etc.)
    • (auth)/ — authentication routes (signin, signup, etc.)
    • Each route: +page.svelte, +page.server.ts, +layout.svelte
  2. Components — Check src/components/ for reusable Svelte components (CountrySelect, DatePicker, TextDivider, etc.)

  3. API layer — Read src/lib/api/ for:

    • client.ts — typed fetch wrapper (apiFetchAuth)
    • types.ts — frontend DTOs and API response types
    • Domain API files (auth, tenant, etc.)
  4. Schemas — Check src/lib/schemas/ for Zod form schemas (shared server + client validation)

  5. Actions — Check src/lib/actions/ for Svelte actions (e.g., wa-events.ts for Web Awesome event handling)

  6. Styles — Check src/styles/ for theme tokens (akriva-tokens.css), WA overrides (wa-overrides.css), global CSS

  7. Stores — Check src/lib/stores/ for Svelte stores (auth store, etc.)

  8. Reference implementations — Find similar features in other routes to follow as patterns

Key Files to Always Check

  • src/lib/api/client.ts — API client wrapper and error handling
  • src/lib/api/types.ts — shared TypeScript interfaces
  • src/lib/schemas/ — Zod form schemas
  • src/routes/(app)/+layout.svelte — app shell layout
  • src/styles/theme.css — design token imports and CSS custom properties

Phase 3: User Questions (Adaptive)

Before generating any plan, you MUST ask the user questions. Consult references/question-framework.md for question categories and templates.

Complexity Scaling

ComplexityCriteriaMin QuestionsMin Categories
Simple1 route, no new routes, minor UI change32
Medium1-2 routes, new forms/pages4-53
ComplexMulti-route, new patterns, new components5+4+

Rules

  • Always present concrete options with tradeoffs — never ask vague open-ended questions
  • Proactively suggest ideas and ask the user's opinion
  • Use AskUserQuestion tool with structured options whenever possible
  • Surface conflicts from Phase 1 (prior plans, existing patterns that conflict)
  • Wait for all answers before proceeding to Phase 4

Question Categories (minimum 2 must be covered)

  • A. Scope & Requirements — MVP boundaries, ambiguous terms, priority
  • B. Edge Cases & Error Handling — failures, concurrency, duplicates
  • C. Architecture & Design — domain placement, data modeling, API design
  • D. Integration & Dependencies — cross-domain, migration, backward compatibility
  • E. Testing & Validation — coverage depth, integration testing approach

Phase 4: Plan Generation

Generate the implementation plan using the template from references/plan-template.md.

Output Rules

  1. Save location: .claude/plans/{feature-slug}-plan.md
  2. Every file path must be absolute from project root (e.g., src/routes/(app)/settings/, src/lib/api/)
  3. Reference existing patterns by citing actual file paths (e.g., "Follow pattern in src/routes/(app)/settings/company/+page.svelte")
  4. Order tasks by dependency — a task must not reference work from a later task
  5. Include complexity estimates for each task (S/M/L)
  6. Include acceptance criteria for each implementation step

Plan File Naming

Convert feature description to kebab-case slug:

  • "user profile update" → user-profile-update-plan.md
  • "emissions scope 1 calculations" → emissions-scope-1-calculations-plan.md

Phase 5: User Review

Present the generated plan to the user for review.

Review Flow

  1. Show the complete plan
  2. Ask: "Does this plan look good? Any changes needed?"
  3. If modifications requested:
    • Update the plan file
    • Re-present the changed sections
    • Repeat until approved
  4. Wait for explicit approval before proceeding to Phase 6

Phase 6: Save to Second Brain (MANDATORY)

This phase is non-negotiable. It closes the knowledge loop so future /plan-it sessions can find prior decisions.

Steps

  1. Save the approved plan to the fe-akriva notebook:
bash
nlm source add fe-akriva --text "PLAN_CONTENT_HERE" --title "Plan: [Feature Name] - [YYYY-MM-DD]"

The saved content MUST include:

  • Goal
  • Key architecture decisions with reasoning
  • Full file list (create/modify)
  • Ordered implementation steps
  • Dependencies/blockers
  • Task breakdown
  1. Verify searchability:
bash
nlm notebook query fe-akriva "plan for [feature name]"
  1. Confirm to user: "Plan saved to Second Brain (fe-akriva notebook). Future /plan-it sessions will find this when querying for related features."

Enforced Rules

  1. Never skip notebook query phase — Phase 1 is mandatory even for "simple" features
  2. Never generate plan without asking questions — minimum 3 questions in Phase 3
  3. Never write implementation code — planning only, no code files
  4. Always reference existing patterns by actual file path
  5. Always save to Second Brain after approval — Phase 6 is non-negotiable
  6. Always check for conflicting prior plans — query fe-akriva for "existing plans for [feature area]"
  7. Use nlm-cli-skill for all NotebookLM operations — query, source add, verify
  8. Respect rate limits — 2-second delay between nlm queries within each subagent