agentleFS
3akat-system3akat-system/nexus-starter/.claude/skills/api-scaffold/SKILL.md

api-scaffold

Skill0 starsChanged 6 months agoMITView on GitHub

REST API scaffolding for Node.js/Express. TRIGGER when: создать API, create API, новый REST эндпоинт, new REST endpoint, scaffold endpoint, CRUD операции, CRUD operations, создать роут с авторизацией, create route with auth, API endpoint с валидацией, API endpoint with validation, создать маршрут для, create route for, сделать API для, build API for. Contains: Express route template, auth middleware, validation, error handling, CRUD pattern.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. xmqywx/claude-code-skills★ 2same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository15 other files it gives its agents.

The file

Files
SKILL.md

API Scaffold — Quick Endpoint Starter

Inspired by: wshobson/commands api-scaffold — adapted for Fuji-master / PlusOne stack

Route Template (create in server/routes/)

// server/routes/items.js
const express = require('express');
const router = express.Router();
const { pool } = require('../db');
const auth = require('../middleware/auth'); // JWT check

// GET /api/items — list
router.get('/', auth, async (req, res) => {
  try {
    const userId = req.user.id;
    const { rows } = await pool.query(
      'SELECT * FROM items WHERE user_id = $1 ORDER BY created_at DESC',
      [userId]
    );
    res.json(rows);
  } catch (err) {
    console.error('GET /items error:', err);
    res.status(500).json({ error: 'Server error' });
  }
});

// POST /api/items — create
router.post('/', auth, async (req, res) => {
  try {
    const { name, description } = req.body;
    if (!name) return res.status(400).json({ error: 'name is required' });

    const { rows } = await pool.query(
      'INSERT INTO items (name, description, user_id) VALUES ($1, $2, $3) RETURNING *',
      [name, description, req.user.id]
    );
    res.status(201).json(rows[0]);
  } catch (err) {
    console.error('POST /items error:', err);
    res.status(500).json({ error: 'Server error' });
  }
});

// PUT /api/items/:id — update
router.put('/:id', auth, async (req, res) => {
  try {
    const { id } = req.params;
    const { name, description } = req.body;

    const { rows } = await pool.query(
      'UPDATE items SET name=$1, description=$2, updated_at=NOW() WHERE id=$3 AND user_id=$4 RETURNING *',
      [name, description, id, req.user.id]
    );
    if (!rows.length) return res.status(404).json({ error: 'Not found' });
    res.json(rows[0]);
  } catch (err) {
    console.error('PUT /items error:', err);
    res.status(500).json({ error: 'Server error' });
  }
});

// DELETE /api/items/:id — delete
router.delete('/:id', auth, async (req, res) => {
  try {
    const { id } = req.params;
    const { rowCount } = await pool.query(
      'DELETE FROM items WHERE id=$1 AND user_id=$2',
      [id, req.user.id]
    );
    if (!rowCount) return res.status(404).json({ error: 'Not found' });
    res.json({ success: true });
  } catch (err) {
    console.error('DELETE /items error:', err);
    res.status(500).json({ error: 'Server error' });
  }
});

module.exports = router;

Register in index.js

const itemsRouter = require('./routes/items');
app.use('/api/items', itemsRouter);

SQL Migration for a New Entity

CREATE TABLE IF NOT EXISTS items (
  id          SERIAL PRIMARY KEY,
  user_id     INTEGER REFERENCES users(id) ON DELETE CASCADE,
  name        VARCHAR(255) NOT NULL,
  description TEXT,
  created_at  TIMESTAMP DEFAULT NOW(),
  updated_at  TIMESTAMP DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_items_user_id ON items(user_id);

Pattern Without Auth (Public API)

// Simply remove the auth middleware from router.get('/', async ...)
router.get('/public', async (req, res) => { ... });

Response Codes

CodeWhen
200Successful GET/PUT
201Successful POST (creation)
400Invalid client data
401Unauthorized
403Access denied
404Not found
500Server error

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.