alekspetrov/navigator/backend-endpoint
Claude Code and agent skill by alekspetrov/navigator
- community
Checking that the SKILL.md file is still in the repository.
Create REST/GraphQL API endpoint with validation, error handling, and tests. Auto-invoke when user says "add endpoint", "create API", "new route", or "add route".
Install
npx vskill@latest install alekspetrov/navigator/backend-endpointSKILL.md
Backend API Endpoint Generator
Generate production-ready REST or GraphQL endpoints with request validation, error handling, and comprehensive tests.
When to Invoke
Auto-invoke when user mentions:
- "Add endpoint"
- "Create API"
- "New route"
- "Add route"
- "Create API endpoint for [resource]"
What This Does
- Generates route handler with proper HTTP methods
- Adds request validation (body, params, query)
- Implements error handling
- Creates test file with request/response tests
- Follows REST/GraphQL conventions
- Includes authentication middleware (if needed)
Execution Steps
Step 0: Check Existing Patterns (Phase 0)
Before gathering requirements, query the knowledge graph for what we already know about API/endpoint work in this project. Mirrors navigator-research's Phase 0.
Also check authentication, validation, and security if the endpoint touches those areas.
If memories surface (PATTERN, PITFALL, DECISION entries), read the full memory files for relevant ones:
What to do with what you find:
- Patterns: apply them (e.g. "we use Zod for validation, not Joi")
- Pitfalls: avoid them (record in
pitfalls_avoidedin Step 8) - Decisions: respect them (e.g. "we return 404 over 422 for missing resources")
If the graph returns nothing useful, proceed without it. Skip this step only if the knowledge graph is disabled in .agent/.nav-config.json.
Step 1: Gather Endpoint Requirements
Ask user for endpoint details:
Validate endpoint path:
- Use predefined function:
functions/route_validator.py - Ensure RESTful conventions
- Check path parameters syntax
- No trailing slashes
Step 1.5: Verify Understanding (ToM Checkpoint) [EXECUTE]
IMPORTANT: This step MUST be executed for high-stakes operations.
Before generating code, confirm interpretation with user.
Display verification:
Skip verification if (HIGH-STAKES ONLY mode):
- Simple CRUD operation (single resource, single path parameter)
- User explicitly said "quick", "just do it", or "skip confirmation"
- No custom authentication logic specified
- Standard GET/POST/PUT/DELETE without complex business logic
Always verify if:
- Multiple path parameters (e.g.,
/users/:userId/posts/:postId) - Custom authorization logic specified
- Non-standard HTTP methods or patterns
- GraphQL mutations with side effects
- Endpoints involving financial or sensitive data
Step 1.8: Declare Belief State (Optional - ToM Anchor)
Before generating code, optionally declare explicit assumptions (enabled by tom_features.belief_anchors in config).
Display belief state anchor:
Skip belief anchor if:
tom_features.belief_anchorsis false in config- User said "skip", "just do it", "quick"
- Simple endpoint with no custom logic
Show belief anchor if:
- Complex endpoint with multiple integrations
- User profile indicates preference for detailed explanations
- First endpoint in a new project (establishing patterns)
Step 2: Generate Route Handler
Based on HTTP method and framework:
Use predefined function: functions/endpoint_generator.py
Template includes:
- Route definition
- Request validation middleware
- Controller/handler function
- Error handling
- Response formatting
- TypeScript types
Step 3: Generate Validation Schema
Use predefined function: functions/validation_generator.py
Supported validation libraries:
- Zod (default, TypeScript-first)
- Joi (JavaScript schema)
- Yup (object schema)
- Express-validator (middleware-based)
Output example (Zod):
Step 4: Generate Error Handling Middleware
Write the error handler inline (no generator script ships for this — author it directly to match the project's existing error-handling pattern).
Write to src/middleware/errorHandler.ts an error handler that includes:
- HTTP status code mapping
- Error response formatting
- Logging integration
- Development vs production modes
- Validation error handling
Follow the framework's idiom (Express error middleware (err, req, res, next); Next.js route-level try/catch returning NextResponse.json).
Step 5: Generate Test File
Write the test inline, using templates/endpoint-test-template.spec.ts as the reference shape (it ships as a reference template; no generator script drives it). Output to tests/routes/users.test.ts.
The test should cover:
- Success case (200/201)
- Validation errors (400)
- Not found (404)
- Unauthorized (401)
- Server errors (500)
- Edge cases
Example test:
Step 6: Generate API Documentation Comment
JSDoc or OpenAPI annotation:
Step 7: Show Endpoint Summary
Display generated files and usage:
Step 8: Emit Execution Summary (Graph Ingestion)
After Step 7, emit an execution_summary JSON block. This is the parity equivalent of the research_findings block emitted by navigator-research, ingested into the knowledge graph so future endpoint work can surface what we learned.
Output the block verbatim (replace placeholders with actual values):
Ingestion (run from project root):
Rules:
- Only include non-obvious entries — empty/trivial blocks pollute the graph.
- Skip the entire block if there's nothing notable to record.
- Confidence ≥ 0.7 for first-hand execution; 0.75 is a reasonable default.
Predefined Functions
1. route_validator.py
Validates route path follows REST conventions.
Usage:
Checks:
- RESTful naming (plural resources)
- Path parameter syntax (
:idor{id}) - No trailing slashes
- HTTP method matches intent
Returns: Valid path or error message
2. endpoint_generator.py
Generates endpoint handler from template.
Usage:
Parameters:
--path: API endpoint path--method: HTTP method--resource: Resource name (singular, PascalCase)--framework: Backend framework--auth: Include auth middleware--validation: Include validation middleware--template: Template file path
Returns: Generated endpoint code
3. validation_generator.py
Generates request validation schema.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/backend-endpoint/SKILL.md
Popularity
- Repository stars
- 161
- Repository forks
- 8
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 9 Apr 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/alekspetrov/navigator/backend-endpoint)