api-organization

Organize API layers using a 5-file TypeScript pattern with role-based access.

Updated Nov 10, 2025
One-click install
npx skills add https://github.com/BOM-98/FinTracker --skill api-organization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-organization
Source: https://github.com/BOM-98/FinTracker/tree/main/.claude/skills/api-organization
Command: npx skills add https://github.com/BOM-98/FinTracker --skill api-organization

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Inconsistent API integration leads to fragmented code, type errors, and security vulnerabilities. This skill provides a rigid, 5-file standardized pattern for organizing all API interactions, ensuring type safety, role-based access control, and maintainability across the codebase.

Core Features & Use Cases

  • 5-File System: Enforces a clear structure for types (endpoint-types.ts), URLs (endpoints.ts), generic clients (api-client.ts), admin clients (admin-api-client.ts), and protected wrappers (protected-endpoints.ts).
  • Type-Safe API: Guarantees full TypeScript coverage from request parameters to response data, reducing runtime errors and improving developer experience.
  • Role-Based Access: Integrates Supabase Auth for automatic authentication and explicit admin-only access patterns, enhancing security and control.
  • Use Case: When adding a new feature that requires interacting with a backend API, use this skill to define the new endpoints, types, and client wrappers, ensuring they conform to the project's strict API standards.

Quick Start

Define new API types for a 'products' resource, including list, get, create, update, and delete operations, following the 5-file API organization pattern.

Frequently Asked Questions about api-organization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I organize API endpoints with type safety across my TypeScript backend?

Standardize API organization using a 5-file system: endpoint-types.ts for type definitions, endpoints.ts for URL constants, api-client.ts for generic client logic, admin-api-client.ts for privileged access, and protected-endpoints.ts for role-based wrappers. This enforces end-to-end TypeScript typing and centralizes authentication.

Can I implement role-based access control for REST APIs with Supabase Auth?

Yes. Use the 5-file API organization pattern with Supabase Auth integration to automatically authenticate requests and enforce admin-only access through protected endpoint wrappers, separating regular user and admin client logic.

What's the best way to avoid duplicated API URLs and client logic in a TypeScript project?

Apply the standardized 5-file API pattern: centralize all URLs in endpoints.ts, define shared types in endpoint-types.ts, and build reusable generic clients in api-client.ts. This creates a single source of truth and eliminates code duplication across the codebase.

How do I ensure consistency when adding new API endpoints to an existing backend?

Follow the rigid 5-file system structure for every new endpoint: define types, add URL constants, extend the generic client, update admin variants if needed, and wrap with role-based protection. This maintains consistency and prevents fragmented integration patterns.

Do I need a centralized API client architecture for backend integration with REST APIs?

For maintainability at scale, yes. A centralized 5-file architecture reduces runtime errors, enforces role-based access, ensures DRY code, and provides a single integration point for all API interactions—critical when managing multiple endpoints and user roles.

What are the limitations of strict API organization patterns for rapid prototyping?

Rigid 5-file structures impose upfront overhead and may feel verbose for simple one-off endpoints. However, this trades short-term speed for long-term security, type safety, and maintainability—best for projects prioritizing consistency over quick iteration.