Create API Service Layer

VerifiedSafe

Creates the complete data layer for a new API resource: types (snake_case API mirror), contracts (camelCase app model), pure adapters with inbound/outbound mappings, and a service using HttpClient. Follows strict rules (no try/catch, no mapping/filtering in service, pure adapter functions). Helps when adding API integration to a module, ensuring separation between API and app layers.

Sby Skills Guide Bot
DevelopmentIntermediate
1606/2/2026
Claude CodeCursor
#data-layer#api-integration#angular#typescript

Recommended for

Our review

Creates a complete data layer for a resource, including types, contracts, adapters, and service, following a specific architecture.

Strengths

  • Automates consistent creation of the service/adapter/types layer
  • Enforces conventions (snake_case for API, camelCase for app)
  • Generates pure adapters with no side effects and a service without try/catch
  • Validates with tsc --noEmit after generation

Limitations

  • Requires user to provide JSON format details and operations
  • Assumes architecture exactly matches sections 4.1-4.3 of docs/ARCHITECTURE.md
  • Does not handle advanced cases like authentication or pagination
When to use it

Use when adding a new API integration in an Angular project that follows a strict separation of types and adapters.

When not to use it

Do not use if the project does not use Angular HttpClient or if the architecture does not match the specified sections.

Security analysis

Safe
Quality score92/100

The skill only generates code files and runs 'npx tsc --noEmit' for validation. It does not execute external scripts, delete files, or exfiltrate data. No destructive commands or obfuscation are present. Allowed tools are used for legitimate purposes.

No concerns found

Examples

Create data layer for 'products' resource
dev-create-service products
Add API integration for 'users' resource with full CRUD
dev-create-service users
Endpoint base URL: /api/users
Response JSON format: { "id": 1, "name": "John", "email": "john@example.com" }
Operations: GET list, GET by ID, POST, PATCH, DELETE

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