@ethlete/agent-rules 0.1.0-next.6 → 0.1.0-next.60

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.
Files changed (220) hide show
  1. package/AGENTS.md +28 -0
  2. package/CHANGELOG.md +841 -0
  3. package/CLAUDE.md +1 -0
  4. package/README.md +244 -36
  5. package/THIRD-PARTY-LICENSES.md +35 -0
  6. package/content/defaults.json +1 -1
  7. package/content/hooks/away-mode.py +410 -0
  8. package/content/hooks/background-commands.py +177 -0
  9. package/content/hooks/builder-idle-check.py +529 -0
  10. package/content/hooks/context-warning.py +666 -134
  11. package/content/hooks/git-safety.py +213 -0
  12. package/content/hooks/human-wait-check.py +167 -0
  13. package/content/hooks/subagent-model-policy.py +261 -0
  14. package/content/mods/.claude-plugin/marketplace.json +26 -0
  15. package/content/mods/plugins/codex-runs/.claude-plugin/plugin.json +6 -0
  16. package/content/mods/plugins/codex-runs/hooks/agent-runs.ts +310 -0
  17. package/content/mods/plugins/codex-runs/hooks/hooks.json +1 -0
  18. package/content/mods/plugins/codex-runs/hooks/progress.ts +130 -0
  19. package/content/mods/plugins/codex-runs/hooks/register.tsx +283 -0
  20. package/content/mods/plugins/codex-runs/tests/pane.test.ts +21 -0
  21. package/content/mods/plugins/codex-runs/tsconfig.json +4 -0
  22. package/content/mods/plugins/codex-runs/types/index.d.ts +37 -0
  23. package/content/mods/plugins/e2e-progress/.claude-plugin/plugin.json +6 -0
  24. package/content/mods/plugins/e2e-progress/hooks/hooks.json +1 -0
  25. package/content/mods/plugins/e2e-progress/hooks/progress.ts +205 -0
  26. package/content/mods/plugins/e2e-progress/hooks/register.tsx +498 -0
  27. package/content/mods/plugins/e2e-progress/tsconfig.json +3 -0
  28. package/content/mods/plugins/e2e-progress/types/index.d.ts +27 -0
  29. package/content/mods/plugins/status-line/.claude-plugin/plugin.json +6 -0
  30. package/content/mods/plugins/status-line/hooks/hooks.json +1 -0
  31. package/content/mods/plugins/status-line/hooks/line.ts +74 -0
  32. package/content/mods/plugins/status-line/hooks/register.tsx +141 -0
  33. package/content/mods/plugins/status-line/types/index.d.ts +5 -0
  34. package/content/mods/plugins/usage-line/.claude-plugin/plugin.json +6 -0
  35. package/content/mods/plugins/usage-line/hooks/codex.ts +52 -0
  36. package/content/mods/plugins/usage-line/hooks/format.ts +24 -0
  37. package/content/mods/plugins/usage-line/hooks/hooks.json +1 -0
  38. package/content/mods/plugins/usage-line/hooks/rate-limits.ts +23 -0
  39. package/content/mods/plugins/usage-line/hooks/register.tsx +83 -0
  40. package/content/mods/plugins/usage-line/tsconfig.json +4 -0
  41. package/content/mods/plugins/usage-line/types/index.d.ts +5 -0
  42. package/content/output-styles/ste-clarity.md +131 -0
  43. package/content/rules/agent-sessions-wake-up.md +11 -0
  44. package/content/rules/app-styling.md +66 -0
  45. package/content/rules/comments.md +4 -1
  46. package/content/rules/lint-and-format.md +7 -5
  47. package/content/rules/nx-layout.md +53 -0
  48. package/content/rules/reactive-state.md +1 -1
  49. package/content/rules/styling.md +19 -10
  50. package/content/rules/subagent-models.md +42 -0
  51. package/content/rules/waiting-on-the-human.md +17 -0
  52. package/content/skills/agent-sessions/SKILL.md +101 -0
  53. package/content/skills/agent-sessions/agent-sessions.mjs +1462 -0
  54. package/content/skills/angular-patterns/SKILL.md +31 -7
  55. package/content/skills/api-source/SKILL.md +156 -0
  56. package/content/skills/app-testing/SKILL.md +141 -0
  57. package/content/skills/codex-subagent/SKILL.md +102 -0
  58. package/content/skills/codex-subagent/codex-agent.mjs +260 -0
  59. package/content/skills/codex-subagent/codex-limit.mjs +106 -0
  60. package/content/skills/design-exploration/SKILL.md +121 -0
  61. package/content/skills/design-exploration/check-story.mjs +139 -0
  62. package/content/skills/design-exploration/reference-shots.md +15 -0
  63. package/content/skills/design-exploration/shoot-template.mjs +61 -0
  64. package/content/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  65. package/content/skills/domain-modeling/SKILL.md +71 -0
  66. package/content/skills/e2e-triage/SKILL.md +80 -0
  67. package/content/skills/figma-export/SKILL.md +16 -18
  68. package/content/skills/git-commit/SKILL.md +21 -7
  69. package/content/skills/git-flow/SKILL.md +9 -5
  70. package/content/skills/grill-with-docs/SKILL.md +13 -0
  71. package/content/skills/grilling/SKILL.md +52 -0
  72. package/content/skills/handoff/SKILL.md +30 -72
  73. package/content/skills/handoff/save.md +189 -0
  74. package/content/skills/query/SKILL.md +165 -74
  75. package/content/skills/report/SKILL.md +26 -0
  76. package/content/skills/rxjs-signals/SKILL.md +33 -4
  77. package/content/skills/sdk-docs/SKILL.md +50 -14
  78. package/content/skills/sdk-local-build/SKILL.md +26 -8
  79. package/content/skills/sdk-local-build/sdk-local-baseline.mjs +64 -0
  80. package/content/skills/sdk-source/SKILL.md +37 -34
  81. package/content/skills/sdk-update/SKILL.md +103 -0
  82. package/content/skills/story-styling/SKILL.md +12 -10
  83. package/content/skills/styleguide/SKILL.md +13 -8
  84. package/content/skills/styleguide/assets.md +54 -0
  85. package/content/skills/styleguide/changesets.md +17 -0
  86. package/content/skills/styleguide/file-structure.md +73 -0
  87. package/content/skills/styleguide/lint-rule-lookup.md +52 -0
  88. package/content/skills/styleguide/storybook-structure.md +25 -0
  89. package/content/skills/theming/SKILL.md +76 -49
  90. package/content/skills/verify-in-app/SKILL.md +107 -0
  91. package/content/skills/verify-in-storybook/SKILL.md +1 -1
  92. package/content/skills/verify-on-apple-devices/SKILL.md +100 -0
  93. package/content/skills/verify-on-apple-devices/apple-remote.sh +421 -0
  94. package/content/skills/verify-on-apple-devices/sim-edge-back.m +159 -0
  95. package/migrations/list-state-query-form.md +20 -0
  96. package/migrations/nx-layout.md +29 -0
  97. package/migrations/sdk-components-over-hand-built-ui.md +27 -0
  98. package/migrations/search-query-field.md +52 -0
  99. package/migrations/studio-claude-plugin.md +27 -0
  100. package/migrations.json +47 -0
  101. package/package.json +8 -3
  102. package/src/index.js +84 -28
  103. package/src/index.js.map +1 -1
  104. package/src/lib/cli-args.d.ts +9 -0
  105. package/src/lib/cli-args.js +48 -0
  106. package/src/lib/cli-args.js.map +1 -0
  107. package/src/lib/commitlint.d.ts +10 -0
  108. package/src/lib/commitlint.js +51 -0
  109. package/src/lib/commitlint.js.map +1 -0
  110. package/src/lib/config.d.ts +53 -22
  111. package/src/lib/config.js +128 -12
  112. package/src/lib/config.js.map +1 -1
  113. package/src/lib/filter.d.ts +3 -0
  114. package/src/lib/filter.js +7 -5
  115. package/src/lib/filter.js.map +1 -1
  116. package/src/lib/frontmatter.d.ts +2 -0
  117. package/src/lib/frontmatter.js +33 -5
  118. package/src/lib/frontmatter.js.map +1 -1
  119. package/src/lib/git-flow/config.js +1 -1
  120. package/src/lib/git-flow/config.js.map +1 -1
  121. package/src/lib/git-flow/index.d.ts +1 -0
  122. package/src/lib/git-flow/index.js +20 -6
  123. package/src/lib/git-flow/index.js.map +1 -1
  124. package/src/lib/git-flow/parse.js +38 -12
  125. package/src/lib/git-flow/parse.js.map +1 -1
  126. package/src/lib/git-flow/rename.d.ts +24 -0
  127. package/src/lib/git-flow/rename.js +70 -0
  128. package/src/lib/git-flow/rename.js.map +1 -0
  129. package/src/lib/git-flow/start.d.ts +27 -0
  130. package/src/lib/git-flow/start.js +34 -1
  131. package/src/lib/git-flow/start.js.map +1 -1
  132. package/src/lib/git-flow-command.js +10 -2
  133. package/src/lib/git-flow-command.js.map +1 -1
  134. package/src/lib/git-flow-repair.d.ts +1 -1
  135. package/src/lib/git-flow-repair.js +30 -15
  136. package/src/lib/git-flow-repair.js.map +1 -1
  137. package/src/lib/git-flow-start.d.ts +1 -1
  138. package/src/lib/git-flow-start.js +25 -32
  139. package/src/lib/git-flow-start.js.map +1 -1
  140. package/src/lib/git.d.ts +37 -0
  141. package/src/lib/git.js +85 -3
  142. package/src/lib/git.js.map +1 -1
  143. package/src/lib/gitlab.js +24 -6
  144. package/src/lib/gitlab.js.map +1 -1
  145. package/src/lib/index.d.ts +2 -0
  146. package/src/lib/index.js +26 -11
  147. package/src/lib/index.js.map +1 -1
  148. package/src/lib/migrate.js +8 -2
  149. package/src/lib/migrate.js.map +1 -1
  150. package/src/lib/output-style-command.d.ts +3 -0
  151. package/src/lib/output-style-command.js +69 -0
  152. package/src/lib/output-style-command.js.map +1 -0
  153. package/src/lib/output-style.d.ts +38 -0
  154. package/src/lib/output-style.js +134 -0
  155. package/src/lib/output-style.js.map +1 -0
  156. package/src/lib/owned-paths.js +8 -2
  157. package/src/lib/owned-paths.js.map +1 -1
  158. package/src/lib/package-runner.d.ts +4 -0
  159. package/src/lib/package-runner.js +86 -0
  160. package/src/lib/package-runner.js.map +1 -0
  161. package/src/lib/plain-text.d.ts +9 -0
  162. package/src/lib/plain-text.js +22 -0
  163. package/src/lib/plain-text.js.map +1 -0
  164. package/src/lib/plan.d.ts +6 -6
  165. package/src/lib/plan.js +153 -40
  166. package/src/lib/plan.js.map +1 -1
  167. package/src/lib/prettier.d.ts +21 -0
  168. package/src/lib/prettier.js +51 -0
  169. package/src/lib/prettier.js.map +1 -0
  170. package/src/lib/prompt.js +10 -2
  171. package/src/lib/prompt.js.map +1 -1
  172. package/src/lib/render.d.ts +14 -1
  173. package/src/lib/render.js +23 -5
  174. package/src/lib/render.js.map +1 -1
  175. package/src/lib/report-command.d.ts +34 -0
  176. package/src/lib/report-command.js +322 -0
  177. package/src/lib/report-command.js.map +1 -0
  178. package/src/lib/sessions-command.d.ts +4 -0
  179. package/src/lib/sessions-command.js +16 -0
  180. package/src/lib/sessions-command.js.map +1 -0
  181. package/src/lib/sync.d.ts +1 -2
  182. package/src/lib/sync.js +37 -17
  183. package/src/lib/sync.js.map +1 -1
  184. package/src/lib/targets/agents-skills.js +1 -1
  185. package/src/lib/targets/agents-skills.js.map +1 -1
  186. package/src/lib/targets/claude-hooks.d.ts +5 -0
  187. package/src/lib/targets/claude-hooks.js +27 -4
  188. package/src/lib/targets/claude-hooks.js.map +1 -1
  189. package/src/lib/targets/claude-mods.d.ts +20 -0
  190. package/src/lib/targets/claude-mods.js +47 -0
  191. package/src/lib/targets/claude-mods.js.map +1 -0
  192. package/src/lib/targets/claude.js +2 -3
  193. package/src/lib/targets/claude.js.map +1 -1
  194. package/src/lib/targets/codex-hooks.js +4 -2
  195. package/src/lib/targets/codex-hooks.js.map +1 -1
  196. package/src/lib/targets/codex.js +4 -4
  197. package/src/lib/targets/codex.js.map +1 -1
  198. package/src/lib/targets/copilot.js +4 -4
  199. package/src/lib/targets/copilot.js.map +1 -1
  200. package/src/lib/targets/cursor.js +3 -3
  201. package/src/lib/targets/cursor.js.map +1 -1
  202. package/src/lib/targets/git-hooks.d.ts +1 -1
  203. package/src/lib/targets/git-hooks.js +6 -5
  204. package/src/lib/targets/git-hooks.js.map +1 -1
  205. package/src/lib/targets/hooks-shared.d.ts +34 -5
  206. package/src/lib/targets/hooks-shared.js +132 -36
  207. package/src/lib/targets/hooks-shared.js.map +1 -1
  208. package/src/lib/targets/mcp.d.ts +25 -0
  209. package/src/lib/targets/mcp.js +114 -0
  210. package/src/lib/targets/mcp.js.map +1 -0
  211. package/src/lib/targets/shared.d.ts +1 -9
  212. package/src/lib/targets/shared.js +4 -8
  213. package/src/lib/targets/shared.js.map +1 -1
  214. package/src/lib/timetrack.d.ts +16 -0
  215. package/src/lib/timetrack.js +149 -0
  216. package/src/lib/timetrack.js.map +1 -0
  217. package/content/skills/styleguide/STYLEGUIDE.md +0 -520
  218. package/src/lib/jira.d.ts +0 -28
  219. package/src/lib/jira.js +0 -83
  220. package/src/lib/jira.js.map +0 -1
@@ -0,0 +1,189 @@
1
+ # Save and handoff mode
2
+
3
+ ## Handoff mode
4
+
5
+ Where this repo installs the `context-warning` hook, it names the budget at session start,
6
+ turns handoff mode on at 70% of it, and warns once more at each later tier. It reaches you at three points, not only when the user types: at
7
+ the start of the session, after a batch of your own tool calls, and as a turn ends. So a
8
+ long autonomous run learns its token count while it works.
9
+
10
+ Handoff mode is not an order to stop. It is the signal to change how you work, so that
11
+ either ending - you finish, or a fresh session takes over - stays cheap:
12
+
13
+ - Work in slices that each end in a committable state. Never leave two half-finished edits
14
+ in the tree.
15
+ - Send bulky reads, searches and test runs to a sub-agent. Its output stays out of your
16
+ context; its answer does not.
17
+ - Write down each decision and dead end as you reach it, in the commit message or in the
18
+ handoff file. Do not save them for a final summary you may have no room for.
19
+ - Start nothing you cannot finish or hand off inside the remaining budget.
20
+ - Spawn no new sub-agent. Sub-agents that already run finish their work.
21
+
22
+ At the critical tier (85%), stop a sub-agent only if it surely hangs: it made no new step
23
+ for more than 30 minutes. Write its remaining work into the handoff file. Never stop a
24
+ sub-agent that still works.
25
+
26
+ At the critical tier the hook also asks you to choose one of two, and to tell the user
27
+ which you chose:
28
+
29
+ 1. **Finish the task.** Only when you can name every step that is left, and they plainly
30
+ fit the remaining budget. Finish it, commit, then apply the save test below - the answer
31
+ is then usually that no file is needed at all.
32
+ 2. **Hand off.** Everything else. Finish the in-flight atomic edit, nothing new, then save.
33
+
34
+ "Nearly done" means you can name the last steps now. It does not mean the end feels close.
35
+ At the last tier (95%) the hook takes option 1 away, because a budget that small covers no
36
+ task.
37
+
38
+ ### Ending a turn over the budget
39
+
40
+ From 85% on, the hook also fires as you try to end the turn, and the turn then continues so
41
+ you can act. It adds a third option to the two above:
42
+
43
+ 3. **Cross the boundary on purpose.** Some sessions are worth the premium rate: the task is
44
+ one step from done, or this session holds reasoning that no handoff file survives. Take
45
+ it only for a reason you can name in one sentence right now. Say the reason, say what it
46
+ costs, and keep working.
47
+
48
+ Option 3 is a judgment call, not a way out of the other two. Naming a reason you cannot
49
+ state plainly is the same as taking option 2 late and expensively. The hook asks once per
50
+ tier, so it will not block the end of a turn twice for the same budget. It stays quiet while a
51
+ handoff is being saved, until the user's next prompt.
52
+
53
+ ## Save mode
54
+
55
+ **Decide first whether a handoff is needed at all.** One exists so work can resume, so
56
+ write one only when at least one of these holds:
57
+
58
+ - Uncommitted work from this session sits in the tree.
59
+ - A step the user asked for is unfinished, blocked, or waiting on a result.
60
+ - A decision, dead end, or user constraint from this session is written down nowhere else -
61
+ not in a commit message, a changeset, a docs page, or a plan file.
62
+
63
+ Check it, never assume it: `git status`, `git log`, and the task as the user stated it. A
64
+ context warning is a token count, not evidence that work is left.
65
+
66
+ If none of them holds, write no file. Tell the user in two or three lines what landed, name
67
+ the commits, and say a fresh session needs nothing from this one. A handoff nobody resumes is
68
+ noise, and it costs the next session the tokens to read it.
69
+
70
+ Then give a prompt the user can copy into the fresh session, in a code block: the next task, the
71
+ plan file or finding it lives in, and any rule of this session that the repo does not record. Keep
72
+ it to a few lines.
73
+
74
+ An open item counts as the next task: a known gap, an open finding, or an unbuilt step in the plan,
75
+ in the task, or in your own report of this session. "Everything waits for the user" is true only
76
+ when every open item needs a decision of the user. Then name each decision; do not stop silently.
77
+ In a `tmux` session, restart yourself with the next task as the prompt (see the next section) instead
78
+ of handing the prompt to the user.
79
+
80
+ Write `{%handoffDir%}/<slug>.md` where `<slug>` is a short kebab-case name for
81
+ the task (use the user-provided slug if they gave one). If the file exists,
82
+ overwrite it - a handoff always describes the _current_ state.
83
+
84
+ **Write for a reader with zero context.** The next session sees none of this
85
+ conversation. No "as discussed above", no shorthand invented mid-session. Every
86
+ claim must be verifiable from the repo: exact file paths, exact commands.
87
+
88
+ Template:
89
+
90
+ ```markdown
91
+ # Handoff: <task title>
92
+
93
+ Branch: <git branch> · Last commit: <short sha> <subject>
94
+ Working tree: <clean | summary of uncommitted changes>
95
+
96
+ ## Goal
97
+
98
+ What the overall task is and why. One paragraph max.
99
+
100
+ ## State
101
+
102
+ - Done: <what is finished and verified, with file paths>
103
+ - In progress: <what is half-done, and exactly where it stands>
104
+ - Not started: <known remaining work>
105
+
106
+ ## Key files
107
+
108
+ - `path/to/file.ts` - why it matters here
109
+
110
+ ## Decisions & constraints
111
+
112
+ Choices already made (and why) that the next session must not re-litigate.
113
+ User-stated constraints verbatim.
114
+
115
+ ## Gotchas / dead ends
116
+
117
+ Things that looked right but weren't. Approaches already tried and rejected,
118
+ and why - this is the most valuable section, don't skip it.
119
+
120
+ ## Next steps
121
+
122
+ 1. Concrete, ordered, actionable steps. Each should name files/commands.
123
+
124
+ ## Verify
125
+
126
+ Commands to check the work (lint, storybook story ids, test commands).
127
+
128
+ ## Follow-ups owed
129
+
130
+ Changeset written? Docs page updated? Whatever this repo treats as part of a
131
+ change rather than optional.
132
+ ```
133
+
134
+ Before writing, actually check `git status`, `git log -1`, and the branch - do
135
+ not describe state from memory. Keep the file under ~150 lines; a handoff is a
136
+ map, not a transcript.
137
+
138
+ After writing, tell the user where it landed and that a fresh session should
139
+ resume from it.
140
+
141
+ ## Clear and resume on your own
142
+
143
+ Run inside a `tmux` session started with the agent-sessions `run` command or the shell functions from `shell-install` (`echo $TMUX` is not empty and
144
+ the agent-sessions script `restart` finds the session)? Then you may clear and
145
+ resume yourself after the save, instead of asking the user to. You decide. Do it only if every line
146
+ is true:
147
+
148
+ - Each sub-agent, workflow and background command that still runs is named in the handoff file:
149
+ its ID, its task, and where its result lands. A restart never waits for them: they keep running
150
+ after the `/clear` and report into the new session.
151
+ - No answer you wait for is open: a peer session, a mailbox reply, a CI run.
152
+ - Each question to the user that has no answer yet is in the handoff file, word for word, under
153
+ `## Open questions`. The resumed session shows them to the user first.
154
+ - The tree is committed, or the handoff file names every uncommitted change.
155
+ - The handoff file is saved and its Next steps are concrete.
156
+
157
+ When you spawn a sub-agent, decide which kind it is:
158
+
159
+ - **Answer needed.** You act on its answer. Its notification reaches the resumed session, which
160
+ acts on it.
161
+ - **Self-reporting.** It commits its own slice and writes its result to
162
+ `.claude/handoffs/agent-results/<name>.md`. Tell it so in its prompt. The resumed session reads
163
+ the result file.
164
+
165
+ If one line is false, finish or collect that first. If you cannot, hand the prompt to the user as
166
+ before. Then run, with the slug of the file you saved:
167
+
168
+ ```bash
169
+ node <sessions-skill-dir>/agent-sessions.mjs restart <name> '<resume command> <slug> [<text after the slug>]'
170
+ ```
171
+
172
+ Add `--process` after `restart` when the session changed a plugin, a settings file, an MCP server or `PATH`.
173
+ A plain restart keeps the old process, so the change reaches only a new one.
174
+ Before `--process`, write the command line of each background job of the session into the handoff file. The exit stops these jobs, so the new process starts them again.
175
+
176
+ If the user wrote text after the slug of the save command, append it to the prompt word for word.
177
+ Escape each `'` in it as `'\''`. The restart drops anything you leave out, and the fresh session has
178
+ no other way to see it.
179
+
180
+ `<resume command>` is your own resume form from the top of this guide, with the name this repo
181
+ installed the skill under: `/ethlete-handoff resume` under Claude Code, `ethlete-handoff resume`
182
+ under Codex. A repo that ships its own copy can name it `handoff`, so check the skill directory
183
+ name. A wrong name runs no skill, and the fresh session starts without the file.
184
+
185
+ `<name>` is the sender name of your own session. Read it first with `tmux display-message -p -t "$TMUX_PANE" '#{session_name}'` and drop the `@<repo>` part: `claude-2@ethlete-sdk` gives `claude-2`. Never take the name from an example: a second Claude session is `claude-2`, not `claude`. The command refuses a session you do not run in. It returns at once. It
186
+ types `/clear` (`/new` for a `codex` name) and the prompt into your pane a few seconds later, so
187
+ end your turn after you run it and do not start another tool call. The `/clear` wipes the pane, so
188
+ the user never sees text you write after the command. Before you run it, put the reason as the
189
+ first line of the handoff file: `Restarted because: <one line>`. End the turn with no text.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: query
3
- description: The signals-first @ethlete/query data-fetching system - the query client, typed query creators, reactive args, and reading results as signals or observables. Read BEFORE writing or reviewing code that fetches data, wires search/autocomplete to an API, adds auth/polling/pagination, or bridges a query into UI or RxJS.
3
+ description: 'The signals-first @ethlete/query data-fetching system. Read BEFORE writing or reviewing code that fetches data: query forms, search/autocomplete, auth, polling, pagination, bridging a query into UI or RxJS.'
4
4
  kind: skill
5
5
  scope: consumer
6
6
  requires: ['@ethlete/query']
@@ -13,38 +13,109 @@ Signals-first, typesafe data fetching for Angular: request dedup, caching, polli
13
13
  paged queries, bearer auth, GraphQL, and a socket.io realtime client.
14
14
 
15
15
  **The written docs are the source of truth - read the relevant page before
16
- non-trivial query work.** This guide is the index plus the load-bearing facts, so you
17
- don't re-derive them from source.
18
-
19
- | Page | Covers |
20
- | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
21
- | {%docsBaseUrl%}/query/ | Overview + the two-generations note |
22
- | {%docsBaseUrl%}/query/queries | **Start here** - client, creators, the query object's signals, auto-execution |
23
- | {%docsBaseUrl%}/query/features | `withArgs`, `withPolling`, `withLongPolling`, `withAutoRefresh`, side-effect handlers |
24
- | {%docsBaseUrl%}/query/http | REST creators, typing requests, response transforms, upload progress |
25
- | {%docsBaseUrl%}/query/auth | Bearer auth: login/refresh, auto token refresh, multi-tab sync |
26
- | {%docsBaseUrl%}/query/caching · `/stacks` · `/errors` · `/gql` · `/ws` | Caching/dedup, pagination, error/retry, GraphQL, WebSockets |
27
- | {%docsBaseUrl%}/query/multi-tab | Opt-in cross-tab sync: shared responses, per-key polling election, mutation fan-out |
28
- | {%docsBaseUrl%}/query/query-forms | Router-synced filter/search forms |
29
- | {%docsBaseUrl%}/query/legacy | The maintenance-mode `V2QueryClient` |
16
+ non-trivial query work.** This guide maps every need to its API and page, plus the
17
+ load-bearing facts, so you don't re-derive them from source or hand-build what ships.
18
+
19
+ | Page | Covers |
20
+ | ------------------------------------------------- | --------------------------------------------------------------------------------------- |
21
+ | {%docsBaseUrl%}/query/ | Overview, the two generations, what else the package ships |
22
+ | {%docsBaseUrl%}/query/queries | **Start here** - client, creators, the query object's signals, auto-execution |
23
+ | {%docsBaseUrl%}/query/features | `withArgs`, polling, auto-refresh, side-effect handlers, custom features |
24
+ | {%docsBaseUrl%}/query/http | REST creators, typing requests, response transforms, upload progress |
25
+ | {%docsBaseUrl%}/query/auth | Bearer auth provider, guards, token refresh, auth features |
26
+ | {%docsBaseUrl%}/query/caching | Cache keys, dedup, `keepUnusedFor`, freshness, refresh and invalidation |
27
+ | {%docsBaseUrl%}/query/multi-tab | Cross-tab response sharing, one poller per key, mutation fan-out |
28
+ | {%docsBaseUrl%}/query/persistence | Successful reads kept in IndexedDB for reloads and offline cold starts |
29
+ | {%docsBaseUrl%}/query/stacks | Many queries of one creator, infinite lists, paged data |
30
+ | {%docsBaseUrl%}/query/dependent-queries | GET → GET dependencies and ordered mutation chains |
31
+ | {%docsBaseUrl%}/query/groups | Several queries behind one state: loading, error and retry follow the one that ran last |
32
+ | {%docsBaseUrl%}/query/batching | Bulk writes with bounded concurrency, per-item results, retry |
33
+ | {%docsBaseUrl%}/query/errors | Error object, opt-in parsers, form submission, violations, retries |
34
+ | {%docsBaseUrl%}/query/testing | Specs: answering requests, `@ethlete/query/testing` helpers and fakes |
35
+ | {%docsBaseUrl%}/query/query-forms | **Any filtered, searched, sorted or paged list** - `defineQueryForm` |
36
+ | {%docsBaseUrl%}/query/gql | GraphQL creators over GET/POST |
37
+ | {%docsBaseUrl%}/query/ws | socket.io rooms and live-updating responses |
38
+ | {%docsBaseUrl%}/query/legacy | The maintenance-mode `V2QueryClient` and its replacements |
39
+ | {%docsBaseUrl%}/query/migrating-from-v2 | Codemods and the screen-by-screen move off the legacy client |
40
+ | {%docsBaseUrl%}/query/migrating-from-ngrx-toolkit | The generator and interop that move a store off `@tomtomb/ngrx-toolkit` |
41
+ | {%docsBaseUrl%}/query-devtools/ | The devtools panel and `provideQueryDevtools()` |
42
+
43
+ ## You need → use → read
44
+
45
+ Before writing a helper, find your need here. Pages are under `{%docsBaseUrl%}/query/`.
46
+
47
+ | You need | Use | Read |
48
+ | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
49
+ | One client per API | `createQueryClient`, `injectApi()` | `queries` |
50
+ | REST reads (auto-executing) | `createGetQuery`, `createHeadQuery`, `createOptionsQuery` | `http` |
51
+ | REST writes (manual) | `createPostQuery`, `createPutQuery`, `createPatchQuery`, `createDeleteQuery` | `http` |
52
+ | The same behind a bearer token | `createSecureGetQuery`, `createSecureHeadQuery`, `createSecureOptionsQuery`, `createSecurePostQuery`, `createSecurePutQuery`, `createSecurePatchQuery`, `createSecureDeleteQuery` | `http`, `auth` |
53
+ | Upload/download progress bar | creator option `reportProgress: true`, then `loading().progress` | `http` |
54
+ | Args that follow signals (route params, inputs, filters) | `withArgs` | `features` |
55
+ | A filtered / searched / sorted / paged list synced to the URL | `defineQueryForm`, `queryField`, `searchQueryField`, `sortQueryField` | `query-forms` |
56
+ | Refetch on an interval | `withPolling` | `features` |
57
+ | Next request once the previous settled, with a cursor from it | `withLongPolling` | `features` |
58
+ | Refetch when some other signal changes | `withAutoRefresh` | `features` |
59
+ | Toast / log / react on success or failure | `withSuccessHandling`, `withErrorHandling`, `withLogging` | `features` |
60
+ | Patch a loaded response in place (e.g. from a socket message) | `withResponseUpdate` | `features`, `ws` |
61
+ | Page falls out of range after a filter shrinks the results | `withPageResetOnError`, `isPageOutOfRangeError` | `features` |
62
+ | Package your own reusable query behavior | `createQueryFeature` | `features` |
63
+ | Refresh reads after a mutation (here and in other tabs) | `injectApi().invalidateQueries({ url })` | `caching` |
64
+ | Show a mutation's result in cached reads before the server answers | `withOptimisticUpdate` | `caching` |
65
+ | One loading, error and retry state for whichever of several mutations ran last | `createQueryGroup` | `groups` |
66
+ | Refetch everything after a client-wide header changed | `injectApi().refreshQueriesInUse()` | `caching` |
67
+ | Show the previous data instantly on back navigation | `keepUnusedFor` + `executionState().cachedResponse` | `caching` |
68
+ | Last known data after a reload or offline | `withQueryPersistence`, `createIndexedDbQueryPersistenceAdapter`, `createNoopQueryPersistenceAdapter` | `persistence` |
69
+ | Tabs share responses, poll once, see each other's mutations | `withMultiTabSync` | `multi-tab` |
70
+ | Parallel detail requests for a list of ids | `createQueryStack`, `transformArrayResponse` | `stacks` |
71
+ | Load more / infinite scroll / classic paging | `createPagedQueryStack`, `ethletePaginationAdapter` (and other adapters) | `stacks` |
72
+ | A GET whose args come from another GET's response | `withArgs` reading the first query's `response()` | `dependent-queries` |
73
+ | Run mutations in order, each using the previous result | `querySequence` | `dependent-queries` |
74
+ | Many edits with progress, time remaining and retry of failures | `createQueryBatch` | `batching` |
75
+ | Submit a signal form through a mutation, violations on fields | `createQuerySubmission` | `errors` |
76
+ | Own submit handler, or server-side validation while typing | `executeUntilSettled`, `executeUntilSettled$`, `mapViolationsToFormErrors`, `validateWithQuery` | `errors` |
77
+ | Understand the error shapes your API returns | `withEthleteApiErrors` (all), `withSymfonyErrors`, `withHtmlErrorParsing` | `errors` |
78
+ | Error text for display, or an error built by hand (tests) | `queryErrorMessage`, `queryErrorMessages`, `createQueryErrorResponse`, `<et-query-error>` | `errors` |
79
+ | Retry failed requests | `withDefaultRetry`, `createDefaultRetryFn` | `errors` |
80
+ | Login / refresh / logout with bearer tokens | `createBearerAuthProvider`, `withAuthenticationQuery`, `withRefreshQuery` | `auth` |
81
+ | Protect routes, check roles or permissions | `createAuthGuard`, `canMatchWith` | `auth` |
82
+ | "Remember me" auto-login | `withPersistentAuth` | `auth` |
83
+ | Log out idle users | `withInactivityLogout` | `auth` |
84
+ | Warn before the session expires | `withTokenExpirationWarning` | `auth` |
85
+ | Revoke the token on logout | `withTokenRevocation` | `auth` |
86
+ | Share login/logout across tabs | `withBearerAuthMultiTabSync` | `auth` |
87
+ | Auth telemetry events | `withTracking` | `auth` |
88
+ | Tokens from SSO or a native shell | `provider.setTokens(access, refresh)` | `auth` |
89
+ | Which of several queries is busy (v2 query collections) | each query's `executionState()` in a `computed`; auth: `provider.executionState()` | `migrating-from-v2` |
90
+ | GraphQL | `createGqlQueryViaGet`, `createGqlQueryViaPost`, `createGqlMutationViaGet`, `createGqlMutationViaPost`, `createSecureGqlQueryViaGet`, `createSecureGqlQueryViaPost`, `createSecureGqlMutationViaGet`, `createSecureGqlMutationViaPost` | `gql` |
91
+ | Realtime rooms over socket.io | `createWebSocketClient` | `ws` |
92
+ | Inspect queries, stacks, auth and cache at runtime | `provideQueryDevtools()` + `@ethlete/query-devtools` | `/query-devtools/` |
30
93
 
31
94
  ## Two generations - use the current one
32
95
 
33
- - **Current (use this):** signals-first, provider-based. `createQueryClient`,
34
- `createGetQuery`/`createPostQuery`/…, `withArgs`. Everything imports from the
35
- single entry `@ethlete/query`.
36
- - **Legacy (maintenance mode):** class-based `V2QueryClient`, `.prepare().execute()`,
37
- `queryComputed`. Don't write new code against it.
96
+ Write new code against the signals-first system (`createQueryClient`, `createGetQuery`, …,
97
+ `withArgs`), all from the single entry `@ethlete/query`. The class-based `V2QueryClient`
98
+ (`.prepare().execute()`, `queryComputed`) is in maintenance mode.
38
99
 
39
100
  ## Core usage
40
101
 
41
- One client per API, one creator per endpoint, one live query per component instance:
102
+ One client per API, one bound creator per method, one query per endpoint, one live query
103
+ per component instance:
42
104
 
43
105
  ```ts
44
106
  import { createQueryClient, createGetQuery, withArgs } from '@ethlete/query';
45
107
 
108
+ // api.ts
46
109
  export const apiClient = createQueryClient({ name: 'api', baseUrl: API_URL });
47
- export const getPost = createGetQuery(apiClient)<GetPostArgs>((p) => `/posts/${p.pathParams.postId}`);
110
+ export const getQuery = createGetQuery(apiClient);
111
+
112
+ // posts.queries.ts
113
+ export type GetPostQueryArgs = {
114
+ response: Post;
115
+ pathParams: { postId: string };
116
+ };
117
+
118
+ export const getPost = getQuery<GetPostQueryArgs>((p) => `/posts/${p.postId}`);
48
119
 
49
120
  // in a component (injection context):
50
121
  postId = input.required<string>();
@@ -54,71 +125,91 @@ post = computed(() => this.postQuery.response());
54
125
 
55
126
  - `GET`/`HEAD`/`OPTIONS` **auto-execute** - immediately when static/argless, or
56
127
  whenever `withArgs` produces new args. Mutations (`POST`/`PUT`/`PATCH`/`DELETE`)
57
- never auto-execute; call `.execute({ args })`. A function route (`pathParams`)
58
- requires `withArgs` (dev-mode error otherwise).
128
+ never auto-execute; declare their args with `withArgs` too and call `.execute()`. A function route (`pathParams`)
129
+ requires `withArgs` (a type error, and a dev-mode error).
130
+ - A route function receives the path params themselves: `(p) => \`/posts/${p.postId}\``.
131
+ - With bearer auth, bind the secure creators the same way:
132
+ `const secureGetQuery = createSecureGetQuery(apiClient, authProviderRef)`.
59
133
  - Queries live in a child injector tied to the creating component; destroyed with it.
60
134
 
135
+ ## Lists with filters, search, sort or paging: `defineQueryForm`
136
+
137
+ Never wire list controls to the URL by hand (`injectQueryParams` + `router.navigate` +
138
+ drafts + effects). `defineQueryForm` does URL sync, debounce, defaults and page resets:
139
+
140
+ ```ts
141
+ qf = defineQueryForm({
142
+ fields: {
143
+ search: searchQueryField(),
144
+ sort: sortQueryField(),
145
+ page: queryField<number>({ defaultValue: 1, isResetBy: ['search', 'sort'] }),
146
+ },
147
+ }).observe();
148
+
149
+ users = getUsers(
150
+ withArgs(() => {
151
+ const { search, sort, page } = this.qf.value();
152
+
153
+ return { queryParams: { query: search, sortBy: sort?.active, sortOrder: sort?.direction, page } };
154
+ }),
155
+ );
156
+ ```
157
+
158
+ Bind form controls with `[formField]="qf.fields.search"`. `et-pagination` and
159
+ `et-page-size-select` are not form controls: bind their `model` to the field's value signal,
160
+ `[(page)]="qf.fields.page().value"`; an `et-table` sort binds the same way to a
161
+ `tableSortQueryField()`, `[(sort)]="qf.fields.sort().value"`, with no mapping. `qf.value()` is the committed, debounced value. Each
162
+ change pushes a history entry; pass `observe({ replaceUrl: true })` to replace it instead. See {%docsBaseUrl%}/query/query-forms for the other field creators,
163
+ filter overlays and `activeFilterCount`.
164
+
165
+ When you move a list that syncs its params by hand, keep the param names the URL already uses, so
166
+ saved links keep working (`queryParamPrefix` when two lists share a route). Keep each old default as
167
+ the field's `defaultValue`. A URL with sort and direction in two params (`?sort=name&dir=asc`)
168
+ keeps two `queryField`s, `dir` with `skipInFilterCount: true`; `sortQueryField()` writes one
169
+ `name:asc` param, so it breaks old links. A date field bound to `et-date-input`,
170
+ `et-date-time-input` or `et-time-input` needs `dateQueryField({ as: 'string' })`.
171
+
61
172
  ## The query object
62
173
 
63
- Every state member is an **`ObservableSignal`** - a `Signal` that also has
64
- `.asObservable()`. So each is both a signal (call it) and a stream:
174
+ Every state member is an **`ObservableSignal`** - call it, or `.asObservable()` it without an
175
+ injection context of your own (it emits `null` first).
65
176
 
66
177
  - `response()` → `TResponse | null` (kept while re-executing; cleared on a failed re-exec).
178
+ To keep showing the last good data after a failure, read `cachedResponse` from the
179
+ `loading` or `failure` variant of `executionState()` - do not copy responses into a signal.
67
180
  - `loading()`, `error()` (normalized `QueryErrorResponse`), `args()`,
68
181
  `executionState()` (`{ type: 'loading' | 'success' | 'failure', … } | null`, great for `@switch`).
69
182
  - Methods: `execute({ args?, options? })`, `reset()`, `createSnapshot()`, `asReadonly()`.
70
183
 
71
- `query.response.asObservable()` binds to the query's own injector, so callers get
72
- an `Observable<T | null>` **without** needing their own injection context (unlike
73
- raw `toObservable`). It emits `null` first - `pipe(filter(r => r !== null))`.
74
-
75
- ## Reactive args & features
76
-
77
- - **`withArgs(() => ({ pathParams, queryParams, body }))`** - runs like a `computed`;
78
- re-runs when a signal it reads changes and re-executes the query. This is how you
79
- drive **search-as-you-type**: back it with a search signal
80
- (`withArgs(() => ({ queryParams: { search: this.search() } }))`). Return `null`
81
- to park the query - args reset to `null`, pausing polling/auto-refresh.
82
- - **Prefer `withArgs` over passing `args` to `execute()`.** Args declared on the query
83
- stay reactive: a `GET` re-executes itself when they change, and `withPolling` /
84
- `withAutoRefresh` restart off the same signal - none of which happens for args handed
85
- to `execute()`. A function route additionally throws without it. With `withArgs` in
86
- place a mutation is just `.execute()`, which reuses the current `args()`. Reserve
87
- `execute({ args })` for a one-off payload no signal holds (a form submit).
88
- - `withPolling({ interval })`, `withAutoRefresh({ onSignalChanges: [...] })`.
89
- - **`withLongPolling({ nextArgs })`** for a completion-driven chain instead of an interval: each
90
- round starts once the previous settled, with args (a cursor) derived from its response. `nextArgs`
91
- returning `null` ends the chain. Not `withPolling` with a small interval - and the two throw when
92
- combined.
93
- - Side-effects: `withSuccessHandling`, `withErrorHandling`, `withLogging`.
94
-
95
- There is no built-in debounce operator - dedup/caching handles repeated identical
96
- requests; debounce at the input if you need it.
97
-
98
- ## Bridging a query into RxJS / other APIs
99
-
100
- To hand a query's results to something that wants an `Observable<T[]>` (e.g. a
101
- `(query) => Observable<...>` source): drive the query by a search signal and return
102
- its response stream.
103
-
104
- ```ts
105
- private search = signal('');
106
- private q = getItems(withArgs(() => ({ queryParams: { q: this.search() } })));
107
-
108
- fetch(query: string) {
109
- this.search.set(query);
110
- return this.q.response.asObservable().pipe(
111
- filter((r): r is ItemsRes => r !== null),
112
- map((r) => r.items),
113
- );
114
- }
115
- ```
184
+ ## Reactive args
185
+
186
+ - **`withArgs(() => ({ pathParams, queryParams, body }))`** runs like a `computed` and
187
+ re-executes on change. Return `null` to park the query (pauses polling/auto-refresh).
188
+ Calling `.execute()` on a parked query is ignored and warns in dev mode
189
+ (`queryExecutedWhileParkedMessage`); pass `execute({ args })` or let the source return args.
190
+ - **Prefer `withArgs` over `execute({ args })`.** Declared args keep a `GET` re-executing and
191
+ polling/auto-refresh restarting off the same signal; a function route throws without it. A
192
+ mutation with `withArgs` is just `.execute()`. Reserve `execute({ args })` for a one-off
193
+ payload no signal holds.
194
+ - Search-as-you-type: read a debounced value (`searchQueryField()` debounces 300ms; every
195
+ query field takes `debounce`) - a raw input signal sends one request per keystroke.
196
+ - `withLongPolling` and `withPolling` throw when combined.
197
+
198
+ ## Bridging into RxJS or callbacks
199
+
200
+ For a callback that must return one correlated result, run a manual query
201
+ (`{ onlyManualExecution: true }`) through `executeUntilSettled$(query, { args })` - cold, its
202
+ snapshot is frozen to that execution, and unsubscribing aborts the request. Keep the Promise
203
+ `executeUntilSettled` for an `async` signal-forms `submit()`. Never set a signal and return the shared `response`
204
+ stream: the retained previous response can be the first non-null emission. See
205
+ {%docsBaseUrl%}/query/queries#the-query-object.
116
206
 
117
207
  ## Gotchas
118
208
 
119
- - Signals-first: read `query.response()` in templates/computeds; it's **nullable**
120
- (`?? []` / `filter(Boolean)` as needed).
121
- - Don't reach for the legacy client for new code.
209
+ - `query.response()` is **nullable** (`?? []` / `filter(Boolean)` as needed).
122
210
  - `.execute()` defaults `args` to the current `args()` when omitted.
123
211
  - Anything under a query's `subtle` namespace is an unsupported escape hatch - never
124
212
  treat it as public API.
213
+ - Use `withArgs` for mutations too. Never reach for `execute({ args })` plus
214
+ `silenceMissingWithArgsFeatureError` unless the args really exist only at call time - the
215
+ flag is an escape hatch, not the mutation pattern.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: report
3
+ description: Print a fixed table of what was done in a period: rows with their commits, parked rows, counts, CI and subagents. Use on "report", "Bericht", "was ist heute passiert", "status of the day".
4
+ kind: skill
5
+ scope: both
6
+ ---
7
+
8
+ # Progress report on demand
9
+
10
+ The report is generated, never written. Run it and paste its output:
11
+
12
+ ```bash
13
+ {%packageRunner%} ethlete-agents report [today|yesterday|week]
14
+ {%packageRunner%} ethlete-agents report --since 2026-11-10 [--until 2026-11-12T18:00]
15
+ ```
16
+
17
+ Text after the skill name picks the period: none means `today`; a day name or date maps to the
18
+ arguments above.
19
+
20
+ 1. Run the command and paste its stdout **unchanged** into the chat: no rewording, no extra
21
+ columns, no summary of the table.
22
+ 2. Below the pasted block, list the open questions for the user, one per line. If there are none,
23
+ write nothing.
24
+
25
+ Short names, the parked section and the queue come from the `report.planFiles` list in
26
+ `ethlete-agents.config.json`; without it the table is built from the git log alone.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: rxjs-signals
3
- description: How to choose between signals and RxJS, and use each correctly - synchronous state vs asynchronous work, unsubscribing, and avoiding RxJS inside effects/computeds. Read when adding reactive state, wiring up an observable, or deciding whether something should be a signal or a stream.
3
+ description: Choosing between signals and RxJS and using each correctly. Read when adding reactive state, wiring up an observable, or deciding whether something should be a signal or a stream.
4
4
  kind: skill
5
5
  scope: both
6
6
  requires: ['@ethlete/core']
@@ -34,9 +34,18 @@ const data = toSignal(obs$);
34
34
 
35
35
  ## Using RxJS correctly
36
36
 
37
- - **Always unsubscribe.** Prefer `takeUntilDestroyed()` (needs an injection
38
- context); otherwise `take` / `takeUntil` / `takeWhile`, or store and call
39
- `.unsubscribe()`. Place the limiting operator **last** in the pipe.
37
+ - **Tear down long-lived or manual subscriptions.** Finite streams that complete on their
38
+ own need no artificial lifecycle operator. For Angular lifecycle cleanup, prefer
39
+ `takeUntilDestroyed()` (it needs an injection context) or explicitly unsubscribe.
40
+ Do not use `takeWhile` as destruction cleanup: without another emission it stays
41
+ subscribed. Use `take(1)` or `first()` only when one emission is the operation's
42
+ intended semantics.
43
+ - **`takeUntilDestroyed()` goes last in its pipe** (`ethlete/take-until-destroyed-last`), so
44
+ higher-order operators such as `switchMap` and their inner subscriptions are covered.
45
+ Completion-only operators (`finalize`, `defaultIfEmpty`, `toArray`, …) may follow it, and
46
+ chained `.pipe(...).pipe(...)` calls count as one pipe.
47
+ Other limiting and finalization operators do not have a universal “last” position;
48
+ place them where their semantics belong.
40
49
  - **Side effects go in `tap()`**, never in the `subscribe()` callback - keep
41
50
  `subscribe()` empty.
42
51
  - **Don't reach for RxJS inside `effect()`/`computed()`.** Subscribing per run
@@ -56,6 +65,26 @@ toObservable(page)
56
65
  .subscribe();
57
66
  ```
58
67
 
68
+ ## An effect that only writes a signal is a derivation
69
+
70
+ If an `effect()` does nothing but `.set()` a signal, even behind an `if`, the value is derived
71
+ state: use `computed()` when it is read-only, `linkedSignal()` when the user can still
72
+ overwrite it. `ethlete/prefer-linked-signal` flags the plain cases. Keep `effect()` for work
73
+ that leaves the signal graph: DOM, storage, logging, third-party APIs.
74
+
75
+ ```ts
76
+ // ❌
77
+ effect(() => {
78
+ if (this.items().length) this.selected.set(this.items()[0]);
79
+ });
80
+
81
+ // ✅ the previous value stays when the list is empty
82
+ selected = linkedSignal<Item[], Item | null>({
83
+ source: this.items,
84
+ computation: (items, previous) => items[0] ?? previous?.value ?? null,
85
+ });
86
+ ```
87
+
59
88
  ## Prefer `@ethlete/core` helpers
60
89
 
61
90
  Lint nudges these, but reach for them by default: `injectViewportSize()`,