The agent-skill-code-runner helps AI agents to execute code snippets across various programming languages seamlessly. Compatible with GitHub Copilot and Claude Code, it enhances development workflows and automates coding tasks efficiently.
claude install formulahendry/agent-skill-code-runnerThe agent-skill-code-runner helps AI agents to execute code snippets across various programming languages seamlessly. Compatible with GitHub Copilot and Claude Code, it enhances development workflows and automates coding tasks efficiently.
[{"step":"Prepare your code snippet","action":"Copy and paste the code you want to execute into the prompt. Ensure it is properly formatted and includes all necessary dependencies (e.g., import statements).","tip":"For complex code, break it into smaller, testable chunks to isolate errors more easily."},{"step":"Define inputs and environment","action":"Specify the programming language (e.g., Python, JavaScript, Java) and any required input values using the [INPUT_VALUES] placeholder. If no inputs are needed, omit this section.","tip":"Include example inputs in comments within the code snippet for clarity, e.g., `# Input: [10, 20, 30]` for a function expecting an array."},{"step":"Execute the code","action":"Run the prompt in your AI tool (e.g., GitHub Copilot, Claude Code). The agent-skill-code-runner will execute the code in a sandboxed environment and return the output.","tip":"For large codebases, use this skill to test individual functions or modules before integrating them into your project."},{"step":"Review and iterate","action":"Analyze the output for errors, warnings, or unexpected results. If issues arise, refine the code or inputs and re-run the prompt.","tip":"Use the agent-skill-code-runner iteratively to debug by adding print statements or assertions to trace execution flow."},{"step":"Document and integrate","action":"Save the output and explanations for future reference. Integrate working code into your project, ensuring it meets your standards for performance and readability.","tip":"Combine this skill with version control (e.g., GitHub) to track changes and collaborate with your team."}]
Automating code testing
Running quick code snippets for debugging
Integrating code execution in chatbots
Enhancing coding tutorials with live examples
claude install formulahendry/agent-skill-code-runnergit clone https://github.com/formulahendry/agent-skill-code-runnerCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Execute the following [CODE_SNIPPET] in [PROGRAMMING_LANGUAGE] and return the output. Handle any errors gracefully and provide a detailed explanation of the results. If the code requires specific inputs, use these values: [INPUT_VALUES]. Code snippet: ```[CODE_SNIPPET]```
### Code Execution Result for Python Snippet
**Input Code:**
```python
import pandas as pd
import numpy as np
# Create a sample DataFrame
data = {
'product': ['Widget A', 'Widget B', 'Widget C', 'Widget D'],
'sales': [15000, 22000, 7500, 12000],
'profit_margin': [0.15, 0.22, 0.08, 0.18]
}
df = pd.DataFrame(data)
# Calculate total profit
profit = df['sales'] * df['profit_margin']
df['profit'] = profit.round(2)
# Identify top 2 products by profit
top_products = df.nlargest(2, 'profit')
print(top_products)
```
**Execution Output:**
```
product sales profit_margin profit
1 Widget B 22000 0.22 4840.0
0 Widget A 15000 0.15 2250.0
```
**Explanation:**
The code snippet calculates the profit for each product by multiplying the sales revenue by the profit margin. The results show:
- **Widget B** generates the highest profit at **$4,840** (22% margin on $22,000 sales).
- **Widget A** follows with **$2,250** (15% margin on $15,000 sales).
- Widgets C and D were excluded from the top 2 due to lower profitability ($600 and $2,160 respectively).
**Error Handling:**
No errors occurred during execution. All operations completed successfully, and the DataFrame was properly formatted.
**Recommendations:**
1. Focus marketing efforts on **Widget B** to maximize profitability.
2. Investigate why **Widget C** has a low profit margin (8%) despite being a core product—potential cost inefficiencies or pricing issues.
3. Consider bundling **Widget A** with complementary products to increase its sales volume.
**Next Steps:**
- Save the `top_products` DataFrame to a CSV file for further analysis: `top_products.to_csv('top_profitable_products.csv', index=False)`.
- Use this data to update the quarterly business review presentation.AI assistant built for thoughtful, nuanced conversation
Your one-stop shop for church and ministry supplies.
Let’s build from here, together
Automate your browser workflows effortlessly
CI/CD automation with build configuration as code
Enhance performance monitoring and root cause analysis with real-time distributed tracing.
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan