From server-side-swift
Plan, implement, test, and diagnose app sync contracts in server-side Swift services, including incremental change feeds, cursor or token semantics, idempotent writes, conflict handling, optimistic concurrency, deleted-record/tombstone behavior, background job handoffs, API-shape coordination, and Vapor or Hummingbird integration.
How this skill is triggered — by the user, by Claude, or both
Slash command
/server-side-swift:app-sync-workflowThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Design, implement, test, or diagnose server-side sync behavior without mixing the sync contract into unrelated routing, persistence, OpenAPI, RPC, auth, or background-job work.
Design, implement, test, or diagnose server-side sync behavior without mixing the sync contract into unrelated routing, persistence, OpenAPI, RPC, auth, or background-job work.
The practical decision is how clients and the server agree on state over time: what changed, what the client has already seen, how writes avoid duplication, how conflicts are detected, how deletions are represented, and how both sides recover after retries, offline edits, or partial failure.
Use repo-local Swift files, checked-out dependency sources, Dash MCP or Dash HTTP for installed Swift package DocC, and then official docs or source when Dash/local coverage is missing or stale. Check one of those source-specific paths before claiming framework, protocol, or HTTP behavior:
Use OpenAPI, RPC, persistence, auth, observability, deployment, or Apple-platform docs when the sync design depends on generated contracts, transport semantics, schema, identity, logging, background jobs, deployment guarantees, or client behavior.
Package.swiftKeep sync contracts boring and explicit.
Name:
Do not expose database row order as the sync order unless it is intentionally stable, indexed, and documented.
Opaque cursors are usually safer than client-parsed cursors because the server can evolve internal ordering. If cursors expire, define the exact restart behavior.
Assume clients, proxies, and background tasks may retry after timeouts or network loss.
For write APIs:
Do not rely on clients "not retrying" as a correctness rule.
A conflict exists when a client writes based on state the server no longer accepts.
Use a clear mechanism:
Return conflict information that lets the client decide what to do next without leaking data from resources the actor cannot access.
Use 409 Conflict for domain conflicts and 412 Precondition Failed for failed HTTP preconditions when the API uses conditional request semantics. Keep the repository's existing status-code style when it already documents one.
Deleted state must be syncable.
Decide:
Do not hard-delete records from sync history before all active clients can learn about the deletion unless the app has a full-resync fallback.
Use background jobs when sync writes trigger expensive side effects that should not block the request.
Use streaming, WebSockets, or server-sent events only when polling or ordinary incremental sync is not enough. Streaming transports still need replay or catch-up behavior after disconnects.
Hand transport-specific decisions to openapi-rpc-workflow when the main question is API style, generated contracts, JSON-RPC, gRPC, MCP-style tools, WebSockets, or plain HTTP.
Use persistence-workflow when the main risk is schema, indexes, migrations, query performance, or transaction boundaries.
Every sync query and write must be scoped to the authenticated actor and tenant.
Test:
Use auth-authorization-workflow for identity and policy design.
Use observability-tracing-workflow for safe sync diagnostics, including cursor names, page counts, operation IDs, conflict counts, retry counts, and latency. Do not log raw cursors if they contain sensitive state.
Choose tests that prove sync correctness:
Prefer deterministic fixtures with explicit clocks, IDs, and revision values when the repository's test setup allows it.
Use vapor-server-workflow or hummingbird-server-workflow for framework route, middleware, request context, and handler structure.
Use openapi-rpc-workflow when the sync API contract, generated types, or transport style is the primary work.
Use persistence-workflow for models, migrations, query design, transactions, indexes, and data-retention behavior.
Use auth-authorization-workflow for identity, tenant scoping, permissions, tokens, and session behavior.
Use observability-tracing-workflow for logs, metrics, traces, conflict counters, and privacy-safe diagnostics.
Use deployment skills when background workers, queue processes, or hosted runtime config must be deployed.
Return:
Sync shape: resources, routes or transport, cursor, ordering, idempotency, conflict model, delete model, jobs, auth scope, and tests.Docs used: HTTP, Vapor, Hummingbird, OpenAPI/RPC, persistence, auth, observability, jobs, deployment, or Apple-platform docs consulted.Behavior: fetch, write, retry, conflict, delete, pagination, retention, authorization, and background work.Command path: exact build, test, migrate, run, job, or HTTP commands run or recommended.Validation: tests, migration checks, manual HTTP checks, job checks, or diagnostic evidence.Handoffs: framework, OpenAPI/RPC, persistence, auth, observability, background jobs, deployment, or client follow-up when the task crosses this skill's boundary.npx claudepluginhub gaelic-ghost/socket --plugin server-side-swiftCreates, edits, and verifies skills using a test-driven development approach with pressure scenarios and subagents.