Skip to content
Back to skills

Service Architecture

ASecurity

Backend architecture decisions: service boundaries, splitting vs consolidating, inter-service calls, auth guards and tiers, where logic lives, strangler migrations. Load before adding or versioning an endpoint or a service-to-service call, or deciding which service owns something. Query performance is database-optimization.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added December 4, 2026
developmentgoapidatabasefrontendbackendperformance

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 4, 2026

npx -y skills add ziazon/zizi-skills --skill service-architecture --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Service Architecture?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Service Architecture
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ziazon-service-architecture/badge)](https://www.skillsdirectory.com/skills/ziazon-service-architecture)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: service-architecture
category: Engineering
description: >
  Backend architecture decisions: service boundaries, splitting vs consolidating, inter-service
  calls, auth guards and tiers, where logic lives, strangler migrations. Load before adding or
  versioning an endpoint or a service-to-service call, or deciding which service owns something.
  Query performance is database-optimization.
---

# Service Architecture

If `LOCAL.md` sits beside this skill, read it first: it carries this install's project
conventions, which are standing directives and win over the generic defaults here.

Goal: make sound service-architecture decisions, surface optimizations and trade-offs,
and apply already-decided patterns consistently. The main failure in this domain is
inventing a parallel solution to a solved problem.

## Workflow

1. **Search before you build.** Grep ALL the repos — legacy and new services — for the
   capability first. It frequently already exists under another name, and a wrong
   "missing feature" guess in a plan costs more than the grep.
2. **Decide where the logic lives.** One service owns each table's writes: route writes
   through the owner (IPC), read pre-joined read models directly — two writers on one
   table is how data diverges. Pick the cheapest channel that respects ownership
   (direct read model < owning-service IPC < queue/event). Prefer deriving a value from
   data that already holds the truth over adding a column + migration.
3. **Weigh consolidation vs. split.** Modules merged into one service call each other
   in-process (DI); keep the interservice client only for genuinely external services —
   re-IPC-ing into yourself adds latency and a failure mode for nothing. Shared libs a
   frontend consumes stay free of server-framework decorators and dependencies.
4. **Auth at the boundary, re-derived at the service layer.** One endpoint serving
   several caller types uses ONE composite, ordered, short-circuiting guard with
   per-route config — duplicated endpoints per audience drift apart. Default to deny;
   fail closed. The guard answers "may you touch this resource?"; the service still
   clamps what the caller may grant or change.
5. **Migrate incrementally.** Move the client-facing surface (URL + auth + docs + tests)
   first, keep delegating to the legacy engine when reimplementing it is large or risky,
   and delete the old endpoint only after confirming nothing else uses it.
6. **Verify the wiring live.** Guard/provider/module changes are invisible to unit tests
   (mocks never build the DI graph) — a real boot is the only proof the change resolves.

The patterns behind each step, with their caveats:
[general-principles.md](general-principles.md).

## Common failure modes

- **Mutating an existing endpoint's auth/shape in place** instead of adding a sibling
  version and migrating the consumer (Hyrum's Law: every observable behavior becomes a
  contract someone depends on).
- **Swapping a guard without checking what it wrote to the request** — handlers may read
  a field the old guard set; a pass/fail-only replacement silently opens an authz hole.
- **An auth decorator without its guard is inert** — metadata does nothing until a guard
  reads it, so the route is silently OPEN.
- **Fanning out one external API call per list row** — keep a synced read model for
  sortable/filterable columns and refresh only the visible page on demand.
- **Building a parallel admin UI** when the same permission-gated screens can serve both
  audiences — then failing to verify the lower tier can't reach the privileged actions.
- **Stampeding boot-time tasks** — gate them (advisory lock + change detection) so N
  instances booting don't all write.

## Related skills

- [deprecation-and-migration](../deprecation-and-migration/SKILL.md): the mechanics of moving logic off a legacy service once this skill has decided where it lands.
- [code-quality](../code-quality/SKILL.md): the hard rules every backend diff meets — one responsibility per file, readable by a junior engineer, and one rhythm per kind of work (every endpoint moves data through the same stages).

## Capturing learnings

Record architectural decisions, the reasoning, patterns adopted and anti-patterns to
avoid in `LEARNINGS.md` beside this skill, when your copy keeps one. Pull the general
principle out into the general-principles reference, and keep project-specific
conventions in `LOCAL.md`. Dedupe and merge; if any one file grows past ~250 lines,
split it further.

Files in this skill

  • SKILL.md4.4 KB
  • general-principles.md6.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.