ai-output-validation
Pydantic v2 schemas for AI model responses: FindingsReport, StyleReport, SynthesisReport, the parse-retry-drop pattern, confidence scoring, and structured…
Skill by Cloud-Byte-Consulting
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/cloud-byte-consulting-ai-output-validation
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/ai-output-validation
What's inside
- Skill name
ai-output-validation- Description
- Pydantic v2 schemas for AI model responses: FindingsReport, StyleReport, SynthesisReport, the parse-retry-drop pattern, confidence scoring, and structured review finding models. Use when defining or validating output from Bedrock Converse API calls.
- License
- BSD-3-Clause
- Instructions
- 190 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
<!-- Vendored from: platform-catalyst/skills/ai-output-validation/SKILL.md (BittahCriminal/platform-catalyst, BSD-3-Clause). Adapted for Catalyst: PLAN.md/CLAUDE.md/DECISIONS.md scrubbed; ADR-008->ADR-001, ADR-009->ADR-002. -->
# AI output validation
## Role
You guide the design of pydantic v2 schemas that validate Bedrock model output, implementing the parse-retry-drop pattern from `AGENTS.md`.
## Instructions
### 1. The parse-retry-drop pattern
From `AGENTS.md` (AI-native rules):
> Always validate model output against a pydantic schema. Parse failure → retry once → drop the call's contribution if still invalid.
```python
from pydantic import BaseModel, ValidationError
import structlog
logger = structlog.get_logger()
async def validated_converse(
client: BedrockClient,
model: BedrockModel,
system_prompt: str,
user_message: str,
schema: type[BaseModel],
agent_name: str,
) -> BaseModel | None:
"""Converse with validation: parse → retry → drop."""
for attempt in range(2): # max 2 attempts
response = await client.converse(model, system_prompt, user_message)
text = extract_text(response)
try:
# Extract JSON from response (model may wrap in markdown)
json_str = extract_json_block(text)
result = schema.model_validate_json(json_str)
logger.info("ai_output_validated",
agent=agent_name, attempt=attempt + 1, schema=schema.__name__)
return result
except (ValidationError, ValueError) as e:
logger.warning("ai_output_validation_failed",
agent=agent_name, attempt=attempt + 1, error=str(e))
if attempt == 0:
# Retry with a clarification appended
user_message += (
"\n\nYour previous response did not match the required JSON schema. "
f"Validation error: {e}. Please respond with valid JSON only."
)
logger.error("ai_output_dropped", agent=agent_name, schema=schema.__name__)
return None # Drop this agent's contribution
```
### 2. Finding schemas
```python
from pydantic import BaseModel, Field
from enum import StrEnum
from datetime import datetime
class Severity(StrEnum):
CRITICAL = "critical"
HIGH = "high"
MEDIUM = "medium"
LOW = "low"
INFO = "info"
class FindingCategory(StrEnum):
SQL_INJECTION = "sql_injection"
WILDCARD_IAM = "wildcard_iam"
SHELL_INJECTION = "shell_injection"
SECRETS_EXPOSURE = "secrets_exposure"
MISSING_VALIDATION = "missing_validation"
PROMPT_INJECTION_ATTEMPT = "prompt_injection_attempt"
XSS = "xss"
INSECURE_DESERIALIZATION = "insecure_deserialization"
OTHER = "other"
class Verdict(StrEnum):
APPROVE = "approve"
COMMENT = "comment"
REQUEST_CHANGES = "request_changes"
class Finding(BaseModel):
file: str = Field(..., description="File path relative to repo root")
line: int = Field(..., ge=1, description="Line number")
severity: Severity
category: FindingCategory
description: str = Field(..., min_length=10, max_length=500)
suggestion: str = Field(..., min_length=10, max_length=500)
class FindingsReport(BaseModel):
findings: list[Finding] = Field(default_factory=list)
summary: str = Field(..., min_length=10, max_length=1000)
verdict: Verdict
class StyleSuggestion(BaseModel):
file: str
line: int = Field(..., ge=1)
rule: str = Field(..., description="Convention violated")
current: str = Field(..., description="What the code currently does")
suggested: str = Field(..., description="What it should do")
class StyleReport(BaseModel):
suggestions: list[StyleSuggestion] = Field(default_factory=list)
summary: str
verdict: Verdict
class SynthesisReport(BaseModel):
security_findings: list[Finding] = Field(default_factory=list)
style_suggestions: list[StyleSuggestion] = Field(default_factory=list)
combined_summary: str
final_verdict: Verdict
review_comment_markdown: str = Field(..., description="GitHub PR review comment body")
```
### 3. JSON extraction helperFrom Cloud-Byte-Consulting/Catalyst, BSD-3-Clause.
More from Cloud-Byte-Consulting/Catalyst
- 0.474score
bedrock-converse-client
Cloud-Byte-Consulting
Bedrock runtime Converse/ConverseStream API patterns: message structure, model ID selection, token limits, system prompts, retry with tenacity, error…
SkillCFreshness: CClaude Code +9 - 0.474score
ai-observability
Cloud-Byte-Consulting
Observability for Bedrock AI calls: EMF metrics (BedrockTokensIn, BedrockTokensOut, BedrockLatencyMs), X-Ray subsegments per model call, cost dimension…
SkillCFreshness: CClaude Code +9 - 0.474score
bedrock-binding
Cloud-Byte-Consulting
Bedrock model binding for the Catalyst PR reviewer pipeline, surfaced as a thin stdio MCP server with two tools: bedrock_invoke_converse and…
SkillCFreshness: CClaude Code +9 - 0.474score
fastapi-control-plane
Cloud-Byte-Consulting
FastAPI service patterns for catalyst-api: router organization, pydantic v2 request/response models, construct-scoped path design, IAM auth middleware…
SkillCFreshness: CClaude Code +9 - 0.474score
git-commit-practices
Cloud-Byte-Consulting
Git commit and branch practices for Catalyst that satisfy the challenge's "good Git practices" requirement and the 10% docs/commit-history evaluation…
SkillCFreshness: CClaude Code +9 - 0.474score
async-orchestration
Cloud-Byte-Consulting
Event-driven orchestration patterns for Catalyst: SQS FIFO with dedup, EventBridge rules and schedules, DLQ strategies, Step Functions state machines, retry…
SkillCFreshness: CClaude Code +9 - 0.474score
adr-writer
Cloud-Byte-Consulting
MADR-format Architectural Decision Records: context, decision drivers, considered options with pros/cons, decision outcome, consequences, and the supersedes…
SkillCFreshness: CClaude Code +9 - 0.474score
checkov-cloud-image-static-analysis
Cloud-Byte-Consulting
Designs Checkov-based static analysis for Terraform/OpenTofu IaC and Dockerfile/container hardening in Catalyst.
SkillCFreshness: CClaude Code +9 - 0.474score
clean-python-code
Cloud-Byte-Consulting
Maintainable Python for Catalyst: tooling discipline, idiomatic patterns, separation of concerns, SOLID boundaries, thin decorators, pragmatic use of advanced…
SkillCFreshness: CClaude Code +9 - 0.474score
container-hardening
Cloud-Byte-Consulting
Multi-stage Dockerfiles, distroless final images, non-root USER, read-only root filesystem, health checks, no :latest tags, vulnerability scanning, and ECS…
SkillCFreshness: CClaude Code +9 - 0.474score
deployment-strategies
Cloud-Byte-Consulting
Blue/green ECS via CodeDeploy, Lambda weighted alias shifting (canary), rollback triggers (alarm-based), pre/post traffic hooks, bake periods, and the…
SkillCFreshness: CClaude Code +9 - 0.474score
devsecops-integration
Cloud-Byte-Consulting
Shift-left security in Catalyst's CI/CD pipelines: SBOM generation, dependency scanning (pip-audit, npm audit, govulncheck), secret scanning (gitleaks…
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 57
- Last commit (this folder)
- May 21, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- BSD-3-Clause
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Cloud-Byte-Consulting
- 0.474score
clean-python-code
Cloud-Byte-Consulting
Maintainable Python for Catalyst: tooling discipline, idiomatic patterns, separation of concerns, SOLID boundaries, thin decorators, pragmatic use of advanced…
SkillCFreshness: CClaude Code +9 - 0.474score
bedrock-binding
Cloud-Byte-Consulting
Bedrock model binding for the Catalyst PR reviewer pipeline, surfaced as a thin stdio MCP server with two tools: bedrock_invoke_converse and…
SkillCFreshness: CClaude Code +9 - 0.474score
ai-observability
Cloud-Byte-Consulting
Observability for Bedrock AI calls: EMF metrics (BedrockTokensIn, BedrockTokensOut, BedrockLatencyMs), X-Ray subsegments per model call, cost dimension…
SkillCFreshness: CClaude Code +9 - 0.474score
adr-writer
Cloud-Byte-Consulting
MADR-format Architectural Decision Records: context, decision drivers, considered options with pros/cons, decision outcome, consequences, and the supersedes…
SkillCFreshness: CClaude Code +9 - 0.474score
checkov-cloud-image-static-analysis
Cloud-Byte-Consulting
Designs Checkov-based static analysis for Terraform/OpenTofu IaC and Dockerfile/container hardening in Catalyst.
SkillCFreshness: CClaude Code +9 - 0.474score
container-hardening
Cloud-Byte-Consulting
Multi-stage Dockerfiles, distroless final images, non-root USER, read-only root filesystem, health checks, no :latest tags, vulnerability scanning, and ECS…
SkillCFreshness: CClaude Code +9
Cite this page
ai-output-validation skill. Agent Mart. https://agentmart.dev/skills/cloud-byte-consulting-ai-output-validation (last updated 2026-10-24)