Files
mhattingpete 71429f72e5 feat: Add Anthropic code execution pattern - 90%+ token savings (#15)
* feat: Add Anthropic code execution pattern - 90%+ token savings

Implements the Anthropic code execution pattern for massive token efficiency.
Instead of loading code through context, Claude executes Python locally with
API access - achieving 90-99% token reduction for bulk operations.

## Core Infrastructure (execution-runtime/)

### API Library (importable in execution)
- api/filesystem.py: File operations (copy, paste, search, batch)
- api/code_analysis.py: AST-based analysis (returns metadata, not source)
- api/code_transform.py: Refactoring operations
- api/git_operations.py: Git command wrappers

### Security
- security/sandbox.py: RestrictedPython execution environment
- security/pii_detector.py: Auto-mask 15+ types of secrets/PII

### MCP Server (mcp_server.py)
- execute_python: Run Python with API access
- save_reusable_skill: Save transformation functions
- create_refactoring_session: Stateful operations
- save_session_state: Checkpoint progress
- list_available_apis: API documentation

### Setup & Docs
- setup.sh: One-command installation
- pyproject.toml: Dependencies (FastMCP, RestrictedPython)
- .env.example: Configuration template
- README.md: Comprehensive documentation

## New Skills

### code-execution skill
- Teaches agents when/how to use execution mode
- 3 example scripts showing token savings
- Comprehensive usage patterns

### Enhanced existing skills
- code-transfer: Auto-uses execution for 10+ operations
- code-refactor: Auto-switches for bulk operations

## New Commands

### /pr command
- Quick access to git-pushing skill
- Creates PRs with comprehensive summaries

## Token Savings

| Operation | Files | Traditional | Execution | Savings |
|-----------|-------|-------------|-----------|---------|
| Rename    | 10    | 5K tokens   | 500       | 90%     |
| Refactor  | 50    | 25K tokens  | 600       | 97.6%   |
| Audit     | 100   | 150K tokens | 1K        | 99.3%   |

## Security Features

✅ Sandboxed execution (RestrictedPython)
✅ Resource limits (30s timeout, 256MB memory)
✅ Restricted imports (whitelist only)
✅ Automatic PII/secret masking
✅ Directory access restrictions

## Installation

Users run: ~/.claude/plugins/execution-runtime/setup.sh

Skills automatically activate execution mode for bulk operations (10+ files).

Reference: https://www.anthropic.com/engineering/code-execution-with-mcp

* refactor(git-pushing): enforce smart_commit.sh script usage

Make the smart_commit.sh script mandatory for all git-pushing operations.
Removes manual git command fallback to ensure consistent behavior.

Changes:
- Updated workflow to always use the script
- Removed manual git command instructions
- Simplified examples to show script usage only
- Added clear 'IMPORTANT' notice about script requirement

Benefits:
- Consistent commit message format
- Automatic Claude Code footer
- Better error handling
- Simpler skill instructions for LLM

* refactor: make skills more concise for LLM consumption

Dramatically reduced skill file lengths to be more LLM-friendly:
- code-execution: 541 → 101 lines (81% reduction)
- git-pushing: simplified workflow instructions

Skills are for LLMs to read, not humans. Keeping them concise:
- Focuses on essential information only
- Removes verbose explanations
- Keeps concrete examples
- Clear do's and don'ts

Benefits:
- Faster LLM processing
- Lower token usage for skill loading
- Clearer decision-making for activation

* refactor: drastically reduce visual documentation skill sizes

Reduced skill files by 80-92% for LLM efficiency:
- architecture-diagram-creator: 992 → 83 lines (92%)
- timeline-creator: 601 → 67 lines (89%)
- technical-doc-creator: 525 → 87 lines (83%)
- dashboard-creator: 406 → 79 lines (81%)
- flowchart-creator: 373 → 78 lines (79%)

Total reduction: 2,897 → 394 lines (86% reduction)

Skills are for LLMs, not humans. Kept only:
- Essential activation criteria
- HTML structure templates
- Key component patterns
- Concise workflow steps

Benefits:
- Faster skill loading (86% less tokens)
- Clearer decision-making
- Same functionality, better performance

* refactor: reduce all skill sizes for LLM efficiency (76% reduction)

Reduced all marketplace skills per user requirement for LLM consumption.

Code Operations: 393->84 lines (79%)
Productivity Skills: 821->580 lines (29%)
Engineering Workflow: 492->393 lines (20%)
Visual Documentation: 2897->394 lines (86%)

Total: 4603->1827 lines (76% reduction, -2776 lines)

Pattern: Keep only activation phrases, brief lists, minimal examples, essential workflow steps.
2025-11-10 14:41:28 +01:00
..
2025-10-22 20:41:15 +02:00

Productivity Skills Plugin

Workflow optimization skills for analyzing usage patterns, auditing code quality, bootstrapping projects, and generating documentation.

Version: 1.0.0


Skills

1. conversation-analyzer

Activates when you say:

  • "Analyze my conversations"
  • "How can I improve my workflow"
  • "Review my Claude Code history"

What it does:

  • Analyzes conversation history from ~/.claude/history.jsonl
  • Identifies patterns, repetitive tasks, and inefficiencies
  • Provides actionable recommendations

2. code-auditor

Activates when you say:

  • "Audit the code"
  • "Check for security issues"
  • "Review code quality"

What it does:

  • Comprehensive analysis across 6 dimensions: architecture, quality, security, performance, testing, maintainability
  • Generates detailed report with file:line references
  • Prioritizes findings and provides action plan

3. project-bootstrapper

Activates when you say:

  • "Set up a new project"
  • "Bootstrap this project"
  • "Add best practices"

What it does:

  • Sets up directory structure, git, testing, linting, CI/CD
  • Creates documentation (README, CONTRIBUTING)
  • Configures development workflow automation

4. codebase-documenter

Activates when you say:

  • "Explain this codebase"
  • "Document the architecture"
  • "Create developer documentation"

What it does:

  • Explores codebase and documents architecture, components, data flow
  • Creates visual diagrams and includes code examples
  • Generates comprehensive documentation files

Installation

Add to your .claude-plugin/marketplace.json:

{
  "plugins": [
    {
      "name": "productivity-skills-plugin",
      "source": "github:anthropics/claude-skills-marketplace/productivity-skills-plugin",
      "version": "1.0.0"
    }
  ]
}

Integration

Works seamlessly with:

  • engineering-workflow-skills: Plan implementations from audit findings, fix issues, commit changes
  • visual-documentation-skills: Create visual diagrams for documentation

Author

mhattingpete