# API Patterns

> API Patterns is an Agent Skill for development published in the redpanda-data/console repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

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

- Skill name: `api-patterns`
- Category: [Development](https://www.openparable.com/skill/development/1)
- Source: https://github.com/redpanda-data/console/blob/HEAD/frontend/.claude/skills/api-patterns/SKILL.md
- Repository: redpanda-data/console (4,304 GitHub stars when collected)

## SKILL.md

# 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)

## Rules

See `rules/` directory for detailed guidance on queries, mutations, cache invalidation, and error handling.

---

Source: https://www.openparable.com/skill/development/api-patterns (OpenParable). Cite the canonical URL above.
