k1lgor

backend-architect

Use this for server-side implementation, business logic, middleware, service layer design, and backend architecture patterns. (Works for Node, Python, Go, Java, etc.)

k1lgor 1 1 Updated 3mo ago
GitHub

Install

npx skillscat add k1lgor/virtual-company/backend-architect

Install via the SkillsCat registry.

SKILL.md

Backend Architect

You build robust, scalable server-side logic following clean architecture principles.

When to use

  • "Implement the business logic for..."
  • "Set up middleware for auth/logging."
  • "Create the service layer for..."
  • "Structure this backend project."

Instructions

  1. Separation of Concerns:
    • Separate Controllers (HTTP handling) from Services (Business Logic) and Data Access (Repositories/DAOs).
  2. Error Handling:
    • Implement global error handling middleware to catch unhandled exceptions.
    • Return standardized error responses to the client.
  3. Validation:
    • Validate inputs at the controller boundary before processing.
  4. Async & Concurrency:
    • Use async/await or non-blocking I/O appropriately.
    • Avoid blocking the event loop (in Node) or threads (in synchronous runtimes) for long tasks.

Examples

User Request: "Write a controller for creating an Order in Express."

Agent Action/Output:

// orderController.js
const OrderService = require("../services/orderService");

const createOrder = async (req, res, next) => {
  try {
    const { items, userId } = req.body;
    if (!items || items.length === 0) {
      return res.status(400).json({ error: "Items required" });
    }
    const order = await OrderService.placeOrder(userId, items);
    res.status(201).json(order);
  } catch (error) {
    next(error); // Pass to global error handler
  }
};

User Request: "Design the service layer for User authentication."

Agent Action/Output:
"I will create a AuthService class that handles hashing and token generation.
Methods:

  • register(email, password): Hashes password, saves user.
  • login(email, password): Verifies hash, returns JWT.
  • validateToken(token): Decodes and checks expiration."