aiblueprint-cli 1.4.108 → 1.4.110
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/README.md +10 -0
- package/agents-config/claude-config/mods/agent4everything/.claude-plugin/plugin.json +5 -0
- package/agents-config/claude-config/mods/agent4everything/hooks/hooks.json +1 -0
- package/agents-config/claude-config/mods/agent4everything/hooks/register.ts +96 -0
- package/agents-config/claude-config/mods/aiblueprint/.claude-plugin/plugin.json +71 -0
- package/agents-config/claude-config/mods/aiblueprint/hooks/hooks.json +1 -0
- package/agents-config/claude-config/mods/aiblueprint/hooks/register.tsx +309 -0
- package/agents-config/claude-config/mods/aiblueprint/tests/band.test.tsx +74 -0
- package/agents-config/claude-config/mods/aiblueprint/types/index.d.ts +14 -0
- package/agents-config/claude-config/scripts/.claude/skills/fix-on-my-computer/SKILL.md +8 -74
- package/agents-config/claude-config/scripts/statusline/src/index.ts +1 -0
- package/agents-config/scripts/.claude/skills/fix-on-my-computer/SKILL.md +8 -74
- package/agents-config/scripts/statusline/src/index.ts +1 -0
- package/agents-config/skills/agents-manager/SKILL.md +15 -453
- package/agents-config/skills/apex/SKILL.md +14 -110
- package/agents-config/skills/app-icon/SKILL.md +22 -117
- package/agents-config/skills/appstore-connect/SKILL.md +22 -85
- package/agents-config/skills/arena/LICENSE +21 -0
- package/agents-config/skills/arena/SKILL.md +371 -0
- package/agents-config/skills/arena/agents/openai.yaml +9 -0
- package/agents-config/skills/arena/assets/codex-icon.svg +22 -0
- package/agents-config/skills/arena/bracket.py +1235 -0
- package/agents-config/skills/arena/rubric.md +79 -0
- package/agents-config/skills/arena/strategies.json +205 -0
- package/agents-config/skills/audit-memories/SKILL.md +13 -139
- package/agents-config/skills/audit-skills/SKILL.md +6 -65
- package/agents-config/skills/environments-manager/SKILL.md +14 -238
- package/agents-config/skills/grill-me/SKILL.md +8 -22
- package/agents-config/skills/hooks-manager/SKILL.md +8 -54
- package/agents-config/skills/rules-manager/SKILL.md +11 -192
- package/agents-config/skills/skill-manager/SKILL.md +19 -158
- package/agents-config/skills/skill-manager/references/description-recommandation.md +15 -85
- package/agents-config/skills/test-audit/CAMPAIGN.md +117 -0
- package/agents-config/skills/test-audit/LICENSE +23 -0
- package/agents-config/skills/test-audit/SKILL.md +169 -0
- package/agents-config/skills/test-audit/agents/openai.yaml +10 -0
- package/agents-config/skills/test-audit/assets/codex-icon.svg +1 -0
- package/agents-config/skills/use-style/SKILL.md +8 -48
- package/dist/cli.js +125 -78
- package/package.json +1 -1
|
@@ -1,195 +1,27 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: environments-manager
|
|
3
3
|
description: Set up per-worktree environments for Claude Code, Cursor, or Codex. Use for worktree-ready repos, IDE environment config, worktree-up/down scripts, or dev.sh wiring.
|
|
4
|
-
disable-model-invocation:
|
|
5
|
-
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
user-invocable: true
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Ask before writing. Use the host's question UI. Shared logic lives in `scripts/*.sh`; IDE configs only point at those files. Read a matching `examples/` file before writing, then adapt.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
1. Ask what a fresh worktree should do (multi-select): copy ignored env files; install deps; isolate or seed a data backend; run codegen. Capture extra project steps in one follow-up.
|
|
11
|
+
2. Ask the backend. PostgreSQL → [postgresql.md](references/postgresql.md). Convex → [convex.md](references/convex.md). None → skip isolation. Any other backend: research official docs and an in-repo example; do not guess CLI flags; summarize before editing.
|
|
12
|
+
3. Ask which IDEs to wire (Claude Code, Cursor, Codex). Generate `scripts/` once. Then load [claude.md](references/claude.md), [cursor.md](references/cursor.md), and/or [codex.md](references/codex.md) for linking config only.
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
Required files: `scripts/worktree-up.sh`, `scripts/worktree-down.sh`, `scripts/dev.sh` (all must end in `.sh`). Put them on the source checkout, not only the current worktree.
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
Resolve paths as `WORKTREE_PATH="${CODEX_WORKTREE_PATH:-${CURSOR_WORKTREE_PATH:-$(pwd)}}"` and `SOURCE_PATH="${CODEX_SOURCE_TREE_PATH:-${ROOT_WORKTREE_PATH:-}}"`. Claude: use `WorktreeCreate`, never `SessionStart`; the wrapper adds the worktree then runs `worktree-up.sh` with `ROOT_WORKTREE_PATH` — see [claude.md](references/claude.md). Hook wrappers must survive a missing `/dev/tty`, a wrong default Node version, and CLI prompts.
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
`worktree-up.sh` is idempotent: `set -euo pipefail`, cd to the worktree, then the selected steps in order. Prefer `.worktreeinclude` for Claude env copy. Detect the lockfile for install. Read resource names from env/config or setup metadata; never invent them from branch names. Provide a reset escape hatch via `<PROJECT>_RESET_<RESOURCE>=1`.
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
`worktree-down.sh` cleans only resources this setup created. Missing tools: print one line and exit 0.
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
`dev.sh` picks a free port from `${DEV_PORT_START:-3910}`. Never hardcode a port.
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
| :--- | :--- |
|
|
24
|
-
| Copy ignored env files from the source checkout | Copy `.env`, `.env.local`, `.env.development.local` when the source has them and the worktree does not. For Claude Code, prefer `.worktreeinclude` when possible. |
|
|
25
|
-
| Install dependencies | `pnpm install`, `bun install`, `yarn install`, or `npm install` based on lockfile. |
|
|
26
|
-
| Isolate or seed a data backend | Load the backend reference when it exists. Otherwise use researcher agents to discover the project's backend, docs, and current best setup pattern before writing scripts. |
|
|
27
|
-
| Run codegen | Project-specific codegen such as Prisma, Drizzle, Convex, generated types, or SDK generation. |
|
|
28
|
-
|
|
29
|
-
If the user has project-specific steps such as seed data, S3/R2 sync, local services, webhook tunnels, fixture generation, or env cloning, ask one follow-up free-form question to capture them.
|
|
30
|
-
|
|
31
|
-
### Step 2: Which data backend, if any?
|
|
32
|
-
|
|
33
|
-
Ask which backend needs worktree isolation or seeding. Use the answer to decide which reference to load:
|
|
34
|
-
|
|
35
|
-
| Backend | Action |
|
|
36
|
-
| :--- | :--- |
|
|
37
|
-
| None | Keep setup to env copy, install, codegen, and dev scripts. |
|
|
38
|
-
| PostgreSQL | Load `references/postgresql.md`. |
|
|
39
|
-
| Convex | Load `references/convex.md`. |
|
|
40
|
-
| Other SQL or non-SQL backend | Use researcher agents to inspect the repo, official docs, and current CLI behavior. Then write a narrow project-specific approach instead of adapting PostgreSQL or Convex by analogy. |
|
|
41
|
-
|
|
42
|
-
For unknown backends, do not guess commands, reset behavior, file formats, import/export semantics, or production-safety flags. Ask researcher agents to find the official docs and at least one in-repo example or closely matching project pattern. Summarize the discovered approach before editing scripts.
|
|
43
|
-
|
|
44
|
-
### Step 3: Which IDEs should be wired up?
|
|
45
|
-
|
|
46
|
-
Ask a multi-select with options: Claude Code, Cursor, Codex. The user can pick any combination. Generate the shared `scripts/` directory once.
|
|
47
|
-
|
|
48
|
-
### Step 4: Apply each selected IDE
|
|
49
|
-
|
|
50
|
-
For each selected IDE, read the matching reference file and apply only its linking config. Do not duplicate script logic in IDE config; the IDE config points at `scripts/worktree-up.sh`, `scripts/worktree-down.sh`, and `scripts/dev.sh`.
|
|
51
|
-
|
|
52
|
-
- Claude Code -> load `references/claude.md`
|
|
53
|
-
- Cursor -> load `references/cursor.md`
|
|
54
|
-
- Codex -> load `references/codex.md`
|
|
55
|
-
|
|
56
|
-
## Shared Shape
|
|
57
|
-
|
|
58
|
-
Every project that uses this skill ends up with:
|
|
59
|
-
|
|
60
|
-
```text
|
|
61
|
-
scripts/
|
|
62
|
-
├── worktree-up.sh # idempotent setup
|
|
63
|
-
├── worktree-down.sh # cleanup before worktree teardown
|
|
64
|
-
├── dev.sh # start dev server on a free port
|
|
65
|
-
└── (project-specific helpers, all *.sh)
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Plus one or more IDE config files. The IDE config is thin; all logic lives in `scripts/`.
|
|
69
|
-
|
|
70
|
-
Naming convention: every generated script MUST end in `.sh`. No bare `worktree-up`, no `dev`. IDE configs reference scripts by full filename (`scripts/worktree-up.sh`, not `scripts/worktree-up`). This is enforced in every reference file and example.
|
|
71
|
-
|
|
72
|
-
## Environment Variable Cascade
|
|
73
|
-
|
|
74
|
-
Each IDE exposes different variables. The shared scripts accept all of them, in this priority:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
WORKTREE_PATH="${CODEX_WORKTREE_PATH:-${CURSOR_WORKTREE_PATH:-$(pwd)}}"
|
|
78
|
-
SOURCE_PATH="${CODEX_SOURCE_TREE_PATH:-${ROOT_WORKTREE_PATH:-}}"
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
| Platform | Worktree path | Source checkout path | Setup trigger |
|
|
82
|
-
| :--- | :--- | :--- | :--- |
|
|
83
|
-
| Codex | `$CODEX_WORKTREE_PATH` | `$CODEX_SOURCE_TREE_PATH` | `[setup] script` in TOML, runs once per worktree. |
|
|
84
|
-
| Cursor | `pwd` inside worktree | `$ROOT_WORKTREE_PATH` | `setup-worktree-unix` in JSON, runs once per worktree. |
|
|
85
|
-
| Claude | `pwd` inside worktree after wrapper `cd` | `$CLAUDE_PROJECT_DIR` from the hook, re-exported as `ROOT_WORKTREE_PATH` by the wrapper | `WorktreeCreate` hook, runs once per worktree. |
|
|
86
|
-
|
|
87
|
-
Important about Claude Code: do not use `SessionStart` for setup; it fires every session. Use the `WorktreeCreate` hook, which fires once when `claude --worktree` creates the worktree. The Claude wrapper script (`scripts/claude-worktree-create.sh`) is responsible for calling `git worktree add` itself, then handing off to `scripts/worktree-up.sh` inside the new worktree with `ROOT_WORKTREE_PATH` set. See `references/claude.md`.
|
|
88
|
-
|
|
89
|
-
If no env var yields a source checkout, fall back to a project-specific absolute path only when you can infer it confidently. Otherwise ask the user during Step 1.
|
|
90
|
-
|
|
91
|
-
## `scripts/worktree-up.sh`
|
|
92
|
-
|
|
93
|
-
Setup must be idempotent: reruns are safe. Build the script from the user's Step 1 selections and any backend reference loaded in Step 2. Required behavior in order:
|
|
94
|
-
|
|
95
|
-
1. `set -euo pipefail`.
|
|
96
|
-
2. Resolve `WORKTREE_PATH` and `SOURCE_PATH`.
|
|
97
|
-
3. `cd "$WORKTREE_PATH"`.
|
|
98
|
-
4. If env copying was selected, copy `.env`, `.env.local`, `.env.development.local` only when the source has them and the worktree does not.
|
|
99
|
-
5. If dependency install was selected, detect the lockfile and run the matching install.
|
|
100
|
-
6. If backend isolation/seeding was selected, apply the backend reference or the researched project-specific approach.
|
|
101
|
-
7. If codegen was selected, run the project's codegen command.
|
|
102
|
-
8. Append any free-form project-specific steps from Step 1.
|
|
103
|
-
|
|
104
|
-
Base template, before backend-specific additions:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
#!/usr/bin/env bash
|
|
108
|
-
set -euo pipefail
|
|
109
|
-
|
|
110
|
-
WORKTREE_PATH="${CODEX_WORKTREE_PATH:-${CURSOR_WORKTREE_PATH:-$(pwd)}}"
|
|
111
|
-
SOURCE_PATH="${CODEX_SOURCE_TREE_PATH:-${ROOT_WORKTREE_PATH:-$HOME/Developer/projects/<repo>}}"
|
|
112
|
-
|
|
113
|
-
cd "$WORKTREE_PATH"
|
|
114
|
-
|
|
115
|
-
# Copy ignored env files.
|
|
116
|
-
# NOTE for Claude Code users: .worktreeinclude handles this natively. Prefer it
|
|
117
|
-
# over the cp loop when the project uses Claude's --worktree.
|
|
118
|
-
for f in .env .env.local .env.development.local; do
|
|
119
|
-
if [[ -f "$SOURCE_PATH/$f" && ! -f "$WORKTREE_PATH/$f" ]]; then
|
|
120
|
-
cp "$SOURCE_PATH/$f" "$WORKTREE_PATH/$f"
|
|
121
|
-
echo "copied $f"
|
|
122
|
-
fi
|
|
123
|
-
done
|
|
124
|
-
|
|
125
|
-
# Install deps.
|
|
126
|
-
if [[ -f pnpm-lock.yaml ]]; then pnpm install
|
|
127
|
-
elif [[ -f bun.lock || -f bun.lockb ]]; then bun install
|
|
128
|
-
elif [[ -f yarn.lock ]]; then yarn install
|
|
129
|
-
elif [[ -f package-lock.json ]]; then npm install
|
|
130
|
-
fi
|
|
131
|
-
|
|
132
|
-
# Backend isolation/seeding and codegen go here.
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## `scripts/worktree-down.sh`
|
|
136
|
-
|
|
137
|
-
Cleanup runs before the IDE destroys the worktree. Keep cleanup scoped to resources that the setup script created or selected explicitly.
|
|
138
|
-
|
|
139
|
-
1. `set -euo pipefail`.
|
|
140
|
-
2. Resolve `WORKTREE_PATH`.
|
|
141
|
-
3. `cd "$WORKTREE_PATH"`.
|
|
142
|
-
4. Run backend-specific cleanup only when the loaded backend reference requires it.
|
|
143
|
-
5. Remove copied local env files only if that is appropriate for the project.
|
|
144
|
-
6. If required tools or env files are missing, print one short message and exit 0.
|
|
145
|
-
|
|
146
|
-
Never guess resource names from branch names. Read names from the worktree's env/config files or from deterministic setup metadata created by `worktree-up.sh`.
|
|
147
|
-
|
|
148
|
-
## `scripts/dev.sh`
|
|
149
|
-
|
|
150
|
-
Pick a free port so multiple worktrees can run in parallel.
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
#!/usr/bin/env bash
|
|
154
|
-
set -euo pipefail
|
|
155
|
-
|
|
156
|
-
WORKTREE_PATH="${CODEX_WORKTREE_PATH:-${CURSOR_WORKTREE_PATH:-$(pwd)}}"
|
|
157
|
-
cd "$WORKTREE_PATH"
|
|
158
|
-
|
|
159
|
-
port="${DEV_PORT_START:-3910}"
|
|
160
|
-
while lsof -nP -iTCP:"$port" -sTCP:LISTEN >/dev/null 2>&1; do
|
|
161
|
-
port=$((port + 1))
|
|
162
|
-
done
|
|
163
|
-
|
|
164
|
-
echo "Starting app on http://localhost:$port"
|
|
165
|
-
exec pnpm dev -p "$port" # adjust for the project package manager
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## Standard Actions
|
|
169
|
-
|
|
170
|
-
Every project should expose these four actions through the IDE's own mechanism:
|
|
171
|
-
|
|
172
|
-
| Action | Command (typical) |
|
|
173
|
-
| :--- | :--- |
|
|
174
|
-
| Dev | `scripts/dev.sh` |
|
|
175
|
-
| Typecheck | `pnpm ts` / `bun run typecheck` |
|
|
176
|
-
| Unit tests | `pnpm test:ci` / `bun test` |
|
|
177
|
-
| Lint | `pnpm lint:ci` / `bun run lint` |
|
|
178
|
-
|
|
179
|
-
Add `E2E` as an action only if the suite is cheap enough to run interactively.
|
|
180
|
-
|
|
181
|
-
## Universal Guardrails
|
|
182
|
-
|
|
183
|
-
- Never commit secrets. Copying ignored env files into a local worktree is fine; logging them is not.
|
|
184
|
-
- Never put fragile multi-line shell programs inside an IDE config file. Keep all logic in `scripts/`; the IDE config just calls those scripts.
|
|
185
|
-
- Never hardcode a dev port. Pick a free one starting from `${DEV_PORT_START:-3910}`.
|
|
186
|
-
- Setup must be idempotent. Provide a reset escape hatch for stateful resources via env var (`<PROJECT>_RESET_<RESOURCE>=1`).
|
|
187
|
-
- Print resource names and redacted hosts only.
|
|
188
|
-
- The scripts and IDE config must live on the source checkout / main branch, not only the current worktree, or future worktrees will have nothing to copy.
|
|
189
|
-
- Never destroy or import from production data by default. Any setup step that exports from a shared source and replays into a worktree must reject production-looking refs unless the user explicitly approved an override env var.
|
|
190
|
-
- Hook wrappers must survive a missing `/dev/tty`, a wrong default Node version, and CLI prompts. See `references/claude.md` -> "Hook Robustness" for the concrete fixes.
|
|
191
|
-
|
|
192
|
-
Use this production-source guard in backend references or project-specific helpers:
|
|
24
|
+
Never commit or log secrets. Never embed multi-line programs in IDE config. Never destroy or import production data unless the user set an override env var. Put this guard in any import/replay helper:
|
|
193
25
|
|
|
194
26
|
```bash
|
|
195
27
|
assert_non_prod_ref() {
|
|
@@ -202,62 +34,6 @@ assert_non_prod_ref() {
|
|
|
202
34
|
}
|
|
203
35
|
```
|
|
204
36
|
|
|
205
|
-
|
|
37
|
+
Expose Dev, typecheck, unit tests, and lint through the IDE; add E2E only if cheap.
|
|
206
38
|
|
|
207
|
-
After
|
|
208
|
-
|
|
209
|
-
```bash
|
|
210
|
-
bash -n scripts/worktree-up.sh scripts/worktree-down.sh scripts/dev.sh
|
|
211
|
-
git status --short
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
If Python 3.11+ is available, validate generated TOML:
|
|
215
|
-
|
|
216
|
-
```bash
|
|
217
|
-
python3 - <<'PY'
|
|
218
|
-
import tomllib
|
|
219
|
-
with open(".codex/environments/environment.toml", "rb") as f:
|
|
220
|
-
tomllib.load(f)
|
|
221
|
-
PY
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
For JSON configs:
|
|
225
|
-
|
|
226
|
-
```bash
|
|
227
|
-
python3 -c "import json; json.load(open('.cursor/worktrees.json'))"
|
|
228
|
-
python3 -c "import json; json.load(open('.claude/settings.json'))"
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
## References
|
|
232
|
-
|
|
233
|
-
Load only the references relevant to the selected backend and IDE:
|
|
234
|
-
|
|
235
|
-
- `references/postgresql.md` - PostgreSQL isolation, reset, and cleanup.
|
|
236
|
-
- `references/convex.md` - Convex local/cloud deployments, allowlisted seeding, env cloning, and cleanup.
|
|
237
|
-
- `references/claude.md` - Claude Code WorktreeCreate/WorktreeRemove wiring.
|
|
238
|
-
- `references/cursor.md` - Cursor worktree setup wiring.
|
|
239
|
-
- `references/codex.md` - Codex local environment TOML.
|
|
240
|
-
|
|
241
|
-
## Examples
|
|
242
|
-
|
|
243
|
-
Working examples live under `examples/`. Read the relevant example before writing files into a real project, but do not copy verbatim. The user's selections, backend reference, and project conventions determine which sections survive.
|
|
244
|
-
|
|
245
|
-
```text
|
|
246
|
-
examples/
|
|
247
|
-
├── scripts/
|
|
248
|
-
│ ├── worktree-up.sh
|
|
249
|
-
│ ├── worktree-down.sh
|
|
250
|
-
│ ├── dev.sh
|
|
251
|
-
│ ├── convex-selective-seed.sh
|
|
252
|
-
│ ├── claude-worktree-create.sh
|
|
253
|
-
│ └── claude-worktree-remove.sh
|
|
254
|
-
├── claude/
|
|
255
|
-
│ ├── .worktreeinclude
|
|
256
|
-
│ ├── settings.json
|
|
257
|
-
│ └── commands/
|
|
258
|
-
├── cursor/
|
|
259
|
-
│ └── worktrees.json
|
|
260
|
-
└── codex/
|
|
261
|
-
└── environments/
|
|
262
|
-
└── environment.toml
|
|
263
|
-
```
|
|
39
|
+
After writing: `bash -n` the three scripts, `git status --short`, and parse generated TOML/JSON when those files exist.
|
|
@@ -4,28 +4,14 @@ description: Grill the user in rapid batches to sharpen a plan, decision, or ide
|
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Grill Me
|
|
8
|
-
|
|
9
7
|
Stress-test the user's thinking until both sides share a precise, actionable understanding.
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
6. After the reply, summarize what is established, call out contradictions or missing dependencies, and investigate any newly discoverable facts.
|
|
19
|
-
7. Ask the next batch of 10 questions. Continue until the important branches of the decision tree are resolved. If fewer than 10 meaningful decisions remain, ask only those remaining; never add filler questions to reach 10.
|
|
20
|
-
8. Present the final shared understanding as a compact decision brief: goal, scope, constraints, chosen approach, rejected alternatives, risks, and acceptance criteria.
|
|
21
|
-
9. Ask for explicit confirmation that the brief is correct before acting on it.
|
|
22
|
-
|
|
23
|
-
## Question quality
|
|
24
|
-
|
|
25
|
-
- Ask decisions only the user can make; investigate facts yourself.
|
|
26
|
-
- Challenge assumptions and compare credible alternatives instead of merely collecting preferences.
|
|
27
|
-
- Keep each question independently answerable and concise enough for a spoken response.
|
|
28
|
-
- Do not repeat settled questions unless new evidence invalidates the earlier answer.
|
|
29
|
-
- Match the user's language.
|
|
9
|
+
1. Resolve discoverable facts from the environment. Ask only decisions the user can make.
|
|
10
|
+
2. Recommend voice input: microphone is fastest; short answers keyed `1` through `10` are enough.
|
|
11
|
+
3. Ask exactly 10 numbered questions in one batch. Lead with the highest-leverage unresolved decisions. Include a concise **Recommended answer** on every question.
|
|
12
|
+
4. Invite one grouped reply. Accept terse answers, skips, or blanket acceptance of the recommendations.
|
|
13
|
+
5. Summarize what is established, investigate new facts, then ask the next batch. If fewer than 10 decisions remain, ask only those.
|
|
14
|
+
6. Present a compact decision brief: goal, scope, constraints, chosen approach, rejected alternatives, risks, and acceptance criteria.
|
|
15
|
+
7. Get explicit confirmation before acting on it.
|
|
30
16
|
|
|
31
|
-
|
|
17
|
+
Challenge assumptions. Compare credible alternatives. Match the user's language. Do not implement until the brief is confirmed.
|
|
@@ -4,61 +4,15 @@ description: Create, edit, configure, and debug hooks for Claude Code, Codex, an
|
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Configure Claude Code, Codex, and Cursor hooks as event-driven commands or prompts. Treat platform syntax as distinct.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
1. Identify the platform and load [router.md](references/router.md).
|
|
10
|
+
2. Load the platform file: [claude-code.md](references/claude-code.md), [codex.md](references/codex.md), or [cursor.md](references/cursor.md).
|
|
11
|
+
3. Pick the scope, file path, lifecycle event, and a command hook (deterministic) or prompt hook (reasoning, if supported).
|
|
12
|
+
4. Validate the native config and run the platform smoke check.
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
Across agents, keep one portable script plus a small adapter per platform. Report unsupported features.
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
2. Load the platform reference: `claude-code.md`, `codex.md`, or `cursor.md`.
|
|
15
|
-
3. Identify the scope and file path for that platform.
|
|
16
|
-
4. Select a supported lifecycle event and adapt the shared payload/decision contract.
|
|
17
|
-
5. Choose a command hook for deterministic shell logic, or a prompt hook when natural-language reasoning is required and the platform supports it.
|
|
18
|
-
6. Validate the native config and run the platform-specific smoke check.
|
|
16
|
+
Load as needed: [hook-types.md](references/hook-types.md), [command-vs-prompt.md](references/command-vs-prompt.md), [matchers.md](references/matchers.md), [input-output-schemas.md](references/input-output-schemas.md), [examples.md](references/examples.md), [troubleshooting.md](references/troubleshooting.md).
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
```json
|
|
23
|
-
{
|
|
24
|
-
"hooks": {
|
|
25
|
-
"PreToolUse": [
|
|
26
|
-
{
|
|
27
|
-
"matcher": "Bash",
|
|
28
|
-
"hooks": [
|
|
29
|
-
{ "type": "command", "command": "./.claude/hooks/check.sh", "timeout": 30000 }
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Command hooks receive JSON on stdin and may return JSON on stdout. Prompt hooks receive `#$ARGUMENTS` and should return a structured decision. Blocking hooks use `{"decision":"block","reason":"..."}`; non-blocking hooks may return a `systemMessage`.
|
|
38
|
-
|
|
39
|
-
## Safety requirements
|
|
40
|
-
|
|
41
|
-
- Check `stop_hook_active` in `Stop` and `SubagentStop` hooks to prevent recursive blocking.
|
|
42
|
-
- Set reasonable timeouts, especially for external commands.
|
|
43
|
-
- Use `$CLAUDE_PROJECT_DIR` or another trusted absolute path for scripts.
|
|
44
|
-
- Validate hook JSON with `jq` before relying on it.
|
|
45
|
-
- Keep blocking rules selective so normal work is not accidentally interrupted.
|
|
46
|
-
- Ensure referenced scripts are executable.
|
|
47
|
-
|
|
48
|
-
## Shared router
|
|
49
|
-
|
|
50
|
-
When the user asks for a hook that should work across agents, define one portable script with a small adapter per platform. Keep platform-specific event names, input fields, output decisions, exit codes, timeouts, and config paths in the references rather than pretending the formats are identical. Report unsupported features explicitly.
|
|
51
|
-
|
|
52
|
-
## References
|
|
53
|
-
|
|
54
|
-
- `references/router.md`: select a platform, map shared lifecycle intent, and avoid unsupported assumptions.
|
|
55
|
-
- `references/claude-code.md`: Claude settings, events, handlers, and `/hooks` verification.
|
|
56
|
-
- `references/codex.md`: Codex config layers, `hooks.json`, trust, and restart/worktree caveats.
|
|
57
|
-
- `references/cursor.md`: Cursor `.cursor/hooks.json`, hook scripts, and native response mapping.
|
|
58
|
-
- `references/research-sources.md`: first-party documentation sources and refresh policy.
|
|
59
|
-
- `references/hook-types.md`: shared event concepts, input/output, and blocking behavior.
|
|
60
|
-
- `references/command-vs-prompt.md`: choose command versus prompt hooks.
|
|
61
|
-
- `references/matchers.md`: regex and MCP matcher patterns.
|
|
62
|
-
- `references/input-output-schemas.md`: event schemas and response fields.
|
|
63
|
-
- `references/examples.md`: notifications, logging, formatting, tests, and safety examples.
|
|
64
|
-
- `references/troubleshooting.md`: debug, JSON, matcher, permission, and timeout checks.
|
|
18
|
+
Check `stop_hook_active` on Stop/SubagentStop. Use trusted absolute paths, timeouts, and `jq` validation. Keep blocking rules selective.
|
|
@@ -1,204 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rules-manager
|
|
3
|
-
description: Create, edit, and maintain AGENTS.md and .agents/rules
|
|
3
|
+
description: Create, edit, and maintain AGENTS.md and .agents/rules/. Use when adding, modifying, restructuring, or optimizing project rules, conventions, or constraints.
|
|
4
4
|
argument-hint: "[init | add <rule-name> | edit | optimize | task description]"
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
user-invocable: true
|
|
5
7
|
---
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
Rules consume tokens on every agent run. Keep them minimal, specific, and discoverable.
|
|
9
|
+
Manage the two-tier rule system: the always-loaded index plus modular files. Every modular file must be linked from the index or agents will not find it.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
Open [agents-vs-claude.md](references/agents-vs-claude.md) before choosing `AGENTS.md` + `.agents/rules/` versus `CLAUDE.md` + `.claude/rules/`, path-scoped `paths:` frontmatter, or dual-format setup. Run the same workflows against the chosen pair. Open [examples.md](references/examples.md) before writing a new rule file or index skeleton.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
- **.agents/rules/\*.md** — Modular rule files for focused topics (changelog, testing, deployment, etc.).
|
|
13
|
+
Never overwrite existing files without asking. Never write a rule file without confirming its content. Default new rules to a modular file (20–60 lines); put 1–2 line constraints in Universal Rules. When the user names index content (stack, commands, universal rules), edit that file in place. Write specific prohibitions. Do not add generic best practices, linter-enforced rules, or facts the agent can read from the code.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
</core_principle>
|
|
15
|
+
`init`: read package manifests; if the index or rules directory exists, ask before writing; create a <40-line index with an empty Rules section and the rules directory.
|
|
17
16
|
|
|
18
|
-
<
|
|
17
|
+
`add <name>`: slugify the name; `init` if no index; ask what it enforces and when it applies; write the modular file; add one index bullet whose path matches the file.
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
project-root/
|
|
22
|
-
├── AGENTS.md # Index + universal rules (always loaded)
|
|
23
|
-
└── .agents/
|
|
24
|
-
└── rules/
|
|
25
|
-
├── changelog.md # Rule for changelog management
|
|
26
|
-
├── testing.md # Rule for tests
|
|
27
|
-
└── deployment.md # Rule for deployment
|
|
28
|
-
```
|
|
19
|
+
`edit`: change only the named index section; keep every modular-file link intact.
|
|
29
20
|
|
|
30
|
-
|
|
31
|
-
</file_layout>
|
|
21
|
+
`optimize`: inventory index vs files (flag orphans and broken links); strip linter-enforced, generic, verbose, and code-derivable rules; compress to bullets; show the diff and wait. Targets: index <80 lines, each rule <60.
|
|
32
22
|
|
|
33
|
-
|
|
34
|
-
Minimal AGENTS.md with rules index:
|
|
35
|
-
|
|
36
|
-
```markdown
|
|
37
|
-
# Project Name
|
|
38
|
-
|
|
39
|
-
Short description (1-2 lines).
|
|
40
|
-
|
|
41
|
-
## Tech Stack
|
|
42
|
-
|
|
43
|
-
- [Non-obvious tech only]
|
|
44
|
-
|
|
45
|
-
## Commands
|
|
46
|
-
|
|
47
|
-
- `[dev]` - Dev server
|
|
48
|
-
- `[test]` - Run tests
|
|
49
|
-
|
|
50
|
-
## Rules
|
|
51
|
-
|
|
52
|
-
The detailed rules live in `.agents/rules/`. Read the relevant file before acting:
|
|
53
|
-
|
|
54
|
-
- **Changelog** - [.agents/rules/changelog.md](.agents/rules/changelog.md) - When/how to update CHANGELOG.md
|
|
55
|
-
- **Testing** - [.agents/rules/testing.md](.agents/rules/testing.md) - Test conventions and coverage
|
|
56
|
-
- **Deployment** - [.agents/rules/deployment.md](.agents/rules/deployment.md) - Deploy checklist
|
|
57
|
-
|
|
58
|
-
## Universal Rules
|
|
59
|
-
|
|
60
|
-
- [2-3 critical rules that apply everywhere]
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
The `## Rules` section is the index. Each bullet = one file in `.agents/rules/`. The `## Universal Rules` section holds short, project-wide constraints that don't deserve their own file.
|
|
64
|
-
</agents_md_template>
|
|
65
|
-
|
|
66
|
-
<rule_file_template>
|
|
67
|
-
Each `.agents/rules/<name>.md` should be focused, short, and actionable.
|
|
68
|
-
|
|
69
|
-
```markdown
|
|
70
|
-
# [Rule Title]
|
|
71
|
-
|
|
72
|
-
Short purpose statement (1 line).
|
|
73
|
-
|
|
74
|
-
## When this applies
|
|
75
|
-
|
|
76
|
-
- [Specific triggers - what task/context loads this rule]
|
|
77
|
-
|
|
78
|
-
## Rules
|
|
79
|
-
|
|
80
|
-
- [Specific, actionable rule]
|
|
81
|
-
- [Another rule with example if format matters]
|
|
82
|
-
|
|
83
|
-
## Example
|
|
84
|
-
|
|
85
|
-
[3-5 line concrete example, only if needed]
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
**Size target:** 20-60 lines per rule file. If longer, split into multiple files.
|
|
89
|
-
</rule_file_template>
|
|
90
|
-
|
|
91
|
-
<writing_rules>
|
|
92
|
-
**Be specific, never vague:**
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
NO: "Update changelog properly"
|
|
96
|
-
YES: "Append entry to CHANGELOG.md under ## Unreleased before every PR. Format: - [type] description (#PR)"
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**Prohibitions beat positive guidance:**
|
|
100
|
-
|
|
101
|
-
```
|
|
102
|
-
NO: "Try to write tests"
|
|
103
|
-
YES: "NEVER merge without a passing test for the changed behavior"
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
**Emphasis hierarchy:** CRITICAL > NEVER > ALWAYS > IMPORTANT
|
|
107
|
-
|
|
108
|
-
- Lead each section with the most critical rule
|
|
109
|
-
- Use **bold + keyword** for non-negotiables: `**CRITICAL**: Never commit secrets`
|
|
110
|
-
|
|
111
|
-
**Do NOT include:**
|
|
112
|
-
|
|
113
|
-
- Generic best practices ("write clean code", "DRY", "SOLID")
|
|
114
|
-
- Linter-enforced rules (ESLint, Prettier, Biome already do this)
|
|
115
|
-
- Things the agent discovers from the code (file structure, framework defaults)
|
|
116
|
-
- Marketing or vision statements
|
|
117
|
-
- Verbose paragraphs - one line is almost always enough
|
|
118
|
-
</writing_rules>
|
|
119
|
-
|
|
120
|
-
<workflows>
|
|
121
|
-
|
|
122
|
-
## `/rules-manager init` - Bootstrap AGENTS.md + .agents/rules/
|
|
123
|
-
|
|
124
|
-
When the argument contains `init`:
|
|
125
|
-
|
|
126
|
-
1. **Detect project context** - Read `package.json` or equivalent for name, stack, scripts.
|
|
127
|
-
2. **Check existing files** - If `AGENTS.md` or `.agents/rules/` already exists, read them and ASK before overwriting.
|
|
128
|
-
3. **Create skeleton** - Write AGENTS.md with empty `## Rules` index, ready to populate.
|
|
129
|
-
4. **Create `.agents/rules/` directory** - Empty for now. New rules added via `add` workflow.
|
|
130
|
-
|
|
131
|
-
Target AGENTS.md size at init: under 40 lines.
|
|
132
|
-
|
|
133
|
-
## `/rules-manager add <name>` - Add a new rule
|
|
134
|
-
|
|
135
|
-
When the argument starts with `add`:
|
|
136
|
-
|
|
137
|
-
1. **Confirm name** - Slugify (e.g., "changelog management" -> `changelog`). Ask user if unclear.
|
|
138
|
-
2. **Read existing AGENTS.md** - Confirm it exists. If not, run `init` first.
|
|
139
|
-
3. **Ask the user for rule content** - What does the rule enforce? When does it apply? Any examples?
|
|
140
|
-
4. **Write `.agents/rules/<name>.md`** - Use the rule file template. Keep it 20-60 lines.
|
|
141
|
-
5. **Update AGENTS.md `## Rules` section** - Add a one-line bullet pointing to the new file:
|
|
142
|
-
```
|
|
143
|
-
- **<Title>** - [.agents/rules/<name>.md](.agents/rules/<name>.md) - <one-line purpose>
|
|
144
|
-
```
|
|
145
|
-
6. **Verify the link** - Make sure the path in AGENTS.md exactly matches the created file.
|
|
146
|
-
|
|
147
|
-
**CRITICAL:** Step 5 is non-negotiable. A rule file without an index entry is invisible.
|
|
148
|
-
|
|
149
|
-
## `/rules-manager edit` - Modify AGENTS.md directly
|
|
150
|
-
|
|
151
|
-
When the user wants to change AGENTS.md itself rather than add a rule file — update the tech stack, commands, universal rules, project description, or restructure sections:
|
|
152
|
-
|
|
153
|
-
1. **Read AGENTS.md** - Load current content.
|
|
154
|
-
2. **Make the targeted edit in place** - Change only the relevant section; leave unrelated sections untouched.
|
|
155
|
-
3. **Preserve the index** - If touching `## Rules`, keep every `.agents/rules/*.md` link intact.
|
|
156
|
-
4. **Stay minimal** - Apply `<writing_rules>`: specific, prohibitions over guidance, no bloat.
|
|
157
|
-
|
|
158
|
-
This is the default when the user references AGENTS.md content (not a rule file) — e.g. "add a command to AGENTS.md", "update the tech stack", "tighten the universal rules".
|
|
159
|
-
|
|
160
|
-
## `/rules-manager optimize` - Audit and clean up
|
|
161
|
-
|
|
162
|
-
When the argument contains `optimize`:
|
|
163
|
-
|
|
164
|
-
1. **Inventory** - List AGENTS.md and every file in `.agents/rules/`.
|
|
165
|
-
2. **Check the index** - For each file in `.agents/rules/`, verify there's a matching bullet in AGENTS.md `## Rules`. Flag missing entries.
|
|
166
|
-
3. **Check for orphans** - For each AGENTS.md bullet, verify the file exists. Flag broken links.
|
|
167
|
-
4. **Apply bloat removal** - For each rule file, remove:
|
|
168
|
-
- Linter-enforced rules
|
|
169
|
-
- Generic best practices
|
|
170
|
-
- Verbose explanations (compress to one line)
|
|
171
|
-
- Things derivable from code
|
|
172
|
-
5. **Compress** - Paragraphs to bullets, multi-line rules to single lines.
|
|
173
|
-
6. **Show diff and ask before applying.**
|
|
174
|
-
|
|
175
|
-
Target sizes:
|
|
176
|
-
|
|
177
|
-
- AGENTS.md: under 80 lines
|
|
178
|
-
- Each rule file: under 60 lines
|
|
179
|
-
|
|
180
|
-
## Default - Add a rule based on description
|
|
181
|
-
|
|
182
|
-
When the argument is a free-form task (e.g., "add a rule about how we tag releases"):
|
|
183
|
-
|
|
184
|
-
1. Treat as `add` with auto-derived name.
|
|
185
|
-
2. Ask the user 1-2 clarifying questions if the rule scope is unclear.
|
|
186
|
-
3. Follow the `add` workflow.
|
|
187
|
-
</workflows>
|
|
188
|
-
|
|
189
|
-
<rules_for_this_skill>
|
|
190
|
-
|
|
191
|
-
- This skill manages ALL of AGENTS.md (tech stack, commands, universal rules, index, description) and `.agents/rules/` — not just creating new rule files. Editing existing AGENTS.md content is fully in scope.
|
|
192
|
-
- ALWAYS update AGENTS.md `## Rules` index when creating a file in `.agents/rules/`
|
|
193
|
-
- NEVER create a rule file without confirming with the user what it should contain
|
|
194
|
-
- NEVER overwrite existing AGENTS.md or rule files without asking
|
|
195
|
-
- Default to short rule files (20-60 lines). Split if larger.
|
|
196
|
-
- When user asks "create a rule", default to creating a file in `.agents/rules/` (not inline in AGENTS.md), unless the rule is 1-2 lines and fits the universal section.
|
|
197
|
-
- When the user references AGENTS.md content directly (a command, the stack, a universal rule), edit AGENTS.md in place via the `edit` workflow — don't spin up a new rule file.
|
|
198
|
-
</rules_for_this_skill>
|
|
199
|
-
|
|
200
|
-
<reference_guides>
|
|
201
|
-
|
|
202
|
-
- **Examples**: [references/examples.md](references/examples.md) - Sample rule files (changelog, testing, deployment)
|
|
203
|
-
- **AGENTS.md vs CLAUDE.md**: [references/agents-vs-claude.md](references/agents-vs-claude.md) - When to use which format
|
|
204
|
-
</reference_guides>
|
|
23
|
+
A free-form request is `add` with a derived name. Ask 1–2 scope questions if the rule is unclear.
|