Skip to content

Commit aa89441

Browse files
committed
added skills
1 parent d70e6c3 commit aa89441

37 files changed

Lines changed: 3246 additions & 85 deletions

File tree

.agents/skills/backend-guidance/SKILL.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ description: Overlay for server-side networked code — HTTP handlers, gRPC serv
55

66
# Backend Guidance
77

8-
Read `AGENTS.md` first. This is a composable overlay, not a standalone workflow.
8+
This is a composable overlay, not a standalone workflow.
99
Use alongside the repo's implementation skill (e.g. **coding-guidance-cpp**, **project-core-dev**)
1010
when the change touches backend code.
1111

12+
Use this as the thin default backend overlay for ordinary backend work.
13+
If the task includes service-boundary refactors, repository or transaction work,
14+
queue or webhook reliability, stronger testing expectations, or explicit
15+
trust-boundary hardening, prefer `backend-systems-guidance`.
16+
1217
## When to use
1318

1419
The repo has server-side networked code: HTTP route handlers, gRPC service
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
name: backend-systems-guidance
3+
description: Canonical overlay for server-side networked code that needs stronger architecture, testing, reliability, and security discipline. Use alongside the repo's implementation skill when implementing or reviewing backend services, APIs, middleware, queues, repositories, or backend refactors.
4+
---
5+
6+
# Backend Systems Guidance
7+
8+
This is a composable overlay, not a standalone workflow.
9+
Use alongside the repo's implementation skill when the change touches backend
10+
code.
11+
12+
This is the canonical backend overlay in this repo.
13+
It extends the thin baseline `backend-guidance` overlay with stronger guidance
14+
for non-trivial service boundaries, repositories, reliability, and trust
15+
boundaries.
16+
17+
Prefer it over `backend-guidance` when the task includes new endpoints or
18+
consumers, multi-layer refactors, repository or transaction work, auth or
19+
trust-boundary logic, or backend review that needs explicit testing and
20+
reliability checks.
21+
22+
Use the bundled references only when needed:
23+
24+
- [references/trigger-evals.md](references/trigger-evals.md) for lightweight
25+
prompt checks when revising the trigger or scope
26+
27+
## When to use
28+
29+
- the repo has server-side networked code such as HTTP handlers, gRPC methods,
30+
webhooks, queue consumers, or message producers
31+
- the task adds or reshapes routes, controllers, services, repositories,
32+
middleware, or request-processing boundaries
33+
- the task changes auth, authorization, validation, idempotency, retries,
34+
external requests, caching, or observability
35+
- the task needs backend review beyond basic handler thinness, especially for
36+
security, data access, or missing tests
37+
38+
## Not for
39+
40+
- HTTP client code, CLI tooling, offline batch scripts, or data pipelines with
41+
no request or consumer boundary
42+
- frontend-only work
43+
- threat modeling or security audit work where `security` should be the primary
44+
workflow skill
45+
46+
Do not fold infrastructure deployment workflows, outbound-client-only guidance,
47+
or full security-audit checklists into this skill. Keep this overlay centered
48+
on backend request and consumer systems plus their immediate reliability and
49+
trust boundaries.
50+
51+
## Core workflow
52+
53+
1. Read the touched backend files and map the request or consumer path end to
54+
end: boundary, service logic, data access, external calls, and state
55+
changes.
56+
2. Pick the mode before changing code:
57+
- baseline backend change when the work is mostly a thin handler or small
58+
service fix
59+
- service-boundary change when responsibilities, data access, or dependency
60+
direction may need to move
61+
- reliability-hardening or review mode when the main risk is missing tests,
62+
auth gaps, retries, observability, or unsafe failure handling
63+
3. Keep the boundary thin: decode input, authenticate and authorize, validate,
64+
call a service, map transport errors, and serialize output. Business
65+
decisions belong in service code that can run without the transport layer.
66+
4. Place persistence and external integrations deliberately:
67+
- repositories or data adapters own query shape, batching, and transaction
68+
details when that improves clarity or testing
69+
- services coordinate business rules, idempotency, retries, and side-effect
70+
ordering
71+
- handlers and controllers do not reach directly into ORM or network clients
72+
unless the change is truly trivial and stays trivial
73+
5. Harden cross-cutting concerns at the edge:
74+
- validate external input once at the boundary
75+
- enforce auth and authorization before business actions
76+
- set timeouts, retry rules, and destination allowlists for outbound calls
77+
- use structured logging, correlation identifiers, and explicit error
78+
mapping for observable failure paths
79+
6. Choose the smallest test set that proves the change:
80+
- unit tests for service logic and decision branches
81+
- integration tests for handlers, consumers, repositories, and transaction
82+
behavior
83+
- auth and permission tests for protected flows
84+
- contract or schema tests when the change alters external API or event
85+
shapes
86+
- load or concurrency tests only for changed hotspots, queue throughput, or
87+
latency-sensitive paths
88+
7. Review the result for boundary leaks, unsafe defaults, data-access
89+
inefficiency, and missing verification before finishing.
90+
91+
## Decision rules
92+
93+
- Start with `backend-guidance` for ordinary backend edits. Use this overlay
94+
when the task needs stronger design pressure, harder review, or explicit
95+
backend quality gates.
96+
- Keep handlers thin in responsibility, not by literal line count. If a
97+
handler or consumer owns business decisions, retries, transaction branching,
98+
or query orchestration, extract inward.
99+
- Keep business logic transport-free. If testing a rule requires booting HTTP,
100+
gRPC, or queue infrastructure, the logic is in the wrong place.
101+
- Add a repository or data-access interface when it reduces duplication,
102+
isolates non-trivial queries, helps transaction composition, or makes tests
103+
materially simpler. Do not add one for single-call trivial CRUD.
104+
- Prefer one validation pass at the outer edge plus typed internal data. Avoid
105+
repeated validation in every layer unless a trust boundary changes.
106+
- Treat retries as a design choice, not a default. Only retry idempotent or
107+
explicitly deduplicated work, and pair retries with deadlines or backoff.
108+
- Use idempotency keys or duplicate-detection for retried creates, webhook
109+
handlers, and queue consumers that can be re-delivered.
110+
- Every outbound request needs a timeout and failure policy. For user-controlled
111+
destinations, apply allowlists or equivalent SSRF protections.
112+
- Keep error handling explicit: domain code returns or throws domain-level
113+
failures; boundary code maps them to HTTP, gRPC, queue, or job semantics.
114+
- Measure before adding caching. Cache only stable read paths with clear
115+
invalidation or bounded staleness.
116+
117+
## Validation
118+
119+
A backend change is done when, in addition to the base implementation skill's
120+
validation:
121+
122+
- handlers or consumers stay as boundary glue and delegate business decisions to
123+
testable service code
124+
- data access and external I/O live behind clear seams when the change is
125+
non-trivial
126+
- external input, auth, and transport-specific error mapping stay at the edge
127+
- retries, idempotency, timeouts, and failure handling are explicit where the
128+
change can duplicate work or call remote systems
129+
- tests cover the changed behavior at the correct level, including integration
130+
coverage for boundary behavior and permission or failure cases when relevant
131+
- new high-risk paths emit enough evidence to debug production behavior
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Backend Systems Guidance Trigger Evals
2+
3+
Use these prompts to spot over-triggering and boundary drift between
4+
`backend-guidance` and `backend-systems-guidance`.
5+
6+
## Expected `backend-guidance`
7+
8+
- "Fix this HTTP handler so it stops doing auth checks inline and just calls the service."
9+
- "Clean up this gRPC method and move input parsing to the boundary."
10+
- "Review this small message consumer and make sure transport concerns stay at the edge."
11+
12+
## Expected `backend-systems-guidance`
13+
14+
- "Add idempotent webhook handling with retries, timeout rules, and integration tests."
15+
- "Refactor this endpoint stack into controller, service, and repository layers and check for N+1 queries."
16+
- "Review this backend change for auth gaps, transaction boundaries, outbound request safety, and missing tests."
17+
18+
## Expected Neither
19+
20+
- "Tune this HTTP client retry policy for outbound SDK calls."
21+
- "Threat-model our auth system and list likely attack paths."
22+
- "Set up Kubernetes deployment manifests and production dashboards."
23+
24+
## Manual Simulation Summary
25+
26+
Prompts used:
27+
28+
- positive-obvious: "Refactor this endpoint stack into controller, service, and repository layers and check for N+1 queries."
29+
- positive-paraphrased: "This backend change touches retries, auth, and webhook deduplication. Use the stronger backend overlay."
30+
- negative-adjacent: "Tune this HTTP client retry policy for outbound SDK calls."
31+
32+
What passed:
33+
34+
- obvious multi-layer backend work points clearly to `backend-systems-guidance`
35+
- paraphrased reliability and trust-boundary work still triggers the stronger
36+
overlay
37+
- outbound-client-only work stays out of scope
38+
39+
Residual risk:
40+
41+
- backend review requests may still need judgment when they are narrow enough to
42+
fit `backend-guidance`
43+
- if the stronger overlay grows more review-specific, re-check whether a
44+
companion review overlay would be cleaner

0 commit comments

Comments
 (0)