frontend-patterns
Frontend patterns — debounce, double-submit prevention, error boundaries.
Skill by Dev-Toolbelt
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/dev-toolbelt-frontend-patterns
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: frontend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/frontend-patterns
What's inside
- Skill name
frontend-patterns- Description
- Frontend patterns — debounce, double-submit prevention, error boundaries.
- License
- MIT
- Instructions
- 71 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
## Interaction Patterns
### Debounce
Apply debounce whenever user input triggers expensive side effects (API calls, heavy computation). Without it, every keystroke fires a request — degrading both UX and server load.
**When to use**: search/autocomplete inputs, address or tag lookup, form field validation against an API, resize/scroll event handlers.
**Framework-agnostic pattern** (adapt to the project's stack):
```ts
// Reusable debounce utility — use lodash.debounce, use-debounce, or VueUse's useDebounceFn
function debounce<T extends (...args: unknown[]) => void>(fn: T, delay: number): T {
let timer: ReturnType<typeof setTimeout>
return ((...args) => { clearTimeout(timer); timer = setTimeout(() => fn(...args), delay) }) as T
}
// Autocomplete example
const searchUsers = debounce(async (query: string) => {
if (query.length < 2) return
results.value = await api.users.search(query)
}, 300)
```
**Rules**:
- 150–300 ms is the standard delay for search inputs; 500 ms+ for validation-only fields
- Cancel in-flight requests when a new debounced call fires (use `AbortController`)
- Clear the debounce timer on component teardown to prevent stale state updates
### Double Submission Prevention
Every form submit or action button must be guarded against duplicate submissions. Two clicks = two POST requests = corrupted data, duplicate payments, or duplicate records.
**Rules**:
- Track a boolean `isSubmitting` state; set it `true` on submission start, `false` on completion (success or error)
- Disable the submit button while `isSubmitting` is `true` — never just rely on UX
- The handler must bail early if already in flight:
```ts
// Framework-agnostic guard
async function handleSubmit() {
if (isSubmitting) return // ← guard: bail on double-click
isSubmitting = true
try {
await api.createOrder(payload)
} finally {
isSubmitting = false // ← always release, even on error
}
}
```
- Use `finally` (or equivalent) — releasing the lock only on success is a common bug that permanently disables the form after an error
- For idempotency-critical operations (payments, order placement), also pass an idempotency key from the backend side
---
## Error Boundaries & Global Error Handling
A runtime error in one component must not crash the entire UI. Wrap every route/page-level component in an error boundary that shows a user-facing fallback.
- **React**: class component with `componentDidCatch`, or `react-error-boundary` (`<ErrorBoundary FallbackComponent={...}>`)
- **Vue**: `onErrorCaptured` in a wrapper component, or `app.config.errorHandler` for global handling
- **Angular**: implement `ErrorHandler` and provide it at the root level (`{ provide: ErrorHandler, useClass: AppErrorHandler }`)
- **Svelte**: `<svelte:boundary>` (Svelte 5) or a wrapper component with `onerror`
**Rules:**
- Place boundaries at the **route/page level** at minimum — a broken widget must not take down the entire app
- Always show a user-facing fallback — never a blank screen or a raw JS stack trace
- Register a global `window.addEventListener('unhandledrejection', ...)` to catch uncaught promise rejections and forward them to the project's error tracking service (Sentry, Datadog, etc.)
- **Never swallow errors silently** — catching without logging or reporting creates invisible bugsFrom Dev-Toolbelt/dev-team-agents, MIT.
More from Dev-Toolbelt/dev-team-agents
- 0.623score
design-patterns
Dev-Toolbelt
Design patterns — KISS, YAGNI, DRY, SOLID, GoF, DDD reference.
SkillAFreshness: A★ 7Claude Code +9 - 0.620score
graphql
Dev-Toolbelt
GraphQL — schema, resolvers, N+1/DataLoader, pagination.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
api-design
Dev-Toolbelt
REST/GraphQL design — naming, status codes, pagination, idempotency.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
api-versioning
Dev-Toolbelt
API versioning — compatibility rules and deprecation lifecycle.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
architecture-docs
Dev-Toolbelt
Where architecture documents live, what each contains, and the conformance report format.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
async-jobs
Dev-Toolbelt
Async jobs — idempotency, retry strategy, DLQ, observability.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
i18n
Dev-Toolbelt
i18n/l10n — locale detection, translations, pluralization, RTL.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
component-patterns
Dev-Toolbelt
Component patterns — container/presentational for React/Vue/Angular.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
css-quality
Dev-Toolbelt
CSS quality — specificity, magic numbers, responsive.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
data-fetching-integrity
Dev-Toolbelt
Detect and prevent duplicate/redundant API calls in SPA/SSG frontends — tool-agnostic.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
event-driven
Dev-Toolbelt
Event-driven — sourcing, CQRS, saga, idempotency, schema registry.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
frontend-code-quality
Dev-Toolbelt
Base frontend code quality rules — component size, state, a11y, performance, type safety.
SkillAFreshness: A★ 7Claude Code +9
Signals
- Stars
- 7
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 18, 2026 (10 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/Dev-Toolbelt/dev-team-agents
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Dev-Toolbelt
- 0.623score
design-patterns
Dev-Toolbelt
Design patterns — KISS, YAGNI, DRY, SOLID, GoF, DDD reference.
SkillAFreshness: A★ 7Claude Code +9 - 0.620score
graphql
Dev-Toolbelt
GraphQL — schema, resolvers, N+1/DataLoader, pagination.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
api-design
Dev-Toolbelt
REST/GraphQL design — naming, status codes, pagination, idempotency.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
architecture-docs
Dev-Toolbelt
Where architecture documents live, what each contains, and the conformance report format.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
async-jobs
Dev-Toolbelt
Async jobs — idempotency, retry strategy, DLQ, observability.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
api-versioning
Dev-Toolbelt
API versioning — compatibility rules and deprecation lifecycle.
SkillAFreshness: A★ 7Claude Code +9
Cite this page
frontend-patterns skill. Agent Mart. https://agentmart.dev/skills/dev-toolbelt-frontend-patterns (last updated 2026-10-24)