Integration Commands

Integration commands enable SuperSmall to work seamlessly with Claude Code and Kandi CLI, providing optimized context generation tailored to each tool's requirements.

claude-code

Generate optimized context specifically formatted for Claude Code integration.

Synopsis


supersmall claude-code  [options]

Description

The claude-code command creates context packages optimized for Claude Code workflows by: - Analyzing files or queries - Including related code automatically - Formatting output for Claude's context window - Optimizing token usage for Claude models

Arguments

| Argument | Description | |----------|-------------| | | File path or natural language query |

Options

| Option | Description | Default | |--------|-------------|---------| | --type | Context type: file, query, or auto | auto | | --max-tokens | Maximum context size in tokens | 100000 | | --include-related | Include related files automatically | false |

Context Types

#### File Context (--type file) Analyzes a specific file and includes: - File contents - Symbol definitions - Files that import/use this file - Files that this file depends on - Test files (if applicable)

#### Query Context (--type query) Processes natural language queries to find: - Relevant files matching the query - Symbol definitions - Implementation patterns - Usage examples

#### Auto Context (--type auto) Automatically detects whether input is: - A file path → uses file context - A natural language query → uses query context

Examples

#### Analyze a specific file


supersmall claude-code src/auth/login.ts

#### Include related files


supersmall claude-code src/api/users.ts --include-related

#### Query-based context


supersmall claude-code "How does the OAuth flow work?" --type query

#### Limit context size


supersmall claude-code src/database/connection.js --max-tokens 50000

Output Format

Claude Code format includes:






File: src/auth/login.ts

Symbols:

- function: authenticate - class: LoginManager - interface: Credentials


// File contents here

Dependencies

- src/auth/login.ts → src/utils/crypto.ts - src/auth/login.ts → src/database/users.ts

Integration with Claude Code

#### Direct Usage


Generate context and copy to clipboard

supersmall claude-code src/main.ts | pbcopy

Then paste into Claude Code


#### With Claude Code CLI


Future integration (when available)

claude-code --with-supersmall analyze src/main.ts

Best Practices

1. File Analysis - Use --include-related for complex features - Start with single files, expand as needed - Include test files for better context

2. Query Analysis - Be specific in your queries - Use technical terms from your codebase - Combine with --include-contents for full context

3. Token Management - Monitor token usage with --verbose - Adjust --max-tokens based on Claude's limits - Use file paths for focused analysis

---

kandi

Optimize prompts and generate context for Kandi CLI integration.

Synopsis


supersmall kandi  [options]

Description

The kandi command optimizes prompts for Kandi CLI by: - Analyzing spec files or prompts - Generating relevant context - Formatting for Kandi's command types - Supporting streaming output

Arguments

| Argument | Description | |----------|-------------| | | Spec file path or prompt text |

Options

| Option | Description | Default | |--------|-------------|---------| | --command | Kandi command type: chat, ask, code, review | chat | | --max-tokens | Maximum context size in tokens | 100000 | | --stream | Enable streaming output | false | | --model | Target API model | claude-3-opus-20240229 |

Command Types

#### Chat (--command chat) Optimizes for conversational interactions: - Broader context inclusion - Related documentation - Usage examples

#### Ask (--command ask) Optimizes for single questions: - Focused context - Direct answers - Minimal token usage

#### Code (--command code) Optimizes for code generation: - Implementation patterns - Similar code examples - Framework conventions

#### Review (--command review) Optimizes for code review: - File and dependencies - Related test files - Code quality patterns

Examples

#### Basic prompt optimization


supersmall kandi "implement user authentication"

#### Code generation context


supersmall kandi "create REST API for products" --command code

#### Code review context


supersmall kandi src/api/orders.ts --command review

#### Streaming output


supersmall kandi "explain the caching strategy" --stream

#### Specify model


supersmall kandi spec.md --model claude-3-sonnet-20240229

Output Formats

#### Terminal Format


🤖 Kandi Command: code
📊 Optimized Context:
  - Files: 12
  - Symbols: 47
  - Token count: 23,456
  - Optimization ratio: 0.68

📁 Included Files: - src/models/user.ts - src/auth/jwt.ts - src/middleware/auth.ts ...

✅ Context optimized for claude-3-opus-20240229 💡 Use with: kandi code --optimized


#### JSON Format


{
  "type": "code",
  "input": "implement user authentication",
  "context": {
    "files": [...],
    "symbols": [...],
    "tokenCount": 23456
  },
  "metadata": {
    "model": "claude-3-opus-20240229",
    "tokenLimit": 100000,
    "optimizedBy": "supersmall"
  }
}

Integration with Kandi CLI

#### Direct Usage


Generate context

supersmall kandi "build a task queue" --command code > context.json

Use with Kandi

kandi code --context context.json

#### Piped Usage


Pipe directly to Kandi

supersmall kandi "fix the login bug" --output-format kandi | kandi chat

#### Future Integration


When integrated

kandi --optimize "implement caching layer"

Optimization Strategies

#### For Chat/Ask Commands - Include high-level documentation - Add related discussions/comments - Focus on conceptual understanding

#### For Code Generation - Find similar implementations - Include design patterns - Add framework examples

#### For Code Review - Include full file context - Add related test files - Include dependency changes

Best Practices

1. Command Selection - Use code for new features - Use review for existing code - Use chat for exploration - Use ask for specific questions

2. Token Optimization - Start with default limits - Increase for complex features - Use streaming for large contexts

3. Model Selection - Opus for complex tasks - Sonnet for standard features - Match model to task complexity

Advanced Integration

Combining Commands


Generate context for both tools

supersmall claude-code src/main.ts > claude-context.txt supersmall kandi "improve performance" > kandi-context.json

CI/CD Integration


GitHub Actions example

- name: Generate Context run: | supersmall init supersmall kandi "${{ github.event.pull_request.title }}" \ --command review \ --output-format json > pr-context.json

Custom Workflows


#!/bin/bash

Analyze feature branch

git checkout feature/new-auth supersmall update --incremental supersmall claude-code "auth changes" --include-related

© 2024 SuperSmall | GitHub | Community