Create API Service Layer

VerifiedSafe

Creates types, contracts, adapter, and service layer for a resource following the project's architecture (sections 4.1-4.3). Use when adding API integration to a module. It asks for endpoint details and generates the full data layer with strict separation between API types and app contracts.

Sby Skills Guide Bot
DevelopmentIntermediate
806/2/2026
Claude Code
#api-integration#data-layer#types#adapters#services

Recommended for

Our review

Creates the complete data layer (types, contracts, adapter, and service) for an API resource following the project's architecture.

Strengths

  • Enforces separation of concerns
  • Generates consistent, reusable code
  • Includes TypeScript validation
  • Follows defined architecture

Limitations

  • Requires clear API specification from user
  • May not handle complex nested data
  • Assumes Angular-style HTTP client
When to use it

When adding a new API integration to an Angular application following the project's architecture.

When not to use it

When the project does not use these layers or when a simple fetch is sufficient.

Security analysis

Safe
Quality score85/100

The skill generates TypeScript source files based on user input and runs a non-destructive TypeScript compilation check. It does not execute external commands, download scripts, or access sensitive data. All tools used (Read, Write, Edit, Bash for tsc, Glob, Grep) are for legitimate local code generation and validation.

No concerns found

Examples

Add user API integration
Use dev-create-service for User resource. Endpoint: /api/users, response: { id: number, name: string, email: string }. Operations: GET list, GET by ID, POST.
Add product API integration
Create service for Product. Base URL: /api/products. Response: { id: number, title: string, price: number, category: string }. Operations: GET list, GET by ID, PATCH, DELETE.
Add orders API integration
Add data layer for Order resource. Endpoint: /api/orders. Response: { id: number, customer_id: number, items: { product_id: number, quantity: number }[], status: string }. Operations: GET list, POST.

name: dev-create-service description: "Use when adding API integration to a module - creates types, contracts, adapter, and service layer." user-invocable: true argument-hint: "[resource-name]" allowed-tools: Read, Write, Edit, Bash, Glob, Grep

Create the complete data layer for a resource following docs/ARCHITECTURE.md sections 4.1-4.3.

Resource: $ARGUMENTS

Steps

  1. Read docs/ARCHITECTURE.md sections 4.1 (Services), 4.2 (Adapters), 4.3 (Types).

  2. Ask the user:

    • What is the endpoint base URL? (e.g. /api/marketplace)
    • What is the response JSON format? (ask for an example or describe the fields)
    • Which operations? (GET list, GET by ID, POST, PATCH, DELETE)
  3. Create in order:

    a. types/[resource].types.ts -- mirrors API exactly (snake_case) b. types/[resource].contracts.ts -- app contract (camelCase, correct types) c. adapters/[resource].adapter.ts -- inbound (API->App) + outbound (App->API) d. services/[resource].service.ts -- HttpClient only, inject(HttpClient), @Injectable({ providedIn: 'root' })

  4. Required rules:

    • Service: NO try/catch, NO .map()/.filter()/new Date()
    • Adapter: pure functions, no side effects
    • Types separated: .types.ts (API) != .contracts.ts (App)
  5. Validate: npx tsc --noEmit

Related skills