service-guard — for Claude Code service-guard, microservices-simulator, community, for Claude Code, ide skills, service-layer guard, precondition checks, data consistency, Layer 3 service-layer guards, aggregate mutations

v1.0.0

Об этом навыке

Подходящий сценарий: Perfect for Development Agents needing advanced service-layer security and data consistency checks. Локализованное описание: Add a Layer 3 service-layer guard to an existing service. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

Возможности

Implement precondition checks using Layer 3 service-layer guards
Read from the database to evaluate preconditions
Throw exceptions before aggregate mutations are applied
Ensure data consistency across applications
Integrate with existing services and repositories

# Core Topics

socialsoftware socialsoftware
[5]
[3]
Updated: 3/26/2026

Killer-Skills Review

Decision support comes first. Repository text comes second.

Reference-Only Page Review Score: 8/11

This page remains useful for teams, but Killer-Skills treats it as reference material instead of a primary organic landing page.

Original recommendation layer Concrete use-case guidance Explicit limitations and caution
Review Score
8/11
Quality Score
33
Canonical Locale
en
Detected Body Locale
en

Подходящий сценарий: Perfect for Development Agents needing advanced service-layer security and data consistency checks. Локализованное описание: Add a Layer 3 service-layer guard to an existing service. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

Зачем использовать этот навык

Рекомендация: Empowers agents to enforce preconditions and validate aggregate mutations using custom repository interfaces and error constants, ensuring data integrity and security within microservices architectures, specifically leveraging Java and UoW transactions.

Подходит лучше всего

Подходящий сценарий: Perfect for Development Agents needing advanced service-layer security and data consistency checks.

Реализуемые кейсы использования for service-guard

Сценарий использования: Implementing service-layer guards for existing services
Сценарий использования: Validating preconditions before aggregate mutations
Сценарий использования: Throwing exceptions for inconsistent data or security breaches

! Безопасность и ограничения

  • Ограничение: Requires knowledge of Java and microservices architecture
  • Ограничение: Limited to services with existing custom repository interfaces
  • Ограничение: Must adhere to specific naming conventions for error constants

Why this page is reference-only

  • - Current locale does not satisfy the locale-governance contract.
  • - The underlying skill quality score is below the review floor.

Source Boundary

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

After The Review

Decide The Next Action Before You Keep Reading Repository Material

Killer-Skills should not stop at opening repository instructions. It should help you decide whether to install this skill, when to cross-check against trusted collections, and when to move into workflow rollout.

Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is service-guard?

Подходящий сценарий: Perfect for Development Agents needing advanced service-layer security and data consistency checks. Локализованное описание: Add a Layer 3 service-layer guard to an existing service. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

How do I install service-guard?

Run the command: npx killer-skills add socialsoftware/microservices-simulator. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for service-guard?

Key use cases include: Сценарий использования: Implementing service-layer guards for existing services, Сценарий использования: Validating preconditions before aggregate mutations, Сценарий использования: Throwing exceptions for inconsistent data or security breaches.

Which IDEs are compatible with service-guard?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for service-guard?

Ограничение: Requires knowledge of Java and microservices architecture. Ограничение: Limited to services with existing custom repository interfaces. Ограничение: Must adhere to specific naming conventions for error constants.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add socialsoftware/microservices-simulator. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use service-guard immediately in the current project.

! Reference-Only Mode

This page remains useful for installation and reference, but Killer-Skills no longer treats it as a primary indexable landing page. Read the review above before relying on the upstream repository instructions.

Upstream Repository Material

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

Upstream Source

service-guard

Локализованное описание: Add a Layer 3 service-layer guard to an existing service. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

SKILL.md
Readonly
Upstream Repository Material
The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.
Supporting Evidence

Add Service-Layer Guard: $ARGUMENTS

You are adding a new Layer 3 service-layer guard to an existing service in applications/quizzes.

A service-layer guard is a precondition check that reads from the database and throws an exception before any aggregate mutation is applied. It runs inside the same UoW transaction as the operation.

The guard must only read the service's own aggregate type. If a foreign aggregate must be read to evaluate the precondition, use a Layer 5 saga step instead (/inter-invariant or a named step in the functionality). Consult docs/concepts/consistency-enforcement.md if uncertain.


Step 0 — Parse the arguments

From $ARGUMENTS identify:

  • ServiceName: the service class to modify (e.g. ExecutionService, TournamentService)
  • Operation method: the service method receiving the guard (e.g. enrollStudent, createCourseExecution)
  • Precondition: what must hold before the mutation is allowed (e.g. "user must be active", "no duplicate acronym/term")

Step 1 — Read existing code

Before writing anything, read:

  1. The service class microservices/<aggregate>/service/<Service>.java — focus on the target operation method and how other guards in the same class are structured
  2. The custom repository interface microservices/<aggregate>/aggregate/<Aggregate>CustomRepository.java (if it exists) and its implementations:
    • microservices/<aggregate>/aggregate/sagas/<Aggregate>SagaRepository.java
    • microservices/<aggregate>/aggregate/causal/<Aggregate>CausalRepository.java
  3. QuizzesErrorMessage.java — existing error constants
  4. The closest test class under src/test/groovy/.../sagas/coordination/<aggregate>/

Step 2 — Design the guard

Decide:

  • Guard placement: immediately before the copy-constructor call or registerChanged(), never after a mutation has been applied
  • Repository query needed: can the check be done on the aggregate already loaded by the operation, or does it need a separate query (e.g. findAllAggregateIds(), a custom finder)?
    • Prefer reusing an already-loaded aggregate over an extra DB read
    • If a new query is needed, add it to the custom repository interface and both implementations (Sagas + TCC)
  • Error constant name: follow the convention:
    • CANNOT_<OP>_WHEN_<CONDITION> (e.g. CANNOT_ENROLL_WHEN_INACTIVE)
    • DUPLICATE_<ENTITY> (e.g. DUPLICATE_COURSE_EXECUTION)
    • INACTIVE_<ENTITY> (e.g. INACTIVE_USER)
    • Reuse an existing constant if one already expresses the same rule

Document the decision in a brief comment before writing code.


Step 3 — Add the guard check

Inside the service method, add the guard before any aggregate mutation, with an inline label comment:

java
1// GUARD_NAME — <one-line description of what is being checked> 2if (<precondition violated>) { 3 throw new QuizzesException(<ERROR_CONSTANT>, <relevant ids...>); 4}

Real examples from ExecutionService.java:

java
1// DUPLICATE_COURSE_EXECUTION — reject creation if acronym+term already exists 2if (existing.getAcronym().equals(courseExecutionDto.getAcronym()) 3 && existing.getAcademicTerm().equals(courseExecutionDto.getAcademicTerm())) { 4 throw new QuizzesException(DUPLICATE_COURSE_EXECUTION, 5 courseExecutionDto.getAcronym(), courseExecutionDto.getAcademicTerm()); 6} 7 8// INACTIVE_USER — block enrollment of inactive users 9if (!courseExecutionStudent.isActive()) { 10 throw new QuizzesException(INACTIVE_USER, courseExecutionStudent.getUserAggregateId()); 11}

Step 4 — Add repository query (if needed)

If the guard requires a DB query not already available:

  1. Add the method signature to the custom repository interface:

    java
    1// <Aggregate>CustomRepository.java 2List<Integer> findAggregateIdsByXxx(Integer someId);
  2. Implement it in both the Sagas and TCC repository classes with the same logic.

If the guard can be evaluated on an aggregate already loaded by the operation, skip this step.


Step 5 — Add error message constant

In QuizzesErrorMessage.java, add the new constant if it does not already exist:

java
1CANNOT_<OP>_WHEN_<CONDITION>("Cannot <operation>: <human-readable reason>"),

Step 6 — Write tests

Add test cases to the relevant *Test.groovy under src/test/groovy/.../sagas/coordination/<aggregate>/.

Cover at minimum:

ScenarioExpected outcome
Precondition satisfiedOperation succeeds
Precondition violatedQuizzesException with the correct error code
Boundary / edge casesCorrect behaviour

Run with:

bash
1mvn clean -Ptest-sagas test -Dtest=<YourTestClass>

Checklist before finishing

  • Guard check added before any mutation in the service method, with inline label comment
  • Repository query added to custom repository interface + both implementations (Sagas + TCC), if a new query was needed
  • Error message constant added to QuizzesErrorMessage.java (or existing one reused)
  • Tests written and passing

Связанные навыки

Looking for an alternative to service-guard or another community skill for your workflow? Explore these related open-source skills.

Показать все

openclaw-release-maintainer

Logo of openclaw
openclaw

Локализованное описание: 🦞 # OpenClaw Release Maintainer Use this skill for release and publish-time workflow. It covers ai, assistant, crustacean workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

widget-generator

Logo of f
f

Локализованное описание: Generate customizable widget plugins for the prompts.chat feed system # Widget Generator Skill This skill guides creation of widget plugins for prompts.chat . It covers ai, artificial-intelligence, awesome-list workflows. This AI agent skill supports Claude Code, Cursor

flags

Logo of vercel
vercel

Локализованное описание: The React Framework # Feature Flags Use this skill when adding or changing framework feature flags in Next.js internals. It covers blog, browser, compiler workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

138.4k
0
Браузер

pr-review

Logo of pytorch
pytorch

Локализованное описание: Usage Modes No Argument If the user invokes /pr-review with no arguments, do not perform a review . It covers autograd, deep-learning, gpu workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

98.6k
0
Разработчик