Skip to content
Back to skills

Structured Output

ASecurity

Sub-skill of ai-prompting: Structured Output (+2).

  • 17 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 9, 2026
ai-agentspythongo

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add vamseeachanta/workspace-hub --skill structured-output --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Structured Output?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Structured Output
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vamseeachanta-structured-output/badge)](https://www.skillsdirectory.com/skills/vamseeachanta-structured-output)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ai-prompting-structured-output
description: 'Sub-skill of ai-prompting: Structured Output (+2).'
version: 1.0.0
category: ai
type: reference
scripts_exempt: true
---

# Structured Output (+2)

## Structured Output


```python
from pydantic import BaseModel

class OutputSchema(BaseModel):
    summary: str
    key_points: list[str]
    confidence: float

# Force structured output
response = llm.complete(
    prompt,
    response_format={"type": "json_object"},
    schema=OutputSchema.schema()
)
```

## Error Handling and Fallbacks


```python
def robust_llm_call(prompt, fallback_response=None):
    try:
        response = llm.complete(prompt, timeout=30)
        if not validate_response(response):
            raise ValueError("Invalid response format")
        return response
    except RateLimitError:
        time.sleep(60)
        return robust_llm_call(prompt, fallback_response)
    except Exception as e:
        logger.error(f"LLM call failed: {e}")
        return fallback_response
```

## Caching and Cost Optimization


```python
import hashlib
from functools import lru_cache

@lru_cache(maxsize=1000)
def cached_embedding(text: str) -> list[float]:
    return embedding_model.embed(text)

def cache_key(prompt, model, temperature):
    content = f"{prompt}|{model}|{temperature}"
    return hashlib.sha256(content.encode()).hexdigest()
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…