aether-colony 5.0.0 → 5.2.1
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/.aether/aether-utils.sh +3226 -3345
- package/.aether/agents-claude/aether-ambassador.md +265 -0
- package/.aether/agents-claude/aether-archaeologist.md +327 -0
- package/.aether/agents-claude/aether-architect.md +236 -0
- package/.aether/agents-claude/aether-auditor.md +271 -0
- package/.aether/agents-claude/aether-builder.md +224 -0
- package/.aether/agents-claude/aether-chaos.md +269 -0
- package/.aether/agents-claude/aether-chronicler.md +305 -0
- package/.aether/agents-claude/aether-gatekeeper.md +330 -0
- package/.aether/agents-claude/aether-includer.md +374 -0
- package/.aether/agents-claude/aether-keeper.md +272 -0
- package/.aether/agents-claude/aether-measurer.md +322 -0
- package/.aether/agents-claude/aether-oracle.md +237 -0
- package/.aether/agents-claude/aether-probe.md +211 -0
- package/.aether/agents-claude/aether-queen.md +330 -0
- package/.aether/agents-claude/aether-route-setter.md +178 -0
- package/.aether/agents-claude/aether-sage.md +418 -0
- package/.aether/agents-claude/aether-scout.md +179 -0
- package/.aether/agents-claude/aether-surveyor-disciplines.md +417 -0
- package/.aether/agents-claude/aether-surveyor-nest.md +355 -0
- package/.aether/agents-claude/aether-surveyor-pathogens.md +289 -0
- package/.aether/agents-claude/aether-surveyor-provisions.md +360 -0
- package/.aether/agents-claude/aether-tracker.md +270 -0
- package/.aether/agents-claude/aether-watcher.md +280 -0
- package/.aether/agents-claude/aether-weaver.md +248 -0
- package/.aether/commands/archaeology.yaml +653 -0
- package/.aether/commands/build.yaml +1221 -0
- package/.aether/commands/chaos.yaml +653 -0
- package/.aether/commands/colonize.yaml +442 -0
- package/.aether/commands/continue.yaml +1484 -0
- package/.aether/commands/council.yaml +509 -0
- package/.aether/commands/data-clean.yaml +80 -0
- package/.aether/commands/dream.yaml +275 -0
- package/.aether/commands/entomb.yaml +863 -0
- package/.aether/commands/export-signals.yaml +64 -0
- package/.aether/commands/feedback.yaml +158 -0
- package/.aether/commands/flag.yaml +160 -0
- package/.aether/commands/flags.yaml +177 -0
- package/.aether/commands/focus.yaml +112 -0
- package/.aether/commands/help.yaml +167 -0
- package/.aether/commands/history.yaml +137 -0
- package/.aether/commands/import-signals.yaml +79 -0
- package/.aether/commands/init.yaml +502 -0
- package/.aether/commands/insert-phase.yaml +102 -0
- package/.aether/commands/interpret.yaml +285 -0
- package/.aether/commands/lay-eggs.yaml +224 -0
- package/.aether/commands/maturity.yaml +122 -0
- package/.aether/commands/memory-details.yaml +74 -0
- package/.aether/commands/migrate-state.yaml +174 -0
- package/.aether/commands/oracle.yaml +1224 -0
- package/.aether/commands/organize.yaml +446 -0
- package/.aether/commands/patrol.yaml +621 -0
- package/.aether/commands/pause-colony.yaml +424 -0
- package/.aether/commands/phase.yaml +124 -0
- package/.aether/commands/pheromones.yaml +153 -0
- package/.aether/commands/plan.yaml +1364 -0
- package/.aether/commands/preferences.yaml +63 -0
- package/.aether/commands/quick.yaml +104 -0
- package/.aether/commands/redirect.yaml +123 -0
- package/.aether/commands/resume-colony.yaml +375 -0
- package/.aether/commands/resume.yaml +407 -0
- package/.aether/commands/run.yaml +229 -0
- package/.aether/commands/seal.yaml +1214 -0
- package/.aether/commands/skill-create.yaml +337 -0
- package/.aether/commands/status.yaml +408 -0
- package/.aether/commands/swarm.yaml +352 -0
- package/.aether/commands/tunnels.yaml +814 -0
- package/.aether/commands/update.yaml +131 -0
- package/.aether/commands/verify-castes.yaml +159 -0
- package/.aether/commands/watch.yaml +454 -0
- package/.aether/docs/INCIDENT_TEMPLATE.md +32 -0
- package/.aether/docs/QUEEN-SYSTEM.md +11 -11
- package/.aether/docs/README.md +32 -2
- package/.aether/docs/command-playbooks/README.md +23 -0
- package/.aether/docs/command-playbooks/build-complete.md +349 -0
- package/.aether/docs/command-playbooks/build-context.md +282 -0
- package/.aether/docs/command-playbooks/build-full.md +1683 -0
- package/.aether/docs/command-playbooks/build-prep.md +284 -0
- package/.aether/docs/command-playbooks/build-verify.md +405 -0
- package/.aether/docs/command-playbooks/build-wave.md +749 -0
- package/.aether/docs/command-playbooks/continue-advance.md +524 -0
- package/.aether/docs/command-playbooks/continue-finalize.md +447 -0
- package/.aether/docs/command-playbooks/continue-full.md +1725 -0
- package/.aether/docs/command-playbooks/continue-gates.md +686 -0
- package/.aether/docs/command-playbooks/continue-verify.md +407 -0
- package/.aether/docs/context-continuity.md +84 -0
- package/.aether/docs/disciplines/DISCIPLINES.md +9 -7
- package/.aether/docs/error-codes.md +1 -1
- package/.aether/docs/known-issues.md +34 -173
- package/.aether/docs/pheromones.md +86 -6
- package/.aether/docs/plans/pheromone-display-plan.md +257 -0
- package/.aether/docs/queen-commands.md +10 -9
- package/.aether/docs/source-of-truth-map.md +132 -0
- package/.aether/docs/xml-utilities.md +47 -0
- package/.aether/rules/aether-colony.md +23 -13
- package/.aether/scripts/incident-test-add.sh +47 -0
- package/.aether/scripts/weekly-audit.sh +79 -0
- package/.aether/skills/.index.json +649 -0
- package/.aether/skills/colony/.manifest.json +16 -0
- package/.aether/skills/colony/build-discipline/SKILL.md +78 -0
- package/.aether/skills/colony/colony-interaction/SKILL.md +56 -0
- package/.aether/skills/colony/colony-lifecycle/SKILL.md +77 -0
- package/.aether/skills/colony/colony-visuals/SKILL.md +112 -0
- package/.aether/skills/colony/context-management/SKILL.md +80 -0
- package/.aether/skills/colony/error-presentation/SKILL.md +99 -0
- package/.aether/skills/colony/pheromone-protocol/SKILL.md +79 -0
- package/.aether/skills/colony/pheromone-visibility/SKILL.md +81 -0
- package/.aether/skills/colony/state-safety/SKILL.md +84 -0
- package/.aether/skills/colony/worker-priming/SKILL.md +82 -0
- package/.aether/skills/domain/.manifest.json +24 -0
- package/.aether/skills/domain/README.md +33 -0
- package/.aether/skills/domain/django/SKILL.md +49 -0
- package/.aether/skills/domain/docker/SKILL.md +52 -0
- package/.aether/skills/domain/golang/SKILL.md +52 -0
- package/.aether/skills/domain/graphql/SKILL.md +51 -0
- package/.aether/skills/domain/html-css/SKILL.md +48 -0
- package/.aether/skills/domain/nextjs/SKILL.md +45 -0
- package/.aether/skills/domain/nodejs/SKILL.md +53 -0
- package/.aether/skills/domain/postgresql/SKILL.md +53 -0
- package/.aether/skills/domain/prisma/SKILL.md +59 -0
- package/.aether/skills/domain/python/SKILL.md +50 -0
- package/.aether/skills/domain/rails/SKILL.md +52 -0
- package/.aether/skills/domain/react/SKILL.md +45 -0
- package/.aether/skills/domain/rest-api/SKILL.md +58 -0
- package/.aether/skills/domain/svelte/SKILL.md +47 -0
- package/.aether/skills/domain/tailwind/SKILL.md +45 -0
- package/.aether/skills/domain/testing/SKILL.md +53 -0
- package/.aether/skills/domain/typescript/SKILL.md +58 -0
- package/.aether/skills/domain/vue/SKILL.md +49 -0
- package/.aether/templates/QUEEN.md.template +23 -41
- package/.aether/templates/colony-state-reset.jq.template +1 -0
- package/.aether/templates/colony-state.template.json +4 -0
- package/.aether/templates/learning-observations.template.json +6 -0
- package/.aether/templates/midden.template.json +13 -0
- package/.aether/templates/pheromones.template.json +6 -0
- package/.aether/templates/session.template.json +9 -0
- package/.aether/utils/atomic-write.sh +63 -17
- package/.aether/utils/chamber-utils.sh +145 -2
- package/.aether/utils/council.sh +425 -0
- package/.aether/utils/emoji-audit.sh +166 -0
- package/.aether/utils/error-handler.sh +21 -7
- package/.aether/utils/file-lock.sh +182 -27
- package/.aether/utils/flag.sh +278 -0
- package/.aether/utils/hive.sh +572 -0
- package/.aether/utils/immune.sh +508 -0
- package/.aether/utils/learning.sh +1928 -0
- package/.aether/utils/midden.sh +520 -0
- package/.aether/utils/oracle/oracle.md +168 -0
- package/.aether/utils/oracle/oracle.sh +1023 -0
- package/.aether/utils/pheromone.sh +2029 -0
- package/.aether/utils/queen.sh +1710 -0
- package/.aether/utils/scan.sh +860 -0
- package/.aether/utils/semantic-cli.sh +10 -8
- package/.aether/utils/session.sh +816 -0
- package/.aether/utils/skills.sh +509 -0
- package/.aether/utils/spawn-tree.sh +103 -271
- package/.aether/utils/spawn.sh +260 -0
- package/.aether/utils/state-api.sh +389 -0
- package/.aether/utils/state-loader.sh +8 -6
- package/.aether/utils/suggest.sh +611 -0
- package/.aether/utils/swarm-display.sh +10 -1
- package/.aether/utils/swarm.sh +1004 -0
- package/.aether/utils/watch-spawn-tree.sh +11 -2
- package/.aether/utils/xml-compose.sh +2 -2
- package/.aether/utils/xml-convert.sh +9 -5
- package/.aether/utils/xml-core.sh +5 -9
- package/.aether/utils/xml-query.sh +4 -4
- package/.aether/workers.md +86 -67
- package/.claude/agents/ant/aether-ambassador.md +2 -1
- package/.claude/agents/ant/aether-archaeologist.md +6 -1
- package/.claude/agents/ant/aether-architect.md +236 -0
- package/.claude/agents/ant/aether-auditor.md +6 -1
- package/.claude/agents/ant/aether-builder.md +38 -1
- package/.claude/agents/ant/aether-chaos.md +2 -1
- package/.claude/agents/ant/aether-chronicler.md +1 -0
- package/.claude/agents/ant/aether-gatekeeper.md +6 -1
- package/.claude/agents/ant/aether-includer.md +1 -0
- package/.claude/agents/ant/aether-keeper.md +1 -0
- package/.claude/agents/ant/aether-measurer.md +6 -1
- package/.claude/agents/ant/aether-oracle.md +237 -0
- package/.claude/agents/ant/aether-probe.md +2 -1
- package/.claude/agents/ant/aether-queen.md +6 -1
- package/.claude/agents/ant/aether-route-setter.md +6 -1
- package/.claude/agents/ant/aether-sage.md +68 -3
- package/.claude/agents/ant/aether-scout.md +38 -1
- package/.claude/agents/ant/aether-surveyor-disciplines.md +2 -1
- package/.claude/agents/ant/aether-surveyor-nest.md +2 -1
- package/.claude/agents/ant/aether-surveyor-pathogens.md +2 -1
- package/.claude/agents/ant/aether-surveyor-provisions.md +2 -1
- package/.claude/agents/ant/aether-tracker.md +6 -1
- package/.claude/agents/ant/aether-watcher.md +37 -1
- package/.claude/agents/ant/aether-weaver.md +2 -1
- package/.claude/commands/ant/archaeology.md +1 -8
- package/.claude/commands/ant/build.md +43 -1159
- package/.claude/commands/ant/chaos.md +1 -14
- package/.claude/commands/ant/colonize.md +3 -14
- package/.claude/commands/ant/continue.md +40 -1026
- package/.claude/commands/ant/council.md +213 -15
- package/.claude/commands/ant/data-clean.md +81 -0
- package/.claude/commands/ant/dream.md +12 -9
- package/.claude/commands/ant/entomb.md +62 -87
- package/.claude/commands/ant/export-signals.md +57 -0
- package/.claude/commands/ant/feedback.md +18 -0
- package/.claude/commands/ant/flag.md +12 -0
- package/.claude/commands/ant/flags.md +22 -8
- package/.claude/commands/ant/focus.md +18 -0
- package/.claude/commands/ant/help.md +40 -8
- package/.claude/commands/ant/history.md +3 -0
- package/.claude/commands/ant/import-signals.md +71 -0
- package/.claude/commands/ant/init.md +349 -191
- package/.claude/commands/ant/insert-phase.md +105 -0
- package/.claude/commands/ant/interpret.md +11 -0
- package/.claude/commands/ant/lay-eggs.md +167 -158
- package/.claude/commands/ant/maturity.md +22 -11
- package/.claude/commands/ant/memory-details.md +77 -0
- package/.claude/commands/ant/migrate-state.md +6 -0
- package/.claude/commands/ant/oracle.md +317 -62
- package/.claude/commands/ant/organize.md +10 -5
- package/.claude/commands/ant/patrol.md +620 -0
- package/.claude/commands/ant/pause-colony.md +8 -22
- package/.claude/commands/ant/phase.md +26 -37
- package/.claude/commands/ant/pheromones.md +156 -0
- package/.claude/commands/ant/plan.md +199 -50
- package/.claude/commands/ant/preferences.md +65 -0
- package/.claude/commands/ant/quick.md +100 -0
- package/.claude/commands/ant/redirect.md +18 -0
- package/.claude/commands/ant/resume-colony.md +37 -22
- package/.claude/commands/ant/resume.md +60 -7
- package/.claude/commands/ant/run.md +231 -0
- package/.claude/commands/ant/seal.md +506 -78
- package/.claude/commands/ant/skill-create.md +286 -0
- package/.claude/commands/ant/status.md +171 -1
- package/.claude/commands/ant/swarm.md +11 -23
- package/.claude/commands/ant/tunnels.md +1 -0
- package/.claude/commands/ant/update.md +58 -135
- package/.claude/commands/ant/verify-castes.md +90 -42
- package/.claude/commands/ant/watch.md +1 -0
- package/.opencode/agents/aether-ambassador.md +1 -1
- package/.opencode/agents/aether-architect.md +133 -0
- package/.opencode/agents/aether-builder.md +3 -3
- package/.opencode/agents/aether-oracle.md +137 -0
- package/.opencode/agents/aether-queen.md +1 -1
- package/.opencode/agents/aether-route-setter.md +1 -1
- package/.opencode/agents/aether-scout.md +1 -1
- package/.opencode/agents/aether-surveyor-disciplines.md +6 -1
- package/.opencode/agents/aether-surveyor-nest.md +6 -1
- package/.opencode/agents/aether-surveyor-pathogens.md +6 -1
- package/.opencode/agents/aether-surveyor-provisions.md +6 -1
- package/.opencode/agents/aether-tracker.md +1 -1
- package/.opencode/agents/aether-watcher.md +1 -1
- package/.opencode/agents/aether-weaver.md +1 -1
- package/.opencode/commands/ant/archaeology.md +7 -14
- package/.opencode/commands/ant/build.md +54 -88
- package/.opencode/commands/ant/chaos.md +7 -24
- package/.opencode/commands/ant/colonize.md +10 -17
- package/.opencode/commands/ant/continue.md +595 -66
- package/.opencode/commands/ant/council.md +150 -18
- package/.opencode/commands/ant/data-clean.md +77 -0
- package/.opencode/commands/ant/dream.md +15 -17
- package/.opencode/commands/ant/entomb.md +28 -18
- package/.opencode/commands/ant/export-signals.md +54 -0
- package/.opencode/commands/ant/feedback.md +24 -5
- package/.opencode/commands/ant/flag.md +16 -4
- package/.opencode/commands/ant/flags.md +24 -10
- package/.opencode/commands/ant/focus.md +22 -5
- package/.opencode/commands/ant/help.md +41 -8
- package/.opencode/commands/ant/history.md +9 -0
- package/.opencode/commands/ant/import-signals.md +68 -0
- package/.opencode/commands/ant/init.md +396 -154
- package/.opencode/commands/ant/insert-phase.md +111 -0
- package/.opencode/commands/ant/interpret.md +16 -0
- package/.opencode/commands/ant/lay-eggs.md +184 -112
- package/.opencode/commands/ant/maturity.md +18 -2
- package/.opencode/commands/ant/memory-details.md +83 -0
- package/.opencode/commands/ant/migrate-state.md +12 -0
- package/.opencode/commands/ant/oracle.md +322 -67
- package/.opencode/commands/ant/organize.md +14 -12
- package/.opencode/commands/ant/patrol.md +626 -0
- package/.opencode/commands/ant/pause-colony.md +12 -29
- package/.opencode/commands/ant/phase.md +30 -40
- package/.opencode/commands/ant/pheromones.md +162 -0
- package/.opencode/commands/ant/plan.md +210 -57
- package/.opencode/commands/ant/preferences.md +71 -0
- package/.opencode/commands/ant/quick.md +91 -0
- package/.opencode/commands/ant/redirect.md +22 -5
- package/.opencode/commands/ant/resume-colony.md +41 -29
- package/.opencode/commands/ant/resume.md +80 -20
- package/.opencode/commands/ant/run.md +237 -0
- package/.opencode/commands/ant/seal.md +230 -25
- package/.opencode/commands/ant/skill-create.md +63 -0
- package/.opencode/commands/ant/status.md +125 -30
- package/.opencode/commands/ant/swarm.md +3 -345
- package/.opencode/commands/ant/tunnels.md +3 -9
- package/.opencode/commands/ant/update.md +63 -127
- package/.opencode/commands/ant/verify-castes.md +96 -42
- package/.opencode/commands/ant/watch.md +7 -0
- package/CHANGELOG.md +368 -1
- package/README.md +195 -324
- package/bin/cli.js +236 -429
- package/bin/generate-commands.js +186 -0
- package/bin/generate-commands.sh +128 -89
- package/bin/lib/spawn-logger.js +0 -15
- package/bin/lib/update-transaction.js +285 -35
- package/bin/npx-install.js +178 -0
- package/bin/validate-package.sh +85 -3
- package/package.json +16 -4
- package/.aether/CONTEXT.md +0 -160
- package/.aether/docs/QUEEN.md +0 -84
- package/.aether/exchange/colony-registry.xml +0 -11
- package/.aether/exchange/pheromones.xml +0 -87
- package/.aether/exchange/queen-wisdom.xml +0 -14
- package/.aether/model-profiles.yaml +0 -100
- package/.aether/utils/spawn-with-model.sh +0 -56
- package/bin/lib/model-profiles.js +0 -445
- package/bin/lib/model-verify.js +0 -288
- package/bin/lib/proxy-health.js +0 -253
- package/bin/lib/telemetry.js +0 -441
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: state-safety
|
|
3
|
+
description: Use when reading or writing JSON state files including COLONY_STATE.json, pheromones.json, constraints.json, or session.json
|
|
4
|
+
type: colony
|
|
5
|
+
domains: [security, state, data-integrity, safety]
|
|
6
|
+
agent_roles: [builder, watcher]
|
|
7
|
+
priority: normal
|
|
8
|
+
version: "1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# State Safety
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Colony state files are critical. A corrupted COLONY_STATE.json can lose an entire colony's progress. A malformed pheromones.json can silently break signal injection. This skill teaches safe state file handling to prevent data loss.
|
|
16
|
+
|
|
17
|
+
## Atomic Writes
|
|
18
|
+
|
|
19
|
+
All JSON state mutations must use atomic write: write to a temporary file first, then rename to the target. This prevents partial writes from corrupting the file if the process is interrupted.
|
|
20
|
+
|
|
21
|
+
### Process
|
|
22
|
+
|
|
23
|
+
1. Write the new content to a temporary file in the same directory (e.g., `COLONY_STATE.json.tmp`).
|
|
24
|
+
2. Validate the temporary file is valid JSON: `jq . file.tmp > /dev/null 2>&1`.
|
|
25
|
+
3. If validation passes, rename the temp file to the target: `mv file.tmp file.json`.
|
|
26
|
+
4. If validation fails, delete the temp file and report the error -- never overwrite good data with bad.
|
|
27
|
+
|
|
28
|
+
Use `atomic-write` utility when available. If writing state manually, follow these four steps exactly.
|
|
29
|
+
|
|
30
|
+
## File Locking
|
|
31
|
+
|
|
32
|
+
Before modifying any state file, acquire a lock to prevent concurrent writes:
|
|
33
|
+
|
|
34
|
+
1. Call `file-lock acquire <file>` before the write operation.
|
|
35
|
+
2. Perform the read-modify-write cycle.
|
|
36
|
+
3. Call `file-lock release <file>` after the write completes.
|
|
37
|
+
4. Always release locks in error paths -- use trap or ensure-release patterns.
|
|
38
|
+
|
|
39
|
+
Lock contention should be rare (colony operations are typically single-threaded), but parallel worker spawns during builds can cause races on shared files like pheromones.json.
|
|
40
|
+
|
|
41
|
+
## Post-Write Validation
|
|
42
|
+
|
|
43
|
+
After every state file write, validate the result:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
jq . "$state_file" > /dev/null 2>&1
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
If validation fails:
|
|
50
|
+
1. Log a warning with the file path and the operation that triggered the write.
|
|
51
|
+
2. Check for a backup (`.bak` extension in the same directory).
|
|
52
|
+
3. If a backup exists and is valid, restore from backup and log the restoration.
|
|
53
|
+
4. If no valid backup exists, report the corruption as a critical error.
|
|
54
|
+
|
|
55
|
+
Never silently ignore a JSON parse failure. A silent parse error today becomes a mysterious crash tomorrow.
|
|
56
|
+
|
|
57
|
+
## Corruption Detection
|
|
58
|
+
|
|
59
|
+
When reading state files, validate before using the data:
|
|
60
|
+
|
|
61
|
+
- Check that the file exists and is non-empty.
|
|
62
|
+
- Parse with `jq` and check the exit code.
|
|
63
|
+
- Verify expected top-level keys exist (e.g., COLONY_STATE.json must have `goal`, `state`, `current_phase`).
|
|
64
|
+
- If any check fails, follow the fallback chain: try backup, then report error.
|
|
65
|
+
|
|
66
|
+
## Backup Strategy
|
|
67
|
+
|
|
68
|
+
Before making significant state changes (phase advances, plan regeneration, seal), create a backup:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
cp "$state_file" "${state_file}.bak"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Keep exactly one backup per file. The backup represents the last known good state.
|
|
75
|
+
|
|
76
|
+
## State Files and Their Critical Fields
|
|
77
|
+
|
|
78
|
+
| File | Critical Fields | Risk if Corrupted |
|
|
79
|
+
|------|----------------|-------------------|
|
|
80
|
+
| COLONY_STATE.json | goal, state, current_phase, plan | Total colony loss |
|
|
81
|
+
| pheromones.json | signals array | Silent signal failure |
|
|
82
|
+
| constraints.json | focus, constraints | Lost constraints |
|
|
83
|
+
| session.json | session_id, colony_goal | Resume failure |
|
|
84
|
+
| midden.json | entries array | Lost failure history |
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: worker-priming
|
|
3
|
+
description: Use when starting work as a spawned worker to understand what context you have been given and how to use it
|
|
4
|
+
type: colony
|
|
5
|
+
domains: [context, priming, awareness]
|
|
6
|
+
agent_roles: [builder, watcher, scout, chaos, oracle, architect, colonizer, route_setter, archaeologist, chronicler, keeper, tracker, probe, weaver, auditor, gatekeeper, includer, measurer, sage, ambassador]
|
|
7
|
+
priority: normal
|
|
8
|
+
version: "1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Worker Priming
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
When you are spawned as a worker, your prompt contains assembled context from colony-prime. Understanding what is in your context -- and what might be missing -- helps you work more effectively. This skill teaches you how to interpret your assembled context.
|
|
16
|
+
|
|
17
|
+
## The 9 Context Sections
|
|
18
|
+
|
|
19
|
+
Colony-prime assembles up to 9 sections into your prompt. Here is what each contains and how to use it:
|
|
20
|
+
|
|
21
|
+
### 1. Rolling Summary
|
|
22
|
+
The most important section. Contains a condensed summary of what has happened in the colony so far: completed phases, key outcomes, current state. Read this first to orient yourself.
|
|
23
|
+
|
|
24
|
+
### 2. Phase Learnings
|
|
25
|
+
Lessons extracted from previous phases. These are things the colony learned while building -- patterns that worked, approaches that failed, technical discoveries. Use these to avoid repeating mistakes.
|
|
26
|
+
|
|
27
|
+
### 3. Key Decisions
|
|
28
|
+
Major decisions made during the colony's lifetime. These include architectural choices, technology selections, and scope changes. Respect these decisions unless your task explicitly requires revisiting them.
|
|
29
|
+
|
|
30
|
+
### 4. Hive Wisdom
|
|
31
|
+
Cross-colony patterns from the Hive Brain. These are generalized learnings from other projects on this machine. They are guidance, not absolute rules. If hive wisdom conflicts with project-specific learnings, prefer the project-specific learning.
|
|
32
|
+
|
|
33
|
+
### 5. Context Capsule
|
|
34
|
+
A snapshot of the most recent session state. Contains the current phase, recent task completions, and in-progress work.
|
|
35
|
+
|
|
36
|
+
### 6. User Preferences
|
|
37
|
+
The user's stated preferences from QUEEN.md. These override general patterns. If a user preference says "prefer dark mode" and a hive wisdom says "use light mode", follow the user preference.
|
|
38
|
+
|
|
39
|
+
### 7. QUEEN Wisdom
|
|
40
|
+
Strategic guidance from the colony's QUEEN.md file. This includes project-level principles, workflow preferences, and communication style notes.
|
|
41
|
+
|
|
42
|
+
### 8. Blocker Warnings
|
|
43
|
+
Any active blockers that may affect your work. If a blocker is relevant to your task, address it or report that you cannot proceed because of it.
|
|
44
|
+
|
|
45
|
+
### 9. Pheromone Signals
|
|
46
|
+
Active FOCUS, REDIRECT, and FEEDBACK signals. See the pheromone-protocol skill for how to handle these. Always check this section before starting work.
|
|
47
|
+
|
|
48
|
+
## Missing Sections
|
|
49
|
+
|
|
50
|
+
Some sections may be absent from your context. This happens when the token budget requires trimming. The trim order is:
|
|
51
|
+
|
|
52
|
+
1. Pheromone signals (trimmed first -- lowest priority)
|
|
53
|
+
2. QUEEN wisdom
|
|
54
|
+
3. User preferences
|
|
55
|
+
4. Context capsule
|
|
56
|
+
5. Hive wisdom
|
|
57
|
+
6. Key decisions
|
|
58
|
+
7. Phase learnings
|
|
59
|
+
8. Rolling summary (trimmed last -- highest priority)
|
|
60
|
+
|
|
61
|
+
If a section is missing, it was trimmed for budget reasons. This is normal and not an error. Work with whatever context you have.
|
|
62
|
+
|
|
63
|
+
## Priority Rules
|
|
64
|
+
|
|
65
|
+
When context sources conflict, resolve in this order (highest priority first):
|
|
66
|
+
|
|
67
|
+
1. **Explicit task instructions** -- What you were specifically asked to do.
|
|
68
|
+
2. **REDIRECT signals** -- Hard constraints that override everything except the task itself.
|
|
69
|
+
3. **User preferences** -- The user's stated wishes.
|
|
70
|
+
4. **FOCUS signals** -- Areas to prioritize.
|
|
71
|
+
5. **Phase learnings** -- Project-specific experience.
|
|
72
|
+
6. **Hive wisdom** -- Cross-colony patterns.
|
|
73
|
+
7. **FEEDBACK signals** -- Gentle adjustments.
|
|
74
|
+
|
|
75
|
+
## Before Starting Work
|
|
76
|
+
|
|
77
|
+
Every time you begin a task:
|
|
78
|
+
1. Read the rolling summary to understand where the colony is.
|
|
79
|
+
2. Check blocker warnings for anything that affects your task.
|
|
80
|
+
3. Review pheromone signals for constraints and focus areas.
|
|
81
|
+
4. Note any missing sections and adjust expectations accordingly.
|
|
82
|
+
5. Begin your task with full awareness of your assembled context.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"managed_by": "aether",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"skills": [
|
|
5
|
+
"django",
|
|
6
|
+
"docker",
|
|
7
|
+
"golang",
|
|
8
|
+
"graphql",
|
|
9
|
+
"html-css",
|
|
10
|
+
"nextjs",
|
|
11
|
+
"nodejs",
|
|
12
|
+
"postgresql",
|
|
13
|
+
"prisma",
|
|
14
|
+
"python",
|
|
15
|
+
"rails",
|
|
16
|
+
"react",
|
|
17
|
+
"rest-api",
|
|
18
|
+
"svelte",
|
|
19
|
+
"tailwind",
|
|
20
|
+
"testing",
|
|
21
|
+
"typescript",
|
|
22
|
+
"vue"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Domain Skills
|
|
2
|
+
|
|
3
|
+
Drop a folder here with a SKILL.md to add custom domain skills.
|
|
4
|
+
Skills created with `/ant:skill-create` are placed here automatically.
|
|
5
|
+
|
|
6
|
+
## Creating a Custom Skill
|
|
7
|
+
|
|
8
|
+
1. Create a directory: `mkdir ~/.aether/skills/domain/my-skill`
|
|
9
|
+
2. Create `SKILL.md` inside it with this frontmatter:
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
---
|
|
13
|
+
name: my-skill
|
|
14
|
+
description: Use when working with my technology
|
|
15
|
+
type: domain
|
|
16
|
+
domains: [my-domain, related-domain]
|
|
17
|
+
agent_roles: [builder]
|
|
18
|
+
detect_files: ["my-config.*"]
|
|
19
|
+
detect_packages: ["my-package"]
|
|
20
|
+
priority: normal
|
|
21
|
+
version: "1.0"
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
Your best practices and guidance here.
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
3. The skill will be auto-detected on the next build
|
|
28
|
+
|
|
29
|
+
## Important
|
|
30
|
+
|
|
31
|
+
- Your custom skills are **never overwritten** by `aether update`
|
|
32
|
+
- Only skills listed in `.manifest.json` are managed by Aether
|
|
33
|
+
- Use `/ant:skill-create "<topic>"` for Oracle-powered skill generation
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: django
|
|
3
|
+
description: Use when the project uses Django for Python web development
|
|
4
|
+
type: domain
|
|
5
|
+
domains: [backend, python, web]
|
|
6
|
+
agent_roles: [builder]
|
|
7
|
+
detect_files: ["manage.py"]
|
|
8
|
+
detect_packages: ["django"]
|
|
9
|
+
priority: normal
|
|
10
|
+
version: "1.0"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Django Best Practices
|
|
14
|
+
|
|
15
|
+
## Project Structure
|
|
16
|
+
|
|
17
|
+
Follow Django's app-based architecture. Each app should represent a distinct feature or domain concept. Keep apps small and focused -- if an app has 20+ models, it probably needs splitting.
|
|
18
|
+
|
|
19
|
+
Place reusable utilities in a `core` or `common` app. Keep `settings.py` clean by splitting into `base.py`, `development.py`, and `production.py` using a settings package.
|
|
20
|
+
|
|
21
|
+
## Models
|
|
22
|
+
|
|
23
|
+
Define explicit `Meta` classes with `ordering`, `verbose_name`, and `db_table` where appropriate. Add `__str__` methods to every model for admin and debugging readability.
|
|
24
|
+
|
|
25
|
+
Use model managers for complex queries rather than scattering `filter()` chains through views. Create custom querysets with `as_manager()` for chainable query methods.
|
|
26
|
+
|
|
27
|
+
Always create migrations after model changes with `makemigrations`. Review generated migration files before running them. Never edit migrations manually unless you understand the implications.
|
|
28
|
+
|
|
29
|
+
## Views
|
|
30
|
+
|
|
31
|
+
Prefer class-based views (CBVs) for CRUD operations -- they eliminate boilerplate. Use function-based views for complex custom logic where CBV mixins would become contorted. In Django REST Framework, use `ModelViewSet` for standard CRUD and `APIView` for custom endpoints.
|
|
32
|
+
|
|
33
|
+
Keep views thin. Business logic belongs in services or model methods, not in views. A view should validate input, call a service, and return a response.
|
|
34
|
+
|
|
35
|
+
## Security
|
|
36
|
+
|
|
37
|
+
Never expose raw model instances to API responses -- use serializers or forms to control which fields are visible. Always validate and clean form input. Use Django's CSRF protection and never disable it.
|
|
38
|
+
|
|
39
|
+
Set `DEBUG = False` in production. Configure `ALLOWED_HOSTS` explicitly. Use environment variables for `SECRET_KEY` and database credentials.
|
|
40
|
+
|
|
41
|
+
## Database
|
|
42
|
+
|
|
43
|
+
Use `select_related()` for foreign key joins and `prefetch_related()` for reverse and many-to-many relationships to avoid N+1 query problems. Use Django Debug Toolbar in development to spot excessive queries.
|
|
44
|
+
|
|
45
|
+
Write data migrations for schema changes that need data transformation. Keep schema and data migrations separate.
|
|
46
|
+
|
|
47
|
+
## Testing
|
|
48
|
+
|
|
49
|
+
Use `TestCase` for tests that need database access, `SimpleTestCase` for those that do not. Use `factory_boy` or model `baker` over fixtures for test data. Test views through the test client, not by calling view functions directly.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docker
|
|
3
|
+
description: Use when the project uses Docker for containerization and deployment
|
|
4
|
+
type: domain
|
|
5
|
+
domains: [infrastructure, containers, deployment]
|
|
6
|
+
agent_roles: [builder]
|
|
7
|
+
detect_files: ["Dockerfile*", "docker-compose.*"]
|
|
8
|
+
priority: normal
|
|
9
|
+
version: "1.0"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Docker Best Practices
|
|
13
|
+
|
|
14
|
+
## Dockerfile Construction
|
|
15
|
+
|
|
16
|
+
Use multi-stage builds to keep production images small. Build dependencies in one stage, copy only the compiled output to a minimal runtime stage. This can reduce image sizes by 10x or more.
|
|
17
|
+
|
|
18
|
+
Order instructions from least to most frequently changed. `COPY package.json` and `RUN npm install` before `COPY . .` so dependency installation is cached when only source code changes. Cache invalidation on early layers rebuilds everything after them.
|
|
19
|
+
|
|
20
|
+
Use specific base image tags (`node:20-alpine`), never `latest`. Pin versions for reproducible builds. Alpine-based images are smaller but may lack libraries -- use slim variants if Alpine causes compatibility issues.
|
|
21
|
+
|
|
22
|
+
## Image Security
|
|
23
|
+
|
|
24
|
+
Run containers as a non-root user. Add `RUN addgroup -S app && adduser -S app -G app` and `USER app` in your Dockerfile. Running as root inside a container is a security risk if the container is compromised.
|
|
25
|
+
|
|
26
|
+
Do not include secrets in images. Never use `COPY .env .` or `ARG SECRET_KEY`. Use runtime environment variables or Docker secrets instead.
|
|
27
|
+
|
|
28
|
+
Minimize the attack surface: install only what you need, remove package manager caches (`rm -rf /var/cache/apk/*`), use `.dockerignore` to exclude `node_modules`, `.git`, and test files from the build context.
|
|
29
|
+
|
|
30
|
+
## Docker Compose
|
|
31
|
+
|
|
32
|
+
Use `docker-compose.yml` for local development and testing environments. Define services, networks, and volumes clearly. Use named volumes for data persistence -- anonymous volumes are harder to manage and back up.
|
|
33
|
+
|
|
34
|
+
Set `depends_on` with health checks for service ordering. Without health checks, `depends_on` only waits for the container to start, not for the service inside it to be ready.
|
|
35
|
+
|
|
36
|
+
Use `.env` files with Compose for configuration, but never commit them to the repository. Document required environment variables in a `.env.example` file.
|
|
37
|
+
|
|
38
|
+
## Networking
|
|
39
|
+
|
|
40
|
+
Use Docker networks to isolate services. Only expose ports that need external access. Internal services (databases, caches) should communicate on internal Docker networks, not through published ports.
|
|
41
|
+
|
|
42
|
+
## Logging
|
|
43
|
+
|
|
44
|
+
Log to stdout/stderr, not to files inside the container. Docker captures stdout/stderr and makes it available via `docker logs`. File-based logging inside containers is difficult to access and fills up container storage.
|
|
45
|
+
|
|
46
|
+
## Health Checks
|
|
47
|
+
|
|
48
|
+
Add `HEALTHCHECK` instructions to Dockerfiles. A health check lets orchestrators (Compose, Kubernetes) detect when a container is running but the application inside has crashed or hung.
|
|
49
|
+
|
|
50
|
+
## Resource Limits
|
|
51
|
+
|
|
52
|
+
Set memory and CPU limits in Compose or your orchestrator. Without limits, a single misbehaving container can starve the host and crash other services.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: golang
|
|
3
|
+
description: Use when the project uses Go for systems programming or backend services
|
|
4
|
+
type: domain
|
|
5
|
+
domains: [backend, systems, concurrency]
|
|
6
|
+
agent_roles: [builder]
|
|
7
|
+
detect_files: ["go.mod", "*.go"]
|
|
8
|
+
priority: normal
|
|
9
|
+
version: "1.0"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Go Best Practices
|
|
13
|
+
|
|
14
|
+
## Error Handling
|
|
15
|
+
|
|
16
|
+
Check every error. The `if err != nil` pattern is intentional -- Go makes error handling explicit. Never discard errors with `_`. Wrap errors with context using `fmt.Errorf("doing X: %w", err)` so call chains produce readable messages.
|
|
17
|
+
|
|
18
|
+
Use sentinel errors (`var ErrNotFound = errors.New("not found")`) for expected conditions that callers check with `errors.Is()`. Use custom error types for errors that carry structured data.
|
|
19
|
+
|
|
20
|
+
## Project Structure
|
|
21
|
+
|
|
22
|
+
Follow the standard layout: `cmd/` for application entry points, `internal/` for private packages, `pkg/` for public libraries (if any). Keep `main.go` minimal -- it wires up dependencies and starts the server.
|
|
23
|
+
|
|
24
|
+
One package per directory. Package names should be short, lowercase, and descriptive. Avoid `util` or `common` packages -- they become dumping grounds.
|
|
25
|
+
|
|
26
|
+
## Concurrency
|
|
27
|
+
|
|
28
|
+
Do not communicate by sharing memory -- share memory by communicating. Use channels for synchronization between goroutines. Use `sync.Mutex` only for protecting simple shared state where channels would be overkill.
|
|
29
|
+
|
|
30
|
+
Always ensure goroutines can be stopped. Pass `context.Context` and check `ctx.Done()`. Leaking goroutines is a memory leak that grows over time.
|
|
31
|
+
|
|
32
|
+
Use `sync.WaitGroup` when you need to wait for a known number of goroutines to complete. Use `errgroup.Group` when any goroutine failure should cancel the rest.
|
|
33
|
+
|
|
34
|
+
## Interfaces
|
|
35
|
+
|
|
36
|
+
Define interfaces where they are used, not where they are implemented. Keep interfaces small -- one or two methods is ideal. The `io.Reader` and `io.Writer` interfaces are the gold standard.
|
|
37
|
+
|
|
38
|
+
Accept interfaces, return structs. This makes code testable -- callers can inject mocks that satisfy the interface.
|
|
39
|
+
|
|
40
|
+
## Testing
|
|
41
|
+
|
|
42
|
+
Use table-driven tests for functions with multiple input/output combinations. Name test cases clearly. Use `t.Run()` for subtests so failures identify which case broke.
|
|
43
|
+
|
|
44
|
+
Use `testing.T.Helper()` in test helper functions so failure messages point to the calling test, not the helper.
|
|
45
|
+
|
|
46
|
+
## Dependencies
|
|
47
|
+
|
|
48
|
+
Use `go mod tidy` to keep `go.mod` clean. Vendor dependencies with `go mod vendor` for reproducible builds in CI. Avoid unnecessary dependencies -- the standard library is comprehensive. Check if `net/http`, `encoding/json`, or `os` already do what you need.
|
|
49
|
+
|
|
50
|
+
## Performance
|
|
51
|
+
|
|
52
|
+
Profile before optimizing with `pprof`. Pre-allocate slices with `make([]T, 0, expectedCap)` when the size is known. Avoid string concatenation in loops -- use `strings.Builder`. Reduce allocations by reusing buffers with `sync.Pool` for hot paths.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: graphql
|
|
3
|
+
description: Use when the project uses GraphQL for API queries and mutations
|
|
4
|
+
type: domain
|
|
5
|
+
domains: [api, query, schema]
|
|
6
|
+
agent_roles: [builder]
|
|
7
|
+
detect_files: ["*.graphql"]
|
|
8
|
+
detect_packages: ["apollo", "graphql"]
|
|
9
|
+
priority: normal
|
|
10
|
+
version: "1.0"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# GraphQL Best Practices
|
|
14
|
+
|
|
15
|
+
## Schema Design
|
|
16
|
+
|
|
17
|
+
Design your schema around the client's needs, not your database tables. Use descriptive type names and field names. Every field should have a clear purpose -- do not expose internal implementation details.
|
|
18
|
+
|
|
19
|
+
Use `ID` type for identifiers, `String` for text, `Int`/`Float` for numbers, `Boolean` for flags. Define custom scalars (DateTime, URL, Email) for domain-specific values that need validation.
|
|
20
|
+
|
|
21
|
+
Make fields non-nullable by default (`String!`). Only use nullable fields when null carries meaning (e.g., "no value set"). Lists should be non-nullable with non-nullable items: `[User!]!`.
|
|
22
|
+
|
|
23
|
+
## Queries and Mutations
|
|
24
|
+
|
|
25
|
+
Separate reads (queries) from writes (mutations). Mutations should return the affected object so clients can update their cache without a refetch. Name mutations as verbs: `createUser`, `updatePost`, `deleteComment`.
|
|
26
|
+
|
|
27
|
+
Use input types for mutation arguments: `input CreateUserInput { name: String!, email: String! }`. This keeps the schema clean and makes validation straightforward.
|
|
28
|
+
|
|
29
|
+
## Pagination
|
|
30
|
+
|
|
31
|
+
Use Relay-style cursor pagination for all list fields: `Connection` type with `edges`, `node`, `pageInfo`, and `cursor`. This handles infinite scroll, bidirectional loading, and real-time updates cleanly. Avoid offset-based pagination -- it breaks when data changes between pages.
|
|
32
|
+
|
|
33
|
+
## N+1 Problem
|
|
34
|
+
|
|
35
|
+
GraphQL's nested resolution model naturally creates N+1 queries. Use DataLoader to batch and cache database lookups within a single request. Every resolver that touches the database should go through a DataLoader.
|
|
36
|
+
|
|
37
|
+
Without DataLoader, a query fetching 50 users with their posts makes 51 database calls (1 for users + 50 for each user's posts). With DataLoader, it makes 2.
|
|
38
|
+
|
|
39
|
+
## Error Handling
|
|
40
|
+
|
|
41
|
+
Return errors in the `errors` array, not in the data. Use error `extensions` for machine-readable codes: `{ "extensions": { "code": "UNAUTHORIZED" } }`. Partial failures are valid in GraphQL -- a query can return data for some fields and errors for others.
|
|
42
|
+
|
|
43
|
+
## Security
|
|
44
|
+
|
|
45
|
+
Limit query depth (typically 7-10 levels) to prevent deeply nested queries that overwhelm the server. Limit query complexity by assigning cost values to fields and rejecting queries that exceed a budget.
|
|
46
|
+
|
|
47
|
+
Disable introspection in production unless your API is intentionally public. Introspection exposes your entire schema to attackers.
|
|
48
|
+
|
|
49
|
+
## Performance
|
|
50
|
+
|
|
51
|
+
Persisted queries reduce bandwidth and prevent arbitrary query execution. Clients send a hash instead of the full query string. Cache responses at the field level, not the query level, since GraphQL queries are highly variable.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: html-css
|
|
3
|
+
description: Use when the project uses plain HTML, CSS, or SCSS for web pages
|
|
4
|
+
type: domain
|
|
5
|
+
domains: [frontend, styling, markup]
|
|
6
|
+
agent_roles: [builder]
|
|
7
|
+
detect_files: ["*.html", "*.css", "*.scss"]
|
|
8
|
+
priority: normal
|
|
9
|
+
version: "1.0"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# HTML & CSS Best Practices
|
|
13
|
+
|
|
14
|
+
## Semantic HTML
|
|
15
|
+
|
|
16
|
+
Use the right element for the job: `<nav>` for navigation, `<main>` for primary content, `<article>` for self-contained content, `<section>` for thematic groupings, `<aside>` for tangential content. Avoid div-soup -- excessive `<div>` nesting with no semantic meaning.
|
|
17
|
+
|
|
18
|
+
Use `<button>` for actions, `<a>` for navigation. Never put click handlers on `<div>` or `<span>` elements -- they are not keyboard accessible.
|
|
19
|
+
|
|
20
|
+
## Accessibility Fundamentals
|
|
21
|
+
|
|
22
|
+
Every `<img>` needs an `alt` attribute. Decorative images get `alt=""`. Every form input needs a `<label>` linked via `for`/`id`. Heading levels (`h1`-`h6`) must not skip levels -- go `h1`, `h2`, `h3`, never `h1` to `h3`.
|
|
23
|
+
|
|
24
|
+
Ensure color contrast ratios meet WCAG AA (4.5:1 for text, 3:1 for large text). Test with browser DevTools accessibility panel.
|
|
25
|
+
|
|
26
|
+
## CSS Architecture
|
|
27
|
+
|
|
28
|
+
Avoid deeply nested selectors (more than 3 levels). Flat, specific class selectors are faster and easier to override. Prefer BEM naming (`.block__element--modifier`) for vanilla CSS projects to keep specificity predictable.
|
|
29
|
+
|
|
30
|
+
Never use `!important` to fix layout problems. It signals a specificity battle -- fix the root cause by reducing selector complexity.
|
|
31
|
+
|
|
32
|
+
## Layout
|
|
33
|
+
|
|
34
|
+
Use CSS Grid for two-dimensional layouts (rows and columns simultaneously). Use Flexbox for one-dimensional layouts (a row or a column). Avoid floats for layout -- they exist for wrapping text around images, not for page structure.
|
|
35
|
+
|
|
36
|
+
Set `box-sizing: border-box` globally. Without it, padding and borders add to element dimensions, making math unpredictable.
|
|
37
|
+
|
|
38
|
+
## Responsive Design
|
|
39
|
+
|
|
40
|
+
Use relative units (`rem`, `em`, `%`, `vw`, `vh`) over fixed pixels for sizing and spacing. Set font sizes in `rem` so they respect user browser settings.
|
|
41
|
+
|
|
42
|
+
Write mobile-first media queries: base styles for small screens, `min-width` breakpoints for larger ones.
|
|
43
|
+
|
|
44
|
+
## Performance
|
|
45
|
+
|
|
46
|
+
Minimize CSS file count and size. Remove unused selectors. Avoid expensive properties in animations: stick to `transform` and `opacity` for smooth 60fps transitions. Never animate `width`, `height`, `top`, or `left`.
|
|
47
|
+
|
|
48
|
+
Place `<link rel="stylesheet">` in the `<head>`. Place `<script>` before `</body>` or use `defer`/`async` attributes to avoid blocking rendering.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nextjs
|
|
3
|
+
description: Use when the project uses Next.js for server-side rendering or full-stack React
|
|
4
|
+
type: domain
|
|
5
|
+
domains: [frontend, ssr, fullstack]
|
|
6
|
+
agent_roles: [builder]
|
|
7
|
+
detect_files: ["next.config.*"]
|
|
8
|
+
detect_packages: ["next"]
|
|
9
|
+
priority: normal
|
|
10
|
+
version: "1.0"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Next.js Best Practices
|
|
14
|
+
|
|
15
|
+
## App Router vs Pages Router
|
|
16
|
+
|
|
17
|
+
Next.js 13+ uses the App Router by default. Check which router the project uses before making changes. App Router uses `app/` directory with `layout.tsx`, `page.tsx`, and `loading.tsx` conventions. Pages Router uses `pages/` with `_app.tsx` and `_document.tsx`. Never mix patterns within the same route.
|
|
18
|
+
|
|
19
|
+
## Server vs Client Components
|
|
20
|
+
|
|
21
|
+
In the App Router, components are Server Components by default. Only add `"use client"` when you need browser APIs, event handlers, hooks, or browser-only libraries. Push `"use client"` as far down the tree as possible -- wrap only the interactive leaf, not the entire page.
|
|
22
|
+
|
|
23
|
+
Server Components can fetch data directly without `useEffect` or API routes. This is the preferred pattern for data loading.
|
|
24
|
+
|
|
25
|
+
## Data Fetching
|
|
26
|
+
|
|
27
|
+
Use `fetch` in Server Components with caching options (`cache: 'force-cache'` for static, `cache: 'no-store'` for dynamic). For mutations, use Server Actions -- functions marked with `"use server"` that run on the server but can be called from client forms.
|
|
28
|
+
|
|
29
|
+
Avoid calling your own API routes from Server Components. You have direct access to the database and services -- use them.
|
|
30
|
+
|
|
31
|
+
## Route Handlers
|
|
32
|
+
|
|
33
|
+
API routes live in `app/api/*/route.ts`. Export named functions matching HTTP methods: `GET`, `POST`, `PUT`, `DELETE`. Always return `NextResponse` objects with appropriate status codes.
|
|
34
|
+
|
|
35
|
+
## Common Gotchas
|
|
36
|
+
|
|
37
|
+
Middleware runs on the Edge Runtime -- no Node.js APIs like `fs` or `path`. Keep middleware lean: auth checks, redirects, header modifications only.
|
|
38
|
+
|
|
39
|
+
Dynamic imports with `next/dynamic` for heavy client components keep initial bundle sizes small. Always provide a loading fallback.
|
|
40
|
+
|
|
41
|
+
Environment variables prefixed with `NEXT_PUBLIC_` are exposed to the browser. Never put secrets in `NEXT_PUBLIC_` variables.
|
|
42
|
+
|
|
43
|
+
## Image and Font Optimization
|
|
44
|
+
|
|
45
|
+
Use `next/image` for all images -- it handles lazy loading, sizing, and format optimization automatically. Use `next/font` for fonts to eliminate layout shift.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nodejs
|
|
3
|
+
description: Use when the project uses Node.js for server-side JavaScript
|
|
4
|
+
type: domain
|
|
5
|
+
domains: [backend, server, api]
|
|
6
|
+
agent_roles: [builder]
|
|
7
|
+
detect_files: ["*.js", "*.mjs"]
|
|
8
|
+
detect_packages: ["express", "fastify"]
|
|
9
|
+
priority: normal
|
|
10
|
+
version: "1.0"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Node.js Best Practices
|
|
14
|
+
|
|
15
|
+
## Error Handling
|
|
16
|
+
|
|
17
|
+
Never ignore errors. Every callback gets an `err` first argument -- check it. With async/await, wrap operations in try/catch and handle failures explicitly. Unhandled promise rejections crash Node.js in modern versions.
|
|
18
|
+
|
|
19
|
+
Use custom error classes that extend `Error` for different failure types (ValidationError, NotFoundError, AuthorizationError). This makes error handling in middleware clean and predictable.
|
|
20
|
+
|
|
21
|
+
## Async Patterns
|
|
22
|
+
|
|
23
|
+
Use `async/await` over raw callbacks or `.then()` chains. For parallel operations, use `Promise.all()`. For parallel with partial failure tolerance, use `Promise.allSettled()`.
|
|
24
|
+
|
|
25
|
+
Never use `async` functions as `EventEmitter` listeners without wrapping them -- thrown errors will be silently swallowed. Wrap in a try/catch and emit an error event.
|
|
26
|
+
|
|
27
|
+
## Project Structure
|
|
28
|
+
|
|
29
|
+
Organize by feature, not by technical role. Group routes, controllers, services, and models for a feature together rather than having separate `routes/`, `controllers/`, `services/` directories.
|
|
30
|
+
|
|
31
|
+
Keep `index.js` or `app.js` thin -- it should only wire up middleware and routes, not contain business logic.
|
|
32
|
+
|
|
33
|
+
## Environment and Configuration
|
|
34
|
+
|
|
35
|
+
Load configuration from environment variables using a dedicated config module. Never hardcode ports, database URLs, or API keys. Validate required env vars at startup and fail fast if any are missing.
|
|
36
|
+
|
|
37
|
+
Use `.env` files only for local development. Never commit `.env` files. Add `.env` to `.gitignore` immediately.
|
|
38
|
+
|
|
39
|
+
## Security
|
|
40
|
+
|
|
41
|
+
Validate and sanitize all input. Use parameterized queries for database access -- never interpolate user input into SQL strings. Set HTTP security headers with `helmet` middleware.
|
|
42
|
+
|
|
43
|
+
Rate-limit API endpoints to prevent abuse. Use `express-rate-limit` or equivalent. Enable CORS explicitly for known origins only, never `*` in production.
|
|
44
|
+
|
|
45
|
+
## Process Management
|
|
46
|
+
|
|
47
|
+
Handle `SIGTERM` and `SIGINT` for graceful shutdown. Close database connections, finish in-flight requests, then exit. This is critical for container deployments where processes receive termination signals during scaling.
|
|
48
|
+
|
|
49
|
+
Never use `process.exit()` in library code. Reserve it for the top-level application entry point.
|
|
50
|
+
|
|
51
|
+
## Logging
|
|
52
|
+
|
|
53
|
+
Use a structured logger (pino, winston) -- not `console.log`. Log with levels (error, warn, info, debug). Include request IDs for tracing across async operations. Never log sensitive data like passwords, tokens, or full credit card numbers.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: postgresql
|
|
3
|
+
description: Use when the project uses PostgreSQL for relational data storage
|
|
4
|
+
type: domain
|
|
5
|
+
domains: [database, sql, data]
|
|
6
|
+
agent_roles: [builder]
|
|
7
|
+
detect_files: ["*.sql"]
|
|
8
|
+
detect_packages: ["pg", "psycopg2"]
|
|
9
|
+
priority: normal
|
|
10
|
+
version: "1.0"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# PostgreSQL Best Practices
|
|
14
|
+
|
|
15
|
+
## Schema Design
|
|
16
|
+
|
|
17
|
+
Design tables in third normal form unless you have a measured performance reason to denormalize. Use meaningful table and column names -- `user_email` over `ue`. Always define primary keys, preferably `BIGSERIAL` or `UUID` depending on scale requirements.
|
|
18
|
+
|
|
19
|
+
Add `created_at` and `updated_at` timestamps to every table. Use `TIMESTAMPTZ` (timestamp with time zone), never `TIMESTAMP` without timezone -- timezone-naive timestamps cause bugs when servers span time zones.
|
|
20
|
+
|
|
21
|
+
## Indexing
|
|
22
|
+
|
|
23
|
+
Create indexes to support your query patterns, not speculatively. Use `EXPLAIN ANALYZE` to verify that queries use indexes. A missing index on a frequently-queried column is a common source of slow pages.
|
|
24
|
+
|
|
25
|
+
Use partial indexes for queries that filter on a condition: `CREATE INDEX idx_active_users ON users(email) WHERE active = true`. Use composite indexes with columns ordered by selectivity (most selective first).
|
|
26
|
+
|
|
27
|
+
Do not over-index. Every index slows down writes. Remove unused indexes identified by `pg_stat_user_indexes` where `idx_scan = 0`.
|
|
28
|
+
|
|
29
|
+
## Queries
|
|
30
|
+
|
|
31
|
+
Always use parameterized queries -- never concatenate user input into SQL strings. This prevents SQL injection and lets PostgreSQL cache query plans.
|
|
32
|
+
|
|
33
|
+
Use `LIMIT` and `OFFSET` for simple pagination, but switch to cursor-based pagination (keyset pagination using `WHERE id > last_seen_id ORDER BY id LIMIT N`) for large datasets. `OFFSET` scans and discards rows, getting slower as pages increase.
|
|
34
|
+
|
|
35
|
+
## Migrations
|
|
36
|
+
|
|
37
|
+
Write migrations as idempotent scripts when possible. Use `IF NOT EXISTS` for `CREATE TABLE` and `CREATE INDEX`. Always test migrations against a copy of production data before deploying.
|
|
38
|
+
|
|
39
|
+
For large tables, avoid `ALTER TABLE ... ADD COLUMN ... DEFAULT` on PostgreSQL versions before 11 -- it rewrites the entire table. Add the column as nullable first, backfill data, then add the constraint.
|
|
40
|
+
|
|
41
|
+
## Transactions
|
|
42
|
+
|
|
43
|
+
Keep transactions short. Long-running transactions hold locks and block other operations. Never leave a transaction open while waiting for user input or external API calls.
|
|
44
|
+
|
|
45
|
+
Use `SERIALIZABLE` isolation only when you need it -- `READ COMMITTED` (the default) is sufficient for most workloads and has better concurrency.
|
|
46
|
+
|
|
47
|
+
## Connection Management
|
|
48
|
+
|
|
49
|
+
Use a connection pool (PgBouncer, or your driver's built-in pool). PostgreSQL creates a process per connection -- too many connections waste memory and degrade performance. Set pool size based on `max_connections` and your application's concurrency needs.
|
|
50
|
+
|
|
51
|
+
## Backups
|
|
52
|
+
|
|
53
|
+
Use `pg_dump` for logical backups and `pg_basebackup` for physical backups. Test restoring from backups regularly. An untested backup is not a backup.
|