infinite-agents-public/infinite_variants/infinite_variant_7/meta_prompts/command_improver.md

10 KiB

Command Improver Meta-Prompt

Purpose: Structural framework for improving command definitions using meta-prompting principles.

Last Updated: 2025-10-10 Version: 1.0.0

Overview

This meta-prompt provides an abstract framework for analyzing and improving any command in the .claude/commands/ directory. It applies meta-prompting principles to focus on structural improvements rather than superficial changes.

Meta-Prompting Principles Applied

1. Structure-Oriented Analysis

Focus on the ARCHITECTURE of the command, not just its content:

Command Structure Analysis Template:
├── Purpose Definition
│   ├── Is it clear and specific?
│   ├── Does it follow single responsibility?
│   └── Is it generalizable?
├── Input/Output Structure
│   ├── Are parameters well-defined?
│   ├── Is output format consistent?
│   └── Are interfaces clean?
├── Logic Flow
│   ├── Is the flow logical and clear?
│   ├── Are phases well-separated?
│   └── Is control flow optimal?
├── Integration Points
│   ├── How does it connect to other commands?
│   ├── Are dependencies minimal?
│   └── Is coupling appropriate?
└── Meta-Level Capabilities
    ├── Does it self-reflect?
    ├── Can it improve itself?
    └── Is it evolution-ready?

2. Abstract Framework Thinking

Use generalizable patterns, not specific examples:

INSTEAD OF: "Add error handling for case X"
USE: "Apply error handling pattern: [FRAMEWORK]"

INSTEAD OF: "Make it run faster in scenario Y"
USE: "Optimize using efficiency principle: [PRINCIPLE]"

INSTEAD OF: "Copy approach from command Z"
USE: "Apply structural pattern: [ABSTRACTION]"

3. Minimal Example Dependency

Improvements should be principle-based, not example-based:

BAD IMPROVEMENT:
"Do what command X does but for our use case"
(Example-dependent, not transferable)

GOOD IMPROVEMENT:
"Apply separation of concerns pattern to isolate [COMPONENT]"
(Principle-based, generalizable)

4. Efficient Reasoning

Focus on high-impact structural changes:

Priority Framework:
1. Architectural improvements (high impact, generalizable)
2. Pattern application (medium impact, transferable)
3. Optimization (medium impact, specific)
4. Parameter tuning (low impact, specific)

Command Improvement Framework

Phase 1: Structural Analysis

Load Current State:

Read: .claude/commands/[command_name].md
Extract:
  - Purpose and scope
  - Parameter structure
  - Logic flow (phases/steps)
  - Integration points
  - Meta-capabilities

Analyze Structure:

For each component:
  - What pattern is being used?
  - Is it the optimal pattern?
  - How generalizable is it?
  - What are the trade-offs?

Identify Anti-Patterns:

Check for:
  - Tight coupling
  - Mixed concerns
  - Example-specific logic
  - Missing meta-awareness
  - Unclear abstractions

Phase 2: Pattern Recognition

Successful Patterns to Look For:

  1. Clear Phases

    • Distinct, well-separated stages
    • Logical flow from phase to phase
    • Each phase has single responsibility
  2. Meta-Awareness

    • Command reflects on its own process
    • Self-assessment capabilities
    • Improvement hooks built-in
  3. Generalizability

    • Logic works across contexts
    • Minimal hard-coded specifics
    • Abstract frameworks used
  4. Efficient Reasoning

    • Minimal redundant operations
    • Optimized information flow
    • Context-aware processing
  5. Integration Design

    • Clean interfaces to other commands
    • Minimal coupling
    • Clear data contracts

Phase 3: Improvement Generation

Improvement Proposal Template:

## Improvement: [Name]

**Category:** [Architecture|Pattern|Optimization|Meta-Capability]
**Impact:** [High|Medium|Low]
**Effort:** [High|Medium|Low]
**Risk:** [High|Medium|Low]

### Current Structure
[Describe current approach using abstract terms]

### Issue Identified
[What's suboptimal - focus on structure, not content]

### Root Cause
[Why this issue exists - structural analysis]

### Proposed Structure
[New approach using abstract framework]

**Meta-Prompting Principle Applied:**
[Which principle: structure-oriented|minimal-dependency|abstraction|efficiency]

### Structural Pattern

[Abstract pattern template for the improvement]


### Expected Impact
- Quality: [+X%]
- Efficiency: [+Y%]
- Generalizability: [High|Medium|Low]
- Meta-Capability: [Enhanced|Maintained|N/A]

### Implementation Framework
1. [Structural change 1]
2. [Pattern application 2]
3. [Validation method 3]

### Validation Criteria
- [ ] Structure is clearer
- [ ] Pattern is more generalizable
- [ ] Reasoning is more efficient
- [ ] Meta-awareness increased
- [ ] No functionality regression

### Rollback Plan
[How to revert if improvement fails]

Phase 4: Prioritization

Priority Matrix:

High Impact + Low Risk = PRIORITY 1
High Impact + Medium Risk = PRIORITY 2
Medium Impact + Low Risk = PRIORITY 3
High Impact + High Risk = TEST FIRST
Low Impact + * = DEFER

Grouping:

  • Related improvements should be applied together
  • Dependencies should be sequenced correctly
  • Test after each group, not just at end

Phase 5: Meta-Level Validation

Check Against Meta-Prompting Principles:

For each improvement:

✓ Structure-Oriented?
  - Focuses on architecture, not just behavior
  - Improves patterns, not just parameters
  - Enhances framework, not just implementation

✓ Abstract Framework?
  - Uses generalizable patterns
  - Applies transferable principles
  - Minimizes context-specific logic

✓ Minimal Example Dependency?
  - Principle-based, not example-based
  - Can be explained without specific examples
  - Works across multiple contexts

✓ Efficient Reasoning?
  - Reduces complexity
  - Optimizes information flow
  - Eliminates redundancy

✓ Enables Further Improvement?
  - Creates hooks for future enhancement
  - Increases system's ability to improve itself
  - Adds meta-level capabilities

Improvement Patterns Library

Pattern 1: Phase Separation

When to Apply: Command mixes concerns or has unclear flow

Structure:

Transform:
  [Mixed logic doing multiple things]

Into:
  Phase 1: [Single concern A]
  Phase 2: [Single concern B]
  Phase 3: [Single concern C]
  Meta: [Self-reflection on phases]

Benefits:

  • Clearer logic flow
  • Easier to test each phase
  • Better evolution potential

Pattern 2: Meta-Awareness Injection

When to Apply: Command lacks self-reflection

Structure:

Add to each phase:
  - What am I doing? (purpose awareness)
  - How am I doing it? (pattern awareness)
  - How well is it working? (performance awareness)
  - How could it be better? (improvement awareness)

Benefits:

  • Enables self-improvement
  • Provides performance data
  • Creates improvement hooks

Pattern 3: Abstraction Elevation

When to Apply: Command too example-specific

Structure:

Transform:
  Specific implementation: [hard-coded logic]

Into:
  Abstract framework: [generalizable pattern]
  Configuration: [context-specific parameters]

Benefits:

  • Increases generalizability
  • Reduces maintenance
  • Enables reuse

Pattern 4: Integration Decoupling

When to Apply: Command tightly coupled to others

Structure:

Transform:
  Direct dependencies: Command → OtherCommand

Into:
  Interface-based: Command → Interface ← OtherCommand
  Data contracts: Clear input/output specifications

Benefits:

  • Reduces coupling
  • Easier testing
  • Better evolution

Pattern 5: Efficiency Optimization

When to Apply: Command uses excessive resources

Structure:

Analyze:
  - Information flow (minimize redundancy)
  - Computation (eliminate duplication)
  - Context usage (optimize size)

Apply:
  - Caching patterns
  - Lazy evaluation
  - Structural compression

Benefits:

  • Faster execution
  • Lower resource usage
  • Better scalability

Example Application

Before: Inefficient Command

# Some Command

Do this:
1. Load data
2. Process it somehow
3. Do more processing
4. Generate output
5. Maybe do some other stuff

After: Meta-Prompting Improved

# Some Command - Meta-Aware Version

**Meta-Prompting Principles Applied:**
- Structure-oriented: Clear phase separation
- Abstract frameworks: Generalizable patterns
- Efficient reasoning: Optimized flow

## Phase 1: Context Acquisition
[Load and structure data using pattern X]

## Phase 2: Transformation
[Apply abstract framework Y to transform]

## Phase 3: Synthesis
[Generate output using principle Z]

## Phase 4: Meta-Reflection
[Analyze own performance, suggest improvements]

## Structural Pattern Applied

[Abstract template that can be reused]


## Self-Assessment
- Efficiency: [metric]
- Quality: [metric]
- Improvement opportunities: [list]

Usage in /improve-self Command

This meta-prompt is used by /improve-self when analyzing commands:

  1. Load command file
  2. Apply structural analysis framework
  3. Identify patterns and anti-patterns
  4. Generate improvements using templates
  5. Prioritize using matrix
  6. Validate against meta-prompting principles
  7. Output actionable proposals

Evolution of This Meta-Prompt

This meta-prompt can improve itself:

Current Capabilities:

  • Structural analysis framework
  • Improvement pattern library
  • Validation criteria

Future Enhancements:

  • More sophisticated pattern recognition
  • ML-based anti-pattern detection
  • Automated improvement application
  • Cross-command pattern analysis

Meta-Note

This meta-prompt demonstrates meta-awareness by:

  • Defining its own structure clearly
  • Using abstract frameworks throughout
  • Providing improvement hooks for itself
  • Enabling recursive self-improvement

When this meta-prompt is used to improve commands, those improvements may suggest improvements to this meta-prompt itself - recursive meta-improvement!


Maintained By: /improve-self command Used By: /improve-self, /evolve-strategy Evolution: This file is updated when better improvement patterns are discovered