# code-execution

Adopt this skill: https://proskills.md/skills/other/mhattingpete-claude-skills-marketplace-code-operations-plugin-skills-code-execut

Page: https://proskills.md/skills/other/mhattingpete-claude-skills-marketplace-code-operations-plugin-skills-code-execut
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: code-operations-plugin/skills/code-execution/SKILL.md
size: 3196
upstream: https://github.com/mhattingpete/claude-skills-marketplace/blob/main/code-operations-plugin/skills/code-execution/SKILL.md

````text
---
name: code-execution
description: Execute Python code locally with marketplace API access for 90%+ token savings on bulk operations. Activates when user requests bulk operations (10+ files), complex multi-step workflows, iterative processing, or mentions efficiency/performance.
---

# Code Execution

Execute Python locally with API access. **90-99% token savings** for bulk operations.

## When to Use

- Bulk operations (10+ files)
- Complex multi-step workflows
- Iterative processing across many files
- User mentions efficiency/performance

## How to Use

Use direct Python imports in Claude Code:

```python
from execution_runtime import fs, code, transform, git

# Code analysis (metadata only!)
functions = code.find_functions('app.py', pattern='handle_.*')

# File operations
code_block = fs.copy_lines('source.py', 10, 20)
fs.paste_code('target.py', 50, code_block)

# Bulk transformations
result = transform.rename_identifier('.', 'oldName', 'newName', '**/*.py')

# Git operations
git.git_add(['.'])
git.git_commit('feat: refactor code')
```

**If not installed:** Run `~/.claude/plugins/marketplaces/mhattingpete-claude-skills/execution-runtime/setup.sh`

## Available APIs

- **Filesystem** (`fs`): copy_lines, paste_code, search_replace, batch_copy
- **Code Analysis** (`code`): find_functions, find_classes, analyze_dependencies - returns METADATA only!
- **Transformations** (`transform`): rename_identifier, remove_debug_statements, batch_refactor
- **Git** (`git`): git_status, git_add, git_commit, git_push

## Pattern

1. **Analyze locally** (metadata only, not source)
2. **Process locally** (all operations in execution)
3. **Return summary** (not data!)

## Examples

**Bulk refactor (50 files):**
```python
from execution_runtime import transform
result = transform.rename_identifier('.', 'oldName', 'newName', '**/*.py')
# Returns: {'files_modified': 50, 'total_replacements': 247}
```

**Extract functions:**
```python
from execution_runtime import code, fs

functions = code.find_functions('app.py', pattern='.*_util$')  # Metadata only!
for func in functions:
    code_block = fs.copy_lines('app.py', func['start_line'], func['end_line'])
    fs.paste_code('utils.py', -1, code_block)

result = {'functions_moved': len(functions)}
```

**Code audit (100 files):**
```python
from execution_runtime import code
from pathlib import Path

files = list(Path('.').glob('**/*.py'))
issues = []

for file in files:
    deps = code.analyze_dependencies(str(file))  # Metadata only!
    if deps.get('complexity', 0) > 15:
        issues.append({'file': str(file), 'complexity': deps['complexity']})

result = {'files_audited': len(files), 'high_complexity': len(issues)}
```

## Best Practices

✅ Return summaries, not data
✅ Use code_analysis (returns metadata, not source)
✅ Batch operations
✅ Handle errors, return error count

❌ Don't return all code to context
❌ Don't read full source when you need metadata
❌ Don't process files one by one

## Token Savings

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

## File: README.md
upstream: https://github.com/mhattingpete/claude-skills-marketplace/blob/main/README.md

````text
# Claude Skills Marketplace

[![Run in Smithery](https://smithery.ai/badge/skills/mhattingpete)](https://smithery.ai/skills?ns=mhattingpete&utm_source=github&utm_medium=badge)

[![GitHub stars](https://img.shields.io/github/stars/mhattingpete/claude-skills-marketplace)](https://github.com/mhattingpete/claude-skills-marketplace/stargazers)
[![License](https://img.shields.io/github/license/mhattingpete/claude-skills-marketplace)](LICENSE)
[![Last Commit](https://img.shields.io/github/last-commit/mhattingpete/claude-skills-marketplace)](https://github.com/mhattingpete/claude-skills-marketplace/commits)

A curated marketplace of Claude Code plugins for software engineering workflows.

<img src="assets/skill-loading.gif" alt="Skill Loading Demo" width="600">

## Repository Structure

```
claude-skills-marketplace/
├── .claude-plugin/
│   └── marketplace.json              # Marketplace manifest
├── execution-runtime/                 # 🚀 Code execution environment (NEW!)
│   ├── api/                           # Importable API library
│   ├── mcp-server/                    # FastMCP server
│   ├── setup.sh                       # One-command installation
│   └── README.md
├── engineering-workflow-plugin/       # Engineering workflow plugin
│   ├── .claude-plugin/
│   │   └── plugin.json               # Plugin manifest
│   ├── agents/
│   │   └── plan-implementer.md       # Plan implementation agent
│   ├── skills/
│   │   ├── feature-planning/         # Feature planning skill
│   │   ├── git-pushing/              # Git automation skill
│   │   ├── review-implementing/      # Code review skill
│   │   └── test-fixing/              # Test fixing skill
│   └── README.md
├── visual-documentation-plugin/       # Visual documentation plugin
│   ├── .claude-plugin/
│   │   └── plugin.json               # Plugin manifest
│   ├── skills/
│   │   ├── architecture-diagram-creator/  # Architecture diagram skill
│   │   ├── dashboard-creator/        # Dashboard creation skill
│   │   ├── flowchart-creator/        # Flowchart creation skill
│   │   ├── technical-doc-creator/    # Technical documentation skill
│   │   └── timeline-creator/         # Timeline creation skill
│   ├── EXAMPLES.md
│   └── README.md
├── productivity-skills-plugin/        # Productivity & optimization plugin
│   ├── .claude-plugin/
│   │   └── plugin.json               # Plugin manifest
│   ├── skills/
│   │   ├── code-auditor/             # Code auditing skill
│   │   ├── codebase-documenter/      # Codebase documentation skill
│   │   ├── conversation-analyzer/    # Usage analysis skill
│   │   └── project-bootstrapper/     # Project setup skill
│   └── README.md
├── code-operations-plugin/            # Code manipulation plugin
│   ├── .claude-plugin/
│   │   └── plugin.json               # Plugin manifest
│   ├── skills/
│   │   ├── code-execution/           # 🚀 Python execution skill (NEW!)
│   │   │   └── examples/             # Example scripts
│   │   ├── code-transfer/            # Code transfer skill
│   │   │   └── scripts/
│   │   │       └── line_insert.py    # Line-based insertion script
│   │   ├── code-refactor/            # Bulk refactoring skill
│   │   └── file-operations/          # File analysis skill
│   └── README.md
├── LICENSE
└── README.md
```

## What are Skills and Agents?

**Skills** are model-invoked capabilities that extend Claude Code's functionality. Unlike slash commands that require explicit user activation, Skills are automatically triggered by Claude based on context and the Skill's description.

Each Skill consists of a `SKILL.md` file with:
- YAML frontmatter (name, description, metadata)
- Detailed instructions for Claude
- Optional supporting files (scripts, templates, references)

**Agents** are specialized Claude instances that can be invoked by Claude to handle specific types of work. They run independently with their own context and can use different models optimized for their task.

Each Agent consists of an `AGENT.md` file with:
- YAML frontmatter (name, description, model selection)
- Specialized instructions and constraints
- Decision-making frameworks for their domain

Skills and Agents work together: Skills can orchestrate when to invoke Agents, and Agents can use Skills while executing their tasks.

## 🚀 NEW: Execution Runtime (90%+ Token Savings)

The marketplace now includes a **code execution environment** implementing the [Anthropic code execution pattern](https://www.anthropic.com/engineering/code-execution-with-mcp). Instead of loading code through context, Claude executes Python locally with API access—achieving **90-99% token reduction** for bulk operations.

### Quick Benefits

✅ **Massive token savings**: Process 100 files with 1K tokens instead of 100K
✅ **Faster operations**: Local execution vs multiple API round-trips
✅ **Stateful workflows**: Resume multi-step refactoring across sessions
✅ **Auto-secure**: PII/secret masking, sandboxed execution

### Setup (2 minutes)

```bash
# After installing marketplace plugin
~/.claude/plugins/marketplaces/mhattingpete-claude-skills/execution-runtime/setup.sh
```

### When It Activates

Skills automatically use execution mode for:
- Bulk operations (10+ files)
- Complex multi-step workflows
- Iterative processing
- Codebase-wide analysis

**Example**: "Rename getUserData to fetchUserData in all Python files"
- **Without execution**: ~25,000 tokens (read/edit 50 files)
- **With execution**: ~600 tokens (script + summary) - **97.6% savings**

[Full documentation →](execution-runtime/README.md)

## Installation

### Install from Marketplace

```bash
# In Claude Code - installs the entire plugin with all skills and agents
/plugin marketplace add mhattingpete/claude-skills-marketplace
```

This installs the `engineering-workflow-plugin` which includes all skills and the plan-implementer agent.

To install individual plugins:

```bash
# Install only engineering workflows
/plugin marketplace add mhattingpete/claude-skills-marketplace/engineering-workflow-plugin

# Install only visual documentation
/plugin marketplace add mhattingpete/claude-skills-marketplace/visual-documentation-plugin

# Install only productivity skills
/plugin marketplace add mhattingpete/claude-skills-marketplace/productivity-skills-plugin

# Install only code operations
/plugin marketplace add mhattingpete/claude-skills-marketplace/code-operations-plugin
```

## Available Plugins

### Engineering Workflow Plugin

Skills for common software engineering workflows including git operations, test fixing, code review implementation, and feature planning.

[View Plugin Documentation →](engineering-workflow-plugin/README.md)

### Visual Documentation Plugin

Skills for creating stunning visual HTML documentation with modern UI design, SVG diagrams, flowcharts, dashboards, timelines, and comprehensive project architecture diagrams.

[View Plugin Documentation →](visual-documentation-plugin/README.md)

### Productivity Skills Plugin

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

[View Plugin Documentation →](productivity-skills-plugin/README.md)

### Code Operations Plugin

High-precision code manipulation operations including line-based insertion, bulk refactoring, and file analysis. Converted from [code-copy-mcp](https://github.com/mhattingpete/code-copy-mcp) to native Claude Code skills.

[View Plugin Documentation →](code-operations-plugin/README.md)

## Available Skills

### Feature Development

#### `feature-planning`
Break down feature requests into detailed, implementable plans with clear tasks that can be executed by the plan-implementer agent.

**Activates when:** User requests a new feature, enhancement, or complex change requiring planning.

**Example usage:**
- "Add user authentication"
- "Build a dashboard for analytics"
- "Plan how to implement export functionality"

**Works with:** `plan-implementer` ag
````
