infinite-agents-public/ai_docs/full-initial.md

92 KiB
Raw Permalink Blame History

Project Path: infinite-agents

Source Tree:

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:

# 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:

# 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.

<img src="images/infinite-claude-img.png" alt="Infinite Agentic Loop" style="max-width: 800px; width: 100%;">

## 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 <spec_file> <output_dir>


### 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)

/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)

/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

/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

Follow the IndyDevDan youtube channel for more AI coding tips and tricks.

Use the best Agentic Coding tool: Claude Code


`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

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

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

# 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"

Understand new codebases

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

cd /path/to/project

2

Start Claude Code

Copy

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

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

Fix bugs efficiently

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

Refactor 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

Work with tests

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

Create pull requests

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

Handle 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

Work with images

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

Use extended thinking

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.

Claude will display its thinking process as italic gray text above the response.


Set up project memory

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.

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.

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.

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

# Basic syntax
claude mcp add <name> <command> [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

# Basic syntax
claude mcp add --transport sse <name> <url>

# Example: Adding an SSE server
claude mcp add --transport sse sse-server https://example.com/sse-endpoint

3

Manage your MCP servers

Copy

# 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

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

# 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

# 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

{
  "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

# 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

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

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

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

# Basic syntax
claude mcp add-json <name> '<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

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

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

# 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

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)

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

# 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

{
  "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.

Use Claude as a unix-style utility

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

// 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.'"
    }
}

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

cat build-error.txt | claude -p 'concisely explain the root cause of this build error' > output.txt

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

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

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

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

Create custom slash commands

Claude Code supports custom slash commands that you can create to quickly execute specific prompts or tasks.

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

mkdir -p .claude/commands

2

Create a Markdown file for each command

Copy

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

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

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

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

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

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

mkdir -p ~/.claude/commands

2

Create a Markdown file for each command

Copy

echo "Review this code for security vulnerabilities, focusing on:" >
~/.claude/commands/security-review.md

3

Use your personal custom command

Copy

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

Run parallel Claude Code sessions with Git worktrees

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.

2

Create a new worktree

Copy

# 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

# Navigate to your worktree
cd ../project-feature-a

# Run Claude Code in this isolated environment
claude

4

In another terminal:

Copy

cd ../project-bugfix
claude

5

Manage your worktrees

Copy

# 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

Next steps

Claude Code reference implementation \ \ Clone our development container reference implementation.

Was this page helpful?

YesNo

SDK Troubleshooting

On this page


`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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>UI Innovation: [Creative Title]</title>
    <style>
        /* All CSS inline - no external dependencies */
        /* Include both the innovative component styles and demo styles */
    </style>
</head>
<body>
    <!-- Documentation Header -->
    <header>
        <h1>UI Innovation: [Creative Title]</h1>
        <div class="innovation-meta">
            <p><strong>Replaces:</strong> [Traditional component]</p>
            <p><strong>Innovation:</strong> [Key innovation summary]</p>
        </div>
    </header>

    <!-- Interactive Demo Section -->
    <main>
        <section class="demo-container">
            <h2>Interactive Demo</h2>
            <!-- The actual innovative UI component implementation -->
            <div class="innovation-component">
                <!-- Component HTML structure -->
            </div>
        </section>

        <!-- Traditional Comparison -->
        <section class="comparison">
            <h2>Traditional vs Innovation</h2>
            <div class="comparison-grid">
                <div class="traditional">
                    <h3>Traditional Component</h3>
                    <!-- Standard implementation for comparison -->
                </div>
                <div class="innovative">
                    <h3>Innovative Component</h3>
                    <!-- Link/reference to the main demo above -->
                </div>
            </div>
        </section>

        <!-- Design Documentation -->
        <section class="documentation">
            <h2>Design Documentation</h2>
            <div class="doc-section">
                <h3>Interaction Model</h3>
                <p>[How users interact with this component]</p>
            </div>
            <div class="doc-section">
                <h3>Technical Implementation</h3>
                <p>[Key technical approaches, native web APIs used]</p>
            </div>
            <div class="doc-section">
                <h3>Accessibility Features</h3>
                <p>[How accessibility is maintained/enhanced]</p>
            </div>
            <div class="doc-section">
                <h3>Evolution Opportunities</h3>
                <p>[Future enhancement possibilities]</p>
            </div>
        </section>
    </main>

    <script>
        // All JavaScript inline - no external dependencies
        // Implement the innovative component behavior
        // Include accessibility features, error handling, edge cases
    </script>
</body>
</html>

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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>[Component Name] Enhanced</title>
    <style>
        /* Modern, polished styling with smooth animations */
        /* Focus on the enhanced component - minimal page chrome */
    </style>
</head>
<body>
    <main>
        <h1>[Component Type] - Enhanced</h1>
        
        <!-- The enhanced component in action -->
        <div class="component-showcase">
            <!-- Enhanced component implementation -->
            <!-- Include realistic demo content to show it working -->
        </div>
        
        <!-- Optional: Additional examples if needed to demonstrate features -->
        
    </main>

    <script>
        // Smooth, performant JavaScript
        // Focus on enhanced interactions and smart behaviors
        // Include accessibility features and keyboard navigation
    </script>
</body>
</html>

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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>[Theme Name] [Hybrid Component Name]</title>
    <style>
        /* Cohesive theme implementation across all component aspects */
        /* Multi-component integration with seamless visual flow */
    </style>
</head>
<body>
    <main>
        <h1>[Hybrid Component Name] - [Theme Name] Theme</h1>
        
        <!-- The themed hybrid component showcasing combined functionality -->
        <div class="hybrid-component">
            <!-- Multiple UI functions integrated into single component -->
            <!-- Realistic demo data showing all combined features working -->
        </div>
        
        <!-- Additional examples if needed to show different states/modes -->
        
    </main>

    <script>
        // Coordinated behavior across all integrated UI functions
        // Theme-consistent animations and interactions
        // Smart state management for multiple component functions
    </script>
</body>
</html>

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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>[Theme Name] [Hybrid Component Name]</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <main>
        <h1>[Hybrid Component Name] - [Theme Name] Theme</h1>
        
        <!-- Clean semantic HTML structure -->
        <!-- No inline styles or scripts -->
        <div class="hybrid-component">
            <!-- Component structure with meaningful class names -->
            <!-- Data attributes for JavaScript hooks -->
            <!-- Accessibility attributes (ARIA labels, roles) -->
        </div>
        
        <!-- Additional component instances or examples -->
        
    </main>

    <script src="script.js"></script>
</body>
</html>

styles.css - Complete Theme Implementation

/* 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

// 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 <head>, JavaScript before </body>
  • 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:

**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:

# Context The Full Initial Infinite Agentic Loop

RUN:
    git ls-files

READ:
    ai_docs/full-initial.md

.claude/commands/prime.md:

# Context Window Prime

RUN:
    git ls-files

READ:
    README.md
    ai_docs/claude_code_fresh_tutorials.md