โ† All skills
Tencent SkillHub ยท Developer Tools

Service Layer Architecture

Controller-service-query layered API architecture with data enrichment and parallel fetching. Use when building REST APIs or GraphQL resolvers with clean separation of concerns. Triggers on API architecture, service layer, controller pattern, data enrichment, REST API.

skill openclawclawhub Free
0 Downloads
0 Stars
0 Installs
0 Score
High Signal

Controller-service-query layered API architecture with data enrichment and parallel fetching. Use when building REST APIs or GraphQL resolvers with clean separation of concerns. Triggers on API architecture, service layer, controller pattern, data enrichment, REST API.

โฌ‡ 0 downloads โ˜… 0 stars Unverified but indexed

Install for OpenClaw

Quick setup
  1. Download the package from Yavira.
  2. Extract the archive and review SKILL.md first.
  3. Import or place the package into your OpenClaw setup.

Requirements

Target platform
OpenClaw
Install method
Manual import
Extraction
Extract archive
Prerequisites
OpenClaw
Primary doc
SKILL.md

Package facts

Download mode
Yavira redirect
Package format
ZIP package
Source platform
Tencent SkillHub
What's included
README.md, SKILL.md

Validation

  • Use the Yavira download entry.
  • Review SKILL.md after the package is downloaded.
  • Confirm the extracted package contains the expected setup assets.

Install with your agent

Agent handoff

Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.

  1. Download the package from Yavira.
  2. Extract it into a folder your agent can access.
  3. Paste one of the prompts below and point your agent at the extracted folder.
New install

I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.

Upgrade existing

I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.

Trust & source

Release facts

Source
Tencent SkillHub
Verification
Indexed source record
Version
1.0.0

Documentation

ClawHub primary doc Primary doc: SKILL.md 10 sections Open source page

Service Layer Architecture

Clean, performant API layers with proper separation of concerns and parallel data fetching.

When to Use

Building REST APIs with complex data aggregation GraphQL resolvers needing data from multiple sources Any API where responses combine data from multiple queries Systems needing testable, maintainable code

Three-Layer Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Controllers โ”‚ HTTP handling, validation โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Services โ”‚ Business logic, data enrichment โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Queries โ”‚ Database access, raw data fetch โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Layer 1: Controllers (HTTP Only)

// controllers/Entity.ts import { getEntity, getEntities } from "../services/Entity"; const router = new Router(); router.get("/entity/:entityId", async (ctx) => { const { entityId } = ctx.params; if (!entityId) { ctx.status = 400; ctx.body = { error: "Invalid entity ID" }; return; } const entity = await getEntity(entityId); if (!entity) { ctx.status = 404; ctx.body = { error: "Entity not found" }; return; } ctx.status = 200; ctx.body = entity; });

Layer 2: Services (Business Logic)

// services/Entity.ts import { queries } from "@common"; export const getEntityData = async (entity: RawEntity): Promise<EnrichedEntity> => { // Parallel fetch all related data const [metadata, score, activity, location] = await Promise.all([ queries.getMetadata(), queries.getLatestScore(entity.id), queries.getActivity(entity.id), queries.getLocation(entity.slotId), ]); // Transform and combine return { ...entity, bonded: entity.bonded / Math.pow(10, metadata.decimals), total: score?.total ?? 0, location: location?.city, activity: { activeCount: activity?.active?.length ?? 0, inactiveCount: activity?.inactive?.length ?? 0, }, }; }; export const getEntity = async (entityId: string): Promise<EnrichedEntity | null> => { const entity = await queries.getEntityById(entityId); if (!entity) return null; return getEntityData(entity); }; export const getEntities = async (): Promise<EnrichedEntity[]> => { const all = await queries.allEntities(); const enriched = await Promise.all(all.map(getEntityData)); return enriched.sort((a, b) => b.total - a.total); };

Layer 3: Queries (Database Access)

// queries/Entities.ts import { EntityModel } from "../models"; export const allEntities = async () => { return EntityModel.find({}).lean(); // Always use .lean() }; export const getEntityById = async (id: string) => { return EntityModel.findOne({ id }).lean(); }; export const validEntities = async () => { return EntityModel.find({ valid: true }).lean(); };

Parallel Data Fetching

// BAD: Sequential (slow) const metadata = await queries.getMetadata(); const score = await queries.getScore(id); const location = await queries.getLocation(id); // Time: sum of all queries // GOOD: Parallel (fast) const [metadata, score, location] = await Promise.all([ queries.getMetadata(), queries.getScore(id), queries.getLocation(id), ]); // Time: max of all queries

Layer Responsibilities

TaskLayerParse request paramsControllerValidate inputControllerSet HTTP statusControllerCombine multiple queriesServiceTransform dataServiceSort/filter resultsServiceRun database queryQuery

Related Skills

Related: postgres-job-queue โ€” Background job processing Related: realtime/websocket-hub-patterns โ€” Real-time updates from services

NEVER Do

NEVER put database queries in controllers โ€” Violates separation NEVER put HTTP concerns in services โ€” Services must be reusable NEVER fetch related data sequentially โ€” Use Promise.all NEVER skip .lean() on read queries โ€” 5-10x faster NEVER expose raw database errors โ€” Transform to user-friendly messages

Category context

Code helpers, APIs, CLIs, browser automation, testing, and developer operations.

Source: Tencent SkillHub

Largest current source with strong distribution and engagement signals.

Package contents

Included in package
2 Docs
  • SKILL.md Primary doc
  • README.md Docs