hive-endpoint
How to create API endpoints in Hive framework
Best use case
hive-endpoint is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
How to create API endpoints in Hive framework
Teams using hive-endpoint should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/hive-endpoint/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How hive-endpoint Compares
| Feature / Agent | hive-endpoint | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
How to create API endpoints in Hive framework
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Creating Endpoints
Location: `/src/resources/{name}/endpoints/{action}.js`
## Template (4 Required Exports)
```javascript
import { z } from 'zod';
import db from 'db';
const myService = db.services.myResource;
export const handler = async (ctx) => {
const { param } = ctx.validatedData;
// Logic here
return { result: 'data' };
};
export const middlewares = [];
export const endpoint = {
url: '/',
method: 'get',
};
export const requestSchema = z.object({
param: z.coerce.string().nullable().optional(),
});
```
## Handler Context (ctx)
```javascript
ctx.validatedData // Validated input (body + query + params)
ctx.state.user // Authenticated user
ctx.params // URL params
ctx.throw(404, 'msg') // Throw error
ctx.assert(cond, 400) // Assert or throw
```
## Common Patterns
**List:**
```javascript
export const handler = async (ctx) => {
const { page, perPage } = ctx.validatedData;
const { results, count } = await service.find(
{ 'user._id': ctx.state.user._id },
{ page, perPage, sort: '-createdOn' }
);
return { results, count };
};
export const endpoint = { url: '/', method: 'get' };
```
**Create:**
```javascript
export const handler = async (ctx) => {
const doc = await service.create({
...ctx.validatedData,
user: ctx.state.user,
});
return doc;
};
export const endpoint = { url: '/', method: 'post' };
```
**Update:**
```javascript
export const handler = async (ctx) => {
const { id, title } = ctx.validatedData;
return await service.updateOne({ _id: id }, (doc) => ({ ...doc, title }));
};
export const endpoint = { url: '/:id', method: 'put' };
```
## Middlewares
```javascript
// By name
export const middlewares = ['allowNoAuth'];
// With args
export const middlewares = [{ name: 'shouldExist', args: ['projects'] }];
// Direct function
import canEditProject from 'middlewares/canEditProject';
export const middlewares = [canEditProject((ctx) => ctx.params.projectId)];
```
## Public Endpoint (No Auth)
```javascript
export const middlewares = ['allowNoAuth'];
```Related Skills
hive-scheduler
How to create scheduled jobs in Hive framework
hive-overview
Hive framework structure and conventions. Apply when working with this codebase.
hive-mapping
Schema mappings for auto-syncing embedded documents
hive-handler
How to create event handlers in Hive framework
hive-credentials
Set up and install credentials for an agent. Detects missing credentials from agent config, collects them from the user, and stores them securely in the local encrypted store at ~/.hive/credentials.
file-archiver
创建和解压ZIP、TAR和GZIP压缩包,支持密码保护。
chatgpt-archive-topic-background-report
Build a topic-focused research collection from ChatGPT archive viewer conversations (latest archive or all archives), run a background Responses API consolidation job with web search, and save markdown plus raw response artifacts. Use when the user asks to find archive threads by topic, reconcile repetition/contradictions, and generate a saved report with minimal polling noise.
api-endpoint
Create REST or GraphQL API endpoints with proper validation, error handling, authentication, and documentation. Use when building backend APIs or serverless functions.
hive-mind-advanced
Advanced Hive Mind collective intelligence system for queen-led multi-agent coordination with consensus mechanisms and persistent memory
github-archive
Investigate GitHub security incidents using tamper-proof GitHub Archive data via BigQuery. Use when verifying repository activity claims, recovering deleted PRs/branches/tags/repos, attributing actions to actors, or reconstructing attack timelines. Provides immutable forensic evidence of all public GitHub events since 2011.
archive
Archive completed task/spec work to ./.gtd/archive/
archive-work
Archive completed scratchpads and session logs to project history. Invoke when user says "archive this work", "clean up scratchpad", "archive scratchpad", or after PR is merged.