@skathio/somi 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.json +108 -0
- package/.claude/settings.local.json +9 -0
- package/.claude/somi-state/last-context-signature +1 -0
- package/.claude-plugin/marketplace.json +21 -0
- package/.claude-plugin/plugin.json +24 -0
- package/.copilot-extension/extension.json +51 -0
- package/.copilot-extension/marketplace.json +19 -0
- package/LICENSE +21 -0
- package/README.md +209 -0
- package/VERSION +1 -0
- package/agents/architecture-reviewer.md +86 -0
- package/agents/coder.md +222 -0
- package/agents/discovery-analyst.md +305 -0
- package/agents/planner.md +256 -0
- package/agents/refactorer.md +72 -0
- package/agents/reviewer.md +233 -0
- package/agents/security-reviewer.md +85 -0
- package/agents/test-strategist.md +74 -0
- package/commands/architecture-review.md +92 -0
- package/commands/code-loop.md +142 -0
- package/commands/code-parallel.md +155 -0
- package/commands/code.md +138 -0
- package/commands/discover.md +175 -0
- package/commands/plan-loop.md +124 -0
- package/commands/plan.md +174 -0
- package/commands/refactor.md +44 -0
- package/commands/review-panel.md +123 -0
- package/commands/review.md +149 -0
- package/commands/security-review.md +73 -0
- package/commands/ship-loop.md +135 -0
- package/commands/ship.md +108 -0
- package/commands/test-strategy.md +82 -0
- package/examples/README.md +19 -0
- package/examples/code-review-example.md +88 -0
- package/examples/discovery-example.md +200 -0
- package/examples/feature-plan-example.md +377 -0
- package/examples/full-pipeline-example.md +188 -0
- package/examples/sample-consumer/.claude/settings.json +29 -0
- package/examples/sample-consumer/CLAUDE.md +41 -0
- package/examples/sample-consumer/README.md +77 -0
- package/hooks/hooks.json +64 -0
- package/hooks/lib/common.sh +120 -0
- package/hooks/post-tool/audit-log.sh +40 -0
- package/hooks/post-tool/lint-changed-files.sh +80 -0
- package/hooks/pre-tool/block-dangerous-bash.sh +83 -0
- package/hooks/pre-tool/block-secret-writes.sh +83 -0
- package/hooks/pre-tool/gate-dep-install.sh +72 -0
- package/hooks/pre-tool/guard-protected-paths.sh +74 -0
- package/hooks/user-prompt-submit/inject-workflow-context.sh +143 -0
- package/package.json +51 -0
- package/rules/00-priorities.md +48 -0
- package/rules/10-solid.md +87 -0
- package/rules/20-clean-code.md +62 -0
- package/rules/30-security-owasp.md +83 -0
- package/rules/40-engineering-practices.md +65 -0
- package/rules/50-collaboration.md +108 -0
- package/rules/99-overrides.md +52 -0
- package/rules/CLAUDE.md +164 -0
- package/skills/api-design/SKILL.md +147 -0
- package/skills/clean-code/SKILL.md +142 -0
- package/skills/market-research/SKILL.md +125 -0
- package/skills/observability/SKILL.md +133 -0
- package/skills/owasp-defense/SKILL.md +141 -0
- package/skills/requirements-engineering/SKILL.md +137 -0
- package/skills/solid-principles/SKILL.md +143 -0
- package/skills/test-strategy/SKILL.md +133 -0
- package/skills/threat-modeling/SKILL.md +117 -0
- package/templates/ADR.md.tmpl +73 -0
- package/templates/BRD.md.tmpl +68 -0
- package/templates/CONTEXT.md.tmpl +74 -0
- package/templates/DECISIONS.md.tmpl +104 -0
- package/templates/DIARY.md.tmpl +65 -0
- package/templates/DOD.md.tmpl +66 -0
- package/templates/FRD.md.tmpl +64 -0
- package/templates/PHASE.md.tmpl +80 -0
- package/templates/PROGRESS.md.tmpl +76 -0
- package/templates/RD-README.md.tmpl +70 -0
- package/templates/RESEARCH.md.tmpl +96 -0
- package/templates/REVIEW.md.tmpl +81 -0
- package/templates/SDD.md.tmpl +82 -0
- package/templates/SOMI-README.md.tmpl +66 -0
- package/templates/SPEC.md.tmpl +123 -0
- package/templates/SRS.md.tmpl +85 -0
- package/templates/TDD.md.tmpl +77 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-design
|
|
3
|
+
description: Use when adding or changing an HTTP/gRPC/library API. Covers resource modeling, error shapes, versioning, idempotency, pagination, and backward compatibility. Optimizes for callers, not implementers.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# API design
|
|
7
|
+
|
|
8
|
+
You are about to expose an interface — HTTP endpoint, gRPC method, library function. Once it has one
|
|
9
|
+
caller you don't control, it's expensive to change. Design it for the caller's life, not your morning's
|
|
10
|
+
convenience.
|
|
11
|
+
|
|
12
|
+
## First principles
|
|
13
|
+
|
|
14
|
+
- **Shape for callers.** What does the consumer actually need? Don't model the interface around the
|
|
15
|
+
implementation's convenience.
|
|
16
|
+
- **Predictable > clever.** Surprise costs every future engineer who hits it.
|
|
17
|
+
- **Boring & consistent.** Within an API, the same concept should use the same vocabulary, the same
|
|
18
|
+
pagination, the same error shape.
|
|
19
|
+
|
|
20
|
+
## Resource modeling (REST)
|
|
21
|
+
|
|
22
|
+
- **Nouns, not verbs.** `POST /orders` to create. `POST /orders/{id}/cancel` only if "cancel" is a
|
|
23
|
+
workflow that doesn't reduce to PATCH.
|
|
24
|
+
- **Collections + items.** `GET /orders` (list), `GET /orders/{id}` (item), `POST /orders` (create),
|
|
25
|
+
`PATCH /orders/{id}` (partial update), `DELETE /orders/{id}` (remove or soft-remove).
|
|
26
|
+
- **Subresources** for hierarchy: `GET /orders/{id}/line-items`. Stop nesting at depth 2 unless deeper is
|
|
27
|
+
semantically required.
|
|
28
|
+
- **Sub-actions** sparingly: `POST /orders/{id}/cancel` if `cancel` isn't a state field update.
|
|
29
|
+
- **IDs**: stable, opaque, externally unique. Don't expose internal autoincrement primary keys.
|
|
30
|
+
|
|
31
|
+
## Idempotency
|
|
32
|
+
|
|
33
|
+
- **Safe by default for GET/HEAD/OPTIONS.**
|
|
34
|
+
- **Idempotent for PUT/DELETE** (same call, same outcome).
|
|
35
|
+
- **POST is non-idempotent** by default. For state-changing POSTs that can be retried by clients (mobile,
|
|
36
|
+
network blips, payments), accept an `Idempotency-Key` header and dedupe server-side for a TTL.
|
|
37
|
+
|
|
38
|
+
## Error shape
|
|
39
|
+
|
|
40
|
+
Pick one error envelope and use it everywhere:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"error": {
|
|
45
|
+
"code": "ORDER_NOT_FOUND",
|
|
46
|
+
"message": "Order with id ord_123 not found.",
|
|
47
|
+
"details": { "id": "ord_123" }
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- **Stable machine code**: `ORDER_NOT_FOUND` — clients branch on this.
|
|
53
|
+
- **Human message**: for logs / dashboards, not for end users (don't leak internals).
|
|
54
|
+
- **Structured details**: optional, for clients to render specific cases.
|
|
55
|
+
- **HTTP status carries the broad category**: 4xx caller-fault, 5xx server-fault. Don't return 200 with
|
|
56
|
+
`{"error": ...}`.
|
|
57
|
+
|
|
58
|
+
## Status codes (quick cheat sheet)
|
|
59
|
+
|
|
60
|
+
| Code | When |
|
|
61
|
+
|------|---------------------------------------------------------------------|
|
|
62
|
+
| 200 | OK (GET, PUT/PATCH that returned the resource) |
|
|
63
|
+
| 201 | Created (POST that created a resource — include `Location` header) |
|
|
64
|
+
| 204 | No Content (DELETE, or PUT with no body) |
|
|
65
|
+
| 400 | Caller sent malformed/invalid input |
|
|
66
|
+
| 401 | Unauthenticated |
|
|
67
|
+
| 403 | Authenticated but not allowed |
|
|
68
|
+
| 404 | Resource doesn't exist OR caller can't see it (don't leak existence)|
|
|
69
|
+
| 409 | Conflict — concurrent modification, duplicate, state mismatch |
|
|
70
|
+
| 422 | Validation failure (sometimes preferred over 400) |
|
|
71
|
+
| 429 | Rate limited (include `Retry-After`) |
|
|
72
|
+
| 5xx | Server fault |
|
|
73
|
+
|
|
74
|
+
Don't get cute (`418`). Don't reinvent (`299`).
|
|
75
|
+
|
|
76
|
+
## Pagination
|
|
77
|
+
|
|
78
|
+
Pick one and stick to it across the API:
|
|
79
|
+
|
|
80
|
+
- **Cursor-based** (preferred for changing data): `?cursor=<opaque>&limit=N` → response includes `next_cursor`
|
|
81
|
+
(or `null` at end).
|
|
82
|
+
- **Offset-based** (only for static data): `?offset=N&limit=N`. Bad for inserts/deletes during iteration.
|
|
83
|
+
- **Page-based**: `?page=N&per_page=N`. Same caveats as offset.
|
|
84
|
+
|
|
85
|
+
Always include the **next pointer** in the response, not just a flag. Callers shouldn't construct pages.
|
|
86
|
+
|
|
87
|
+
## Filtering, sorting, fields
|
|
88
|
+
|
|
89
|
+
- **Filter**: `?status=active&owner=u_123`. Document allowed fields.
|
|
90
|
+
- **Sort**: `?sort=created_at,-priority` (prefix `-` for descending). Allowlist sortable fields.
|
|
91
|
+
- **Field selection**: `?fields=id,name,status` for bandwidth-sensitive clients. Optional.
|
|
92
|
+
|
|
93
|
+
## Versioning
|
|
94
|
+
|
|
95
|
+
Choose one path:
|
|
96
|
+
|
|
97
|
+
1. **URI versioning**: `/v1/orders`. Coarse but unambiguous.
|
|
98
|
+
2. **Header versioning**: `Accept: application/vnd.example.v1+json`. Cleaner URIs, harder caching.
|
|
99
|
+
3. **No versioning, additive forever**: feasible if discipline is iron and the API is small.
|
|
100
|
+
|
|
101
|
+
**Breaking changes** require either a new version or a deprecation cycle (announce → warn → remove with
|
|
102
|
+
months of overlap).
|
|
103
|
+
|
|
104
|
+
## Backward compatibility
|
|
105
|
+
|
|
106
|
+
- **Adding fields** to responses is safe (clients should ignore unknowns; document this expectation).
|
|
107
|
+
- **Removing or renaming fields** is breaking. Deprecate, warn, then remove.
|
|
108
|
+
- **Changing types or meanings** is breaking even with the same name.
|
|
109
|
+
- **Tightening validation** is breaking (calls that used to succeed now fail).
|
|
110
|
+
- **Loosening validation** is generally safe.
|
|
111
|
+
|
|
112
|
+
Document a deprecation policy: `Deprecation: true` header, sunset date, alternative.
|
|
113
|
+
|
|
114
|
+
## Time
|
|
115
|
+
|
|
116
|
+
- **ISO-8601 UTC** in responses (`2026-05-20T18:42:11Z`). Never bare timestamps without timezone.
|
|
117
|
+
- **Accept ISO-8601** in inputs; reject otherwise. Don't guess locales.
|
|
118
|
+
|
|
119
|
+
## IDs
|
|
120
|
+
|
|
121
|
+
- **Prefix typed IDs** for human safety: `ord_8f3a...`, `usr_2c91...`. Bug reports cite IDs all the time;
|
|
122
|
+
prefixed IDs prevent confusion across types.
|
|
123
|
+
- **Opaque**: don't encode internal facts (timestamps, shard hints) where callers can see them.
|
|
124
|
+
|
|
125
|
+
## Rate limiting
|
|
126
|
+
|
|
127
|
+
- **`429 Too Many Requests`** with `Retry-After` (seconds) and ideally `X-RateLimit-Remaining`,
|
|
128
|
+
`X-RateLimit-Reset`.
|
|
129
|
+
- **Limit per principal**, not per IP, when there's auth.
|
|
130
|
+
- **Document the limits** publicly. Hidden limits cause outages.
|
|
131
|
+
|
|
132
|
+
## Security touchpoints
|
|
133
|
+
|
|
134
|
+
API design is half security design. Cross-reference [`owasp-defense`](../owasp-defense/SKILL.md):
|
|
135
|
+
|
|
136
|
+
- **AuthZ at the resource**, not just the route.
|
|
137
|
+
- **Idempotency keys** on state-changing public endpoints.
|
|
138
|
+
- **Input validation** with allowlists.
|
|
139
|
+
- **SSRF** if the endpoint takes a URL.
|
|
140
|
+
- **PII** — don't return more than the caller needs.
|
|
141
|
+
|
|
142
|
+
## When to invoke `architecture-reviewer`
|
|
143
|
+
|
|
144
|
+
- The API introduces a new contract that other systems will depend on.
|
|
145
|
+
- The API changes dependency direction (e.g., service A now calls service B where it used to be the
|
|
146
|
+
reverse).
|
|
147
|
+
- The versioning strategy is being decided for the first time.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: clean-code
|
|
3
|
+
description: Use when naming things, structuring functions, deciding whether to add a comment, or cleaning up code mid-implementation. Pragmatic clean-code rules with explicit anti-patterns and when-not-to-apply guidance.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Clean code — pragmatic rules
|
|
7
|
+
|
|
8
|
+
The principles are in [`rules/20-clean-code.md`](../../rules/20-clean-code.md) — that's the
|
|
9
|
+
always-on floor. This skill adds **operational depth**: decision tables (parameter counts,
|
|
10
|
+
function length), before/after example pairs (early returns, boolean naming), and
|
|
11
|
+
when-not-to-apply guidance. When a section restates the rule verbatim, replace with a pointer
|
|
12
|
+
and only keep the operational expansion.
|
|
13
|
+
|
|
14
|
+
## Naming
|
|
15
|
+
|
|
16
|
+
### Rules of thumb
|
|
17
|
+
|
|
18
|
+
- **Intent > mechanics.** `eligibleUserIds` beats `arr`.
|
|
19
|
+
- **Length scales with scope.** Loop variable: 1–3 chars. Module-level: spell it out.
|
|
20
|
+
- **One concept, one word.** Don't shuffle `fetch`/`get`/`retrieve`/`load`/`pull` for the same operation.
|
|
21
|
+
- **No type-encoded prefixes** (`strName`, `bIsValid`).
|
|
22
|
+
- **Watch for weasel words**: `Manager`, `Helper`, `Util`, `Processor`, `Handler`, `Service`. They usually
|
|
23
|
+
hide an SRP violation.
|
|
24
|
+
|
|
25
|
+
### Boolean naming
|
|
26
|
+
|
|
27
|
+
- **Be a question.** `isActive`, `hasPermission`, `canEdit`, `shouldRetry`.
|
|
28
|
+
- **Avoid double negatives.** `isNotInvalid` is unreadable.
|
|
29
|
+
- **Avoid ambiguity.** `flag` is meaningless. `accountFrozen` is clear.
|
|
30
|
+
|
|
31
|
+
### Side-effect signaling
|
|
32
|
+
|
|
33
|
+
- **Verbs for action**, **nouns for state**.
|
|
34
|
+
- `user.name` is state; `user.deactivate()` is action.
|
|
35
|
+
- `validateOrder` better not also charge the card. Name truthfully.
|
|
36
|
+
|
|
37
|
+
## Functions
|
|
38
|
+
|
|
39
|
+
### Length
|
|
40
|
+
|
|
41
|
+
Aim for under ~20 lines. Length is a smell, not a hard limit. A 40-line function that reads top-to-bottom
|
|
42
|
+
without nesting is fine. A 15-line function with five nested ifs is not.
|
|
43
|
+
|
|
44
|
+
### Parameters
|
|
45
|
+
|
|
46
|
+
| Count | Verdict |
|
|
47
|
+
|-------|--------------------------------------------------------|
|
|
48
|
+
| 0 | Suspect — what state is it pulling from? |
|
|
49
|
+
| 1 | Great. |
|
|
50
|
+
| 2 | Great. |
|
|
51
|
+
| 3 | Borderline. Consider a parameter object if related. |
|
|
52
|
+
| 4+ | Almost always wants a struct/record/object. |
|
|
53
|
+
|
|
54
|
+
### Flag arguments
|
|
55
|
+
|
|
56
|
+
Banned.
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
// bad
|
|
60
|
+
processOrder(order, true); // what does `true` mean?
|
|
61
|
+
|
|
62
|
+
// good
|
|
63
|
+
processOrderAndCharge(order);
|
|
64
|
+
processOrderAsDraft(order);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Early returns
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
# bad — pyramid of doom
|
|
71
|
+
def process(req):
|
|
72
|
+
if req.is_valid():
|
|
73
|
+
if req.user.has_quota():
|
|
74
|
+
if not req.is_duplicate():
|
|
75
|
+
# actual work, four levels deep
|
|
76
|
+
...
|
|
77
|
+
|
|
78
|
+
# good — guard clauses, work at the surface level
|
|
79
|
+
def process(req):
|
|
80
|
+
if not req.is_valid(): return Err("invalid")
|
|
81
|
+
if not req.user.has_quota(): return Err("quota")
|
|
82
|
+
if req.is_duplicate(): return Err("duplicate")
|
|
83
|
+
# actual work
|
|
84
|
+
...
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Comments
|
|
88
|
+
|
|
89
|
+
**Default: no comment.** The bar to add one is high. A comment is justified only when **the WHY is
|
|
90
|
+
non-obvious**:
|
|
91
|
+
|
|
92
|
+
- A hidden constraint (`// must run before the lock is acquired — see issue #2412`).
|
|
93
|
+
- A non-local invariant (`// keep aligned with the schema in migrations/0042`).
|
|
94
|
+
- A workaround for a specific bug or library quirk (`// libfoo 1.4 returns null for empty results`).
|
|
95
|
+
- A subtle performance choice (`// pre-allocate; the hot path runs ~1e6 times/sec`).
|
|
96
|
+
|
|
97
|
+
**Banned**:
|
|
98
|
+
|
|
99
|
+
- Narrating WHAT the code does (`// increment i`).
|
|
100
|
+
- References to the current PR/task/ticket (`// added for TICKET-1234`) — that rots; PR history is the
|
|
101
|
+
right place.
|
|
102
|
+
- Commented-out code (delete it; source control remembers).
|
|
103
|
+
- Outdated comments. If you change the code, update or delete the comment.
|
|
104
|
+
|
|
105
|
+
## Errors
|
|
106
|
+
|
|
107
|
+
Canonical rules: [`rules/20-clean-code.md`](../../rules/20-clean-code.md) §Errors. Operational
|
|
108
|
+
expansion specific to this skill:
|
|
109
|
+
|
|
110
|
+
- **Preserve cause idiomatically.** `raise ProcessingError("step 3") from e` (Python),
|
|
111
|
+
`fmt.Errorf("step 3: %w", err)` (Go), `throw new ProcessingError("step 3", { cause: e })`
|
|
112
|
+
(JS). Don't `throw new Error(e.message)` — the stack and chain are lost.
|
|
113
|
+
- **Boundary-decided error logging.** Don't log-and-rethrow at every layer; one log at the
|
|
114
|
+
layer that decides the response. Many duplicates for one event is dashboard noise.
|
|
115
|
+
|
|
116
|
+
## Structure
|
|
117
|
+
|
|
118
|
+
Canonical rules: [`rules/20-clean-code.md`](../../rules/20-clean-code.md) §Structure. Operational
|
|
119
|
+
addition specific to this skill:
|
|
120
|
+
|
|
121
|
+
- **No `utils.py` / `helpers.ts` / `common.go`** grab-bag modules. They become SRP graveyards.
|
|
122
|
+
When you reach for one, the actual concept already wants a name — give it one.
|
|
123
|
+
|
|
124
|
+
## Diff hygiene
|
|
125
|
+
|
|
126
|
+
See [`rules/20-clean-code.md`](../../rules/20-clean-code.md) §Diff hygiene for the canonical
|
|
127
|
+
list. Operational note: hooks (`hooks/pre-tool/guard-protected-paths.sh`) enforce some of these
|
|
128
|
+
mechanically (e.g., no lockfile hand-edits, no writes inside `.git/`). When a hook fires, the
|
|
129
|
+
rule is being enforced — don't work around the hook.
|
|
130
|
+
|
|
131
|
+
## When clean-code rules are *not* the right move
|
|
132
|
+
|
|
133
|
+
- **Hot paths.** Sometimes the readable version costs 10x and you need the gnarly one. Document why.
|
|
134
|
+
- **Generated code.** Don't fight your generator's conventions.
|
|
135
|
+
- **Existing code without coverage.** Don't "clean up" code you can't safely modify. Refactor under green
|
|
136
|
+
or escalate to [`test-strategist`](../test-strategy/SKILL.md) first.
|
|
137
|
+
|
|
138
|
+
## The reader test
|
|
139
|
+
|
|
140
|
+
Write code as if explaining the problem to a smart colleague who knows the language but not this codebase.
|
|
141
|
+
Names, structure, and tests should let them follow along without questions. When a reviewer asks "what
|
|
142
|
+
does this do?", the code lost.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: market-research
|
|
3
|
+
description: Use when researching a software idea before specifying it — scanning competitors, mining real user complaints and churn reasons, finding recurring failure modes to design away from, and turning that evidence into requirements, non-goals, and risks. Covers where to look, signal-vs-noise, citation discipline, and how to avoid fabrication and confirmation bias.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Market & competitive research
|
|
7
|
+
|
|
8
|
+
This skill powers the research half of the discovery phase. The owning agent is
|
|
9
|
+
[`discovery-analyst`](../../agents/discovery-analyst.md); the output of this research feeds directly
|
|
10
|
+
into [`requirements-engineering`](../requirements-engineering/SKILL.md) — every finding should become
|
|
11
|
+
a requirement, a non-goal, or a risk, or it was wasted effort.
|
|
12
|
+
|
|
13
|
+
The honesty floor is in [`rules/00-priorities.md`](../../rules/00-priorities.md) ("identify
|
|
14
|
+
uncertainty; verify before claiming; don't invent facts to sound confident"). This skill is the
|
|
15
|
+
operational version of that rule applied to research: **cite or qualify everything, fabricate
|
|
16
|
+
nothing.**
|
|
17
|
+
|
|
18
|
+
## Why research before requirements
|
|
19
|
+
|
|
20
|
+
Most products fail at problems someone already solved badly, in ways that are publicly documented.
|
|
21
|
+
The competition has already run the experiment and the users have already written down what hurts.
|
|
22
|
+
Reading that record is the cheapest risk reduction available — and skipping it means re-discovering
|
|
23
|
+
known failure modes with your own users' patience.
|
|
24
|
+
|
|
25
|
+
The goal is not a generic industry summary. It is a **specific, cited map** of: who else does this,
|
|
26
|
+
where they fall down, what users leave over, and what gap is open.
|
|
27
|
+
|
|
28
|
+
## Where to look
|
|
29
|
+
|
|
30
|
+
| Source | What it tells you |
|
|
31
|
+
|--------|-------------------|
|
|
32
|
+
| Competitor **marketing pages** | Claimed value, target persona, positioning |
|
|
33
|
+
| Competitor **pricing pages** | Where the money and the pain are; packaging friction |
|
|
34
|
+
| Competitor **changelogs / roadmaps** | What they're racing to fix (their known weaknesses) |
|
|
35
|
+
| Competitor **docs / help center** | What's hard enough to need explaining (complexity tax) |
|
|
36
|
+
| **Review platforms** (G2, Capterra, Trustpilot, app stores) | Structured praise *and* complaints at volume |
|
|
37
|
+
| **Community threads** (Reddit, Hacker News, Stack Overflow, niche forums) | Unfiltered pain, workarounds, "why we left X" |
|
|
38
|
+
| **Public issue trackers** (GitHub issues, support forums) | Concrete bugs, long-standing unmet requests |
|
|
39
|
+
| **Shutdown / migration posts** | What made incumbents lose users — the strongest signal |
|
|
40
|
+
|
|
41
|
+
## What to extract (organize the report around these)
|
|
42
|
+
|
|
43
|
+
- **Recurring complaints** — the same pain from many independent users. Your must-avoid list; rich
|
|
44
|
+
source of requirements and non-goals.
|
|
45
|
+
- **Churn / abandonment reasons** — what made people *leave*. Designing away from these usually beats
|
|
46
|
+
any new feature.
|
|
47
|
+
- **Unmet demand** — features repeatedly requested and never delivered. Candidate differentiators.
|
|
48
|
+
- **Reliability / performance / security / UX friction** — the non-functional reasons trust erodes.
|
|
49
|
+
These become NFRs with numbers.
|
|
50
|
+
- **Pricing / packaging pain** — where the commercial model frustrates users; informs scope even when
|
|
51
|
+
out of code scope.
|
|
52
|
+
|
|
53
|
+
## Jobs-to-be-done framing
|
|
54
|
+
|
|
55
|
+
Don't catalogue features — find the **job** the user hires the product to do. "People don't want a
|
|
56
|
+
quarter-inch drill; they want a quarter-inch hole." When you frame around the job, you see substitutes
|
|
57
|
+
the feature list misses (a spreadsheet, a manual process, a competitor in an adjacent category) and
|
|
58
|
+
you avoid building a slightly-different version of a tool people already resent.
|
|
59
|
+
|
|
60
|
+
## Signal vs noise — the discipline that makes research trustworthy
|
|
61
|
+
|
|
62
|
+
- **One angry review is noise.** The *same* complaint across many independent sources is **signal**.
|
|
63
|
+
Always say which you have ("cited across 30+ reports" vs "one user mentioned").
|
|
64
|
+
- **Recency matters** — a complaint about a bug fixed last year is stale. Date your findings and
|
|
65
|
+
check whether the changelog already addressed them.
|
|
66
|
+
- **Beware survivorship & selection bias** — review sites skew to extremes (delighted or furious);
|
|
67
|
+
forums skew technical. Triangulate across source *types*, not just count.
|
|
68
|
+
- **Separate fact from inference** — "users report X" (fact, cited) vs "this suggests Y" (your
|
|
69
|
+
inference, labeled).
|
|
70
|
+
|
|
71
|
+
## Citation discipline (non-negotiable)
|
|
72
|
+
|
|
73
|
+
- **Cite every non-obvious claim** with a URL or a clearly named source. A complaint without a source
|
|
74
|
+
is an opinion.
|
|
75
|
+
- **Never fabricate** a competitor, a statistic, a review quote, or a citation. This is the cardinal
|
|
76
|
+
sin of this phase: an invented competitor weakness can steer the entire project wrong, and it looks
|
|
77
|
+
exactly as authoritative as a real one.
|
|
78
|
+
- **"No evidence found" is a valid, valuable result.** It tells the team a claim is an assumption to
|
|
79
|
+
validate, not a fact to build on. Say it plainly.
|
|
80
|
+
- **Quote sparingly and attribute** — a short representative quote is fine; don't paste walls of
|
|
81
|
+
copyrighted text.
|
|
82
|
+
|
|
83
|
+
## From research to requirements (the whole point)
|
|
84
|
+
|
|
85
|
+
Every finding must land somewhere downstream, or cut it:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
Recurring complaint → FR / NFR (build the thing they're missing, correctly)
|
|
89
|
+
Churn reason → NFR or non-goal (design away from the abandonment driver)
|
|
90
|
+
Unmet demand → differentiator FR (Should/Could) or explicit "Won't, because…"
|
|
91
|
+
Known failure mode → Risk + mitigation (verify our approach doesn't inherit it)
|
|
92
|
+
Pricing/UX friction → scope/non-goal in the BRD
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
See the worked trace in [`discovery-analyst`](../../agents/discovery-analyst.md) ("Example of a good
|
|
96
|
+
research-to-requirement trace").
|
|
97
|
+
|
|
98
|
+
## Anti-patterns to call out
|
|
99
|
+
|
|
100
|
+
- **Fabrication** — inventing competitors, numbers, or quotes. Disqualifying.
|
|
101
|
+
- **Hollow authority** — confident prose, zero citations. Cite or qualify.
|
|
102
|
+
- **Confirmation bias** — researching only what supports the idea you already like. Actively look for
|
|
103
|
+
why the idea might be redundant or wrong; record the strongest counter-case.
|
|
104
|
+
- **Feature-listing** — cataloguing competitor features instead of finding the *job* and the *pain*.
|
|
105
|
+
- **Research theatre** — gathering complaints and never converting them to requirements/risks. If a
|
|
106
|
+
finding doesn't change a document, it didn't matter.
|
|
107
|
+
- **Stale-as-fresh** — citing old complaints a changelog already fixed.
|
|
108
|
+
- **Single-source confidence** — treating one thread as a market truth.
|
|
109
|
+
|
|
110
|
+
## When *not* to over-apply
|
|
111
|
+
|
|
112
|
+
- For an **internal tool with no external competition**, the "research" is interviewing the actual
|
|
113
|
+
users/stakeholders, not scanning G2 — adapt the method, keep the discipline (cite who said what).
|
|
114
|
+
- For a **well-understood incremental feature**, deep market research is overkill — a quick check of
|
|
115
|
+
how the current product and one or two peers handle it is enough.
|
|
116
|
+
- Don't let research become an excuse to delay; **time-box** it and note what you'd still validate.
|
|
117
|
+
|
|
118
|
+
## When to escalate / hand off
|
|
119
|
+
|
|
120
|
+
- **To the user (verification protocol)** — when the research surfaces a strategic fork (which
|
|
121
|
+
competitor weakness to attack, which persona to serve). Present options grounded in the findings.
|
|
122
|
+
- **To [`requirements-engineering`](../requirements-engineering/SKILL.md)** — to convert findings into
|
|
123
|
+
testable, traceable requirements.
|
|
124
|
+
- **To [`threat-modeling`](../threat-modeling/SKILL.md)** — when competitor *security* failures are a
|
|
125
|
+
recurring complaint; they become security NFRs and trust-boundary requirements.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: observability
|
|
3
|
+
description: Use when adding logs, metrics, or traces — or when reviewing whether code can be debugged in production at 3am. Covers structured logging, the three signals, correlation, cardinality, and alerting philosophy.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Observability
|
|
7
|
+
|
|
8
|
+
The principles are in [`rules/40-engineering-practices.md`](../../rules/40-engineering-practices.md)
|
|
9
|
+
§Observability — that's the always-on floor (structured logs, three signals, correlation,
|
|
10
|
+
cardinality, alert philosophy). This skill adds **operational depth**: log-level decision table,
|
|
11
|
+
RED/USE frames, the metric-cardinality blast radius, per-change checklist.
|
|
12
|
+
|
|
13
|
+
The 3am test: a paged on-call engineer must be able to figure out what happened from logs/metrics/traces
|
|
14
|
+
alone, without re-deploying with extra `printf`s. If they can't, observability is missing.
|
|
15
|
+
|
|
16
|
+
## The three signals
|
|
17
|
+
|
|
18
|
+
- **Logs** — discrete events with context. "What happened?"
|
|
19
|
+
- **Metrics** — aggregated numbers over time. "How often / how fast / how many?"
|
|
20
|
+
- **Traces** — causality across services. "What called what, and where did the time go?"
|
|
21
|
+
|
|
22
|
+
Each is the wrong tool for the others' job:
|
|
23
|
+
|
|
24
|
+
- Don't aggregate logs into metrics — too expensive, too noisy.
|
|
25
|
+
- Don't put per-request detail into metric labels — cardinality explodes.
|
|
26
|
+
- Don't reconstruct call chains from logs — that's what traces are for.
|
|
27
|
+
|
|
28
|
+
## Logging
|
|
29
|
+
|
|
30
|
+
### Format
|
|
31
|
+
|
|
32
|
+
- **Structured** (JSON or key=value), never `printf` soup.
|
|
33
|
+
- **One event per record**, no multi-line concatenation.
|
|
34
|
+
- **Stable keys**: don't shuffle `user_id` / `userId` / `user`.
|
|
35
|
+
- **UTC ISO-8601 timestamps**, server-side. Don't trust client clocks.
|
|
36
|
+
|
|
37
|
+
### Levels
|
|
38
|
+
|
|
39
|
+
| Level | When |
|
|
40
|
+
|---------|----------------------------------------------------------------------------|
|
|
41
|
+
| ERROR | Something requires human attention (paging, ticketing, retry exhausted) |
|
|
42
|
+
| WARN | Anomaly that didn't fail, but you'd want to know if it became common |
|
|
43
|
+
| INFO | Notable lifecycle events (start, stop, deploys, scheduled jobs) |
|
|
44
|
+
| DEBUG | High-volume detail, gated, off in prod by default |
|
|
45
|
+
|
|
46
|
+
Don't log INFO for every request — that's a metric, not a log.
|
|
47
|
+
|
|
48
|
+
### Required context
|
|
49
|
+
|
|
50
|
+
Every log line in a request path carries:
|
|
51
|
+
|
|
52
|
+
- `request_id` / `trace_id` — correlation across services.
|
|
53
|
+
- `user_id` or `principal_id` — *when not in a credential endpoint and not leaking PII*.
|
|
54
|
+
- `service` / `environment` — for multi-service log aggregators.
|
|
55
|
+
- `error` (when applicable) — full stack/chain, not `e.message`.
|
|
56
|
+
|
|
57
|
+
### Never log
|
|
58
|
+
|
|
59
|
+
- Passwords, tokens, API keys, session IDs.
|
|
60
|
+
- Full PII for credential / payment endpoints (mask: `user@****.com`).
|
|
61
|
+
- Raw request body when it might contain the above.
|
|
62
|
+
- Cookies, authorization headers.
|
|
63
|
+
|
|
64
|
+
### Error logging
|
|
65
|
+
|
|
66
|
+
- **Capture the cause chain.** Re-raise with original cause; don't drop the stack.
|
|
67
|
+
- **Log at the boundary that decides what to do**, not every layer that re-raises. Many duplicate logs
|
|
68
|
+
for one event is noise.
|
|
69
|
+
|
|
70
|
+
## Metrics
|
|
71
|
+
|
|
72
|
+
### Cardinality discipline
|
|
73
|
+
|
|
74
|
+
A metric `http_requests{status="500", path="/api/orders", user_id="<id>"}` will blow up your storage when
|
|
75
|
+
user IDs proliferate. Rule of thumb:
|
|
76
|
+
|
|
77
|
+
- **Labels with bounded cardinality only**: `status`, `method`, `route` (template, not raw path),
|
|
78
|
+
`service`.
|
|
79
|
+
- **Never**: user IDs, request IDs, timestamps, query strings, free-text fields.
|
|
80
|
+
|
|
81
|
+
### RED / USE
|
|
82
|
+
|
|
83
|
+
Two standard frames:
|
|
84
|
+
|
|
85
|
+
- **RED** (request-driven services): **R**ate, **E**rrors, **D**uration. Track per route/handler.
|
|
86
|
+
- **USE** (resources): **U**tilization, **S**aturation, **E**rrors. Track for CPU, memory, disk, queue
|
|
87
|
+
depth.
|
|
88
|
+
|
|
89
|
+
### Histograms over averages
|
|
90
|
+
|
|
91
|
+
Latency averages lie. Use histograms (Prometheus, OpenTelemetry). Watch p50, p95, p99.
|
|
92
|
+
|
|
93
|
+
## Traces
|
|
94
|
+
|
|
95
|
+
- **Propagate the trace context** across every RPC, queue, and async hop. Without propagation, traces
|
|
96
|
+
are isolated spans, not a story.
|
|
97
|
+
- **Add spans for non-trivial work**: external calls, slow algorithms, batched operations.
|
|
98
|
+
- **Attach attributes** to spans (small, bounded): the entity ID, the operation outcome, the size of the
|
|
99
|
+
batch.
|
|
100
|
+
|
|
101
|
+
## Correlation
|
|
102
|
+
|
|
103
|
+
The single most useful thing for debugging is **one ID that ties everything together**.
|
|
104
|
+
|
|
105
|
+
- **`request_id`** generated at the edge; propagated to every log, metric exemplar, and trace span.
|
|
106
|
+
- **Pass it across service boundaries** via a header (e.g. `X-Request-Id`).
|
|
107
|
+
- **Log it on every error**, every external call, every business event.
|
|
108
|
+
|
|
109
|
+
## Alerting
|
|
110
|
+
|
|
111
|
+
- **Alert on symptoms**, not causes. "Error rate > 1%" beats "disk usage > 90%."
|
|
112
|
+
- **Page on impact, not anomaly.** Disk filling up is a ticket; user-facing error rate is a page.
|
|
113
|
+
- **Every alert needs a runbook.** If you can't write the runbook, the alert isn't ready.
|
|
114
|
+
- **Alert noise is a bug.** Repeated false positives train on-call to ignore alerts. Fix or remove.
|
|
115
|
+
|
|
116
|
+
## What to add per change
|
|
117
|
+
|
|
118
|
+
For a non-trivial change, ask:
|
|
119
|
+
|
|
120
|
+
1. **Log lines** — what new events should be loggable? What context do they need?
|
|
121
|
+
2. **Metrics** — what new aggregates? RED for new endpoints; USE for new resources.
|
|
122
|
+
3. **Traces** — what new spans? Any new RPC/queue hops to propagate context across?
|
|
123
|
+
4. **Alerts** — does this new code path warrant a new alert? (Often no; sometimes critical.)
|
|
124
|
+
5. **Dashboards** — is there a dashboard panel that should be updated?
|
|
125
|
+
|
|
126
|
+
## Anti-patterns
|
|
127
|
+
|
|
128
|
+
- **Log-and-rethrow chains** — every layer logs, dashboards drown.
|
|
129
|
+
- **`printf("here")` debugging shipped to prod.**
|
|
130
|
+
- **Metrics with per-user labels.**
|
|
131
|
+
- **Alerts with no runbook, no owner, or no removal condition.**
|
|
132
|
+
- **Sampling traces away the rare cases** that are the only ones worth investigating.
|
|
133
|
+
- **Counting "we have logs" as observability.** Volume isn't signal.
|