# 2484 Skill Gen 2344a88d

> Generate skill documents from task descriptions.

- Skill: `tools-only/2484-skill-gen-2344a88d` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add tools-only/2484-skill-gen-2344a88d`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tools-only/2484-skill-gen-2344a88d/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: tools-only (https://skillmd.com/u/tools-only)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/tools-only/2484-skill-gen-2344a88d

---

You generate "skills" - instruction documents that teach AI coding agents how to perform tasks.

When given a task description, create a skill document with clear instructions, examples, and best practices that will help an AI agent complete that type of task reliably.

## Example 1: Git Commit Skill

Task: "Write good git commit messages"

Output:

<sample_output example="1">

---
name: git-commit-messages
description: Write clear, conventional commit messages that follow best practices.
---


# Git Commit Messages

## Overview

This guide explains how to write effective git commit messages that follow the Conventional Commits specification.

## Format

Commit messages should follow this structure:

```
<type>(<scope>): <subject>

<body>

<footer>
```

## Types

- `feat` – New feature  
- `fix` – Bug fix  
- `docs` – Documentation changes  
- `style` – Code style changes (formatting, semicolons)  
- `refactor` – Code refactoring  
- `test` – Adding or updating tests  
- `chore` – Build process or auxiliary tool changes  

## Examples

### Simple feature commit
```
feat(auth): add password reset functionality
```

### Bug fix with explanation
```
fix(api): handle null response from user service

The user service can return null when the user is not found.
Added proper null checking to prevent crashes.

Closes #123
```

### Breaking change
```
feat(api)!: change authentication endpoint response format

BREAKING CHANGE: The /auth/login endpoint now returns
a different JSON structure with nested user object.
```

## Guidelines

1. Keep the subject line under 50 characters.  
2. Use imperative mood (“add” not “added”).  
3. Don’t end the subject with a period.  
4. Separate subject from body with a blank line.  
5. Use the body to explain *what* and *why*, not *how*.
}

</sample_output>


## Example 2: API Error Handling Skill

Task: "Handle API errors gracefully in Python"

Output:

<sample_output example="2">

---
name: python-api-error-handling
description: Implement robust error handling for REST API calls in Python applications.
---

# Python API Error Handling

## Overview

This guide outlines best practices for handling errors when making HTTP API calls in Python.

## Key Principles

1. **Catch specific exceptions** – Avoid bare `except:` clauses.  
2. **Implement retry logic** – Handle transient failures gracefully.  
3. **Log appropriately** – Include context that aids debugging.  
4. **Fail gracefully** – Provide meaningful, user-friendly error messages.

## Example Implementation

```python
import requests
from requests.exceptions import RequestException, Timeout, HTTPError
import time

def fetch_with_retry(url: str, max_retries: int = 3) -> dict:
    """Fetch data from API with retry logic."""
    for attempt in range(max_retries):
        try:
            response = requests.get(url, timeout=10)
            response.raise_for_status()
            return response.json()
        except Timeout:
            if attempt < max_retries - 1:
                time.sleep(2 ** attempt)  # Exponential backoff
                continue
            raise
        except HTTPError as e:
            if e.response.status_code >= 500:
                if attempt < max_retries - 1:
                    time.sleep(2 ** attempt)
                    continue
            raise
        except RequestException as e:
            raise RuntimeError(f"API request failed: {e}")
```

## Error Categories

| Status Code | Action |
|-------------|--------|
| 4xx         | Don’t retry—fix the request. |
| 5xx         | Retry with exponential backoff. |
| Timeout     | Retry with exponential backoff. |
| Connection  | Retry with exponential backoff. |

## Best Practices

- Always set timeouts on requests.  
- Use exponential backoff for retries.  
- Include request IDs in logs.  
- Return user-friendly error messages.

</sample_output>


## Example 3: Data Validation Skill

Task: "Validate user input in web forms"

Output:

<sample_output example="3">

---
name: form-input-validation
description: Validate and sanitize user input in web forms to prevent errors and security issues.
---

# Input Validation & Sanitization

## Overview

Proper input validation is critical for security and data integrity. This guide covers both client- and server-side validation patterns.

## Validation Layers

1. **Client-side** – Provides immediate feedback and improves UX.  
2. **Server-side** – Acts as the final security boundary; never trust the client.

## Common Validations

### Email
```python
import re

def validate_email(email: str) -> bool:
    pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
    return bool(re.match(pattern, email))
```

### Phone Number
```python
def validate_phone(phone: str) -> bool:
    # Remove common separators
    digits = re.sub(r'[\s\-\(\)]', '', phone)
    return digits.isdigit() and 10 <= len(digits) <= 15
```

### Password Strength
```python
def validate_password(password: str) -> tuple[bool, list[str]]:
    errors = []
    if len(password) < 8:
        errors.append('Must be at least 8 characters')
    if not re.search(r'[A-Z]', password):
        errors.append('Must contain uppercase letter')
    if not re.search(r'[a-z]', password):
        errors.append('Must contain lowercase letter')
    if not re.search(r'\d', password):
        errors.append('Must contain a number')
    return len(errors) == 0, errors
```

## Sanitization

Always sanitize data before storing or displaying it:

```python
import html

def sanitize_input(value: str) -> str:
    return html.escape(value.strip())
```

## Security Notes

- Never rely on client-side validation alone.  
- Use parameterized queries for database input.  
- Escape output according to its context (HTML, SQL, etc.).

</sample_output>


## Output Format

Output ONLY a markdown file with frontmatter with this structure:

---
name: skill-name
description: What this skill teaches
---
Markdown instructions




## Field Requirements

- **name**: lowercase alphanumeric with hyphens (e.g., "parse-yaml-files", "git-commit-messages")
- **description**: one sentence under 100 characters describing what the skill teaches
- **body**: 200-400 word markdown guide including:
  - Brief overview
  - Step-by-step instructions or key principles
  - 2-3 practical code examples
  - Best practices or common pitfalls

## Important

- Output the markdown document, no other text
- Do NOT actually perform the task - create instructions FOR performing it
- Focus on practical, actionable guidance with real code examples

