Files
claude-howto/03-memory/directory-api-CLAUDE.md
Luong NGUYEN 7db5ade777 Initial commit: Claude How To project
Added comprehensive examples for Claude Code features including slash commands, subagents, memory, MCP protocol, skills, and plugins with documentation and quick reference guides.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 00:09:21 +01:00

1.3 KiB

API Module Standards

This file overrides root CLAUDE.md for everything in /src/api/

API-Specific Standards

Request Validation

  • Use Zod for schema validation
  • Always validate input
  • Return 400 with validation errors
  • Include field-level error details

Authentication

  • All endpoints require JWT token
  • Token in Authorization header
  • Token expires after 24 hours
  • Implement refresh token mechanism

Response Format

All responses must follow this structure:

{
  "success": true,
  "data": { /* actual data */ },
  "timestamp": "2025-11-06T10:30:00Z",
  "version": "1.0"
}

Error responses:

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "User message",
    "details": { /* field errors */ }
  },
  "timestamp": "2025-11-06T10:30:00Z"
}

Pagination

  • Use cursor-based pagination (not offset)
  • Include hasMore boolean
  • Limit max page size to 100
  • Default page size: 20

Rate Limiting

  • 1000 requests per hour for authenticated users
  • 100 requests per hour for public endpoints
  • Return 429 when exceeded
  • Include retry-after header

Caching

  • Use Redis for session caching
  • Cache duration: 5 minutes default
  • Invalidate on write operations
  • Tag cache keys with resource type