error-handling-api
Production-ready API error handling for Next.js with standardized error codes, request tracking, user-friendly messages, and automatic error wrapping.
Skill by JimmyBlanquet
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/jimmyblanquet-error-handling-api
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, backend
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. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Node.js package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/error-handling-api
What's inside
- Skill name
error-handling-api- Description
- Production-ready API error handling for Next.js with standardized error codes, request tracking, user-friendly messages, and automatic error wrapping. Type-safe responses with logging separation.
- License
- MIT
- Instructions
- 438 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Agent Skills spec issues
- files: referenced but missing: references/CUSTOM_ERROR_CLASSES.md, examples/01-basic-route.ts, examples/02-advanced-errors.ts, examples/03-protected-route.ts, examples/04-batch-operations.ts
Files (19)
- README.md
- SKILL.md
- VALIDATION.md
- advanced-patterns.ts · examples/
- basic-usage.ts · examples/
- custom-logger.ts · examples/
- nextjs-api-route.ts · examples/
- manifest.yaml
- package-lock.json
- package.json
- error-codes.ts · src/
- error-handler.ts · src/
- index.ts · src/
- types.ts · src/
- utils.ts · src/
- error-handler.test.ts · tests/
- index.test.ts · tests/
- tsconfig.json
- vitest.config.ts
SKILL.md (first lines)
# Error Handling API
Centralized error handling system for Next.js API routes with consistent responses, request tracking, and separation between user-facing messages and technical logs.
## When to Use
Use this skill when building Next.js APIs that need:
- Consistent error response format across all endpoints
- User-friendly error messages (never expose internal details)
- Request ID tracking for debugging
- Automatic error catching and logging
- Type-safe error codes and responses
- Separation between client errors (4xx) and server errors (5xx)
**Don't use this skill if:**
- You're building a simple static site without APIs
- You need GraphQL error handling (this is REST-focused)
- You're using Next.js Pages Router (this uses App Router Route Handlers)
## Stack
- Next.js 14+ (App Router Route Handlers)
- TypeScript (strict mode)
- Optional: Logging library integration (Pino, Winston, etc.)
## Quick Start
### 1. Install Skill
```bash
npm install -D @project-forge/error-handling-api
```
### 2. Create Error Codes Dictionary
```typescript
// lib/api/errors.ts
import { API_ERROR } from '@project-forge/error-handling-api'
// Use predefined errors or extend with your own
export const AppErrors = {
...API_ERROR,
CUSTOM_ERROR: {
code: 'CUSTOM_ERROR',
message: 'Your custom error message',
status: 400,
},
} as const
```
### 3. Use in API Routes
```typescript
// app/api/users/route.ts
import { apiError, apiSuccess } from '@project-forge/error-handling-api'
import { NextRequest } from 'next/server'
export async function GET(request: NextRequest) {
const userId = request.nextUrl.searchParams.get('id')
if (!userId) {
return apiError('MISSING_PARAMS')
}
const user = await db.users.findUnique({ where: { id: userId } })
if (!user) {
return apiError('NOT_FOUND')
}
return apiSuccess(user)
}
```
### 4. Wrap Routes with Error Handler
```typescript
import { withErrorHandler } from '@project-forge/error-handling-api'
export const POST = withErrorHandler(async (request) => {
// Any unhandled errors are caught and returned as 500
const data = await processData()
return apiSuccess(data)
})
```
## Key Features
### Standard Error Codes
Pre-defined error codes for common scenarios:
**Authentication (401)**
- `UNAUTHORIZED` - Authentication required
- `SESSION_EXPIRED` - Session expired, please reconnect
**Authorization (403)**
- `FORBIDDEN` - Access denied
- `RESOURCE_FORBIDDEN` - No access to this resource
**Not Found (404)**
- `NOT_FOUND` - Resource not found
- `PROFILE_NOT_FOUND`, `EMAIL_NOT_FOUND`, etc.
**Validation (400)**
- `VALIDATION_ERROR` - Invalid data
- `INVALID_PARAMS` - Invalid parameters
- `MISSING_PARAMS` - Required parameters missing
**Rate Limiting (429)**
- `RATE_LIMITED` - Too many requests
**Server Errors (500)**
- `INTERNAL_ERROR` - Internal server error
- `DATABASE_ERROR` - Database operation failed
- `SERVICE_UNAVAILABLE` - Service temporarily unavailable
### Request ID TrackingFrom JimmyBlanquet/project-forge, MIT.
More from JimmyBlanquet/project-forge
- 0.479score
ralph-agent-teams
JimmyBlanquet
Parallel implementation of Ralph++ PRD sub-stories using Claude Opus 4.6 Agent Teams.
SkillCFreshness: CClaude Code +9 - 0.476score
email-oauth-flows
JimmyBlanquet
Production-ready Gmail and Outlook OAuth integration for Next.js with Supabase.
SkillCFreshness: CClaude Code +9 - 0.476score
context-maximizer
JimmyBlanquet
Exploit the 1M token context (Opus 4.6 / Sonnet 4.6) for full codebase awareness in SpecKit.
SkillCFreshness: CClaude Code +9 - 0.476score
auth-supabase-complete
JimmyBlanquet
Production-ready Supabase authentication for Next.js 14+ with RLS patterns, session management, OAuth flows, and comprehensive testing.
SkillCFreshness: CClaude Code +9 - 0.474score
ralph-loop
JimmyBlanquet
Use when implementing features autonomously from a prd.json, spawning fresh Task agents per story with quality gates and atomic commits
SkillCFreshness: CClaude Code +9 - 0.474score
dev-pilot
JimmyBlanquet
Full autonomous pipeline orchestrator that loops over features.json and executes the complete development cycle for each feature: spec → plan → tasks →…
SkillCFreshness: CClaude Code +9 - 0.472score
effort-optimizer
JimmyBlanquet
Optimize API costs by adjusting thinking effort per task type.
SkillCFreshness: CClaude Code +9 - 0.471score
config-centralization
JimmyBlanquet
Type-safe, environment-aware configuration management for Next.js/TypeScript applications using a singleton pattern with runtime validation.
SkillCFreshness: CClaude Code +9 - 0.471score
ai-multi-provider
JimmyBlanquet
Multi-provider LLM orchestration system with intelligent routing, fallback chains, cost optimization, and automatic observability.
SkillCFreshness: CClaude Code +9 - 0.471score
logging-structured
JimmyBlanquet
Structured logging with typed contexts for Next.js applications.
SkillCFreshness: CClaude Code +9 - 0.471score
rate-limiting-persistent
JimmyBlanquet
Persistent rate limiting using PostgreSQL for atomic counters.
SkillCFreshness: CClaude Code +9 - 0.470score
speckit-archi-review
JimmyBlanquet
Run an architecture audit on the current project to detect drift, layer violations, ADR non-compliance, and technical debt.
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 2
- Last commit (this folder)
- May 10, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/JimmyBlanquet/project-forge
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from JimmyBlanquet
- 0.479score
ralph-agent-teams
JimmyBlanquet
Parallel implementation of Ralph++ PRD sub-stories using Claude Opus 4.6 Agent Teams.
SkillCFreshness: CClaude Code +9 - 0.476score
auth-supabase-complete
JimmyBlanquet
Production-ready Supabase authentication for Next.js 14+ with RLS patterns, session management, OAuth flows, and comprehensive testing.
SkillCFreshness: CClaude Code +9 - 0.476score
email-oauth-flows
JimmyBlanquet
Production-ready Gmail and Outlook OAuth integration for Next.js with Supabase.
SkillCFreshness: CClaude Code +9 - 0.476score
context-maximizer
JimmyBlanquet
Exploit the 1M token context (Opus 4.6 / Sonnet 4.6) for full codebase awareness in SpecKit.
SkillCFreshness: CClaude Code +9 - 0.474score
dev-pilot
JimmyBlanquet
Full autonomous pipeline orchestrator that loops over features.json and executes the complete development cycle for each feature: spec → plan → tasks →…
SkillCFreshness: CClaude Code +9 - 0.474score
ralph-loop
JimmyBlanquet
Use when implementing features autonomously from a prd.json, spawning fresh Task agents per story with quality gates and atomic commits
SkillCFreshness: CClaude Code +9
Cite this page
error-handling-api skill. Agent Mart. https://agentmart.dev/skills/jimmyblanquet-error-handling-api (last updated 2026-10-24)