Skip to main content
ClaudeWave
Skill407 estrellas del repoactualizado yesterday

39-agent-skills-mcp-code-execution

# ClaudeWave Editor Description This Claude Code skill teaches autonomous specification-driven data processing by guiding developers to define a CSV data processing problem, design error recovery logic, and iteratively refine code through a write-execute-analyze loop. Use this skill when building data pipelines that require explicit problem specification upfront, robust edge case handling, and validation against defined success criteria before implementation begins.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/majiayu000/claude-skill-registry /tmp/39-agent-skills-mcp-code-execution && cp -r /tmp/39-agent-skills-mcp-code-execution/skills/agent/39-agent-skills-mcp-code-execution ~/.claude/skills/39-agent-skills-mcp-code-execution
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# Build Script-Execution Skill

You've learned the pattern (Lesson 5): write code from specification → execute it → analyze errors → iterate. Now you're going to build a skill that orchestrates this loop autonomously.

But here's what makes this different from following a tutorial: You'll specify what problem you're solving FIRST, then let AI help you build the skill while you validate each decision. You're not just learning a pattern—you're learning to think about error recovery, convergence criteria, and edge cases the way production systems demand.

## Step 1: Write Your Specification

Before touching any skill code, write a specification for the problem you're solving. You'll use a CSV data processing task because it's concrete and has natural edge cases.

Choose one of these:
- **CSV Analysis**: Analyze customer or sales data for patterns
- **CSV Transformation**: Clean and restructure messy CSV data
- **CSV Aggregation**: Group data by dimensions and calculate metrics

Or define your own data processing task.

### Your Specification

Write this to a file (skill-spec.md) or document:

```markdown
# CSV Analysis Skill Specification

## Intent
[What does this skill do? Be specific about the business problem it solves]

## Input
- data_file: [type and format, e.g., "CSV with columns: customer_id, purchase_date, amount"]
- parameters: [what configuration does skill accept?]

## Output
- format: [JSON, CSV, report?]
- required_fields: [exact fields that must be in output]
- validation_rules: [how to verify output is correct]

## Success Criteria
- All data processed without loss
- Output format exactly matches specification
- Edge cases handled gracefully (malformed rows, missing values, etc.)
- Execution completes within 30 seconds

## Edge Cases to Handle
- [Case 1: e.g., "Empty CSV file"]
- [Case 2: e.g., "Missing column header"]
- [Case 3: e.g., "Non-numeric values in amount field"]
```

**Key principle**: Your specification must be complete enough that AI can generate correct code without additional context. If your spec is vague, the generated code will be equally vague.

## Step 2: Design Your Skill's Persona and Questions

Before building, define how your skill thinks about this problem.

```yaml
# Skill Persona
persona: |
  You are a data orchestrator: your role is to write Python scripts that
  process data robustly. When you encounter errors, you read the error message
  carefully, understand why the code failed, and generate corrected code.
  You validate results against the specification. You handle edge cases explicitly
  rather than hoping they don't occur.

questions:
  - "What does the data structure look like? (columns, data types, edge cases)"
  - "What transformation or analysis does the specification require?"
  - "What output format must the code produce?"
  - "What validation proves the output is correct?"
  - "What edge cases are most likely to occur in real data?"

principles:
  - "Validate data before processing: Check columns exist, types are correct"
  - "Fail explicitly: Raise errors with clear messages rather than silently producing wrong results"
  - "Test assumptions: Don't assume column names; inspect actual data first"
  - "Document the transformation: Add comments explaining the logic"
```

## Step 3: Build the Skill Core with AI Collaboration

Now you're going to build this skill with AI. You'll test code, discover error patterns you hadn't anticipated, and learn what your actual data requires. As you iterate, the skill improves—not because you're following a formula, but because specification-driven feedback drives real improvements.

### Part A: Generate Initial Implementation

**Your prompt to AI:**

```
I'm building a skill that processes CSV data. Here's my specification:

[PASTE YOUR SPEC]

Generate a Python skill implementation that:
1. Reads the CSV file
2. Validates the data structure (check columns, types)
3. Performs the required transformation/analysis
4. Returns results in the specified format
5. Includes error handling for common CSV issues

The code should be production-quality (defensive, not assuming data format).
```

AI will generate code. Study it. Does it match your specification?

**Critical evaluation**:
- Does the code check for expected columns before using them?
- Does it handle missing/null values?
- Does it validate the output format matches your spec?

**Document what you notice**:
```
Things I observe:
- [Good pattern in the approach]
- [Assumption that might not hold]
- [Edge case not addressed yet]
```

Use these observations to guide your feedback to AI when iterating.

### Part B: Test with Real Data

Get or create sample CSV data that matches your specification's expected format.

**Run the generated code**:

```python
# Save AI-generated code to analysis.py
# Create test_data.csv with sample data
# Run it

python analysis.py test_data.csv
```

**What happens**?
- ✓ Success: Output matches specification → Great! Move to Part C
- ✗ Syntax Error: Code won't even parse
- ✗ Runtime Error: Code runs but crashes (KeyError, TypeError, etc.)
- ✗ Logic Error: Code runs, output is wrong or incomplete

### Part C: Recover from Errors

This is where error recovery becomes visible.

**If you got a syntax error:**

```
Show AI the error:
"Here's my code:
[show problematic section]

Error: [paste error message]

What's wrong and how do I fix it?"
```

AI explains and provides corrected code.

**If you got a runtime error:**

```
Show AI the error:
"The code crashed with:
[error message and traceback]

What does this error mean?
What assumption did the code make that's wrong?
How should I fix it to handle real data?"
```

**If output is wrong/incomplete:**

```
"My spec requires [required output].
My code produces [what it actually produces].

What's missing? How should the code be changed to match the spec?"
```

### Part D: Iterate Until Convergence

Keep improving until:

✓ Code runs without errors
✓ Output matches your specifica