Skip to content

mhattingpete/claude-skills-marketplace / code-operations-plugin/skills/code-execution

code-execution

Verified

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.

FileKindSize
SKILL.mdskill md3.1 KB
examples/bulk_refactor.pyscript737 B
examples/codebase_audit.pyscript2.2 KB
examples/extract_functions.pyscript1.2 KB

examples/extract_functions.py

View on GitHub
"""
Example: Extract Functions to New File

Shows how to find and move functions to a separate file
with minimal token usage.
"""

from api.code_analysis import find_functions
from api.filesystem import copy_lines, paste_code, read_file, write_file

# Find utility functions (returns metadata ONLY, not source code)
functions = find_functions('app.py', pattern='.*_util$', regex=True)

print(f"Found {len(functions)} utility functions")

# Extract imports from original file
content = read_file('app.py')
imports = [line for line in content.splitlines()
           if line.strip().startswith(('import ', 'from '))]

# Create new utils.py with imports
write_file('utils.py', '\\n'.join(set(imports)) + '\\n\\n')

# Copy each function to utils.py
for func in functions:
    print(f"  Moving {func['name']} (lines {func['start_line']}-{func['end_line']})")
    code = copy_lines('app.py', func['start_line'], func['end_line'])
    paste_code('utils.py', -1, code + '\\n\\n')  # -1 = append to end

result = {
    'functions_extracted': len(functions),
    'function_names': [f['name'] for f in functions]
}

# Token usage: ~800 tokens
# vs ~15,000 tokens reading full file into context
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall