Unnamed Skill
Create or modify API endpoints in IdeaForge backend. Triggers: new route, controller, service, repository, CRUD operation, Zod validation, API debugging. Pattern: Routes → Controller → Service → Repository.
$ 설치
git clone https://github.com/Holo00/IdeaForge /tmp/IdeaForge && cp -r /tmp/IdeaForge/.claude/skills/api-endpoint ~/.claude/skills/IdeaForge// tip: Run this command in your terminal to install the skill
SKILL.md
name: api-endpoint description: Create or modify API endpoints in IdeaForge backend. Triggers: new route, controller, service, repository, CRUD operation, Zod validation, API debugging. Pattern: Routes → Controller → Service → Repository.
API Endpoints
Architecture
Route (backend/src/api/routes/) → DI setup + routing
Controller (backend/src/api/controllers/) → Zod validation + ApiResponse
Service (backend/src/services/) → Business logic
Repository (backend/src/repositories/) → Database queries
Quick Start
1. Route (routes/{resource}.ts)
import { Router } from 'express';
const router = Router();
// Manual DI
const repo = new MyRepository();
const service = new MyService(repo);
const controller = new MyController(service);
router.get('/', (req, res, next) => controller.getAll(req, res, next));
router.post('/', (req, res, next) => controller.create(req, res, next));
export default router;
2. Controller (controllers/{resource}Controller.ts)
const CreateSchema = z.object({
name: z.string().min(1).max(255),
});
export class MyController {
constructor(private service: MyService) {}
async create(req: Request, res: Response, next: NextFunction) {
try {
const data = CreateSchema.parse(req.body);
const result = await this.service.create(data);
res.json({ success: true, data: result } as ApiResponse<typeof result>);
} catch (error) {
next(error);
}
}
}
3. Register (index.ts)
import myRouter from './api/routes/my';
app.use('/api/my-resource', myRouter);
Response Format
// Success
{ success: true, data: { ... } }
// Error (via errorHandler middleware)
{ success: false, error: { message: "...", code: "ERROR_CODE" } }
Rules
- Controllers: validation + response only
- Services: all business logic
- Always use
ApiResponse<T>wrapper - Always
next(error)- never catch and format - Zod for all input validation
- Manual DI in route files
Repository

Holo00
Author
Holo00/IdeaForge/.claude/skills/api-endpoint
0
Stars
0
Forks
Updated3h ago
Added1w ago