Skip to content

Commit 3c8668c

Browse files
committed
remove "links", just put filenames directly
1 parent 92d7bde commit 3c8668c

1 file changed

Lines changed: 54 additions & 61 deletions

File tree

.kilocode/skills/waveenv/SKILL.md

Lines changed: 54 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -23,82 +23,75 @@ Create a narrowing whenever you are writing a component (or group of components)
2323

2424
## File Location
2525

26-
- **Separate file** (preferred for shared/complex envs): name it `<feature>env.ts` next to the component, e.g. [`frontend/app/block/blockenv.ts`](frontend/app/block/blockenv.ts).
27-
- **Inline** (acceptable for small, single-file components): export the type directly from the component file, e.g. `WidgetsEnv` in [`frontend/app/workspace/widgets.tsx`](frontend/app/workspace/widgets.tsx:23).
26+
- **Separate file** (preferred for shared/complex envs): name it `<feature>env.ts` next to the component, e.g. `frontend/app/block/blockenv.ts`.
27+
- **Inline** (acceptable for small, single-file components): export the type directly from the component file, e.g. `WidgetsEnv` in `frontend/app/workspace/widgets.tsx`.
2828

2929
## Imports Required
3030

3131
```ts
3232
import {
33-
BlockMetaKeyAtomFnType, // only if you use getBlockMetaKeyAtom
34-
ConnConfigKeyAtomFnType, // only if you use getConnConfigKeyAtom
35-
SettingsKeyAtomFnType, // only if you use getSettingsKeyAtom
36-
WaveEnv,
37-
WaveEnvSubset,
33+
BlockMetaKeyAtomFnType, // only if you use getBlockMetaKeyAtom
34+
ConnConfigKeyAtomFnType, // only if you use getConnConfigKeyAtom
35+
SettingsKeyAtomFnType, // only if you use getSettingsKeyAtom
36+
WaveEnv,
37+
WaveEnvSubset,
3838
} from "@/app/waveenv/waveenv";
3939
```
4040

4141
## The Shape
4242

4343
```ts
4444
export type MyEnv = WaveEnvSubset<{
45-
// --- Simple WaveEnv properties ---
46-
// Copy the type verbatim from WaveEnv with WaveEnv["key"] syntax.
47-
isDev: WaveEnv["isDev"];
48-
createBlock: WaveEnv["createBlock"];
49-
showContextMenu: WaveEnv["showContextMenu"];
50-
platform: WaveEnv["platform"];
51-
52-
// --- electron: list only the methods you call ---
53-
electron: {
54-
openExternal: WaveEnv["electron"]["openExternal"];
55-
};
56-
57-
// --- rpc: list only the commands you call ---
58-
rpc: {
59-
ActivityCommand: WaveEnv["rpc"]["ActivityCommand"];
60-
ConnEnsureCommand: WaveEnv["rpc"]["ConnEnsureCommand"];
61-
};
62-
63-
// --- atoms: list only the atoms you read ---
64-
atoms: {
65-
modalOpen: WaveEnv["atoms"]["modalOpen"];
66-
fullConfigAtom: WaveEnv["atoms"]["fullConfigAtom"];
67-
};
68-
69-
// --- wos: always take the whole thing, no sub-typing needed ---
70-
wos: WaveEnv["wos"];
71-
72-
// --- key-parameterized atom factories: enumerate the keys you use ---
73-
getSettingsKeyAtom: SettingsKeyAtomFnType<
74-
| "app:focusfollowscursor"
75-
| "window:magnifiedblockopacity"
76-
>;
77-
getBlockMetaKeyAtom: BlockMetaKeyAtomFnType<
78-
| "view"
79-
| "frame:title"
80-
| "connection"
81-
>;
82-
getConnConfigKeyAtom: ConnConfigKeyAtomFnType<"conn:wshenabled">;
83-
84-
// --- other atom helpers: copy verbatim ---
85-
getConnStatusAtom: WaveEnv["getConnStatusAtom"];
86-
getLocalHostDisplayNameAtom: WaveEnv["getLocalHostDisplayNameAtom"];
45+
// --- Simple WaveEnv properties ---
46+
// Copy the type verbatim from WaveEnv with WaveEnv["key"] syntax.
47+
isDev: WaveEnv["isDev"];
48+
createBlock: WaveEnv["createBlock"];
49+
showContextMenu: WaveEnv["showContextMenu"];
50+
platform: WaveEnv["platform"];
51+
52+
// --- electron: list only the methods you call ---
53+
electron: {
54+
openExternal: WaveEnv["electron"]["openExternal"];
55+
};
56+
57+
// --- rpc: list only the commands you call ---
58+
rpc: {
59+
ActivityCommand: WaveEnv["rpc"]["ActivityCommand"];
60+
ConnEnsureCommand: WaveEnv["rpc"]["ConnEnsureCommand"];
61+
};
62+
63+
// --- atoms: list only the atoms you read ---
64+
atoms: {
65+
modalOpen: WaveEnv["atoms"]["modalOpen"];
66+
fullConfigAtom: WaveEnv["atoms"]["fullConfigAtom"];
67+
};
68+
69+
// --- wos: always take the whole thing, no sub-typing needed ---
70+
wos: WaveEnv["wos"];
71+
72+
// --- key-parameterized atom factories: enumerate the keys you use ---
73+
getSettingsKeyAtom: SettingsKeyAtomFnType<"app:focusfollowscursor" | "window:magnifiedblockopacity">;
74+
getBlockMetaKeyAtom: BlockMetaKeyAtomFnType<"view" | "frame:title" | "connection">;
75+
getConnConfigKeyAtom: ConnConfigKeyAtomFnType<"conn:wshenabled">;
76+
77+
// --- other atom helpers: copy verbatim ---
78+
getConnStatusAtom: WaveEnv["getConnStatusAtom"];
79+
getLocalHostDisplayNameAtom: WaveEnv["getLocalHostDisplayNameAtom"];
8780
}>;
8881
```
8982

9083
### Rules for Each Section
9184

92-
| Section | Pattern | Notes |
93-
|---|---|---|
94-
| `electron` | `electron: { method: WaveEnv["electron"]["method"]; }` | List every method called; omit the rest. |
95-
| `rpc` | `rpc: { Cmd: WaveEnv["rpc"]["Cmd"]; }` | List every RPC command called; omit the rest. |
96-
| `atoms` | `atoms: { atom: WaveEnv["atoms"]["atom"]; }` | List every atom read; omit the rest. |
97-
| `wos` | `wos: WaveEnv["wos"]` | Take the whole `wos` object (no sub-typing needed), but **only add it if `wos` is actually used**. |
98-
| `getSettingsKeyAtom` | `SettingsKeyAtomFnType<"key1" \| "key2">` | Union all settings keys accessed. |
99-
| `getBlockMetaKeyAtom` | `BlockMetaKeyAtomFnType<"key1" \| "key2">` | Union all block meta keys accessed. |
100-
| `getConnConfigKeyAtom` | `ConnConfigKeyAtomFnType<"key1">` | Union all conn config keys accessed. |
101-
| All other `WaveEnv` fields | `WaveEnv["fieldName"]` | Copy type verbatim. |
85+
| Section | Pattern | Notes |
86+
| -------------------------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
87+
| `electron` | `electron: { method: WaveEnv["electron"]["method"]; }` | List every method called; omit the rest. |
88+
| `rpc` | `rpc: { Cmd: WaveEnv["rpc"]["Cmd"]; }` | List every RPC command called; omit the rest. |
89+
| `atoms` | `atoms: { atom: WaveEnv["atoms"]["atom"]; }` | List every atom read; omit the rest. |
90+
| `wos` | `wos: WaveEnv["wos"]` | Take the whole `wos` object (no sub-typing needed), but **only add it if `wos` is actually used**. |
91+
| `getSettingsKeyAtom` | `SettingsKeyAtomFnType<"key1" \| "key2">` | Union all settings keys accessed. |
92+
| `getBlockMetaKeyAtom` | `BlockMetaKeyAtomFnType<"key1" \| "key2">` | Union all block meta keys accessed. |
93+
| `getConnConfigKeyAtom` | `ConnConfigKeyAtomFnType<"key1">` | Union all conn config keys accessed. |
94+
| All other `WaveEnv` fields | `WaveEnv["fieldName"]` | Copy type verbatim. |
10295

10396
## Using the Narrowed Type in Components
10497

@@ -118,5 +111,5 @@ The generic parameter on `useWaveEnv<MyEnv>()` casts the context to your narrowe
118111

119112
## Real Examples
120113

121-
- [`BlockEnv`](frontend/app/block/blockenv.ts:12) — complex narrowing with all section types, in a separate file.
122-
- [`WidgetsEnv`](frontend/app/workspace/widgets.tsx:23) — smaller narrowing defined inline in the component file.
114+
- `BlockEnv` in `frontend/app/block/blockenv.ts` — complex narrowing with all section types, in a separate file.
115+
- `WidgetsEnv` in `frontend/app/workspace/widgets.tsx` — smaller narrowing defined inline in the component file.

0 commit comments

Comments
 (0)