Skip to content
Back to skills

Api Patterns

ASecurity

Connect Query patterns for API calls. Use when working with mutations, queries, or data fetching.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
developmenttypescriptreactapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill api-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Api Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Api Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-api-patterns/badge)](https://www.skillsdirectory.com/skills/david-li0406-api-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: api-patterns
description: Connect Query patterns for API calls. Use when working with mutations, queries, or data fetching.
---

# API Patterns

Make API calls with Connect Query and handle responses properly.

## Activation Conditions

- Making API calls
- Using Connect Query hooks
- Cache invalidation
- Mutations and optimistic updates
- Toast notifications for errors

## Quick Reference

| Action | Rule |
|--------|------|
| Fetch data | `use-connect-query.md` |
| After mutation | `api-invalidate-cache.md` |
| Handle errors | `api-toast-errors.md` (use `formatToastErrorMessage` in onError) |
| Protobuf files | `protobuf-no-edit.md` |

## Key Locations

| Location | Purpose |
|----------|---------|
| `/src/react-query/` | Connect Query hooks |
| `/src/protogen/` | Generated protos (DO NOT EDIT) |

Regenerate protos: `task proto:generate` (from repo root)

## Basic Patterns

### Query

```typescript
import { useQuery } from '@connectrpc/connect-query';
import { getUser } from 'protogen/user-UserService_connectquery';

const { data, isLoading, error } = useQuery(
  getUser,
  { id: userId },
  { enabled: !!userId }
);
```

### Mutation

```typescript
import { useMutation } from '@connectrpc/connect-query';
import { createUser } from 'protogen/user-UserService_connectquery';

const mutation = useMutation(createUser, {
  onSuccess: () => {
    queryClient.invalidateQueries({ queryKey: ['getUser'] });
  },
});

mutation.mutate({ name, config });
```

## Rules

See `rules/` directory for detailed guidance.

Files in this skill

  • SKILL.md1.5 KB
  • rules/api-invalidate-cache.md2.3 KB
  • rules/api-toast-errors.md1.8 KB
  • rules/protobuf-no-edit.md1.7 KB
  • rules/use-connect-query.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…