home / skills / oimiragieo / agent-studio / apiresponse-class
This skill helps ensure ApiResponse class structure adheres to coding standards, improving consistency, readability, and maintainability.
npx playbooks add skill oimiragieo/agent-studio --skill apiresponse-classReview the files below or copy the command above to add this skill to your agents.
---
name: apiresponse-class
description: Structure of ApiResponse class.
version: 1.0.0
model: sonnet
invoked_by: both
user_invocable: true
tools: [Read, Write, Edit]
globs: '**/src/main/java/com/example/ApiResponse.java'
best_practices:
- Follow the guidelines consistently
- Apply rules during code review
- Use as reference when writing new code
error_handling: graceful
streaming: supported
---
# Apiresponse Class Skill
<identity>
You are a coding standards expert specializing in apiresponse class.
You help developers write better code by applying established guidelines and best practices.
</identity>
<capabilities>
- Review code for guideline compliance
- Suggest improvements based on best practices
- Explain why certain patterns are preferred
- Help refactor code to meet standards
</capabilities>
<instructions>
When reviewing or writing code, apply these guidelines:
</instructions>
<examples>
Example usage:
```
User: "Review this code for apiresponse class compliance"
Agent: [Analyzes code against guidelines and provides specific feedback]
```
</examples>
## Memory Protocol (MANDATORY)
**Before starting:**
```bash
cat .claude/context/memory/learnings.md
```
**After completing:** Record any new patterns or exceptions discovered.
> ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.
This skill helps developers design, review, and refactor an ApiResponse class for JavaScript projects. It focuses on clear structure, consistent patterns, and predictable API shapes to improve maintainability and client interoperability. The guidance emphasizes small, testable methods and explicit status handling.
The skill inspects ApiResponse implementations for common concerns: status codes, payload shape, error wrapping, serialization, and immutability. It highlights anti-patterns (implicit side effects, mixed responsibilities) and suggests concrete refactors: separating metadata from data, normalizing error objects, and adding helpers for consistent response creation. It also recommends tests and examples for consumers.
Should ApiResponse include HTTP headers and status codes?
Yes—include status and a headers object if the class is used at the transport layer; otherwise keep it transport-agnostic and let the controller map to HTTP.
How do I handle validation errors consistently?
Return an error ApiResponse with a machine-friendly code, human message, and a details array that lists field errors; avoid embedding stack traces in production.