diff --git a/.claude/commands/infinite-web.md b/.claude/commands/infinite-web.md new file mode 100644 index 0000000..d6d2924 --- /dev/null +++ b/.claude/commands/infinite-web.md @@ -0,0 +1,388 @@ +**WEB-ENHANCED INFINITE AGENTIC LOOP COMMAND** + +Think deeply about this web-enhanced infinite generation task. You are about to embark on a sophisticated iterative creation process with progressive web-based knowledge acquisition. + +**Variables:** + +spec_file: $ARGUMENTS +output_dir: $ARGUMENTS +count: $ARGUMENTS +url_strategy_file: $ARGUMENTS (optional, defaults to specs/d3_url_strategy.json) + +**ARGUMENTS PARSING:** +Parse the following arguments from "$ARGUMENTS": +1. `spec_file` - Path to the markdown specification file (required) +2. `output_dir` - Directory where iterations will be saved (required) +3. `count` - Number of iterations (1-N or "infinite") (required) +4. `url_strategy_file` - Path to URL strategy JSON (optional, defaults to specs/d3_url_strategy.json) + +**PHASE 0: INITIAL WEB PRIMING** + +Before generating any iterations, perform deep web research to establish foundational knowledge: + +**Priming Objectives:** +1. Read the specification file completely to understand the domain and requirements +2. If url_strategy_file exists, read it and extract priming URLs +3. Fetch 3-5 foundational web resources using WebFetch or WebSearch: + - Official documentation pages + - Comprehensive tutorials + - Pattern libraries or galleries + - Best practices guides + - Recent updates and new features + +**Priming Web Research Tasks:** +For each priming URL: +- Use WebFetch to retrieve and analyze content +- Extract key concepts, techniques, and patterns +- Build mental model of the domain +- Identify progressive learning pathways +- Note important code patterns and best practices + +**Priming Synthesis:** +Create a comprehensive knowledge base from web research: +- Core concepts and terminology +- Common patterns and anti-patterns +- Technical foundations (APIs, libraries, methods) +- Visual design principles (if applicable) +- Accessibility considerations +- Performance optimization strategies + +**PHASE 1: SPECIFICATION + WEB CONTEXT ANALYSIS** + +Read and deeply understand the specification file at `spec_file` in conjunction with priming knowledge: +- What type of content to generate (enhanced by web learnings) +- Format and structure requirements +- Specific parameters or constraints +- Intended evolution pattern between iterations +- How web research should enhance each iteration + +**Web Integration Strategy:** +- How should each iteration incorporate new web knowledge? +- What makes a valuable web source for this domain? +- How should learnings accumulate across iterations? +- What URL selection strategy best serves the goal? + +**PHASE 2: OUTPUT DIRECTORY + URL TRACKING RECONNAISSANCE** + +Thoroughly analyze the `output_dir` to understand current state: +- List all existing files and their naming patterns +- Identify the highest iteration number currently present +- Analyze content evolution across existing iterations +- Review which URLs have already been used (check file footers/comments) +- Build list of USED_URLS to avoid duplication +- Understand the trajectory of previous generations +- Identify knowledge gaps that new web research could fill + +**URL Strategy Analysis:** +If url_strategy_file exists: +- Read and parse the JSON structure +- Extract URLs categorized by iteration range +- Understand the progressive difficulty curve +- Note web search templates for dynamic discovery +- Plan URL assignment for upcoming iterations + +**PHASE 3: WEB-ENHANCED ITERATION STRATEGY** + +Based on spec analysis, priming knowledge, and existing iterations: + +**Iteration Planning:** +- Determine starting iteration number (highest existing + 1) +- Plan how each iteration will be unique and evolutionary +- Map iteration numbers to appropriate URL complexity level +- Assign specific web sources to each planned iteration +- Consider how to build upon previous iterations + new web knowledge + +**URL Assignment Strategy:** + +For each upcoming iteration, determine web source: + +1. **Pre-defined URL Mode** (if url_strategy_file exists): + - Match iteration number to URL category (foundation, intermediate, advanced, expert) + - Select next unused URL from appropriate category + - Ensure no duplicate URLs across iterations + - Track assigned URLs in USED_URLS list + +2. **Dynamic Search Mode** (fallback or primary): + - Generate targeted web search queries based on: + - Current iteration number + - Previous iteration analysis + - Identified knowledge gaps + - Specific technique to explore + - Use WebSearch to find relevant resources + - Select most valuable result for the iteration + +3. **Hybrid Mode** (recommended): + - Use pre-defined URLs for core techniques + - Use dynamic search for novel explorations + - Balance structure with discovery + +**PHASE 4: PARALLEL WEB-ENHANCED AGENT COORDINATION** + +Deploy multiple Sub Agents with individualized web research assignments for maximum efficiency and learning diversity: + +**Sub-Agent Distribution Strategy:** +- For count 1-3: Launch all agents simultaneously with different URLs +- For count 4-10: Launch in batches of 3-4 agents to manage web requests +- For count 11+: Launch in batches of 5 agents to optimize coordination +- For "infinite": Launch waves of 3-4 agents, monitoring context and web source availability + +**Agent Assignment Protocol:** + +Each Sub Agent receives: +1. **Spec Context**: Complete specification file analysis + priming knowledge summary +2. **Directory Snapshot**: Current state of output_dir at launch time +3. **Iteration Assignment**: Specific iteration number (starting_number + agent_index) +4. **Web Research Assignment**: Specific URL to fetch and learn from +5. **Used URLs List**: All previously used URLs to avoid duplication +6. **Uniqueness Directive**: Explicit instruction to avoid duplicating previous concepts +7. **Quality Standards**: Detailed requirements from the specification +8. **Integration Directive**: How to synthesize web learning with previous work + +**Agent Task Specification:** +``` +TASK: Generate iteration [NUMBER] for [SPEC_FILE] with web research integration + +You are Sub Agent [X] generating iteration [NUMBER] with web-enhanced learning. + +WEB RESEARCH ASSIGNMENT: +- Your assigned URL: [SPECIFIC_URL] +- Topic: [URL_TOPIC] +- Your mission: Fetch this URL, learn a specific technique, and apply it to your iteration + +RESEARCH PROCESS: +1. Use WebFetch tool to retrieve content from [SPECIFIC_URL] +2. Analyze the content deeply for: + - New techniques, APIs, or patterns + - Code examples and implementations + - Visual design principles (if applicable) + - Best practices and optimizations + - Accessibility considerations +3. Extract 1-3 specific learnings to apply to your iteration +4. Plan how to integrate these learnings with the specification requirements + +CONTEXT: +- Specification: [Full spec analysis] +- Priming knowledge: [Summary of initial web research] +- Existing iterations: [Summary of current output_dir contents] +- Used URLs: [List of URLs already researched to avoid duplication] +- Your iteration number: [NUMBER] +- Expected complexity level: [foundation/intermediate/advanced/expert] + +REQUIREMENTS: +1. FIRST: Fetch and analyze your assigned URL using WebFetch +2. Extract specific technique(s) from the web source +3. Read and understand the specification completely +4. Analyze existing iterations to ensure your output is unique +5. Generate content that: + - Follows spec format exactly + - Applies learning from your web source + - Builds upon previous iterations where appropriate + - Introduces genuine novelty and improvement +6. Document your web source and what you learned in the output file +7. Create file with exact name pattern specified + +DELIVERABLE: +- Single file as specified by spec +- Must demonstrate learning from assigned URL +- Must document web source and improvements +- Must be genuinely enhanced by web research + +CRITICAL: If WebFetch fails, fall back to WebSearch for the topic and find alternative source. +``` + +**Parallel Execution Management:** +- Launch assigned Sub Agents in batches to avoid overwhelming web services +- Each agent performs independent WebFetch for their assigned URL +- Monitor agent progress and web fetch completion +- Handle web fetch failures by reassigning different URLs +- Ensure no duplicate URLs across parallel agents in same batch +- Collect and validate all completed iterations +- Verify that web learnings were actually applied + +**PHASE 5: INFINITE WEB-ENHANCED MODE ORCHESTRATION** + +For infinite generation mode, orchestrate continuous waves with progressive web learning: + +**Wave-Based Web Learning Strategy:** +1. **Wave Planning**: + - Determine next wave size (3-4 agents) based on context capacity + - Select URL category for wave (foundation → intermediate → advanced → expert) + - Identify unused URLs in target category + - Plan specific URL assignment for each agent in wave + +2. **Progressive URL Difficulty**: + - Wave 1: Foundation URLs (basic concepts) + - Wave 2: Intermediate URLs (common patterns) + - Wave 3: Advanced URLs (complex techniques) + - Wave 4+: Expert URLs + dynamic searches for cutting-edge techniques + +3. **Knowledge Accumulation**: + - Each wave builds on previous waves' learnings + - Later agents can reference earlier iterations' web discoveries + - Progressive complexity in both content and web sources + - Synthesis of multiple web learnings in later iterations + +4. **URL Exhaustion Handling**: + - If pre-defined URLs exhausted, switch to dynamic WebSearch mode + - Generate targeted search queries based on: + - Current iteration sophistication level + - Gaps in previous iterations + - Novel techniques to explore + - Continue until context limits approached + +**Infinite Execution Cycle:** +``` +INITIALIZE: + - Load url_strategy_file + - Extract all available URLs by category + - Initialize USED_URLS tracker + - Initialize current_difficulty_level = "foundation" + +WHILE context_capacity > threshold: + WAVE_SETUP: + 1. Assess current output_dir state + 2. Count existing iterations + 3. Determine appropriate difficulty level for next wave + 4. Select 3-4 unused URLs from current difficulty category + 5. If no URLs available, increment difficulty level or switch to dynamic search + + AGENT_PREPARATION: + For each agent in wave: + - Assign unique iteration number + - Assign unique URL from selected batch + - Prepare context snapshot + - Add URL to USED_URLS tracker + + EXECUTION: + 6. Launch parallel Sub Agent wave with web assignments + 7. Monitor wave completion and web fetch success + 8. Validate that web learnings were applied + + POST_WAVE: + 9. Update directory state snapshot + 10. Review iteration quality and web integration + 11. Evaluate context capacity remaining + 12. If sufficient capacity: Continue to next wave + 13. If approaching limits: Complete final wave and summarize + + DIFFICULTY_PROGRESSION: + - Waves 1-2: foundation URLs + - Waves 3-4: intermediate URLs + - Waves 5-6: advanced URLs + - Waves 7+: expert URLs + dynamic discovery +``` + +**Dynamic Web Search Integration:** + +When pre-defined URLs are exhausted or for novel exploration: + +**Search Query Generation:** +- Analyze current iteration goals +- Identify knowledge gaps from previous iterations +- Generate targeted search queries using templates from url_strategy_file +- Example: "D3.js force simulation collision detection site:observablehq.com" + +**Search Result Selection:** +- Use WebSearch to find relevant resources +- Evaluate search results for quality and relevance +- Select top result not in USED_URLS +- Assign to agent with clear learning objectives + +**PHASE 6: WEB INTEGRATION QUALITY ASSURANCE** + +After each wave completion, verify web integration quality: + +**Quality Checks:** +1. **Web Source Attribution**: Each iteration documents its URL source +2. **Learning Application**: Specific technique from URL is actually implemented +3. **Improvement Evidence**: Iteration shows measurable improvement +4. **Uniqueness**: No duplicate web sources, no duplicate implementations +5. **Spec Compliance**: Meets all specification requirements +6. **Cumulative Progress**: Builds upon previous iterations appropriately + +**Failure Handling:** +- If agent fails to fetch URL: Reassign with backup URL or web search +- If agent doesn't apply learning: Regenerate with clearer directive +- If URL already used: Select next available URL in category +- If web source unavailable: Fall back to dynamic web search + +**EXECUTION PRINCIPLES:** + +**Progressive Web Learning:** +- Each iteration incorporates new web-sourced knowledge +- Knowledge accumulates across iterations +- Later iterations can build upon earlier web discoveries +- Balance between learning new techniques and mastering previous ones + +**Quality & Uniqueness:** +- Each iteration must be genuinely unique and valuable +- Web research must genuinely enhance the output +- Build upon previous work while introducing novel elements +- Maintain consistency with original specification +- Document web sources and learnings clearly + +**Parallel Web Coordination:** +- Deploy Sub Agents strategically with diverse web sources +- Assign different URLs to each agent in a wave +- Coordinate timing to avoid web service rate limiting +- Monitor web fetch success and content extraction +- Ensure all agents successfully integrate their web learnings + +**Scalability & Efficiency:** +- Batch web requests to avoid overwhelming services +- Cache web content for potential reuse in context +- Track used URLs rigorously to avoid duplication +- Optimize URL selection for progressive learning curve +- Balance parallel speed with web fetch reliability + +**ULTRA-THINKING DIRECTIVE:** + +Before beginning generation, engage in extended thinking about: + +**Web Research Strategy:** +- What web sources will provide the most value? +- How should URL difficulty progress across iterations? +- What's the optimal balance between pre-defined URLs and dynamic search? +- How can web learnings accumulate most effectively? +- What makes a web source genuinely useful vs. superficial? + +**Specification & Web Synergy:** +- How does web research enhance the specification goals? +- What web knowledge is most critical for success? +- How should iterations balance spec requirements with web inspiration? +- What progressive learning pathway serves the goal best? + +**Parallel Web Coordination:** +- Optimal Sub Agent distribution for web-enhanced generation +- How to assign URLs for maximum learning diversity +- Managing web fetch timing and rate limits +- Ensuring each agent extracts valuable, applicable learnings +- Preventing duplicate web sources across parallel streams + +**Knowledge Integration:** +- How should agents synthesize web content with spec requirements? +- What level of detail from web sources should be applied? +- How to build upon previous iterations' web discoveries? +- Balancing novelty from web vs. consistency with previous work + +**Infinite Mode Web Optimization:** +- Progressive URL difficulty strategy across waves +- When to switch from pre-defined URLs to dynamic search +- Balancing web research depth vs. breadth +- Context management with web content inclusion +- Quality control for web-enhanced parallel outputs + +**Risk Mitigation:** +- Handling web fetch failures gracefully +- Ensuring web learnings are actually applied, not just mentioned +- Managing URL exhaustion in long runs +- Preventing superficial web integration +- Maintaining spec compliance despite web inspiration + +**Quality Assurance:** +- How to verify that web research genuinely improved output? +- What evidence shows learning application vs. mere citation? +- How to ensure cumulative knowledge building? +- Balancing web fidelity with creative adaptation? + +Begin execution with deep analysis of the web-enhanced learning strategy and proceed systematically through each phase, leveraging Sub Agents with individualized web research assignments for maximum knowledge acquisition and creative output. diff --git a/.claude/commands/prime-initial.md b/.claude/commands/prime-initial.md new file mode 100644 index 0000000..34ba6b8 --- /dev/null +++ b/.claude/commands/prime-initial.md @@ -0,0 +1,7 @@ +# Context The Full Initial Infinite Agentic Loop + +RUN: + git ls-files + +READ: + ai_docs/full-initial.md diff --git a/CLAUDE.md b/CLAUDE.md index eb693af..13c8fab 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -8,7 +8,7 @@ This is an experimental project demonstrating the Infinite Agentic Loop pattern ## Key Commands -### Running the Infinite Agentic Loop +### Running the Original Infinite Agentic Loop ```bash claude @@ -30,34 +30,88 @@ Then use the `/project:infinite` slash command with these variants: /project:infinite specs/invent_new_ui_v3.md infinite_src_new/ infinite ``` +### Running the Web-Enhanced Infinite Loop (NEW!) + +The `/project:infinite-web` command adds progressive web-based learning where each iteration fetches and learns from web resources: + +```bash +# Single D3 visualization with web learning +/project:infinite-web specs/d3_visualization_progressive.md d3_viz 1 + +# Batch of 5 with different web sources +/project:infinite-web specs/d3_visualization_progressive.md d3_viz 5 + +# Progressive learning (20 iterations from foundation → expert) +/project:infinite-web specs/d3_visualization_progressive.md d3_viz 20 specs/d3_url_strategy.json + +# Infinite mode - continuous learning until context limits +/project:infinite-web specs/d3_visualization_progressive.md d3_viz infinite specs/d3_url_strategy.json +``` + +**Key Enhancement:** Each iteration fetches a web URL, learns specific techniques, and applies them to create progressively sophisticated outputs. See [WEB_ENHANCED_GUIDE.md](WEB_ENHANCED_GUIDE.md) for details. + ## Architecture & Structure ### Command System The project uses Claude Code's custom commands feature: -- `.claude/commands/infinite.md` - Main infinite loop orchestrator command -- `.claude/commands/prime.md` - Additional command (if present) +- `.claude/commands/infinite.md` - Original infinite loop orchestrator command +- `.claude/commands/infinite-web.md` - NEW! Web-enhanced loop with progressive learning +- `.claude/commands/prime.md` - Context priming command +- `.claude/commands/prime-initial.md` - Initial context loading command - `.claude/settings.json` - Permissions configuration allowing Write, MultiEdit, Edit, and Bash ### Specification-Driven Generation - Specifications in `specs/` directory define what type of content to generate -- Current main spec: `specs/invent_new_ui_v3.md` - Themed Hybrid UI Component Specification -- Specs define naming patterns, content structure, design dimensions, and quality standards +- **Original Specs:** + - `specs/invent_new_ui_v3.md` - Themed Hybrid UI Component Specification + - `specs/invent_new_ui_v4.md` - Modular architecture variant (3-file structure) +- **Web-Enhanced Specs (NEW!):** + - `specs/d3_visualization_progressive.md` - D3.js visualizations with progressive web learning + - `specs/d3_url_strategy.json` - Curated URL progression for D3 learning +- Specs define naming patterns, content structure, design dimensions, quality standards, and web integration strategy ### Multi-Agent Orchestration Pattern -The infinite command implements sophisticated parallel agent coordination: +Both infinite commands implement sophisticated parallel agent coordination: + +**Original Pattern (`/project:infinite`):** 1. **Specification Analysis** - Deeply understands the spec requirements 2. **Directory Reconnaissance** - Analyzes existing iterations to maintain uniqueness 3. **Parallel Sub-Agent Deployment** - Launches multiple agents with distinct creative directions 4. **Wave-Based Generation** - For infinite mode, manages successive agent waves 5. **Context Management** - Optimizes context usage across all agents +**Web-Enhanced Pattern (`/project:infinite-web` - NEW!):** +1. **Initial Web Priming** - Fetches foundational web resources to build knowledge base +2. **Specification + Web Context Analysis** - Understands spec with web knowledge integration +3. **URL Strategy Planning** - Maps iterations to progressive difficulty URLs +4. **Parallel Web-Enhanced Agents** - Each agent fetches unique URL, learns, and generates +5. **Progressive Wave Learning** - Each wave increases sophistication with expert URLs +6. **Knowledge Accumulation** - Later iterations build on earlier web discoveries + ### Generated Content Organization -- `src/` - Primary output directory for generated UI components -- `src_infinite/` - Alternative output for infinite generation runs +**Original Loop Outputs:** +- `src/` - Primary output directory for themed hybrid UI components (35 files) +- `src_infinite/` - Infinite mode UI generations (25 files) +- `src_group/` - Modular 3-file architecture components (5 directories) - `legacy/` - Previous iteration attempts and experiments +**Web-Enhanced Loop Outputs (NEW!):** +- `d3_viz/` - D3 visualizations with progressive web learning (create with `/project:infinite-web`) +- Each output file documents its web source and learning application + ### Key Implementation Details +**Original Loop:** - Sub-agents receive complete context including spec, existing iterations, and unique creative assignments - Parallel execution managed through Task tool with batch sizes optimized by count - Progressive sophistication strategy for infinite mode waves -- Each iteration must be genuinely unique while maintaining spec compliance \ No newline at end of file +- Each iteration must be genuinely unique while maintaining spec compliance + +**Web-Enhanced Loop (NEW!):** +- Initial web priming phase fetches 3-5 foundational resources before generation +- Each sub-agent assigned unique URL to fetch and learn from +- WebFetch or WebSearch tools used to retrieve documentation, tutorials, examples +- Agents extract 1-3 specific techniques from web source and apply to output +- URL tracking prevents duplicate web sources across iterations +- Progressive URL difficulty: foundation → intermediate → advanced → expert +- Dynamic web search fallback when pre-defined URLs exhausted +- All outputs document web source and demonstrate learning application \ No newline at end of file diff --git a/README.md b/README.md index 3fdcf60..7e2a4fd 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,24 @@ > **Watch the Tutorial**: [Infinite Agentic Loop with Claude Code](https://youtu.be/9ipM_vDwflI) -An experimental project demonstrating Infinite Agentic Loop in a two prompt system using Claude Code. +An experimental project demonstrating Infinite Agentic Loop patterns using Claude Code - now with **Web-Enhanced Progressive Learning**! Infinite Agentic Loop ## Overview -This project uses a custom Claude Code slash command (`/project:infinite`) to orchestrate multiple AI agents in parallel, generating evolving iterations of content based on specifications. +This project provides two powerful slash commands for orchestrating multiple AI agents in parallel: + +1. **`/project:infinite`** - Original loop for generating evolving iterations based on specifications +2. **`/project:infinite-web`** - NEW! Web-enhanced loop where each iteration learns from web resources + +### What's New: Web-Enhanced Learning + +The new `/project:infinite-web` command creates a **self-improving knowledge loop** where: +- Each iteration fetches and learns from a different web URL +- Knowledge progressively accumulates across iterations +- Agents apply learnings from documentation, tutorials, and examples +- Output quality improves as the system learns more sophisticated techniques ## Usage @@ -49,7 +60,37 @@ Generate 20 iterations in coordinated batches of 5 agents for optimal resource m ``` Continuous generation in waves until context limits are reached, with progressive sophistication. -## How It Works +## Web-Enhanced Command (NEW!) + +### D3 Data Visualization Example + +Generate progressively sophisticated D3 visualizations with web-based learning: + +```bash +# Single visualization with web learning +/project:infinite-web specs/d3_visualization_progressive.md d3_output 1 + +# Batch of 5 with different web sources +/project:infinite-web specs/d3_visualization_progressive.md d3_output 5 + +# Progressive learning (20 iterations) +/project:infinite-web specs/d3_visualization_progressive.md d3_output 20 specs/d3_url_strategy.json + +# Infinite mode - continuous learning +/project:infinite-web specs/d3_visualization_progressive.md d3_output infinite specs/d3_url_strategy.json +``` + +**How It Works:** +1. **Initial Priming**: Fetches 3-5 foundational web resources to build knowledge base +2. **Progressive URL Assignment**: Each iteration gets a URL matched to its complexity level +3. **Web Fetch & Learn**: Agent fetches URL, extracts techniques, applies learnings +4. **Generate & Document**: Creates output demonstrating new technique, documents source +5. **Accumulate Knowledge**: Each iteration builds on previous learnings +6. **Infinite Waves**: Continues with progressive sophistication until context limits + +See [WEB_ENHANCED_GUIDE.md](WEB_ENHANCED_GUIDE.md) for complete documentation and how to create your own web-enhanced loops! + +## How the Original Loop Works 1. **Specification Analysis**: Reads and understands the spec file requirements 2. **Directory Reconnaissance**: Analyzes existing iterations to determine starting point @@ -59,10 +100,22 @@ Continuous generation in waves until context limits are reached, with progressiv ## Directions you can take to enhance this pattern -- Apply this to a use case of your choice. -- Build an MCP Server that enables reuse of the infinite agentic loop. -- Get the `.claude/commands/infinite.md` into your `~/.claude/commands/` directory for global use. -- Update `.claude/commands/infinite.md` to generate sets of files instead of a single file. +### Original Loop Enhancements +- Apply this to a use case of your choice +- Build an MCP Server that enables reuse of the infinite agentic loop +- Get the `.claude/commands/infinite.md` into your `~/.claude/commands/` directory for global use +- Update `.claude/commands/infinite.md` to generate sets of files instead of a single file + +### Web-Enhanced Loop Possibilities +- **React Components**: Progressive React patterns from official docs, popular libraries, and best practices +- **CSS Techniques**: Master CSS animations, layouts, and effects through web tutorials +- **Python Data Science**: Learn pandas, matplotlib, seaborn through progressive web examples +- **Machine Learning**: Implement progressively complex ML models with paper and tutorial learnings +- **API Development**: Build REST/GraphQL APIs learning from official documentation +- **Game Development**: Create progressively complex games learning from web tutorials +- **Any Domain**: Create your own spec + URL strategy for any progressive learning goal + +See [WEB_ENHANCED_GUIDE.md](WEB_ENHANCED_GUIDE.md) for detailed instructions on creating your own web-enhanced loops! ## Master AI Coding Learn to code with AI with foundational [Principles of AI Coding](https://agenticengineer.com/principled-ai-coding?y=infageloop) diff --git a/WEB_ENHANCED_GUIDE.md b/WEB_ENHANCED_GUIDE.md new file mode 100644 index 0000000..6261026 --- /dev/null +++ b/WEB_ENHANCED_GUIDE.md @@ -0,0 +1,560 @@ +# Web-Enhanced Infinite Agentic Loop Guide + +## Overview + +The **Web-Enhanced Infinite Agentic Loop** extends the original infinite loop pattern with progressive web-based knowledge acquisition. Each iteration fetches and learns from web resources, creating a self-improving system that gets smarter with each generation. + +## Core Innovation + +**Traditional Loop:** +``` +Spec → Generate → Iterate → Generate → Iterate... +``` + +**Web-Enhanced Loop:** +``` +Spec → Web Prime → [Fetch URL → Learn → Generate]* → Iterate... + ↑_______________| +``` + +Each iteration: +1. Fetches a NEW web resource (URL) +2. Learns specific techniques from that resource +3. Applies learnings to create improved output +4. Documents what was learned and how it was applied + +## System Components + +### 1. Specification File (`specs/*.md`) +Defines what to generate and how web research should enhance it. + +**Example:** `specs/d3_visualization_progressive.md` +- Output format and structure +- Quality standards +- Progressive enhancement dimensions +- Web integration strategy +- Success criteria + +### 2. URL Strategy File (`specs/*_url_strategy.json`) +Curated knowledge pathway with URLs organized by difficulty. + +**Structure:** +```json +{ + "priming_urls": [...], // Initial research URLs + "foundation_urls": [...], // Iterations 1-5 + "intermediate_urls": [...], // Iterations 6-12 + "advanced_urls": [...], // Iterations 13-20 + "expert_urls": [...], // Iterations 21+ + "web_search_templates": [...] // Dynamic search fallbacks +} +``` + +### 3. Command: `/project:infinite-web` +Orchestrates the web-enhanced generation process. + +**Location:** `.claude/commands/infinite-web.md` + +## Usage + +### Basic Command Structure + +```bash +/project:infinite-web [url_strategy_file] +``` + +**Parameters:** +- `spec_file`: Path to specification markdown +- `output_dir`: Where to save generated files +- `count`: Number of iterations (1-N or "infinite") +- `url_strategy_file`: (Optional) Path to URL strategy JSON + +### Usage Examples + +#### 1. Single D3 Visualization with Web Learning +```bash +/project:infinite-web specs/d3_visualization_progressive.md d3_output 1 +``` + +**What happens:** +1. Reads D3 spec +2. Performs initial web priming (3-5 foundational URLs) +3. Selects one URL from foundation category +4. Fetches URL, learns technique +5. Generates `d3_viz_1.html` applying learning +6. Documents web source in file footer + +#### 2. Small Batch (5 Visualizations) +```bash +/project:infinite-web specs/d3_visualization_progressive.md d3_output 5 +``` + +**What happens:** +1. Initial web priming phase +2. Launches 5 parallel agents simultaneously +3. Each agent gets different URL from foundation category +4. Each agent fetches, learns, generates +5. Produces 5 unique visualizations (d3_viz_1 through d3_viz_5) +6. Each demonstrates different technique from different web source + +#### 3. Progressive Learning (20 Iterations) +```bash +/project:infinite-web specs/d3_visualization_progressive.md d3_output 20 specs/d3_url_strategy.json +``` + +**What happens:** +1. Initial web priming +2. Launches in batches of 5 agents +3. Iterations 1-5: Foundation URLs (basic concepts) +4. Iterations 6-12: Intermediate URLs (common patterns) +5. Iterations 13-20: Advanced URLs (complex techniques) +6. Each batch builds upon previous knowledge +7. Progressive sophistication across all 20 outputs + +#### 4. Infinite Mode - Continuous Learning +```bash +/project:infinite-web specs/d3_visualization_progressive.md d3_infinite infinite specs/d3_url_strategy.json +``` + +**What happens:** +1. Initial web priming +2. Wave 1: 3-4 agents, foundation URLs +3. Wave 2: 3-4 agents, intermediate URLs +4. Wave 3: 3-4 agents, advanced URLs +5. Wave 4+: Expert URLs, then dynamic web search +6. Continues until context limits approached +7. Each wave more sophisticated than last +8. Graceful conclusion with summary + +## How It Works + +### Phase 0: Initial Web Priming + +Before any generation, the system builds foundational knowledge: + +``` +1. Read specification file +2. Load URL strategy (if provided) +3. Fetch 3-5 priming URLs: + - Official documentation + - Tutorials + - Pattern libraries + - Best practices +4. Synthesize core concepts, patterns, principles +5. Build mental model for domain +``` + +### Phase 1-3: Analysis & Planning + +``` +1. Analyze specification with priming knowledge +2. Scan output directory for existing iterations +3. Track which URLs have been used (avoid duplicates) +4. Plan URL assignments for upcoming iterations +5. Match iteration numbers to URL difficulty levels +``` + +### Phase 4: Parallel Web-Enhanced Agents + +Each sub-agent follows this process: + +``` +SUB-AGENT WORKFLOW: +├─ Receive assignment (iteration number + specific URL) +├─ WebFetch assigned URL +├─ Analyze content for techniques +├─ Extract 1-3 specific learnings +├─ Read specification +├─ Review existing iterations +├─ Generate output applying web learning +├─ Document web source and improvements +└─ Save file +``` + +**Key Features:** +- Each agent gets unique URL (no duplicates in batch) +- Parallel execution for speed +- Independent web research per agent +- All learnings documented in output + +### Phase 5: Infinite Mode Waves + +``` +WAVE CYCLE: +while (context_available): + ├─ Determine wave size (3-4 agents) + ├─ Select URL category (foundation → expert) + ├─ Assign unique URLs to each agent + ├─ Launch parallel agents + ├─ Monitor completion + ├─ Update used URLs tracker + ├─ Check context capacity + └─ Prepare next wave (if capacity available) +``` + +**Progressive Difficulty:** +- Early waves: Foundational concepts +- Mid waves: Common patterns and techniques +- Later waves: Advanced and expert topics +- Final waves: Dynamic web search for novel techniques + +## URL Selection Strategies + +### 1. Pre-defined URLs (Structured Learning) + +**Advantages:** +- Curated, high-quality sources +- Progressive difficulty curve +- Predictable learning pathway +- Avoids low-quality content + +**How it works:** +```json +// URL strategy file defines ranges +{ + "foundation_urls": { + "iteration_range": [1, 5], + "urls": [ + {"url": "...", "topic": "Basic Bar Charts"}, + {"url": "...", "topic": "Scale Functions"}, + ... + ] + } +} +``` + +Agent for iteration 3 gets URL from foundation_urls category. + +### 2. Dynamic Web Search (Adaptive Discovery) + +**Advantages:** +- Finds latest resources +- Adapts to specific needs +- Never runs out of sources +- Discovers novel techniques + +**How it works:** +``` +Agent determines knowledge gap + → Generates targeted search query + → Uses WebSearch tool + → Selects best result + → Fetches and learns from it +``` + +**Example query generation:** +``` +"D3.js force simulation collision detection site:observablehq.com" +"D3 responsive design best practices 2024" +"Advanced D3 network visualization techniques" +``` + +### 3. Hybrid Mode (Recommended) + +**Best of both worlds:** +- Use pre-defined URLs for core curriculum +- Fall back to dynamic search when URLs exhausted +- Dynamic search for novel explorations +- Structured foundation + adaptive innovation + +## Creating Your Own Web-Enhanced Loop + +### Step 1: Define Your Domain + +Create a specification file for your domain: + +**Template:** `specs/your_domain_progressive.md` + +Key sections: +- Core challenge and goals +- Output format requirements +- Progressive enhancement dimensions +- Web research integration strategy +- Quality standards +- Iteration evolution pattern + +### Step 2: Curate URL Strategy (Optional but Recommended) + +Create URL strategy JSON: `specs/your_domain_url_strategy.json` + +**Organize URLs by:** +- Priming (foundational knowledge) +- Foundation (basic techniques) +- Intermediate (common patterns) +- Advanced (complex implementations) +- Expert (cutting-edge techniques) + +**Include:** +- Web search templates for dynamic discovery +- Topic tags for each URL +- Learning objectives + +### Step 3: Run Your Loop + +```bash +/project:infinite-web specs/your_domain_progressive.md output_dir specs/your_domain_url_strategy.json +``` + +## Example Domains Beyond D3 + +### 1. React Component Library +```bash +# Spec: Progressive React component patterns +# URLs: React docs, popular libraries, best practices +# Output: Increasingly sophisticated React components +/project:infinite-web specs/react_components_progressive.md react_output 20 +``` + +### 2. CSS Animation Techniques +```bash +# Spec: CSS animation mastery +# URLs: CSS-Tricks, MDN, CodePen examples +# Output: Progressive animation techniques +/project:infinite-web specs/css_animations_progressive.md css_output infinite +``` + +### 3. Python Data Science +```bash +# Spec: Data analysis and visualization +# URLs: Pandas docs, Matplotlib gallery, Seaborn tutorials +# Output: Jupyter notebooks with progressive techniques +/project:infinite-web specs/python_datascience_progressive.md notebooks 15 +``` + +### 4. Machine Learning Models +```bash +# Spec: ML model implementations +# URLs: TensorFlow tutorials, papers, Kaggle kernels +# Output: Progressive ML implementations +/project:infinite-web specs/ml_models_progressive.md models 10 +``` + +## Quality Assurance + +### What Makes a Good Iteration? + +**Web Integration:** +- ✅ Specific URL documented in output +- ✅ Technique from URL clearly identified +- ✅ Learning demonstrably applied (not just mentioned) +- ✅ Improvement over previous iteration explained + +**Technical Quality:** +- ✅ Follows specification format exactly +- ✅ Code is clean, commented, functional +- ✅ Demonstrates mastery of learned technique +- ✅ Builds upon previous iterations appropriately + +**Uniqueness:** +- ✅ No duplicate URLs across iterations +- ✅ Novel implementation (not copy-paste from web) +- ✅ Genuine advancement over previous work +- ✅ Creative synthesis of multiple learnings + +### Common Pitfalls to Avoid + +**Superficial Web Integration:** +- ❌ URL cited but technique not applied +- ❌ Copying example code without understanding +- ❌ Mentioning learning without demonstrating it + +**Poor Progression:** +- ❌ Iterations don't build on each other +- ❌ No measurable improvement +- ❌ Duplicate techniques from different sources + +**URL Management:** +- ❌ Reusing same URL in multiple iterations +- ❌ Low-quality or irrelevant sources +- ❌ Ignoring URL strategy difficulty curve + +## Advanced Techniques + +### Custom Web Search Strategies + +Define search templates in your URL strategy: + +```json +{ + "web_search_templates": [ + "{domain} {technique} tutorial site:observablehq.com", + "{domain} {feature} best practices 2024", + "advanced {domain} {area} technique", + "{domain} performance optimization {context}" + ] +} +``` + +Agents can fill templates dynamically based on needs. + +### Multi-Domain Knowledge Fusion + +Combine multiple URL strategies: + +```bash +# Fuse D3 + Design + Accessibility knowledge +/project:infinite-web specs/accessible_dataviz.md output 20 specs/multi_domain_urls.json +``` + +### Iteration Forking + +Generate multiple variants per iteration: + +```bash +# Each iteration explores 3 different techniques from same URL +/project:infinite-web specs/exploration_spec.md variants 30 +``` + +### Knowledge Checkpointing + +Summarize learnings periodically: + +``` +Iterations 1-10 → Generate summary.md with accumulated knowledge +Iterations 11-20 → Build upon summary + new research +``` + +## Troubleshooting + +### WebFetch Failures + +**Problem:** URL fetch fails + +**Solutions:** +1. System falls back to WebSearch for topic +2. Tries alternative URL from same category +3. Logs failure and continues with fallback + +### URL Exhaustion + +**Problem:** All pre-defined URLs used + +**Solutions:** +1. Automatically switches to dynamic WebSearch mode +2. Generates targeted queries based on: + - Current sophistication level + - Knowledge gaps + - Novel areas to explore + +### Context Limits in Infinite Mode + +**Problem:** Approaching context window limits + +**Solutions:** +1. System monitors context usage continuously +2. Completes current wave before limits +3. Generates summary of progress +4. Graceful conclusion with statistics + +### Poor Web Learning Integration + +**Problem:** Agents cite but don't apply learnings + +**Solutions:** +1. Strengthen integration directive in prompts +2. Review output for genuine technique application +2. Require code examples demonstrating learning +4. Validate improvement over previous iteration + +## Best Practices + +### 1. Start Small, Scale Up +```bash +# Test with 1 iteration first +/project:infinite-web specs/your_spec.md test 1 + +# Then try batch +/project:infinite-web specs/your_spec.md test 5 + +# Finally go infinite +/project:infinite-web specs/your_spec.md production infinite +``` + +### 2. Curate Quality URLs +- Choose authoritative sources +- Verify URLs are accessible +- Organize by genuine difficulty progression +- Include diverse perspectives + +### 3. Write Clear Specifications +- Explicit output format requirements +- Clear quality standards +- Specific integration directives +- Progressive enhancement dimensions + +### 4. Monitor First Wave +- Check first 3-5 outputs carefully +- Verify web learning application +- Adjust spec if needed +- Refine URL strategy based on results + +### 5. Document Learnings +- Each iteration should document: + - Web source URL + - Specific technique learned + - How it was applied + - Improvement over previous iteration + +## System Architecture Summary + +``` +┌─────────────────────────────────────────────────────────┐ +│ /project:infinite-web Command │ +│ ├─ Phase 0: Initial Web Priming (3-5 foundational URLs)│ +│ ├─ Phase 1: Spec Analysis + Priming Knowledge │ +│ ├─ Phase 2: Directory Recon + URL Tracking │ +│ ├─ Phase 3: Web-Enhanced Iteration Strategy │ +│ ├─ Phase 4: Parallel Agent Coordination │ +│ │ ├─ Agent 1: URL A → Fetch → Learn → Generate │ +│ │ ├─ Agent 2: URL B → Fetch → Learn → Generate │ +│ │ └─ Agent N: URL N → Fetch → Learn → Generate │ +│ └─ Phase 5: Infinite Mode Waves (optional) │ +│ └─ Wave 1, 2, 3... until context limits │ +└─────────────────────────────────────────────────────────┘ +``` + +## Example Session + +```bash +# Terminal session +$ claude + +> /project:infinite-web specs/d3_visualization_progressive.md d3_viz 5 specs/d3_url_strategy.json + +# System performs: +# 1. Reads D3 spec +# 2. Loads URL strategy +# 3. Fetches 3 priming URLs: +# - d3js.org/what-is-d3 +# - observablehq.com/@d3/learn-d3 +# - d3-graph-gallery.com +# 4. Synthesizes foundational knowledge +# 5. Launches 5 parallel agents: +# - Agent 1: d3js.org/d3-selection → learns selections → generates d3_viz_1.html +# - Agent 2: d3js.org/d3-scale → learns scales → generates d3_viz_2.html +# - Agent 3: observablehq.com/@d3/bar-chart → learns bar charts → d3_viz_3.html +# - Agent 4: observablehq.com/@d3/line-chart → learns line charts → d3_viz_4.html +# - Agent 5: observablehq.com/@d3/scatterplot → learns scatter → d3_viz_5.html +# 6. Each file documents its web source and learnings +# 7. Summary of all 5 iterations and techniques learned + +✓ Generated 5 D3 visualizations with progressive web learning +✓ URLs used: 8 total (3 priming + 5 iteration) +✓ Techniques applied: selections, scales, bar charts, line charts, scatter plots +``` + +## Next Steps + +1. **Try the D3 Example**: Run a small batch to see the system in action +2. **Create Your Domain**: Define spec and URL strategy for your use case +3. **Experiment with Modes**: Try single, batch, and infinite modes +4. **Refine Strategy**: Adjust URL difficulty progression based on results +5. **Scale Up**: Once validated, run larger batches or infinite mode + +## Conclusion + +The Web-Enhanced Infinite Agentic Loop transforms the original loop pattern into a **self-improving knowledge system**. Each iteration doesn't just generate output—it learns from the web, applies new techniques, and builds upon accumulated knowledge. + +**Key Innovation:** Progressive web-based learning creates outputs that continuously improve in sophistication, quality, and technical excellence. + +Start experimenting with D3 visualizations, then apply this pattern to any domain where progressive web-enhanced learning can create increasingly sophisticated outputs! diff --git a/ai_docs/full-initial.md b/ai_docs/full-initial.md new file mode 100644 index 0000000..0035a9d --- /dev/null +++ b/ai_docs/full-initial.md @@ -0,0 +1,2747 @@ +Project Path: infinite-agents + +Source Tree: + +```txt +infinite-agents +├── CLAUDE.md +├── README.md +├── ai_docs +│ └── claude_code_fresh_tutorials.md +└── specs + ├── invent_new_ui.md + ├── invent_new_ui_v2.md + ├── invent_new_ui_v3.md + └── invent_new_ui_v4.md + +``` + +`infinite-agents/CLAUDE.md`: + +```md +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +This is an experimental project demonstrating the Infinite Agentic Loop pattern using Claude Code's custom slash commands. The project orchestrates multiple AI agents in parallel to generate evolving iterations of themed hybrid UI components based on specifications. + +## Key Commands + +### Running the Infinite Agentic Loop + +```bash +claude +``` + +Then use the `/project:infinite` slash command with these variants: + +```bash +# Single generation +/project:infinite specs/invent_new_ui_v3.md src 1 + +# Small batch (5 iterations) +/project:infinite specs/invent_new_ui_v3.md src_new 5 + +# Large batch (20 iterations) +/project:infinite specs/invent_new_ui_v3.md src_new 20 + +# Infinite mode (continuous generation) +/project:infinite specs/invent_new_ui_v3.md infinite_src_new/ infinite +``` + +## Architecture & Structure + +### Command System +The project uses Claude Code's custom commands feature: +- `.claude/commands/infinite.md` - Main infinite loop orchestrator command +- `.claude/commands/prime.md` - Additional command (if present) +- `.claude/settings.json` - Permissions configuration allowing Write, MultiEdit, Edit, and Bash + +### Specification-Driven Generation +- Specifications in `specs/` directory define what type of content to generate +- Current main spec: `specs/invent_new_ui_v3.md` - Themed Hybrid UI Component Specification +- Specs define naming patterns, content structure, design dimensions, and quality standards + +### Multi-Agent Orchestration Pattern +The infinite command implements sophisticated parallel agent coordination: +1. **Specification Analysis** - Deeply understands the spec requirements +2. **Directory Reconnaissance** - Analyzes existing iterations to maintain uniqueness +3. **Parallel Sub-Agent Deployment** - Launches multiple agents with distinct creative directions +4. **Wave-Based Generation** - For infinite mode, manages successive agent waves +5. **Context Management** - Optimizes context usage across all agents + +### Generated Content Organization +- `src/` - Primary output directory for generated UI components +- `src_infinite/` - Alternative output for infinite generation runs +- `legacy/` - Previous iteration attempts and experiments + +### Key Implementation Details +- Sub-agents receive complete context including spec, existing iterations, and unique creative assignments +- Parallel execution managed through Task tool with batch sizes optimized by count +- Progressive sophistication strategy for infinite mode waves +- Each iteration must be genuinely unique while maintaining spec compliance +``` + +`infinite-agents/README.md`: + +```md +# Infinite Agentic Loop POC + +> **Watch the Tutorial**: [Infinite Agentic Loop with Claude Code](https://youtu.be/9ipM_vDwflI) + +An experimental project demonstrating Infinite Agentic Loop in a two prompt system using Claude Code. + +Infinite Agentic Loop + +## Overview + +This project uses a custom Claude Code slash command (`/project:infinite`) to orchestrate multiple AI agents in parallel, generating evolving iterations of content based on specifications. + +## Usage + +Read `.claude/settings.json` to see the permissions and commands allowed. + +Start Claude Code: `claude` + +Type slash command `/project:infinite` to start the infinite agentic loop. + +The infinite command takes three arguments: +``` +/project:infinite +``` + +### 4 Command Variants + +#### 1. Single Generation +```bash +/project:infinite specs/invent_new_ui_v3.md src 1 +``` +Generate one new iteration using the UI specification. + +#### 2. Small Batch (5 iterations) +```bash +/project:infinite specs/invent_new_ui_v3.md src_new 5 +``` +Deploy 5 parallel agents to generate 5 unique iterations simultaneously. + +#### 3. Large Batch (20 iterations) +```bash +/project:infinite specs/invent_new_ui_v3.md src_new 20 +``` +Generate 20 iterations in coordinated batches of 5 agents for optimal resource management. + +#### 4. Infinite Mode +```bash +/project:infinite specs/invent_new_ui_v3.md infinite_src_new/ infinite +``` +Continuous generation in waves until context limits are reached, with progressive sophistication. + +## How It Works + +1. **Specification Analysis**: Reads and understands the spec file requirements +2. **Directory Reconnaissance**: Analyzes existing iterations to determine starting point +3. **Parallel Coordination**: Deploys Sub Agents with unique creative directions +4. **Quality Assurance**: Ensures each iteration is unique and spec-compliant +5. **Wave Management**: For infinite mode, manages successive waves of agents + +## Directions you can take to enhance this pattern + +- Apply this to a use case of your choice. +- Build an MCP Server that enables reuse of the infinite agentic loop. +- Get the `.claude/commands/infinite.md` into your `~/.claude/commands/` directory for global use. +- Update `.claude/commands/infinite.md` to generate sets of files instead of a single file. + +## Master AI Coding +Learn to code with AI with foundational [Principles of AI Coding](https://agenticengineer.com/principled-ai-coding?y=infageloop) + +Follow the [IndyDevDan youtube channel](https://www.youtube.com/@indydevdan) for more AI coding tips and tricks. + +Use the best Agentic Coding tool: [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) +``` + +`infinite-agents/ai_docs/claude_code_fresh_tutorials.md`: + +```md +[Anthropic home page![light logo](https://mintlify.s3.us-west-1.amazonaws.com/anthropic/logo/light.svg)![dark logo](https://mintlify.s3.us-west-1.amazonaws.com/anthropic/logo/dark.svg)](https://docs.anthropic.com/) + +English + +Search... + +Ctrl K + +Search... + +Navigation + +Claude Code + +Tutorials + +[Welcome](https://docs.anthropic.com/en/home) [Developer Guide](https://docs.anthropic.com/en/docs/welcome) [API Guide](https://docs.anthropic.com/en/api/overview) [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) [Resources](https://docs.anthropic.com/en/resources/overview) [Release Notes](https://docs.anthropic.com/en/release-notes/overview) + +This guide provides step-by-step tutorials for common workflows with Claude Code. Each tutorial includes clear instructions, example commands, and best practices to help you get the most from Claude Code. + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#table-of-contents) Table of contents + +- [Resume previous conversations](https://docs.anthropic.com/en/docs/claude-code/tutorials#resume-previous-conversations) +- [Understand new codebases](https://docs.anthropic.com/en/docs/claude-code/tutorials#understand-new-codebases) +- [Fix bugs efficiently](https://docs.anthropic.com/en/docs/claude-code/tutorials#fix-bugs-efficiently) +- [Refactor code](https://docs.anthropic.com/en/docs/claude-code/tutorials#refactor-code) +- [Work with tests](https://docs.anthropic.com/en/docs/claude-code/tutorials#work-with-tests) +- [Create pull requests](https://docs.anthropic.com/en/docs/claude-code/tutorials#create-pull-requests) +- [Handle documentation](https://docs.anthropic.com/en/docs/claude-code/tutorials#handle-documentation) +- [Work with images](https://docs.anthropic.com/en/docs/claude-code/tutorials#work-with-images) +- [Use extended thinking](https://docs.anthropic.com/en/docs/claude-code/tutorials#use-extended-thinking) +- [Set up project memory](https://docs.anthropic.com/en/docs/claude-code/tutorials#set-up-project-memory) +- [Set up Model Context Protocol (MCP)](https://docs.anthropic.com/en/docs/claude-code/tutorials#set-up-model-context-protocol-mcp) +- [Use Claude as a unix-style utility](https://docs.anthropic.com/en/docs/claude-code/tutorials#use-claude-as-a-unix-style-utility) +- [Create custom slash commands](https://docs.anthropic.com/en/docs/claude-code/tutorials#create-custom-slash-commands) +- [Run parallel Claude Code sessions with Git worktrees](https://docs.anthropic.com/en/docs/claude-code/tutorials#run-parallel-claude-code-sessions-with-git-worktrees) + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#resume-previous-conversations) Resume previous conversations + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#continue-your-work-seamlessly) Continue your work seamlessly + +**When to use:** You've been working on a task with Claude Code and need to continue where you left off in a later session. + +Claude Code provides two options for resuming previous conversations: + +- `--continue` to automatically continue the most recent conversation +- `--resume` to display a conversation picker + +1 + +Continue the most recent conversation + +Copy + +```bash +claude --continue + +``` + +This immediately resumes your most recent conversation without any prompts. + +2 + +Continue in non-interactive mode + +Copy + +```bash +claude --continue --print "Continue with my task" + +``` + +Use `--print` with `--continue` to resume the most recent conversation in non-interactive mode, perfect for scripts or automation. + +3 + +Show conversation picker + +Copy + +```bash +claude --resume + +``` + +This displays an interactive conversation selector showing: + +- Conversation start time +- Initial prompt or conversation summary +- Message count + +Use arrow keys to navigate and press Enter to select a conversation. + +**How it works:** + +1. **Conversation Storage**: All conversations are automatically saved locally with their full message history +2. **Message Deserialization**: When resuming, the entire message history is restored to maintain context +3. **Tool State**: Tool usage and results from the previous conversation are preserved +4. **Context Restoration**: The conversation resumes with all previous context intact + +**Tips:** + +- Conversation history is stored locally on your machine +- Use `--continue` for quick access to your most recent conversation +- Use `--resume` when you need to select a specific past conversation +- When resuming, you'll see the entire conversation history before continuing +- The resumed conversation starts with the same model and configuration as the original + +**Examples:** + +Copy + +```bash +# Continue most recent conversation +claude --continue + +# Continue most recent conversation with a specific prompt +claude --continue --print "Show me our progress" + +# Show conversation picker +claude --resume + +# Continue most recent conversation in non-interactive mode +claude --continue --print "Run the tests again" + +``` + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#understand-new-codebases) Understand new codebases + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#get-a-quick-codebase-overview) Get a quick codebase overview + +**When to use:** You've just joined a new project and need to understand its structure quickly. + +1 + +Navigate to the project root directory + +Copy + +```bash +cd /path/to/project + +``` + +2 + +Start Claude Code + +Copy + +```bash +claude + +``` + +3 + +Ask for a high-level overview + +Copy + +``` +> give me an overview of this codebase + +``` + +4 + +Dive deeper into specific components + +Copy + +``` +> explain the main architecture patterns used here + +``` + +Copy + +``` +> what are the key data models? + +``` + +Copy + +``` +> how is authentication handled? + +``` + +**Tips:** + +- Start with broad questions, then narrow down to specific areas +- Ask about coding conventions and patterns used in the project +- Request a glossary of project-specific terms + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#find-relevant-code) Find relevant code + +**When to use:** You need to locate code related to a specific feature or functionality. + +1 + +Ask Claude to find relevant files + +Copy + +``` +> find the files that handle user authentication + +``` + +2 + +Get context on how components interact + +Copy + +``` +> how do these authentication files work together? + +``` + +3 + +Understand the execution flow + +Copy + +``` +> trace the login process from front-end to database + +``` + +**Tips:** + +- Be specific about what you're looking for +- Use domain language from the project + +* * * + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#fix-bugs-efficiently) Fix bugs efficiently + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#diagnose-error-messages) Diagnose error messages + +**When to use:** You've encountered an error message and need to find and fix its source. + +1 + +Share the error with Claude + +Copy + +``` +> I'm seeing an error when I run npm test + +``` + +2 + +Ask for fix recommendations + +Copy + +``` +> suggest a few ways to fix the @ts-ignore in user.ts + +``` + +3 + +Apply the fix + +Copy + +``` +> update user.ts to add the null check you suggested + +``` + +**Tips:** + +- Tell Claude the command to reproduce the issue and get a stack trace +- Mention any steps to reproduce the error +- Let Claude know if the error is intermittent or consistent + +* * * + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#refactor-code) Refactor code + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#modernize-legacy-code) Modernize legacy code + +**When to use:** You need to update old code to use modern patterns and practices. + +1 + +Identify legacy code for refactoring + +Copy + +``` +> find deprecated API usage in our codebase + +``` + +2 + +Get refactoring recommendations + +Copy + +``` +> suggest how to refactor utils.js to use modern JavaScript features + +``` + +3 + +Apply the changes safely + +Copy + +``` +> refactor utils.js to use ES2024 features while maintaining the same behavior + +``` + +4 + +Verify the refactoring + +Copy + +``` +> run tests for the refactored code + +``` + +**Tips:** + +- Ask Claude to explain the benefits of the modern approach +- Request that changes maintain backward compatibility when needed +- Do refactoring in small, testable increments + +* * * + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#work-with-tests) Work with tests + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#add-test-coverage) Add test coverage + +**When to use:** You need to add tests for uncovered code. + +1 + +Identify untested code + +Copy + +``` +> find functions in NotificationsService.swift that are not covered by tests + +``` + +2 + +Generate test scaffolding + +Copy + +``` +> add tests for the notification service + +``` + +3 + +Add meaningful test cases + +Copy + +``` +> add test cases for edge conditions in the notification service + +``` + +4 + +Run and verify tests + +Copy + +``` +> run the new tests and fix any failures + +``` + +**Tips:** + +- Ask for tests that cover edge cases and error conditions +- Request both unit and integration tests when appropriate +- Have Claude explain the testing strategy + +* * * + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#create-pull-requests) Create pull requests + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#generate-comprehensive-prs) Generate comprehensive PRs + +**When to use:** You need to create a well-documented pull request for your changes. + +1 + +Summarize your changes + +Copy + +``` +> summarize the changes I've made to the authentication module + +``` + +2 + +Generate a PR with Claude + +Copy + +``` +> create a pr + +``` + +3 + +Review and refine + +Copy + +``` +> enhance the PR description with more context about the security improvements + +``` + +4 + +Add testing details + +Copy + +``` +> add information about how these changes were tested + +``` + +**Tips:** + +- Ask Claude directly to make a PR for you +- Review Claude's generated PR before submitting +- Ask Claude to highlight potential risks or considerations + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#handle-documentation) Handle documentation + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#generate-code-documentation) Generate code documentation + +**When to use:** You need to add or update documentation for your code. + +1 + +Identify undocumented code + +Copy + +``` +> find functions without proper JSDoc comments in the auth module + +``` + +2 + +Generate documentation + +Copy + +``` +> add JSDoc comments to the undocumented functions in auth.js + +``` + +3 + +Review and enhance + +Copy + +``` +> improve the generated documentation with more context and examples + +``` + +4 + +Verify documentation + +Copy + +``` +> check if the documentation follows our project standards + +``` + +**Tips:** + +- Specify the documentation style you want (JSDoc, docstrings, etc.) +- Ask for examples in the documentation +- Request documentation for public APIs, interfaces, and complex logic + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#work-with-images) Work with images + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#analyze-images-and-screenshots) Analyze images and screenshots + +**When to use:** You need to work with images in your codebase or get Claude's help analyzing image content. + +1 + +Add an image to the conversation + +You can use any of these methods: + +1. Drag and drop an image into the Claude Code window +2. Copy an image and paste it into the CLI with cmd+v (on Mac) +3. Provide an image path claude "Analyze this image: /path/to/your/image.png" + +2 + +Ask Claude to analyze the image + +Copy + +``` +> What does this image show? +> Describe the UI elements in this screenshot +> Are there any problematic elements in this diagram? + +``` + +3 + +Use images for context + +Copy + +``` +> Here's a screenshot of the error. What's causing it? +> This is our current database schema. How should we modify it for the new feature? + +``` + +4 + +Get code suggestions from visual content + +Copy + +``` +> Generate CSS to match this design mockup +> What HTML structure would recreate this component? + +``` + +**Tips:** + +- Use images when text descriptions would be unclear or cumbersome +- Include screenshots of errors, UI designs, or diagrams for better context +- You can work with multiple images in a conversation +- Image analysis works with diagrams, screenshots, mockups, and more + +* * * + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#use-extended-thinking) Use extended thinking + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#leverage-claude%E2%80%99s-extended-thinking-for-complex-tasks) Leverage Claude's extended thinking for complex tasks + +**When to use:** When working on complex architectural decisions, challenging bugs, or planning multi-step implementations that require deep reasoning. + +1 + +Provide context and ask Claude to think + +Copy + +``` +> I need to implement a new authentication system using OAuth2 for our API. Think deeply about the best approach for implementing this in our codebase. + +``` + +Claude will gather relevant information from your codebase and +use extended thinking, which will be visible in the interface. + +2 + +Refine the thinking with follow-up prompts + +Copy + +``` +> think about potential security vulnerabilities in this approach +> think harder about edge cases we should handle + +``` + +**Tips to get the most value out of extended thinking:** + +Extended thinking is most valuable for complex tasks such as: + +- Planning complex architectural changes +- Debugging intricate issues +- Creating implementation plans for new features +- Understanding complex codebases +- Evaluating tradeoffs between different approaches + +The way you prompt for thinking results in varying levels of thinking depth: + +- "think" triggers basic extended thinking +- intensifying phrases such as "think more", "think a lot", "think harder", or "think longer" triggers deeper thinking + +For more extended thinking prompting tips, see [Extended thinking tips](https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/extended-thinking-tips). + +Claude will display its thinking process as italic gray text above the +response. + +* * * + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#set-up-project-memory) Set up project memory + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#create-an-effective-claude-md-file) Create an effective CLAUDE.md file + +**When to use:** You want to set up a CLAUDE.md file to store important project information, conventions, and frequently used commands. + +1 + +Bootstrap a CLAUDE.md for your codebase + +Copy + +``` +> /init + +``` + +**Tips:** + +- Include frequently used commands (build, test, lint) to avoid repeated searches +- Document code style preferences and naming conventions +- Add important architectural patterns specific to your project +- CLAUDE.md memories can be used for both instructions shared with your team and for your individual preferences. + +* * * + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#set-up-model-context-protocol-mcp) Set up Model Context Protocol (MCP) + +Model Context Protocol (MCP) is an open protocol that enables LLMs to access external tools and data sources. For more details, see the [MCP documentation](https://modelcontextprotocol.io/introduction). + +Use third party MCP servers at your own risk. Make sure you trust the MCP +servers, and be especially careful when using MCP servers that talk to the +internet, as these can expose you to prompt injection risk. + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#configure-mcp-servers) Configure MCP servers + +**When to use:** You want to enhance Claude's capabilities by connecting it to specialized tools and external servers using the Model Context Protocol. + +1 + +Add an MCP Stdio Server + +Copy + +```bash +# Basic syntax +claude mcp add [args...] + +# Example: Adding a local server +claude mcp add my-server -e API_KEY=123 -- /path/to/server arg1 arg2 + +``` + +2 + +Add an MCP SSE Server + +Copy + +```bash +# Basic syntax +claude mcp add --transport sse + +# Example: Adding an SSE server +claude mcp add --transport sse sse-server https://example.com/sse-endpoint + +``` + +3 + +Manage your MCP servers + +Copy + +```bash +# List all configured servers +claude mcp list + +# Get details for a specific server +claude mcp get my-server + +# Remove a server +claude mcp remove my-server + +``` + +**Tips:** + +- Use the `-s` or `--scope` flag to specify where the configuration is stored: + + - `local` (default): Available only to you in the current project (was called `project` in older versions) + - `project`: Shared with everyone in the project via `.mcp.json` file + - `user`: Available to you across all projects (was called `global` in older versions) +- Set environment variables with `-e` or `--env` flags (e.g., `-e KEY=value`) +- Configure MCP server startup timeout using the MCP\_TIMEOUT environment variable (e.g., `MCP_TIMEOUT=10000 claude` sets a 10-second timeout) +- Check MCP server status any time using the `/mcp` command within Claude Code +- MCP follows a client-server architecture where Claude Code (the client) can connect to multiple specialized servers + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#understanding-mcp-server-scopes) Understanding MCP server scopes + +**When to use:** You want to understand how different MCP scopes work and how to share servers with your team. + +1 + +Local-scoped MCP servers + +The default scope ( `local`) stores MCP server configurations in your project-specific user settings. These servers are only available to you while working in the current project. + +Copy + +```bash +# Add a local-scoped server (default) +claude mcp add my-private-server /path/to/server + +# Explicitly specify local scope +claude mcp add my-private-server -s local /path/to/server + +``` + +2 + +Project-scoped MCP servers (.mcp.json) + +Project-scoped servers are stored in a `.mcp.json` file at the root of your project. This file should be checked into version control to share servers with your team. + +Copy + +```bash +# Add a project-scoped server +claude mcp add shared-server -s project /path/to/server + +``` + +This creates or updates a `.mcp.json` file with the following structure: + +Copy + +```json +{ + "mcpServers": { + "shared-server": { + "command": "/path/to/server", + "args": [], + "env": {} + } + } +} + +``` + +3 + +User-scoped MCP servers + +User-scoped servers are available to you across all projects on your machine, and are private to you. + +Copy + +```bash +# Add a user server +claude mcp add my-user-server -s user /path/to/server + +``` + +**Tips:** + +- Local-scoped servers take precedence over project-scoped and user-scoped servers with the same name +- Project-scoped servers (in `.mcp.json`) take precedence over user-scoped servers with the same name +- Before using project-scoped servers from `.mcp.json`, Claude Code will prompt you to approve them for security +- The `.mcp.json` file is intended to be checked into version control to share MCP servers with your team +- Project-scoped servers make it easy to ensure everyone on your team has access to the same MCP tools +- If you need to reset your choices for which project-scoped servers are enabled or disabled, use the `claude mcp reset-project-choices` command + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#connect-to-a-postgres-mcp-server) Connect to a Postgres MCP server + +**When to use:** You want to give Claude read-only access to a PostgreSQL database for querying and schema inspection. + +1 + +Add the Postgres MCP server + +Copy + +```bash +claude mcp add postgres-server /path/to/postgres-mcp-server --connection-string "postgresql://user:pass@localhost:5432/mydb" + +``` + +2 + +Query your database with Claude + +Copy + +``` +# In your Claude session, you can ask about your database + +> describe the schema of our users table +> what are the most recent orders in the system? +> show me the relationship between customers and invoices + +``` + +**Tips:** + +- The Postgres MCP server provides read-only access for safety +- Claude can help you explore database structure and run analytical queries +- You can use this to quickly understand database schemas in unfamiliar projects +- Make sure your connection string uses appropriate credentials with minimum required permissions + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#add-mcp-servers-from-json-configuration) Add MCP servers from JSON configuration + +**When to use:** You have a JSON configuration for a single MCP server that you want to add to Claude Code. + +1 + +Add an MCP server from JSON + +Copy + +```bash +# Basic syntax +claude mcp add-json '' + +# Example: Adding a stdio server with JSON configuration +claude mcp add-json weather-api '{"type":"stdio","command":"/path/to/weather-cli","args":["--api-key","abc123"],"env":{"CACHE_DIR":"/tmp"}}' + +``` + +2 + +Verify the server was added + +Copy + +```bash +claude mcp get weather-api + +``` + +**Tips:** + +- Make sure the JSON is properly escaped in your shell +- The JSON must conform to the MCP server configuration schema +- You can use `-s global` to add the server to your global configuration instead of the project-specific one + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#import-mcp-servers-from-claude-desktop) Import MCP servers from Claude Desktop + +**When to use:** You have already configured MCP servers in Claude Desktop and want to use the same servers in Claude Code without manually reconfiguring them. + +1 + +Import servers from Claude Desktop + +Copy + +```bash +# Basic syntax +claude mcp add-from-claude-desktop + +``` + +2 + +Select which servers to import + +After running the command, you'll see an interactive dialog that allows you to select which servers you want to import. + +3 + +Verify the servers were imported + +Copy + +```bash +claude mcp list + +``` + +**Tips:** + +- This feature only works on macOS and Windows Subsystem for Linux (WSL) +- It reads the Claude Desktop configuration file from its standard location on those platforms +- Use the `-s global` flag to add servers to your global configuration +- Imported servers will have the same names as in Claude Desktop +- If servers with the same names already exist, they will get a numerical suffix (e.g., `server_1`) + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#use-claude-code-as-an-mcp-server) Use Claude Code as an MCP server + +**When to use:** You want to use Claude Code itself as an MCP server that other applications can connect to, providing them with Claude's tools and capabilities. + +1 + +Start Claude as an MCP server + +Copy + +```bash +# Basic syntax +claude mcp serve + +``` + +2 + +Connect from another application + +You can connect to Claude Code MCP server from any MCP client, such as Claude Desktop. If you're using Claude Desktop, you can add the Claude Code MCP server using this configuration: + +Copy + +```json +{ + "command": "claude", + "args": ["mcp", "serve"], + "env": {} +} + +``` + +**Tips:** + +- The server provides access to Claude's tools like View, Edit, LS, etc. +- In Claude Desktop, try asking Claude to read files in a directory, make edits, and more. +- Note that this MCP server is simply exposing Claude Code's tools to your MCP client, so your own client is responsible for implementing user confirmation for individual tool calls. + +* * * + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#use-claude-as-a-unix-style-utility) Use Claude as a unix-style utility + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#add-claude-to-your-verification-process) Add Claude to your verification process + +**When to use:** You want to use Claude Code as a linter or code reviewer. + +**Steps:** + +1 + +Add Claude to your build script + +Copy + +```json +// package.json +{ + ... + "scripts": { + ... + "lint:claude": "claude -p 'you are a linter. please look at the changes vs. main and report any issues related to typos. report the filename and line number on one line, and a description of the issue on the second line. do not return any other text.'" + } +} + +``` + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#pipe-in%2C-pipe-out) Pipe in, pipe out + +**When to use:** You want to pipe data into Claude, and get back data in a structured format. + +1 + +Pipe data through Claude + +Copy + +```bash +cat build-error.txt | claude -p 'concisely explain the root cause of this build error' > output.txt + +``` + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#control-output-format) Control output format + +**When to use:** You need Claude's output in a specific format, especially when integrating Claude Code into scripts or other tools. + +1 + +Use text format (default) + +Copy + +```bash +cat data.txt | claude -p 'summarize this data' --output-format text > summary.txt + +``` + +This outputs just Claude's plain text response (default behavior). + +2 + +Use JSON format + +Copy + +```bash +cat code.py | claude -p 'analyze this code for bugs' --output-format json > analysis.json + +``` + +This outputs a JSON array of messages with metadata including cost and duration. + +3 + +Use streaming JSON format + +Copy + +```bash +cat log.txt | claude -p 'parse this log file for errors' --output-format stream-json + +``` + +This outputs a series of JSON objects in real-time as Claude processes the request. Each message is a valid JSON object, but the entire output is not valid JSON if concatenated. + +**Tips:** + +- Use `--output-format text` for simple integrations where you just need Claude's response +- Use `--output-format json` when you need the full conversation log +- Use `--output-format stream-json` for real-time output of each conversation turn + +* * * + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#create-custom-slash-commands) Create custom slash commands + +Claude Code supports custom slash commands that you can create to quickly execute specific prompts or tasks. + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#create-project-specific-commands) Create project-specific commands + +**When to use:** You want to create reusable slash commands for your project that all team members can use. + +1 + +Create a commands directory in your project + +Copy + +```bash +mkdir -p .claude/commands + +``` + +2 + +Create a Markdown file for each command + +Copy + +```bash +echo "Analyze the performance of this code and suggest three specific optimizations:" > .claude/commands/optimize.md + +``` + +3 + +Use your custom command in Claude Code + +Copy + +```bash +claude > /project:optimize + +``` + +**Tips:** + +- Command names are derived from the filename (e.g., `optimize.md` becomes `/project:optimize`) +- You can organize commands in subdirectories (e.g., `.claude/commands/frontend/component.md` becomes `/project:frontend:component`) +- Project commands are available to everyone who clones the repository +- The Markdown file content becomes the prompt sent to Claude when the command is invoked + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#add-command-arguments-with-%24arguments) Add command arguments with $ARGUMENTS + +**When to use:** You want to create flexible slash commands that can accept additional input from users. + +1 + +Create a command file with the $ARGUMENTS placeholder + +Copy + +```bash +echo "Find and fix issue #$ARGUMENTS. Follow these steps: 1. +Understand the issue described in the ticket 2. Locate the relevant code in +our codebase 3. Implement a solution that addresses the root cause 4. Add +appropriate tests 5. Prepare a concise PR description" > +.claude/commands/fix-issue.md + +``` + +2 + +Use the command with an issue number + +Copy + +```bash +claude > /project:fix-issue 123 + +``` + +This will replace $ARGUMENTS with "123" in the prompt. + +**Tips:** + +- The $ARGUMENTS placeholder is replaced with any text that follows the command +- You can position $ARGUMENTS anywhere in your command template +- Other useful applications: generating test cases for specific functions, creating documentation for components, reviewing code in particular files, or translating content to specified languages + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#create-personal-slash-commands) Create personal slash commands + +**When to use:** You want to create personal slash commands that work across all your projects. + +1 + +Create a commands directory in your home folder + +Copy + +```bash +mkdir -p ~/.claude/commands + +``` + +2 + +Create a Markdown file for each command + +Copy + +```bash +echo "Review this code for security vulnerabilities, focusing on:" > +~/.claude/commands/security-review.md + +``` + +3 + +Use your personal custom command + +Copy + +```bash +claude > /user:security-review + +``` + +**Tips:** + +- Personal commands are prefixed with `/user:` instead of `/project:` +- Personal commands are only available to you and not shared with your team +- Personal commands work across all your projects +- You can use these for consistent workflows across different codebases + +* * * + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#run-parallel-claude-code-sessions-with-git-worktrees) Run parallel Claude Code sessions with Git worktrees + +### [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#use-worktrees-for-isolated-coding-environments) Use worktrees for isolated coding environments + +**When to use:** You need to work on multiple tasks simultaneously with complete code isolation between Claude Code instances. + +1 + +Understand Git worktrees + +Git worktrees allow you to check out multiple branches from the same +repository into separate directories. Each worktree has its own working +directory with isolated files, while sharing the same Git history. Learn +more in the [official Git worktree\\ +documentation](https://git-scm.com/docs/git-worktree). + +2 + +Create a new worktree + +Copy + +```bash +# Create a new worktree with a new branch +git worktree add ../project-feature-a -b feature-a + +# Or create a worktree with an existing branch +git worktree add ../project-bugfix bugfix-123 + +``` + +This creates a new directory with a separate working copy of your repository. + +3 + +Run Claude Code in each worktree + +Copy + +```bash +# Navigate to your worktree +cd ../project-feature-a + +# Run Claude Code in this isolated environment +claude + +``` + +4 + +In another terminal: + +Copy + +```bash +cd ../project-bugfix +claude + +``` + +5 + +Manage your worktrees + +Copy + +```bash +# List all worktrees +git worktree list + +# Remove a worktree when done +git worktree remove ../project-feature-a + +``` + +**Tips:** + +- Each worktree has its own independent file state, making it perfect for parallel Claude Code sessions +- Changes made in one worktree won't affect others, preventing Claude instances from interfering with each other +- All worktrees share the same Git history and remote connections +- For long-running tasks, you can have Claude working in one worktree while you continue development in another +- Use descriptive directory names to easily identify which task each worktree is for +- Remember to initialize your development environment in each new worktree according to your project's setup. Depending on your stack, this might include: + - JavaScript projects: Running dependency installation ( `npm install`, `yarn`) + - Python projects: Setting up virtual environments or installing with package managers + - Other languages: Following your project's standard setup process + +* * * + +## [​](https://docs.anthropic.com/en/docs/claude-code/tutorials\#next-steps) Next steps + +[**Claude Code reference implementation** \\ +\\ +Clone our development container reference implementation.](https://github.com/anthropics/claude-code/tree/main/.devcontainer) + +Was this page helpful? + +YesNo + +[SDK](https://docs.anthropic.com/en/docs/claude-code/sdk) [Troubleshooting](https://docs.anthropic.com/en/docs/claude-code/troubleshooting) + +On this page + +- [Table of contents](https://docs.anthropic.com/en/docs/claude-code/tutorials#table-of-contents) +- [Resume previous conversations](https://docs.anthropic.com/en/docs/claude-code/tutorials#resume-previous-conversations) +- [Continue your work seamlessly](https://docs.anthropic.com/en/docs/claude-code/tutorials#continue-your-work-seamlessly) +- [Understand new codebases](https://docs.anthropic.com/en/docs/claude-code/tutorials#understand-new-codebases) +- [Get a quick codebase overview](https://docs.anthropic.com/en/docs/claude-code/tutorials#get-a-quick-codebase-overview) +- [Find relevant code](https://docs.anthropic.com/en/docs/claude-code/tutorials#find-relevant-code) +- [Fix bugs efficiently](https://docs.anthropic.com/en/docs/claude-code/tutorials#fix-bugs-efficiently) +- [Diagnose error messages](https://docs.anthropic.com/en/docs/claude-code/tutorials#diagnose-error-messages) +- [Refactor code](https://docs.anthropic.com/en/docs/claude-code/tutorials#refactor-code) +- [Modernize legacy code](https://docs.anthropic.com/en/docs/claude-code/tutorials#modernize-legacy-code) +- [Work with tests](https://docs.anthropic.com/en/docs/claude-code/tutorials#work-with-tests) +- [Add test coverage](https://docs.anthropic.com/en/docs/claude-code/tutorials#add-test-coverage) +- [Create pull requests](https://docs.anthropic.com/en/docs/claude-code/tutorials#create-pull-requests) +- [Generate comprehensive PRs](https://docs.anthropic.com/en/docs/claude-code/tutorials#generate-comprehensive-prs) +- [Handle documentation](https://docs.anthropic.com/en/docs/claude-code/tutorials#handle-documentation) +- [Generate code documentation](https://docs.anthropic.com/en/docs/claude-code/tutorials#generate-code-documentation) +- [Work with images](https://docs.anthropic.com/en/docs/claude-code/tutorials#work-with-images) +- [Analyze images and screenshots](https://docs.anthropic.com/en/docs/claude-code/tutorials#analyze-images-and-screenshots) +- [Use extended thinking](https://docs.anthropic.com/en/docs/claude-code/tutorials#use-extended-thinking) +- [Leverage Claude's extended thinking for complex tasks](https://docs.anthropic.com/en/docs/claude-code/tutorials#leverage-claude%E2%80%99s-extended-thinking-for-complex-tasks) +- [Set up project memory](https://docs.anthropic.com/en/docs/claude-code/tutorials#set-up-project-memory) +- [Create an effective CLAUDE.md file](https://docs.anthropic.com/en/docs/claude-code/tutorials#create-an-effective-claude-md-file) +- [Set up Model Context Protocol (MCP)](https://docs.anthropic.com/en/docs/claude-code/tutorials#set-up-model-context-protocol-mcp) +- [Configure MCP servers](https://docs.anthropic.com/en/docs/claude-code/tutorials#configure-mcp-servers) +- [Understanding MCP server scopes](https://docs.anthropic.com/en/docs/claude-code/tutorials#understanding-mcp-server-scopes) +- [Connect to a Postgres MCP server](https://docs.anthropic.com/en/docs/claude-code/tutorials#connect-to-a-postgres-mcp-server) +- [Add MCP servers from JSON configuration](https://docs.anthropic.com/en/docs/claude-code/tutorials#add-mcp-servers-from-json-configuration) +- [Import MCP servers from Claude Desktop](https://docs.anthropic.com/en/docs/claude-code/tutorials#import-mcp-servers-from-claude-desktop) +- [Use Claude Code as an MCP server](https://docs.anthropic.com/en/docs/claude-code/tutorials#use-claude-code-as-an-mcp-server) +- [Use Claude as a unix-style utility](https://docs.anthropic.com/en/docs/claude-code/tutorials#use-claude-as-a-unix-style-utility) +- [Add Claude to your verification process](https://docs.anthropic.com/en/docs/claude-code/tutorials#add-claude-to-your-verification-process) +- [Pipe in, pipe out](https://docs.anthropic.com/en/docs/claude-code/tutorials#pipe-in%2C-pipe-out) +- [Control output format](https://docs.anthropic.com/en/docs/claude-code/tutorials#control-output-format) +- [Create custom slash commands](https://docs.anthropic.com/en/docs/claude-code/tutorials#create-custom-slash-commands) +- [Create project-specific commands](https://docs.anthropic.com/en/docs/claude-code/tutorials#create-project-specific-commands) +- [Add command arguments with $ARGUMENTS](https://docs.anthropic.com/en/docs/claude-code/tutorials#add-command-arguments-with-%24arguments) +- [Create personal slash commands](https://docs.anthropic.com/en/docs/claude-code/tutorials#create-personal-slash-commands) +- [Run parallel Claude Code sessions with Git worktrees](https://docs.anthropic.com/en/docs/claude-code/tutorials#run-parallel-claude-code-sessions-with-git-worktrees) +- [Use worktrees for isolated coding environments](https://docs.anthropic.com/en/docs/claude-code/tutorials#use-worktrees-for-isolated-coding-environments) +- [Next steps](https://docs.anthropic.com/en/docs/claude-code/tutorials#next-steps) +``` + +`infinite-agents/specs/invent_new_ui.md`: + +```md +# UI Component Innovation Specification + +## Core Challenge +Invent a novel UI component that **completely replaces** an existing UI element while maintaining its core functionality through an innovative interaction paradigm. + +## Output Requirements + +**File Naming**: `ui_innovation_[iteration_number].html` + +**Content Structure**: Complete self-contained HTML file with inline CSS and JavaScript +```html + + + + + + UI Innovation: [Creative Title] + + + + +
+

UI Innovation: [Creative Title]

+
+

Replaces: [Traditional component]

+

Innovation: [Key innovation summary]

+
+
+ + +
+
+

Interactive Demo

+ +
+ +
+
+ + +
+

Traditional vs Innovation

+
+
+

Traditional Component

+ +
+
+

Innovative Component

+ +
+
+
+ + +
+

Design Documentation

+
+

Interaction Model

+

[How users interact with this component]

+
+
+

Technical Implementation

+

[Key technical approaches, native web APIs used]

+
+
+

Accessibility Features

+

[How accessibility is maintained/enhanced]

+
+
+

Evolution Opportunities

+

[Future enhancement possibilities]

+
+
+
+ + + + +``` + +## Innovation Dimensions + +### **Interaction Paradigms** +- **Physical Metaphors**: Gravity, magnetism, fluid dynamics, organic growth +- **Natural Behaviors**: Weather patterns, plant growth, animal behaviors, ecosystem dynamics +- **Temporal Elements**: Memory, adaptation, prediction, lifecycle progression +- **Spatial Innovation**: 3D environments, physics simulation, dimensional layering +- **Emotional Integration**: Mood-responsive, empathy-driven, personality-adaptive +- **Collaborative Models**: Social interactions, competitive elements, shared experiences +- **Sensory Expansion**: Sound, haptics, environmental feedback, multi-modal input + +### **Target Components (Examples)** +- **Input Elements**: Text fields, dropdowns, checkboxes, sliders, file uploads +- **Navigation**: Menus, tabs, breadcrumbs, pagination, search interfaces +- **Display**: Tables, cards, lists, galleries, dashboards, charts +- **Feedback**: Alerts, progress indicators, loading states, notifications +- **Controls**: Buttons, toggles, steppers, date pickers, color selectors + +### **Replacement Strategies** +1. **Metaphor Transformation**: Replace digital metaphors with physical/natural ones +2. **Interaction Modality Shift**: Move beyond click/touch to gesture, voice, gaze, environment +3. **Paradigm Inversion**: Turn passive elements active, individual into collaborative +4. **Dimensional Expansion**: Add spatial, temporal, or contextual dimensions +5. **Intelligence Integration**: Add learning, adaptation, or predictive capabilities + +## Innovation Principles + +### **Functional Preservation** +- Must accomplish the same core task as the original component +- Maintain or improve accessibility and usability +- Preserve essential feedback and state communication +- Ensure compatibility with existing interface ecosystems + +### **Novel Differentiation** +- Introduce genuinely new interaction methods +- Challenge conventional UI wisdom +- Create memorable and engaging experiences +- Enable capabilities impossible with traditional approaches + +### **Practical Viability** +- **Native Web Technologies Only**: Use only HTML, CSS, and vanilla JavaScript +- **Single File Constraint**: Everything must work in one self-contained .html file +- **Browser Compatibility**: Leverage modern but widely-supported web APIs +- **Performance**: Maintain 60fps animations, responsive interactions +- **Accessibility**: Full keyboard navigation, screen reader support, ARIA attributes +- **Progressive Enhancement**: Graceful degradation for older browsers +- **No Dependencies**: Zero external libraries, frameworks, or assets + +## Iteration Evolution Pattern + +### **Progressive Sophistication** +- **Early Iterations**: Focus on core functional replacement with single novel element +- **Mid Iterations**: Add contextual awareness, temporal elements, or collaborative features +- **Advanced Iterations**: Integrate multiple innovation dimensions, emotional intelligence, adaptive behaviors +- **Infinite Iterations**: Explore hybrid approaches, cross-paradigm combinations, revolutionary concepts + +### **Exploration Vectors** +- Different target components (breadth) +- Deeper innovation within same component type (depth) +- Cross-paradigm hybrid approaches (synthesis) +- Ecosystem-level integration concepts (scale) +- Future technology integration (speculation) + +## Quality Standards + +### **Innovation Metrics** +- **Novelty**: How unprecedented is this approach? +- **Functionality**: Does it fully replace the original component? +- **Usability**: Is it learnable and efficient? +- **Engagement**: Does it create compelling user experiences? +- **Extensibility**: Can this concept scale or apply elsewhere? + +### **Design Excellence** +- **Interactive Demo**: Fully functional component that users can immediately try +- **Side-by-side Comparison**: Traditional vs innovative implementation +- **Complete Documentation**: Embedded design rationale and technical notes +- **Accessibility Compliance**: WCAG 2.1 AA standards minimum +- **Code Quality**: Clean, commented, maintainable vanilla JavaScript/CSS +- **Performance Optimized**: Smooth animations, efficient event handling +- **Self-Contained**: Opens and works perfectly in any modern browser + +## Ultra-Thinking Directive + +Before each iteration, engage in deep analysis: +- What makes traditional UI components limited or frustrating? +- How do humans naturally want to interact with digital information? +- What metaphors from the physical world could be digitally reimagined? +- How might emerging technologies enable new interaction paradigms? +- What would UI look like if we started from scratch today? + +**Generate components that are simultaneously:** +- Functionally equivalent to their traditional counterparts +- Interactively revolutionary and engaging +- Self-contained HTML files with native web technologies only +- Immediately usable and demonstrable +- Accessible and performant +- Evolutionarily positioned for future iterations + +## Native Web API Opportunities + +### **Animation & Graphics** +- CSS Transforms, Transitions, Animations, Custom Properties +- Canvas 2D, WebGL for complex graphics +- SVG animations and interactions +- Intersection Observer for scroll-based effects + +### **Interaction** +- Pointer Events, Touch Events, Keyboard Events +- Drag & Drop API, Selection API +- Gamepad API for alternative inputs +- Web Audio API for sound feedback + +### **Advanced Features** +- Web Animations API for complex timing +- ResizeObserver for responsive components +- MutationObserver for dynamic content +- requestAnimationFrame for smooth performance +- CSS Grid, Flexbox for innovative layouts +- CSS Custom Properties for dynamic theming +``` + +`infinite-agents/specs/invent_new_ui_v2.md`: + +```md +# Practical UI Component Enhancement Specification + +## Core Challenge +Take an existing UI component and create a **significantly enhanced version** that users immediately recognize as superior. Focus on practical improvements through animation, interaction design, and intelligent behaviors that make the component more delightful and efficient to use. + +## Output Requirements + +**File Naming**: `ui_enhanced_[iteration_number].html` + +**Content Structure**: Clean, focused HTML file showcasing the enhanced component +```html + + + + + + [Component Name] Enhanced + + + +
+

[Component Type] - Enhanced

+ + +
+ + +
+ + + +
+ + + + +``` + +## Enhancement Principles + +### **Practical Improvements** +- **Animation & Polish**: Smooth transitions, hover effects, loading states +- **Micro-Interactions**: Delightful feedback for user actions +- **Smart Behaviors**: Auto-focus, intelligent defaults, predictive features +- **Better Feedback**: Clear visual responses, progress indicators, validation +- **Enhanced Accessibility**: Superior keyboard navigation, screen reader support +- **Performance**: 60fps animations, efficient event handling, fast responses + +### **Self-Evident Value** +- Users should immediately see the improvement without explanation +- Enhanced version should feel significantly better to interact with +- Improvements should be intuitive and build on familiar patterns +- Component should invite exploration and repeated use + +### **Focus Areas** +- **Visual Excellence**: Better typography, spacing, colors, shadows, gradients +- **Interaction Flow**: Smoother state changes, better click targets, drag interactions +- **Intelligence**: Smart validation, auto-complete, contextual suggestions +- **Responsiveness**: Adapts to screen size, input method, user preferences +- **Error Handling**: Graceful error states, helpful constraints, recovery options + +## Enhancement Dimensions + +### **Animation & Motion** +- **State Transitions**: Smooth changes between states (hover, focus, active, disabled) +- **Loading States**: Elegant spinners, skeleton screens, progressive loading +- **Micro-Animations**: Button press feedback, input focus, menu reveals +- **Physics**: Natural easing, spring animations, momentum-based interactions +- **Performance**: Hardware-accelerated transforms, efficient animations + +### **Interaction Intelligence** +- **Predictive Behavior**: Auto-complete, smart suggestions, learned preferences +- **Context Awareness**: Adapts based on user patterns, device capabilities +- **Smart Defaults**: Intelligent initial values, remembered settings +- **Progressive Disclosure**: Reveal complexity gradually as needed +- **Shortcuts**: Keyboard shortcuts, gesture support, power-user features + +### **Visual & Spatial Design** +- **Depth & Layering**: Subtle shadows, elevation, z-index management +- **Typography**: Better font choices, line spacing, reading experience +- **Color & Contrast**: Accessible color palettes, dark mode support +- **Spacing & Rhythm**: Consistent grid systems, harmonious proportions +- **Iconography**: Clear, consistent icons with proper sizing + +### **Accessibility & Inclusion** +- **Keyboard Navigation**: Full keyboard support, logical tab order, shortcuts +- **Screen Readers**: Proper ARIA labels, live regions, semantic markup +- **Color Independence**: Information not conveyed by color alone +- **Motion Sensitivity**: Respects prefers-reduced-motion settings +- **Touch Targets**: Proper sizing for mobile, accessible click areas + +## Target Components + +### **Form Elements** +- **Text Inputs**: Floating labels, smart validation, auto-complete +- **Dropdowns**: Searchable, keyboard navigation, smart positioning +- **Checkboxes/Radios**: Better visual feedback, group interactions +- **File Uploads**: Drag-and-drop, progress indicators, preview +- **Date Pickers**: Intuitive navigation, keyboard shortcuts, range selection + +### **Navigation** +- **Tabs**: Smooth transitions, overflow handling, keyboard navigation +- **Menus**: Smart positioning, search, hierarchical navigation +- **Breadcrumbs**: Interactive, collapsible, contextual actions +- **Pagination**: Smart loading, infinite scroll, jump navigation + +### **Data Display** +- **Tables**: Sortable headers, row selection, responsive layouts +- **Cards**: Hover states, action overlays, smart layouts +- **Lists**: Virtual scrolling, drag reordering, bulk actions +- **Charts**: Interactive tooltips, smooth animations, accessibility + +### **Feedback & Status** +- **Buttons**: Loading states, success feedback, smart disabled states +- **Progress Bars**: Smooth animations, contextual information +- **Alerts/Toasts**: Better positioning, dismissal, action buttons +- **Modals**: Smooth entrance, focus management, backdrop interactions + +## Quality Standards + +### **Enhancement Metrics** +- **Usability**: Measurably easier/faster to use than standard version +- **Delight**: Creates positive emotional response and satisfaction +- **Accessibility**: WCAG 2.1 AA compliant with enhanced keyboard support +- **Performance**: Smooth 60fps animations, fast response times +- **Polish**: Professional visual design that feels modern and refined + +### **Technical Excellence** +- **Clean Code**: Well-structured, commented, maintainable +- **Progressive Enhancement**: Works without JavaScript, enhanced with it +- **Cross-Browser**: Compatible with modern browsers +- **Responsive**: Adapts beautifully to different screen sizes +- **Performant**: Efficient animations, minimal reflows, optimized assets + +## Evolution Strategy + +### **Iteration Progression** +- **Foundation (1-3)**: Core component types with fundamental enhancements +- **Sophistication (4-8)**: Advanced interactions, smart behaviors, complex animations +- **Innovation (9+)**: Novel interaction patterns, AI-enhanced features, experimental UI + +### **Enhancement Complexity** +- **Visual Polish**: Start with better styling, colors, typography +- **Interaction Layer**: Add smooth animations, hover effects, transitions +- **Intelligence Layer**: Implement smart behaviors, prediction, adaptation +- **Advanced Features**: Complex animations, gesture support, voice interaction + +## Native Web Technologies + +### **CSS Features** +- **Modern Layout**: Grid, Flexbox, Container Queries +- **Animations**: Transitions, Keyframes, Web Animations API +- **Visual Effects**: Filters, Backdrop-filter, Clip-path, Gradients +- **Responsive**: Media queries, Viewport units, Clamp functions +- **Custom Properties**: Dynamic theming, animation coordination + +### **JavaScript APIs** +- **Interaction**: Intersection Observer, Resize Observer, Pointer Events +- **Animation**: requestAnimationFrame, Web Animations API +- **Accessibility**: Focus management, ARIA live regions +- **Performance**: Virtual scrolling, Debouncing, Throttling +- **Modern Features**: ES6+ syntax, Async/await, Template literals + +## Ultra-Thinking Directive + +Before each enhancement, deeply consider: + +**User Experience:** +- What frustrates users about the current component? +- How can animation make interactions feel more natural? +- What would make this component delightful to use repeatedly? +- How can we anticipate and prevent user errors? + +**Enhancement Opportunities:** +- Which micro-interactions would provide the most value? +- How can we make the component more accessible without sacrificing design? +- What smart behaviors would users appreciate but not expect? +- How can animation guide user attention and understanding? + +**Technical Excellence:** +- What modern web APIs can enhance this component? +- How can we ensure smooth performance across devices? +- What's the most elegant way to implement this enhancement? +- How can we make the code maintainable and extensible? + +**Practical Impact:** +- Would users prefer this enhanced version in real applications? +- How does this enhancement scale to enterprise use cases? +- What's the learning curve vs. value proposition? +- How can we make the enhancement feel familiar yet superior? + +**Generate components that are:** +- **Immediately Better**: Users instantly recognize the improvement +- **Practically Useful**: Solves real problems with existing components +- **Delightfully Animated**: Smooth, purposeful motion that enhances usability +- **Accessible by Design**: Enhanced keyboard navigation and screen reader support +- **Self-Contained**: No dependencies, works perfectly as a standalone HTML file +``` + +`infinite-agents/specs/invent_new_ui_v3.md`: + +```md +# Themed Hybrid UI Component Specification + +## Core Challenge +Create a **uniquely themed UI component** that combines multiple existing UI elements into one elegant solution. + +Apply a distinctive design language while solving multiple interface problems in a single, cohesive component - achieving "two birds with one stone" efficiency. + +## Output Requirements + +**File Naming**: `ui_hybrid_[iteration_number].html` + +**Content Structure**: Themed, multi-functional HTML component +```html + + + + + + [Theme Name] [Hybrid Component Name] + + + +
+

[Hybrid Component Name] - [Theme Name] Theme

+ + +
+ + +
+ + + +
+ + + + +``` + +## Design Dimensions + +### **Unique Theme Development** +Each component must embody a distinctive design language that creates personality and memorable experience. Here are example themes to consider - don't limit yourself to these, use your imagination to create new unique themes: + +#### **Theme Categories** +- **Organic Nature**: Plant growth, water flow, seasonal changes, natural textures +- **Digital Minimalism**: Pure geometry, negative space, precise typography, subtle motion +- **Retro Computing**: Terminal aesthetics, scan lines, monospace fonts, command-line feel +- **Glass Morphism**: Translucent layers, backdrop blur, depth, light refraction effects +- **Industrial Design**: Metal textures, mechanical movement, precision engineering, functional beauty +- **Playful Animation**: Bouncy physics, bright colors, cartoon-like interactions, joyful feedback +- **Zen Philosophy**: Calm palettes, breathing animations, mindful transitions, peaceful flow +- **Cyberpunk Future**: Neon accents, glitch effects, holographic elements, digital noir +- **Handcrafted Paper**: Torn edges, shadows, texture, analog warmth in digital space +- **Architectural Brutalism**: Bold concrete forms, stark contrasts, imposing geometry + +#### **Theme Implementation** +- **Visual Language**: Consistent color palette, typography, iconography, spacing +- **Motion Personality**: Signature animation easing, timing, transition styles +- **Interaction Character**: How the component responds to user input (playful, precise, organic) +- **Sound Identity**: Audio feedback that reinforces the theme (when appropriate) +- **Micro-Details**: Small touches that strengthen the thematic experience + +### **Hybrid Component Strategy** +Combine 2-4 existing UI components into one powerful, multi-functional interface. Don't limit yourself to the examples below, use your imagination to create new unique combinations: + +#### **Smart Combinations** +- **Search Hub**: Search bar + autocomplete + recent items + filters + results preview +- **Input Intelligence**: Text field + validation + help system + formatting + autocomplete +- **Action Controller**: Button + loading state + confirmation + success feedback + error handling +- **File Manager**: Upload area + progress tracking + preview + validation + file browser +- **Navigation Center**: Tabs + breadcrumbs + search + quick actions + state memory +- **Data Explorer**: Table + pagination + search + filter + sort + export + selection +- **Content Card**: Preview + actions + modal + sharing + favoriting + metadata +- **Form Wizard**: Progress indicator + steps + validation + navigation + save states +- **Media Player**: Controls + playlist + visualizer + sharing + quality selector +- **Dashboard Widget**: Chart + filter + export + refresh + settings + alerts + +#### **Integration Principles** +- **Seamless Flow**: Combined functions feel naturally connected, not forced together +- **Contextual Revelation**: Advanced features appear when needed, hide when not +- **Shared State**: All component functions work with the same data intelligently +- **Progressive Disclosure**: Complexity reveals gradually based on user engagement +- **Unified Interaction**: Single interaction model across all combined functions + +## Enhancement Principles + +### **Thematic Consistency** +- **Visual Cohesion**: All elements follow the same design language strictly +- **Behavioral Harmony**: Animations and interactions reinforce the theme consistently +- **Emotional Resonance**: Theme creates appropriate mood and user connection +- **Memorable Identity**: Component has distinctive personality users remember +- **Authentic Expression**: Theme feels genuine, not superficial decoration + +### **Functional Integration** +- **Two Birds, One Stone**: Genuinely solves multiple UI problems in single component +- **Natural Combination**: Combined functions complement each other logically +- **Efficiency Gain**: Users accomplish more with fewer interface elements +- **Reduced Cognitive Load**: Integration simplifies rather than complicates usage +- **Smart Coordination**: Functions work together intelligently, sharing context + +### **Practical Excellence** +- **Enhanced Usability**: Hybrid approach makes tasks easier, not harder +- **Performance Optimized**: Multiple functions don't compromise speed or smoothness +- **Accessibility Maintained**: All functions fully accessible via keyboard and screen reader +- **Responsive Design**: Works beautifully across all device sizes and orientations +- **Self-Evident Value**: Users immediately understand and appreciate the combination + +## Theme Development Guide + +### **Visual Identity** +- **Color Psychology**: Choose palettes that reinforce theme emotional goals +- **Typography Character**: Select fonts that embody the theme personality +- **Spatial Rhythm**: Use spacing and proportions that feel thematically appropriate +- **Texture & Depth**: Apply visual treatments that strengthen theme identity +- **Iconography Style**: Create or adapt icons that match thematic language + +### **Motion Language** +- **Easing Personality**: Custom timing functions that feel thematically consistent +- **Animation Metaphors**: Movement patterns inspired by theme concepts +- **Transition Flow**: State changes that reinforce thematic narrative +- **Physics Simulation**: Natural or stylized physics that match theme world +- **Feedback Rhythm**: Response timing that creates appropriate emotional pace + +### **Interaction Behaviors** +- **Input Response**: How component reacts to user actions thematically +- **State Communication**: Visual language for different component states +- **Error Personality**: How problems are communicated within theme voice +- **Success Celebration**: Achievement feedback that matches theme energy +- **Loading Character**: Wait states that maintain theme immersion + +## Combination Strategies + +### **Function Pairing Logic** +- **Workflow Optimization**: Combine steps users typically do in sequence +- **Context Sharing**: Functions that benefit from shared data or state +- **Space Efficiency**: Multiple functions in constrained interface real estate +- **Cognitive Grouping**: Related functions users think of as connected +- **Progressive Enhancement**: Basic function enhanced by additional capabilities + +### **Integration Patterns** +- **Nested Functions**: One component contains others as sub-features +- **Parallel Functions**: Multiple capabilities available simultaneously +- **Sequential Functions**: Workflow that progresses through different modes +- **Contextual Functions**: Features that appear based on current state or data +- **Adaptive Functions**: Component behavior changes based on usage patterns + +### **State Management** +- **Unified Data Model**: Single source of truth for all combined functions +- **Intelligent Defaults**: Smart initial states based on combined function needs +- **Cross-Function Communication**: Changes in one area appropriately affect others +- **Memory & Recovery**: Component remembers user preferences across all functions +- **Conflict Resolution**: Graceful handling when combined functions have competing needs + +## Quality Standards + +### **Thematic Execution** +- **Authentic Voice**: Theme feels genuine and well-researched, not superficial +- **Consistent Application**: Every design decision reinforces the chosen theme +- **Emotional Impact**: Theme creates appropriate user emotional response +- **Cultural Sensitivity**: Themes respect cultural contexts and avoid stereotypes +- **Timeless Quality**: Theme execution feels polished, not trendy or dated + +### **Hybrid Functionality** +- **Genuine Integration**: Combined functions truly enhance each other +- **Usability Testing**: Hybrid approach measurably improves user task completion +- **Performance Maintenance**: Multiple functions don't compromise component speed +- **Accessibility Compliance**: All combined functions meet WCAG 2.1 AA standards +- **Edge Case Handling**: Component gracefully manages complex state interactions + +### **Technical Excellence** +- **Clean Architecture**: Well-organized code despite increased complexity +- **Progressive Enhancement**: Works without JavaScript, enhanced with it +- **Browser Compatibility**: Functions correctly across modern browsers +- **Responsive Adaptation**: All combined functions work on mobile and desktop +- **Performance Optimization**: Efficient rendering and interaction handling + +## Iteration Evolution + +### **Theme Sophistication** +- **Foundation (1-3)**: Establish clear theme identity with basic combinations +- **Refinement (4-6)**: Deepen thematic details and improve integration elegance +- **Innovation (7+)**: Push thematic boundaries and create novel combinations + +### **Combination Complexity** +- **Simple Pairs**: Start with 2 closely related UI functions +- **Functional Triads**: Combine 3 complementary interface elements +- **Complex Systems**: Integrate 4+ functions into sophisticated multi-tools +- **Adaptive Hybrids**: Components that learn and adapt their combination strategy + +## Ultra-Thinking Directive + +Before each themed hybrid creation, deeply consider: + +**Theme Development:** +- What personality should this component embody? +- How can visual design reinforce the emotional goals? +- What motion language would feel authentic to this theme? +- How can micro-interactions strengthen the thematic experience? +- What makes this theme memorable and distinctive? + +**Function Combination:** +- Which UI functions naturally belong together in user workflows? +- How can combining these functions reduce user cognitive load? +- What shared data or state would make integration seamless? +- How can progressive disclosure reveal complexity appropriately? +- What makes this combination genuinely better than separate components? + +**Integration Excellence:** +- How can the theme unify disparate UI functions visually? +- What interaction patterns work across all combined functions? +- How can we maintain accessibility across increased complexity? +- What performance optimizations are needed for multiple functions? +- How can error states be handled consistently across all functions? + +**User Experience:** +- Does this themed hybrid solve real problems elegantly? +- Would users prefer this over separate themed components? +- How does the combination enhance rather than complicate workflows? +- What makes this approach self-evidently valuable? +- How can we ensure the theme enhances rather than distracts from functionality? + +**Generate components that are:** +- **Thematically Distinctive**: Strong design personality that creates memorable experience +- **Functionally Integrated**: Multiple UI capabilities working together seamlessly +- **Practically Superior**: Genuinely better than using separate components +- **Technically Excellent**: Smooth performance despite increased complexity +- **Immediately Compelling**: Users instantly understand and appreciate the hybrid approach +``` + +`infinite-agents/specs/invent_new_ui_v4.md`: + +```md +# Themed Hybrid UI Component Specification v4 + +## Evolution from v3: Modular Architecture + +This specification builds upon v3's successful themed hybrid component approach with a critical architectural improvement: **separation of concerns through modular file structure**. While v3 delivered powerful themed components in single HTML files, v4 embraces modern development practices by splitting each component into three distinct files within organized directories. + +### Key Improvements in v4: +- **Maintainability**: Styles and scripts can be modified without touching HTML structure +- **Reusability**: CSS themes and JavaScript behaviors can be extended or shared +- **Performance**: Better browser caching, conditional loading, and optimization opportunities +- **Collaboration**: Teams can work on styling, structure, and behavior independently +- **Scalability**: Components are ready for integration into larger systems +- **Developer Experience**: Clean separation follows industry best practices + +## Core Challenge (Enhanced) +Create a **uniquely themed UI component** that combines multiple existing UI elements into one elegant solution, now with **professional-grade file organization** that demonstrates mastery of modern web development practices. + +Apply a distinctive design language while solving multiple interface problems in a single, cohesive component - achieving "two birds with one stone" efficiency through both functional integration and architectural excellence. + +## Output Requirements + +**Directory Structure**: `ui_hybrid_[iteration_number]/` + +Each iteration creates its own directory containing exactly three files: +``` +ui_hybrid_[iteration_number]/ +├── index.html # Semantic HTML structure +├── styles.css # Complete styling and theme implementation +└── script.js # All JavaScript functionality and interactions +``` + +**File Naming**: +- Directory: `ui_hybrid_[iteration_number]` (e.g., `ui_hybrid_1`, `ui_hybrid_2`) +- Files: Always `index.html`, `styles.css`, `script.js` (consistent naming) + +## Content Structure + +### **index.html** - Semantic Structure +```html + + + + + + [Theme Name] [Hybrid Component Name] + + + +
+

[Hybrid Component Name] - [Theme Name] Theme

+ + + +
+ + + +
+ + + +
+ + + + +``` + +### **styles.css** - Complete Theme Implementation +```css +/* Theme Variables and Custom Properties */ +:root { + /* Color palette for the theme */ + /* Typography scale */ + /* Animation timings */ + /* Spacing system */ +} + +/* Reset and Base Styles */ +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +/* Theme Foundation */ +body { + /* Theme-specific base styles */ + /* Background treatments */ + /* Default typography */ +} + +/* Component Architecture */ +.hybrid-component { + /* Main component container */ + /* Theme-specific treatments */ +} + +/* Component Sub-elements */ +.hybrid-component__[element] { + /* BEM or consistent naming convention */ + /* Element-specific theme styling */ +} + +/* State Classes */ +.is-active, .is-loading, .is-error { + /* State-based styling */ + /* Theme-consistent feedback */ +} + +/* Animations and Transitions */ +@keyframes [themeAnimation] { + /* Theme-specific animations */ +} + +/* Responsive Design */ +@media (max-width: 768px) { + /* Mobile adaptations maintaining theme */ +} + +/* Print Styles */ +@media print { + /* Print-optimized theme variant */ +} +``` + +### **script.js** - Functionality and Interactions +```javascript +// Strict mode for better error catching +'use strict'; + +// Theme Configuration +const THEME_CONFIG = { + // Animation durations + // API endpoints if needed + // Theme-specific settings +}; + +// Component State Management +class HybridComponent { + constructor(element) { + this.element = element; + this.state = { + // Component state properties + }; + this.init(); + } + + init() { + // Setup event listeners + // Initialize sub-components + // Load any necessary data + this.bindEvents(); + this.setupThemeFeatures(); + } + + bindEvents() { + // Event delegation for efficiency + // Touch and mouse events + // Keyboard navigation + } + + setupThemeFeatures() { + // Theme-specific interactions + // Special effects or behaviors + // Animation triggers + } + + // Component Methods + updateState(updates) { + // State management logic + // UI updates based on state + } + + // API Methods if needed + async fetchData() { + // Data loading with error handling + } + + // Utility Methods + debounce(func, wait) { + // Performance optimizations + } +} + +// Initialize on DOM Ready +document.addEventListener('DOMContentLoaded', () => { + // Find all component instances + const components = document.querySelectorAll('.hybrid-component'); + + // Initialize each instance + components.forEach(element => { + new HybridComponent(element); + }); + + // Setup any global theme features + initializeThemeEffects(); +}); + +// Global Theme Functions +function initializeThemeEffects() { + // Ambient animations + // Parallax effects + // Theme-wide interactions +} + +// Export for potential module usage +if (typeof module !== 'undefined' && module.exports) { + module.exports = HybridComponent; +} +``` + +## Design Dimensions (Preserved from v3) + +### **Unique Theme Development** +Each component must embody a distinctive design language that creates personality and memorable experience. The multi-file structure enhances theme implementation: + +#### **Enhanced Theme Implementation** +- **CSS Variables**: Define theme tokens in `:root` for consistent application +- **Modular Styles**: Theme variations can be swapped by changing stylesheets +- **JavaScript Theming**: Dynamic theme features separated from core functionality +- **Asset Organization**: Theme-specific assets referenced properly from each file + +[All theme categories from v3 remain the same: Organic Nature, Digital Minimalism, Retro Computing, etc.] + +### **Hybrid Component Strategy** +The same powerful combinations from v3, now with better architectural separation: + +#### **Architectural Benefits per Component Type** +- **Search Hub**: Search logic isolated in JS, theme animations in CSS +- **Input Intelligence**: Validation rules in JS, visual feedback in CSS +- **Data Explorer**: Sorting algorithms in JS, table styling in CSS +- **Media Player**: Playback logic in JS, visualizer styles in CSS + +[All component combinations from v3 remain valid] + +## Enhancement Principles (Evolved) + +### **Architectural Excellence** (New in v4) +- **Separation of Concerns**: Each file has a single, clear responsibility +- **No Inline Styles/Scripts**: All styling in CSS, all behavior in JavaScript +- **Progressive Enhancement**: HTML works without CSS/JS, enhanced by both +- **Module Boundaries**: Clear interfaces between files, no tight coupling +- **Future-Ready**: Structure supports build tools, frameworks, component libraries + +### **Development Best Practices** (New in v4) +- **CSS Organization**: Logical section ordering, consistent naming conventions +- **JavaScript Patterns**: Modern ES6+, class-based or functional approaches +- **HTML Semantics**: Proper element selection, accessibility-first markup +- **Performance Focus**: Optimized selectors, efficient event handling +- **Documentation**: Clear comments explaining theme decisions and component logic + +[All original enhancement principles from v3 remain: Thematic Consistency, Functional Integration, Practical Excellence] + +## File Integration Guidelines + +### **Linking Strategy** +- **Consistent Paths**: Always use relative paths (`href="styles.css"`) +- **Load Order**: CSS in ``, JavaScript before `` +- **No CDNs**: All functionality self-contained within the three files +- **Fallbacks**: Graceful degradation if CSS or JS fails to load + +### **Communication Between Files** +- **HTML → CSS**: Semantic class names, data attributes for styling hooks +- **HTML → JS**: IDs for unique elements, data attributes for configuration +- **CSS → JS**: CSS custom properties readable by JavaScript +- **JS → CSS**: Dynamic class additions, CSS variable updates + +### **Naming Conventions** +- **CSS Classes**: BEM, semantic, or consistent methodology +- **JavaScript**: camelCase for variables/functions, PascalCase for classes +- **Data Attributes**: `data-component-*` for component-specific data +- **CSS Variables**: `--theme-*` prefix for theme variables + +## Quality Standards (Enhanced) + +### **Code Quality** (New in v4) +- **Valid HTML**: Passes W3C validation, proper semantic structure +- **CSS Organization**: Logical property grouping, no redundancy +- **JavaScript Quality**: No global pollution, proper error handling +- **Cross-Browser**: Works in all modern browsers (Chrome, Firefox, Safari, Edge) +- **Performance**: Lighthouse score of 90+ in all categories + +### **File-Specific Standards** (New in v4) +- **HTML**: Semantic, accessible, minimal, no presentation logic +- **CSS**: Organized, maintainable, efficient selectors, mobile-first +- **JavaScript**: Modular, testable, documented, memory-efficient + +[All original quality standards from v3 remain in effect] + +## Migration Example: v3 to v4 + +**v3 Structure (Single File):** +``` +ui_hybrid_1.html (contains everything) +``` + +**v4 Structure (Modular):** +``` +ui_hybrid_1/ +├── index.html (structure only) +├── styles.css (all styling) +└── script.js (all behavior) +``` + +The same themed hybrid component now benefits from: +- 3x better caching (each file cached independently) +- Easier debugging (concerns separated) +- Simpler version control (changes isolated to relevant files) +- Team collaboration (parallel development possible) +- Build tool ready (can be processed, minified, bundled) + +## Iteration Evolution (Enhanced) + +### **Architectural Sophistication** (New in v4) +- **Foundation (1-3)**: Clean separation, basic modular structure +- **Refinement (4-6)**: Advanced CSS architecture, sophisticated JS patterns +- **Innovation (7+)**: Creative file communication, advanced state management + +### **Development Complexity** +- **Phase 1**: Standard separation with clear file boundaries +- **Phase 2**: Advanced patterns like CSS custom properties + JS integration +- **Phase 3**: Sophisticated architectures with event systems, style injection +- **Phase 4**: Revolutionary approaches to component modularity + +## Ultra-Thinking Directive (Enhanced) + +Before each themed hybrid creation, deeply consider: + +**Architectural Decisions:** +- How can the three-file structure enhance this specific theme? +- What belongs in CSS vs JavaScript for this component type? +- How can files communicate elegantly for this use case? +- What patterns best support this component's evolution? +- How does separation improve maintainability here? + +**File Responsibility Planning:** +- What is the minimal, semantic HTML needed? +- Which styles are structural vs thematic? +- What JavaScript is essential vs enhancement? +- How can each file remain focused and clean? +- Where are the natural boundaries between concerns? + +**Integration Excellence:** +- How do the files work together seamlessly? +- What naming conventions ensure clarity? +- How can we avoid tight coupling? +- What patterns enable future extensions? +- How does the architecture support the theme? + +[All original ultra-thinking directives from v3 remain relevant] + +**Generate components that are:** +- **Architecturally Sound**: Professional-grade file organization and separation +- **Thematically Distinctive**: Strong design personality across all three files +- **Functionally Integrated**: Multiple UI capabilities with clean code boundaries +- **Professionally Crafted**: Industry-standard patterns and practices +- **Immediately Impressive**: Excellence visible in both UI and code structure + +The evolution from v3 to v4 represents growth from powerful prototypes to production-ready components, maintaining all creative excellence while adding architectural sophistication. +``` + +Project Path: .claude + +Source Tree: + +```txt +.claude +└── commands + ├── infinite.md + ├── prime-initial.md + └── prime.md + +``` + +`.claude/commands/infinite.md`: + +```md +**INFINITE AGENTIC LOOP COMMAND** + +Think deeply about this infinite generation task. You are about to embark on a sophisticated iterative creation process. + +**Variables:** + +spec_file: $ARGUMENTS +output_dir: $ARGUMENTS +count: $ARGUMENTS + +**ARGUMENTS PARSING:** +Parse the following arguments from "$ARGUMENTS": +1. `spec_file` - Path to the markdown specification file +2. `output_dir` - Directory where iterations will be saved +3. `count` - Number of iterations (1-N or "infinite") + +**PHASE 1: SPECIFICATION ANALYSIS** +Read and deeply understand the specification file at `spec_file`. This file defines: +- What type of content to generate +- The format and structure requirements +- Any specific parameters or constraints +- The intended evolution pattern between iterations + +Think carefully about the spec's intent and how each iteration should build upon previous work. + +**PHASE 2: OUTPUT DIRECTORY RECONNAISSANCE** +Thoroughly analyze the `output_dir` to understand the current state: +- List all existing files and their naming patterns +- Identify the highest iteration number currently present +- Analyze the content evolution across existing iterations +- Understand the trajectory of previous generations +- Determine what gaps or opportunities exist for new iterations + +**PHASE 3: ITERATION STRATEGY** +Based on the spec analysis and existing iterations: +- Determine the starting iteration number (highest existing + 1) +- Plan how each new iteration will be unique and evolutionary +- Consider how to build upon previous iterations while maintaining novelty +- If count is "infinite", prepare for continuous generation until context limits + +**PHASE 4: PARALLEL AGENT COORDINATION** +Deploy multiple Sub Agents to generate iterations in parallel for maximum efficiency and creative diversity: + +**Sub-Agent Distribution Strategy:** +- For count 1-5: Launch all agents simultaneously +- For count 6-20: Launch in batches of 5 agents to manage coordination +- For "infinite": Launch waves of 3-5 agents, monitoring context and spawning new waves + +**Agent Assignment Protocol:** +Each Sub Agent receives: +1. **Spec Context**: Complete specification file analysis +2. **Directory Snapshot**: Current state of output_dir at launch time +3. **Iteration Assignment**: Specific iteration number (starting_number + agent_index) +4. **Uniqueness Directive**: Explicit instruction to avoid duplicating concepts from existing iterations +5. **Quality Standards**: Detailed requirements from the specification + +**Agent Task Specification:** +``` +TASK: Generate iteration [NUMBER] for [SPEC_FILE] in [OUTPUT_DIR] + +You are Sub Agent [X] generating iteration [NUMBER]. + +CONTEXT: +- Specification: [Full spec analysis] +- Existing iterations: [Summary of current output_dir contents] +- Your iteration number: [NUMBER] +- Assigned creative direction: [Specific innovation dimension to explore] + +REQUIREMENTS: +1. Read and understand the specification completely +2. Analyze existing iterations to ensure your output is unique +3. Generate content following the spec format exactly +4. Focus on [assigned innovation dimension] while maintaining spec compliance +5. Create file with exact name pattern specified +6. Ensure your iteration adds genuine value and novelty + +DELIVERABLE: Single file as specified, with unique innovative content +``` + +**Parallel Execution Management:** +- Launch all assigned Sub Agents simultaneously using Task tool +- Monitor agent progress and completion +- Handle any agent failures by reassigning iteration numbers +- Ensure no duplicate iteration numbers are generated +- Collect and validate all completed iterations + +**PHASE 5: INFINITE MODE ORCHESTRATION** +For infinite generation mode, orchestrate continuous parallel waves: + +**Wave-Based Generation:** +1. **Wave Planning**: Determine next wave size (3-5 agents) based on context capacity +2. **Agent Preparation**: Prepare fresh context snapshots for each new wave +3. **Progressive Sophistication**: Each wave should explore more advanced innovation dimensions +4. **Context Monitoring**: Track total context usage across all agents and main orchestrator +5. **Graceful Conclusion**: When approaching context limits, complete current wave and summarize + +**Infinite Execution Cycle:** +``` +WHILE context_capacity > threshold: + 1. Assess current output_dir state + 2. Plan next wave of agents (size based on remaining context) + 3. Assign increasingly sophisticated creative directions + 4. Launch parallel Sub Agent wave + 5. Monitor wave completion + 6. Update directory state snapshot + 7. Evaluate context capacity remaining + 8. If sufficient capacity: Continue to next wave + 9. If approaching limits: Complete final wave and summarize +``` + +**Progressive Sophistication Strategy:** +- **Wave 1**: Basic functional replacements with single innovation dimension +- **Wave 2**: Multi-dimensional innovations with enhanced interactions +- **Wave 3**: Complex paradigm combinations with adaptive behaviors +- **Wave N**: Revolutionary concepts pushing the boundaries of the specification + +**Context Optimization:** +- Each wave uses fresh agent instances to avoid context accumulation +- Main orchestrator maintains lightweight state tracking +- Progressive summarization of completed iterations to manage context +- Strategic pruning of less essential details in later waves + +**EXECUTION PRINCIPLES:** + +**Quality & Uniqueness:** +- Each iteration must be genuinely unique and valuable +- Build upon previous work while introducing novel elements +- Maintain consistency with the original specification +- Ensure proper file organization and naming + +**Parallel Coordination:** +- Deploy Sub Agents strategically to maximize creative diversity +- Assign distinct innovation dimensions to each agent to avoid overlap +- Coordinate timing to prevent file naming conflicts +- Monitor all agents for successful completion and quality + +**Scalability & Efficiency:** +- Think deeply about the evolution trajectory across parallel streams +- For infinite mode, optimize for maximum valuable output before context exhaustion +- Use wave-based generation to manage context limits intelligently +- Balance parallel speed with quality and coordination overhead + +**Agent Management:** +- Provide each Sub Agent with complete context and clear assignments +- Handle agent failures gracefully with iteration reassignment +- Ensure all parallel outputs integrate cohesively with the overall progression + +**ULTRA-THINKING DIRECTIVE:** +Before beginning generation, engage in extended thinking about: + +**Specification & Evolution:** +- The deeper implications of the specification +- How to create meaningful progression across iterations +- What makes each iteration valuable and unique +- How to balance consistency with innovation + +**Parallel Strategy:** +- Optimal Sub Agent distribution for the requested count +- How to assign distinct creative directions to maximize diversity +- Wave sizing and timing for infinite mode +- Context management across multiple parallel agents + +**Coordination Challenges:** +- How to prevent duplicate concepts across parallel streams +- Strategies for ensuring each agent produces genuinely unique output +- Managing file naming and directory organization with concurrent writes +- Quality control mechanisms for parallel outputs + +**Infinite Mode Optimization:** +- Wave-based generation patterns for sustained output +- Progressive sophistication strategies across multiple waves +- Context capacity monitoring and graceful conclusion planning +- Balancing speed of parallel generation with depth of innovation + +**Risk Mitigation:** +- Handling agent failures and iteration reassignment +- Ensuring coherent overall progression despite parallel execution +- Managing context window limits across the entire system +- Maintaining specification compliance across all parallel outputs + +Begin execution with deep analysis of these parallel coordination challenges and proceed systematically through each phase, leveraging Sub Agents for maximum creative output and efficiency. +``` + +`.claude/commands/prime-initial.md`: + +```md +# Context The Full Initial Infinite Agentic Loop + +RUN: + git ls-files + +READ: + ai_docs/full-initial.md + +``` + +`.claude/commands/prime.md`: + +```md +# Context Window Prime + +RUN: + git ls-files + +READ: + README.md + ai_docs/claude_code_fresh_tutorials.md +``` diff --git a/d3_test/d3_viz_1.html b/d3_test/d3_viz_1.html new file mode 100644 index 0000000..49434fa --- /dev/null +++ b/d3_test/d3_viz_1.html @@ -0,0 +1,493 @@ + + + + + + D3 Visualization 1: Interactive Technology Adoption Dashboard + + + + +
+

Technology Adoption Dashboard

+

Interactive visualization demonstrating D3 selection patterns and data binding

+ +
+ + + + + +
+ +
+ +
+

Visualization Insights

+

Click on any bar to see detailed information. Hover for interactive effects.

+
+
+
+ High Adoption (>70%) +
+
+
+ Medium Adoption (40-70%) +
+
+
+ Growing (<40%) +
+
+
+ Select a technology to see details... +
+
+
+ + + +
+

Iteration 1 - Web Learning Applied

+
    +
  • Web Source: https://d3js.org/d3-selection
  • +
  • Topic: D3 Selections API - Core DOM manipulation patterns
  • +
  • Techniques Learned & Applied: +
      +
    • select() & selectAll(): Used throughout for querying single (#viz) and multiple (.bar, .control-btn) elements
    • +
    • data() & join(): Implemented modern enter/update/exit pattern for dynamic bar chart updates with object constancy
    • +
    • attr(), style(), html(), text(): Chained DOM manipulation methods for setting SVG attributes, CSS styles, and content
    • +
    • on() event handling: Interactive click, mouseenter, mouseleave events with 'this' context and d3.select(this) pattern
    • +
    • Method chaining: Fluent API usage throughout for concise, readable code
    • +
    • classed() method: Toggle CSS classes on button selections for active states
    • +
    +
  • +
  • What This Demonstrates: An interactive horizontal bar chart showing technology adoption rates. Users can click bars to see details, sort by different criteria, randomize data, and reset. The visualization showcases all core D3 selection patterns: querying elements (select/selectAll), binding data (data/join), manipulating DOM (attr/style/html/text), and handling events (on). The enter/update/exit pattern via join() ensures smooth transitions when data changes, demonstrating D3's power for data-driven document transformation.
  • +
  • Data: 20 real-world technologies with adoption rates, growth percentages, categories, and user counts
  • +
  • Interactive Features: Click bars for details, hover for effects, sort controls, data randomization, full reset capability
  • +
+
+ + diff --git a/d3_test/d3_viz_2.html b/d3_test/d3_viz_2.html new file mode 100644 index 0000000..ba82b41 --- /dev/null +++ b/d3_test/d3_viz_2.html @@ -0,0 +1,749 @@ + + + + + + D3 Visualization 2: Multi-Scale Temperature Analysis + + + + +
+

Multi-Scale Temperature Analysis Dashboard

+ +
+
+ + +
+
+ + +
+
+ +
+
+
1. Time Scale + Sequential Color Scale
+
+ Using scaleTime() for temporal data mapping and scaleSequential() for temperature color encoding +
+ +
+ +
+
2. Band Scale + Linear Scale + Threshold Color Scale
+
+ Using scaleBand() for categorical positioning, scaleLinear() for height, and scaleThreshold() for discrete color ranges +
+ +
+ +
+
3. Point Scale + Log Scale
+
+ Using scalePoint() for precise categorical positioning and scaleLog() for exponential temperature variance display +
+ +
+
+ +
+

Scale Mappings Explained

+
+
+

Time Scale (scaleTime)

+

Maps JavaScript Date objects to pixel positions. Domain: [earliest date, latest date] → Range: [0, chartWidth]. Automatically handles date arithmetic and tick formatting.

+
+
+

Sequential Color Scale

+

Maps continuous temperature values to smooth color gradients. Domain: [minTemp, maxTemp] → Range: color interpolation. Perfect for showing intensity variations.

+
+
+

Band Scale (scaleBand)

+

Maps categorical city names to positions with automatic padding. Divides available space evenly with configurable inner/outer padding for bar charts.

+
+
+

Linear Scale (scaleLinear)

+

Standard numeric mapping. Domain: [0, maxTemp] → Range: [chartHeight, 0]. Inverted for SVG coordinate system where y=0 is at top.

+
+
+

Threshold Scale

+

Maps continuous input to discrete output using breakpoints. Temperature thresholds: [10°, 20°, 30°] create 4 color categories for "cold", "cool", "warm", "hot".

+
+
+

Log Scale (scaleLog)

+

Maps wide-range data using logarithmic transformation. Domain: [1, maxVariance] → Range: [0, height]. Compresses large values, expands small ones for better visibility.

+
+
+
+
+ + + +
+

Iteration 2 - Web Learning Applied

+
    +
  • Web Source: https://d3js.org/d3-scale
  • +
  • Topic: D3 Scale Functions for Data-to-Visual Mapping
  • +
  • Techniques Learned: +
      +
    1. scaleTime() - Temporal data mapping with automatic date handling and tick formatting
    2. +
    3. scaleSequential() - Continuous color encoding with smooth interpolation (RdYlBu color scheme)
    4. +
    5. scaleBand() - Categorical positioning with automatic padding for bar charts
    6. +
    7. scaleLinear() - Standard numeric domain-to-range mapping with inverted y-axis
    8. +
    9. scaleThreshold() - Discrete binning with custom breakpoints (10°, 20°, 30°) for color categories
    10. +
    11. scalePoint() - Precise categorical positioning without bandwidth (point charts)
    12. +
    13. scaleLog() - Logarithmic transformation for wide-range variance data compression
    14. +
    +
  • +
  • What This Demonstrates: Scales are the foundation of D3 visualizations - they map abstract data domains (temperatures from -5°C to 32°C, dates from Jan-Dec, city names) to visual ranges (pixel positions, colors, sizes). Each scale type solves specific mapping challenges: time scales handle temporal data, band scales divide categorical space evenly, threshold scales create discrete bins, and log scales compress exponential ranges.
  • +
  • Improvement over Iteration 1: While Iteration 1 focused on DOM selection and manipulation (the "how to change elements" foundation), Iteration 2 demonstrates the "how to map data" layer. We now transform raw temperature data through 8 different scale types to create meaningful visual encodings. The progression shows D3's architecture: selections manipulate the DOM, scales transform the data before it reaches the DOM.
  • +
  • Scale Mapping Examples: +
      +
    • Time: new Date(2024, 6, 1) → 600px (middle of chart)
    • +
    • Sequential: 30°C#d73027 (red/hot)
    • +
    • Band: "Miami" → x position with automatic 20% padding
    • +
    • Threshold: 25°C#f59e0b (warm category)
    • +
    • Log: variance=20 → compressed visual height vs linear display
    • +
    +
  • +
+
+ + \ No newline at end of file diff --git a/d3_test/d3_viz_3.html b/d3_test/d3_viz_3.html new file mode 100644 index 0000000..51f2bf3 --- /dev/null +++ b/d3_test/d3_viz_3.html @@ -0,0 +1,563 @@ + + + + + + D3 Visualization 3: Global Coffee Production Analysis + + + + +
+

Global Coffee Production by Country (2024)

+ +
+
+ + + + +
+
+ +
+
+ +
+ +
+ +
+

Key Insights from Coffee Production Data

+
+
+

🏆 Top Producer

+

Loading...

+
+
+

📊 Total Production

+

Loading...

+
+
+

📈 Average Production

+

Loading...

+
+
+

🌍 Market Concentration

+

Loading...

+
+
+
+
+ +
+ + + +
+

Iteration 3 - Web Learning Applied: Complete Bar Chart Visualization

+
    +
  • Web Source: https://observablehq.com/@d3/bar-chart
  • +
  • Topic: D3 Bar Charts - Creating complete data visualizations with axes, scales, and interactivity
  • +
  • Techniques Learned: +
      +
    1. Margin Convention: Proper SVG layout using margin object to create space for axes and labels
    2. +
    3. Band Scales: Using scaleBand() for categorical data positioning with automatic spacing
    4. +
    5. Axis Creation: Creating and positioning axes with axisBottom() and axisLeft(), removing outer ticks for cleaner appearance
    6. +
    +
  • +
  • What This Demonstrates: A complete, interactive bar chart showing global coffee production by country. Features dynamic sorting (default, ascending, descending), color theme toggling, smooth transitions, hover tooltips, and automated insights calculation.
  • +
  • Knowledge Synthesis: +
      +
    • From Iteration 1 (Selections): Used data joins with enter/exit/update pattern, event handlers for interactivity, and dynamic DOM manipulation
    • +
    • From Iteration 2 (Scales): Applied scaleBand for X-axis categorical positioning, scaleLinear for Y-axis numerical mapping, and scaleSequential for color encoding
    • +
    • From Iteration 3 (Bar Charts): Implemented margin convention, responsive SVG with viewBox, proper axis creation and positioning, and bar height calculation using scale inversion
    • +
    +
  • +
  • Improvement over Previous: This is a complete, production-ready visualization combining all learned concepts. Unlike isolated examples of selections (Iteration 1) or scales (Iteration 2), this demonstrates a fully functional chart with professional styling, multiple interaction patterns, data-driven insights, and responsive design. The bar chart brings together DOM manipulation, data transformation, visual encoding, and user interactivity into a cohesive whole.
  • +
+
+ + diff --git a/specs/d3_url_strategy.json b/specs/d3_url_strategy.json new file mode 100644 index 0000000..56fc7f6 --- /dev/null +++ b/specs/d3_url_strategy.json @@ -0,0 +1,270 @@ +{ + "priming_urls": [ + { + "url": "https://d3js.org/what-is-d3", + "topic": "D3 Fundamentals", + "description": "Core concepts and philosophy of D3" + }, + { + "url": "https://observablehq.com/@d3/learn-d3", + "topic": "D3 Tutorial", + "description": "Comprehensive introduction to D3" + }, + { + "url": "https://d3-graph-gallery.com/", + "topic": "D3 Pattern Library", + "description": "Gallery of common D3 visualizations" + } + ], + + "foundation_urls": [ + { + "iteration_range": [1, 5], + "urls": [ + { + "url": "https://d3js.org/d3-selection", + "topic": "Selections", + "description": "Core selection API for DOM manipulation" + }, + { + "url": "https://d3js.org/d3-scale", + "topic": "Scales", + "description": "Mapping data to visual dimensions" + }, + { + "url": "https://observablehq.com/@d3/bar-chart", + "topic": "Bar Charts", + "description": "Creating basic bar charts" + }, + { + "url": "https://observablehq.com/@d3/line-chart", + "topic": "Line Charts", + "description": "Time series and line visualizations" + }, + { + "url": "https://observablehq.com/@d3/scatterplot", + "topic": "Scatter Plots", + "description": "Plotting points in 2D space" + }, + { + "url": "https://d3js.org/d3-axis", + "topic": "Axes", + "description": "Creating and customizing axes" + }, + { + "url": "https://observablehq.com/@d3/margin-convention", + "topic": "Margin Convention", + "description": "Standard layout pattern for charts" + }, + { + "url": "https://d3js.org/d3-array", + "topic": "Data Arrays", + "description": "Data transformation and statistics" + } + ] + }, + + "intermediate_urls": [ + { + "iteration_range": [6, 12], + "urls": [ + { + "url": "https://d3js.org/d3-transition", + "topic": "Transitions", + "description": "Smooth animated transitions" + }, + { + "url": "https://observablehq.com/@d3/d3-hierarchy", + "topic": "Hierarchies", + "description": "Tree and hierarchical data layouts" + }, + { + "url": "https://observablehq.com/@d3/force-directed-graph", + "topic": "Force Layouts", + "description": "Physics-based network graphs" + }, + { + "url": "https://observablehq.com/@d3/color-schemes", + "topic": "Color Scales", + "description": "Color theory and palettes" + }, + { + "url": "https://observablehq.com/@d3/zoom", + "topic": "Zoom & Pan", + "description": "Interactive zoom and pan behaviors" + }, + { + "url": "https://observablehq.com/@d3/brush", + "topic": "Brushing", + "description": "Interactive selection with brush" + }, + { + "url": "https://observablehq.com/@d3/treemap", + "topic": "Treemaps", + "description": "Hierarchical space-filling visualization" + }, + { + "url": "https://observablehq.com/@d3/sunburst", + "topic": "Sunburst", + "description": "Radial hierarchical visualization" + }, + { + "url": "https://observablehq.com/@d3/chord-diagram", + "topic": "Chord Diagrams", + "description": "Circular relationship visualization" + }, + { + "url": "https://observablehq.com/@d3/sankey", + "topic": "Sankey Diagrams", + "description": "Flow and network visualization" + }, + { + "url": "https://observablehq.com/@d3/focus-context", + "topic": "Focus + Context", + "description": "Linked overview and detail views" + }, + { + "url": "https://observablehq.com/@d3/streamgraph", + "topic": "Streamgraph", + "description": "Stacked area charts with smooth curves" + } + ] + } + ], + + "advanced_urls": [ + { + "iteration_range": [13, 20], + "urls": [ + { + "url": "https://d3js.org/d3-geo", + "topic": "Geographic Projections", + "description": "Map projections and transformations" + }, + { + "url": "https://observablehq.com/@d3/world-map", + "topic": "Choropleth Maps", + "description": "Geographic data visualization" + }, + { + "url": "https://observablehq.com/@d3/versor-dragging", + "topic": "Globe Rotation", + "description": "Interactive 3D globe projection" + }, + { + "url": "https://observablehq.com/@d3/contours", + "topic": "Contour Plots", + "description": "Density and elevation visualization" + }, + { + "url": "https://observablehq.com/@d3/voronoi", + "topic": "Voronoi Diagrams", + "description": "Spatial partitioning visualization" + }, + { + "url": "https://observablehq.com/@d3/hierarchical-edge-bundling", + "topic": "Edge Bundling", + "description": "Advanced network visualization" + }, + { + "url": "https://observablehq.com/@d3/parallel-coordinates", + "topic": "Parallel Coordinates", + "description": "Multi-dimensional data visualization" + }, + { + "url": "https://observablehq.com/@d3/calendar", + "topic": "Calendar View", + "description": "Time-based heatmap visualization" + }, + { + "url": "https://observablehq.com/@d3/horizon-chart", + "topic": "Horizon Charts", + "description": "Compact time series visualization" + }, + { + "url": "https://observablehq.com/@d3/collision-detection", + "topic": "Force Simulation", + "description": "Advanced physics-based layouts" + }, + { + "url": "https://observablehq.com/@d3/multi-line-chart", + "topic": "Multi-Series Charts", + "description": "Complex time series with interactions" + }, + { + "url": "https://observablehq.com/@d3/zoomable-sunburst", + "topic": "Zoomable Hierarchies", + "description": "Interactive hierarchical exploration" + } + ] + } + ], + + "expert_urls": [ + { + "iteration_range": [21, 999], + "urls": [ + { + "url": "https://observablehq.com/@d3/canvas-scatterplot", + "topic": "Canvas Rendering", + "description": "High-performance canvas visualization" + }, + { + "url": "https://observablehq.com/@d3/webgl-scatterplot", + "topic": "WebGL Integration", + "description": "GPU-accelerated visualization" + }, + { + "url": "https://observablehq.com/@d3/seamless-zoomable-map-tiles", + "topic": "Map Tiles", + "description": "Advanced geographic visualization" + }, + { + "url": "https://observablehq.com/@d3/radial-stacked-bar-chart", + "topic": "Radial Layouts", + "description": "Creative circular visualizations" + }, + { + "url": "https://observablehq.com/@d3/gradient-encoding", + "topic": "Advanced Encodings", + "description": "Novel visual encoding techniques" + }, + { + "url": "https://observablehq.com/@d3/streamgraph-transitions", + "topic": "Complex Transitions", + "description": "Sophisticated animated transitions" + }, + { + "url": "https://observablehq.com/@d3/force-directed-lattice", + "topic": "Custom Force Simulations", + "description": "Advanced physics-based interactions" + }, + { + "url": "https://observablehq.com/@d3/cluster-dendrogram", + "topic": "Advanced Clustering", + "description": "Hierarchical clustering visualization" + } + ] + } + ] + }, + + "web_search_templates": [ + "D3.js {technique} tutorial site:observablehq.com", + "D3 {chart_type} best practices", + "D3.js {feature} examples", + "Advanced D3 {area} techniques", + "D3 interactive {element} implementation", + "D3.js performance optimization {context}", + "D3 {visualization_type} accessibility", + "D3 responsive {chart_type} design" + ], + + "url_selection_strategy": { + "mode": "progressive", + "description": "Select URLs based on iteration number and previous learnings", + "fallback": "dynamic_search", + "avoid_duplicates": true, + "track_used_urls": true + } +} diff --git a/specs/d3_visualization_progressive.md b/specs/d3_visualization_progressive.md new file mode 100644 index 0000000..59c53fc --- /dev/null +++ b/specs/d3_visualization_progressive.md @@ -0,0 +1,331 @@ +# D3 Data Visualization - Progressive Web-Enhanced Specification + +## Core Challenge +Create progressively sophisticated D3.js data visualizations that improve with each iteration by integrating knowledge from web documentation, tutorials, and examples. Each iteration should represent a measurable improvement in visual design, interactivity, data handling, or technical implementation. + +## Output Requirements + +**File Naming**: `d3_viz_[iteration_number].html` + +**Content Structure**: Self-contained D3 visualization with embedded data +```html + + + + + + D3 Visualization [iteration_number]: [Descriptive Name] + + + + +
+

[Descriptive Visualization Title]

+
+ +
+
+ +
+
+ +
+
+ + + + + + + +``` + +## Progressive Enhancement Dimensions + +### **Visual Design Evolution** +- **Iteration 1-3**: Basic chart types (bar, line, scatter) with clean styling +- **Iteration 4-6**: Advanced color schemes, gradients, annotations, responsive layouts +- **Iteration 7-10**: Complex compositions, small multiples, linked views, brushing +- **Iteration 11+**: Innovative visual encodings, custom force simulations, advanced interactions + +### **Interactivity Sophistication** +- **Basic**: Tooltips, hover effects, clickable elements +- **Intermediate**: Zooming, panning, brushing, filtering, transitions +- **Advanced**: Drag interactions, real-time data updates, coordinated multi-view +- **Expert**: Custom force simulations, physics-based interactions, generative animations + +### **Data Handling Complexity** +- **Simple**: Embedded arrays, basic data structures +- **Moderate**: Hierarchical data, nested structures, data transformations +- **Advanced**: Time-series data, geospatial data, network graphs +- **Expert**: Real-time data streams, large datasets with virtualization, external APIs + +### **Technical Implementation** +- **Foundation**: Core D3 selections, scales, axes, basic shapes +- **Intermediate**: Layouts (hierarchy, force, chord), transitions, generators +- **Advanced**: Custom scales, advanced projections, data joins, enter/exit/update patterns +- **Expert**: WebGL integration, canvas rendering for performance, worker threads + +## Web Research Integration Strategy + +### **Initial Priming Phase URLs** +The priming agent should research these foundational topics: +1. D3.js official documentation (d3js.org) +2. Observable D3 tutorials and examples +3. D3 Graph Gallery for pattern library +4. Mike Bostock's blocks and articles +5. Recent D3.js best practices and v7+ features + +### **Iteration URL Strategy** + +**URL Categories for Progressive Learning:** + +1. **Foundation URLs (Iterations 1-5)** + - D3 official API documentation pages + - Basic chart tutorials (bar, line, scatter, pie) + - Scale and axis fundamentals + - Selection and data binding basics + +2. **Intermediate URLs (Iterations 6-12)** + - D3 layout documentation (force, hierarchy, chord) + - Transition and animation guides + - Interactive visualization tutorials + - Color theory and D3 color scales + - Responsive D3 patterns + +3. **Advanced URLs (Iterations 13-20)** + - Complex force simulations + - Geographic projections and maps + - Network visualization techniques + - Performance optimization for large datasets + - Custom interpolators and transitions + +4. **Expert URLs (Iterations 21+)** + - Cutting-edge D3 techniques + - WebGL integration with D3 + - Real-time data visualization + - Advanced interaction patterns + - Novel visual encoding research papers + +### **Dynamic URL Discovery** +Each iteration can also perform targeted web searches: +- "D3.js [specific technique] tutorial" +- "D3 [chart type] best practices" +- "D3 interactive [feature] example" +- "Advanced D3 [specific area] technique" + +## Visualization Types to Explore + +### **Statistical Visualizations** +- Bar charts (vertical, horizontal, grouped, stacked) +- Line charts (single, multi-series, area, streamgraph) +- Scatter plots (basic, bubble, matrix) +- Box plots, violin plots, beeswarm plots +- Histograms and distribution plots + +### **Hierarchical Visualizations** +- Tree diagrams (tidy tree, radial tree) +- Treemaps (squarified, binary, slice-dice) +- Sunburst diagrams +- Circle packing +- Icicle plots + +### **Network Visualizations** +- Force-directed graphs +- Arc diagrams +- Chord diagrams +- Sankey diagrams +- Hierarchical edge bundling + +### **Geographic Visualizations** +- Choropleth maps +- Point maps with clustering +- Flow maps +- Cartograms +- Globe projections + +### **Temporal Visualizations** +- Time series with brushing +- Calendar heatmaps +- Gantt charts +- Horizon charts +- Streamgraphs + +### **Advanced/Novel Visualizations** +- Parallel coordinates +- Voronoi diagrams +- Contour plots +- Custom force simulations +- Generative/algorithmic art with data + +## Quality Standards + +### **Code Quality** +- **D3 Best Practices**: Proper data joins, efficient updates, semantic selections +- **Performance**: Optimized for 60fps animations, efficient rendering +- **Accessibility**: ARIA labels, keyboard navigation, screen reader support +- **Responsive**: Works on mobile, tablet, desktop with appropriate scaling +- **Clean Code**: Well-organized, commented, maintainable JavaScript + +### **Visual Excellence** +- **Clarity**: Information is immediately understandable +- **Aesthetics**: Professional design, harmonious colors, appropriate typography +- **Innovation**: Each iteration introduces novel elements or techniques +- **Data-Ink Ratio**: Maximize information, minimize clutter +- **Storytelling**: Visualization reveals insights and supports understanding + +### **Web Integration Quality** +- **Source Attribution**: Each iteration credits the web source that inspired it +- **Knowledge Application**: Demonstrates specific technique learned from URL +- **Progressive Learning**: Shows clear improvement over previous iteration +- **Novel Synthesis**: Combines multiple web sources creatively when appropriate + +## Iteration Evolution Pattern + +### **Knowledge Accumulation Strategy** + +**Wave 1 (Iterations 1-5): Foundation Building** +- Learn core D3 APIs and patterns +- Master basic chart types +- Establish coding standards and structure +- Focus: Technical competence + +**Wave 2 (Iterations 6-12): Enhancement & Interaction** +- Add sophisticated interactions +- Improve visual design substantially +- Introduce advanced D3 layouts +- Focus: User experience + +**Wave 3 (Iterations 13-20): Innovation & Complexity** +- Tackle complex data structures +- Create novel visualization types +- Optimize for performance +- Focus: Technical excellence + +**Wave 4 (Iterations 21+): Mastery & Experimentation** +- Push D3 boundaries +- Integrate cutting-edge techniques +- Create publication-quality visualizations +- Focus: Artistic and technical mastery + +### **Improvement Metrics** + +Each iteration should improve on at least one dimension: +- **Visual Design**: Better colors, layout, typography, spacing +- **Interactivity**: New interaction patterns, smoother transitions +- **Data Handling**: More complex data, better transformations +- **Performance**: Faster rendering, smoother animations +- **Accessibility**: Better keyboard support, ARIA labels, color contrast +- **Code Quality**: Cleaner architecture, better patterns +- **Innovation**: Novel techniques, creative applications + +## Web Research Directive + +### **For Each Iteration** + +**Before Generating:** +1. Fetch assigned web URL +2. Analyze the content for: + - New D3 techniques or APIs + - Design patterns and best practices + - Code examples and implementations + - Visual design inspiration + - Interaction patterns +3. Identify 1-3 specific learnings to apply +4. Plan how to integrate learnings with previous iterations + +**During Generation:** +1. Apply new technique from web source +2. Maintain continuity with previous work where appropriate +3. Document what was learned and how it was applied +4. Ensure the iteration is genuinely improved, not just different + +**After Generation:** +1. Document the web source in the footer +2. Explicitly state the improvement over previous iteration +3. Note what future iterations could explore + +## Data Strategy + +### **Embedded Data Requirements** +- Use realistic, meaningful datasets +- Data should be appropriate for the visualization type +- Include enough data to demonstrate the technique (50-500 data points typically) +- For hierarchical data, ensure proper nesting +- For network data, ensure connected graph structure + +### **Example Data Domains** +- Sales/business metrics (revenue, growth, segments) +- Scientific data (measurements, experiments, observations) +- Social network data (connections, interactions, communities) +- Geographic data (countries, cities, regions, statistics) +- Temporal data (events over time, trends, patterns) +- Categorical data (comparisons, distributions, rankings) + +## Ultra-Thinking Directive + +Before each iteration, deeply consider: + +**Web Source Integration:** +- What is the core lesson from the fetched URL? +- How can this technique improve upon the previous iteration? +- What aspects of the web example are most valuable? +- How can I adapt this learning to my specific visualization goal? + +**Progressive Improvement:** +- What was limiting about the previous iteration? +- How does this iteration represent genuine progress? +- What new capability am I adding? +- How am I building upon accumulated knowledge? + +**Technical Excellence:** +- Am I using D3 best practices from the web source? +- Is my code efficient and maintainable? +- Have I applied the technique correctly? +- What edge cases should I handle? + +**Visual Communication:** +- Does this visualization communicate data clearly? +- Have I improved the visual design? +- Are interactions intuitive and valuable? +- What story does this data tell? + +**Innovation Balance:** +- Am I innovating while maintaining usability? +- Have I combined multiple learnings effectively? +- Is this iteration production-ready or experimental? +- What makes this visualization memorable? + +## Success Criteria + +A successful D3 iteration demonstrates: +1. **Web Learning Applied**: Specific technique from URL is implemented correctly +2. **Measurable Improvement**: Clear advancement over previous iteration +3. **Technical Quality**: Proper D3 patterns, performant code, accessible +4. **Visual Excellence**: Professional design, clear communication, aesthetic appeal +5. **Self-Contained**: Works perfectly as standalone HTML file with D3 CDN +6. **Documented**: Clear explanation of improvements and web source attribution + +Generate visualizations that progressively evolve from competent implementations to masterful, publication-quality interactive data visualizations through systematic web-enhanced learning.