Saltar al contenido principal

Capítulo 2: Generación y depuración de código

Plantilla para generación de código​

Language: \{LANGUAGE\}
Framework: \{FRAMEWORK\} (if applicable)

Task: \{DESCRIPTION\}

Requirements:
- Input: \{INPUT_TYPES\}
- Output: \{OUTPUT_TYPE\}
- Edge cases: \{EDGE_CASES\}
- Performance: \{REQUIREMENTS\}

Include:
- Type hints/annotations
- Docstrings with examples
- Error handling
- Unit tests (optional)

Style: \{STYLE_GUIDE\}

Prompts para depuración​

Debug this \{LANGUAGE\} code:

```{language}
\{CODE\}

Error message: \{ERROR\} Expected behavior: {EXPECTED} Actual behavior: {ACTUAL}

Please:

  1. Identify the bug
  2. Explain why it occurs
  3. Provide the fixed code
  4. Suggest how to prevent similar bugs

## Revisión de código

```text
Review this code for:
- [ ] Correctness/bugs
- [ ] Performance issues
- [ ] Security vulnerabilities
- [ ] Code style/readability
- [ ] Best practices

Format:
| Line | Issue | Severity | Suggestion |
|------|-------|----------|------------|

Generación de documentación​

Generate documentation for this \{LANGUAGE\} \{TYPE\}:

```{language}
\{CODE\}

Include:

  • Description
  • Parameters (types, descriptions)
  • Return value
  • Usage examples (3)
  • Exceptions/errors

## Puntos clave

:::tip[Summary]
1. Especifique **lenguaje, framework, guía de estilo**
2. Incluya **tipos de entrada/salida y casos límite**
3. Solicite **explicaciones** junto con el código
4. Utilice **formatos estructurados** para revisiones
:::

---

**[← Anterior: Creación de contenido](/module_07/chapitre1-content-creation)** | **[Siguiente: Análisis de datos →](/module_07/chapitre3-data-analysis)**