crud-service

Enforce transactional boundaries, auditing, and standardized error translation in CRUD service layers.

357|65|Updated Jul 29, 2022
One-click install
npx skills add https://github.com/ArtisanCloud/PowerX --skill crud-service
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: crud-service
Source: https://github.com/ArtisanCloud/PowerX/tree/main/.codex/skills/crud/service
Command: npx skills add https://github.com/ArtisanCloud/PowerX --skill crud-service

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PowerX CRUD Service 规则(事务、审计、错误翻译、传输解耦)。

Core Features & Use Cases

  • 统一 Service 层职责:鉴权/审计、事务边界、幂等与并发控制、错误翻译(404/409),与 Repository/DTO/Handler/DI 对齐,保持传输无关(HTTP/gRPC 共用)。
  • 设计原则:Service 通过注入仓库层接口与 shared.Deps 实现解耦,确保跨层边界清晰,便于测试和复用。
  • Use Case: Ensure consistent CRUD operations with proper transaction handling and error translation across the API surface.

Quick Start

Configure the CRUD service to enforce transactional boundaries, auditing hooks, and standardized error translation across all internal services.

Frequently Asked Questions about crud-service

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce transactional boundaries in a Go service layer?

Enforce transactional boundaries in a Go service layer by applying repository pattern rules with repo.WithTx to coordinate operations. This ensures transactional integrity and consistent CRUD execution across internal services.

What is the best way to standardize error translation across HTTP and gRPC APIs?

Standardize error translation across HTTP and gRPC APIs by enforcing service layer rules that map internal errors to consistent HTTP/gRPC responses. This approach decouples transport protocols from core logic and standardizes outputs like 404/409 errors.

How do I implement RBAC and audit instrumentation in CRUD operations?

Implement RBAC and audit instrumentation in CRUD operations by configuring service layer governance rules. This automatically satisfies RBAC and audit requirements, ensuring secure and tracked operations across internal service implementations.

Does this service layer pattern support idempotent create operations?

Yes, the service layer pattern supports idempotent create operations. It enforces robust service rules that include idempotent creation and concurrency control, ensuring consistent state and preventing duplicate records during concurrent requests.

Can I decouple service layer logic from transport protocols for reuse?

Yes, you can decouple service layer logic from transport protocols by injecting repository interfaces and shared dependencies. This keeps boundaries clear and transport-agnostic, allowing the same logic to be reused across HTTP and gRPC surfaces.

Why do my API endpoints return inconsistent errors across different services?

API endpoints return inconsistent errors without standardized service layer rules. Enforcing consistent error translation across the service layer maps internal failures to uniform HTTP/gRPC responses, resolving discrepancies like mismatched 404/409 codes.