spoosh-angularlisted
Install: claude install-skill spooshdev/skills
# Spoosh Angular
Spoosh is a type-safe API toolkit with a composable plugin architecture for TypeScript. This skill covers the Angular integration using signals including inject functions API, plugins, and component patterns.
## Setup
```bash
pnpm add @spoosh/core @spoosh/angular
```
```typescript
import { Spoosh } from "@spoosh/core";
import { create } from "@spoosh/angular";
type ApiSchema = {
users: {
GET: { data: User[] };
POST: { data: User; body: CreateUserBody };
};
"users/:id": {
GET: { data: User };
DELETE: { data: void };
};
};
const spoosh = new Spoosh<ApiSchema, Error>("/api").use([
cachePlugin(),
retryPlugin(),
]);
export const { injectRead, injectWrite, injectPages, injectQueue } =
create(spoosh);
```
## Inject Functions API
### injectRead
Fetch data with automatic caching and state management. Returns signals.
```typescript
const users = injectRead((api) => api("users").GET(), {
staleTime: 30000,
enabled: true,
});
```
**Returns (all signals except methods):** `data`, `loading`, `fetching`, `error`, `trigger()`, `abort()`, `meta`
**Options:** `enabled` (supports Signal or function), `tags`, `staleTime`, `retry`, `pollingInterval`, `refetch`, `debounce`, `transform`, `initialData`
### injectWrite
Perform mutations (POST, PUT, DELETE). Returns signals.
```typescript
const createUser = injectWrite((api) => api("users").POST());
// Invalidation is AUTOMATIC - no need to specify in most cases!
await createUser.trigg