opencode-skills-antigravity 1.0.13 → 1.0.14
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/bundled-skills/app-store-changelog/SKILL.md +75 -0
- package/bundled-skills/app-store-changelog/agents/openai.yaml +4 -0
- package/bundled-skills/app-store-changelog/references/release-notes-guidelines.md +34 -0
- package/bundled-skills/app-store-changelog/scripts/collect_release_changes.sh +33 -0
- package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
- package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
- package/bundled-skills/docs/maintainers/repo-growth-seo.md +3 -3
- package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
- package/bundled-skills/docs/sources/sources.md +10 -0
- package/bundled-skills/docs/users/bundles.md +9 -1
- package/bundled-skills/docs/users/claude-code-skills.md +1 -1
- package/bundled-skills/docs/users/faq.md +36 -0
- package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
- package/bundled-skills/docs/users/getting-started.md +1 -1
- package/bundled-skills/docs/users/kiro-integration.md +1 -1
- package/bundled-skills/docs/users/usage.md +14 -4
- package/bundled-skills/docs/users/visual-guide.md +4 -4
- package/bundled-skills/github/SKILL.md +76 -0
- package/bundled-skills/github/agents/openai.yaml +4 -0
- package/bundled-skills/ios-debugger-agent/SKILL.md +59 -0
- package/bundled-skills/ios-debugger-agent/agents/openai.yaml +4 -0
- package/bundled-skills/macos-menubar-tuist-app/SKILL.md +109 -0
- package/bundled-skills/macos-menubar-tuist-app/agents/openai.yaml +4 -0
- package/bundled-skills/macos-spm-app-packaging/SKILL.md +105 -0
- package/bundled-skills/macos-spm-app-packaging/agents/openai.yaml +4 -0
- package/bundled-skills/macos-spm-app-packaging/assets/templates/bootstrap/Package.swift +17 -0
- package/bundled-skills/macos-spm-app-packaging/assets/templates/bootstrap/Sources/MyApp/Resources/.keep +0 -0
- package/bundled-skills/macos-spm-app-packaging/assets/templates/bootstrap/Sources/MyApp/main.swift +11 -0
- package/bundled-skills/macos-spm-app-packaging/assets/templates/bootstrap/version.env +2 -0
- package/bundled-skills/macos-spm-app-packaging/assets/templates/build_icon.sh +49 -0
- package/bundled-skills/macos-spm-app-packaging/assets/templates/compile_and_run.sh +63 -0
- package/bundled-skills/macos-spm-app-packaging/assets/templates/launch.sh +28 -0
- package/bundled-skills/macos-spm-app-packaging/assets/templates/make_appcast.sh +82 -0
- package/bundled-skills/macos-spm-app-packaging/assets/templates/package_app.sh +206 -0
- package/bundled-skills/macos-spm-app-packaging/assets/templates/setup_dev_signing.sh +52 -0
- package/bundled-skills/macos-spm-app-packaging/assets/templates/sign-and-notarize.sh +52 -0
- package/bundled-skills/macos-spm-app-packaging/assets/templates/version.env +2 -0
- package/bundled-skills/macos-spm-app-packaging/references/packaging.md +17 -0
- package/bundled-skills/macos-spm-app-packaging/references/release.md +32 -0
- package/bundled-skills/macos-spm-app-packaging/references/scaffold.md +79 -0
- package/bundled-skills/orchestrate-batch-refactor/SKILL.md +97 -0
- package/bundled-skills/orchestrate-batch-refactor/agents/openai.yaml +4 -0
- package/bundled-skills/orchestrate-batch-refactor/references/agent-prompt-templates.md +53 -0
- package/bundled-skills/orchestrate-batch-refactor/references/work-packet-template.md +31 -0
- package/bundled-skills/project-skill-audit/SKILL.md +190 -0
- package/bundled-skills/project-skill-audit/agents/openai.yaml +4 -0
- package/bundled-skills/react-component-performance/SKILL.md +135 -0
- package/bundled-skills/react-component-performance/agents/openai.yaml +4 -0
- package/bundled-skills/react-component-performance/references/examples.md +88 -0
- package/bundled-skills/simplify-code/SKILL.md +179 -0
- package/bundled-skills/snowflake-development/SKILL.md +5 -0
- package/bundled-skills/swift-concurrency-expert/SKILL.md +113 -0
- package/bundled-skills/swift-concurrency-expert/agents/openai.yaml +4 -0
- package/bundled-skills/swift-concurrency-expert/references/approachable-concurrency.md +63 -0
- package/bundled-skills/swift-concurrency-expert/references/swift-6-2-concurrency.md +272 -0
- package/bundled-skills/swift-concurrency-expert/references/swiftui-concurrency-tour-wwdc.md +33 -0
- package/bundled-skills/swiftui-liquid-glass/SKILL.md +98 -0
- package/bundled-skills/swiftui-liquid-glass/agents/openai.yaml +4 -0
- package/bundled-skills/swiftui-liquid-glass/references/liquid-glass.md +280 -0
- package/bundled-skills/swiftui-performance-audit/SKILL.md +114 -0
- package/bundled-skills/swiftui-performance-audit/agents/openai.yaml +4 -0
- package/bundled-skills/swiftui-performance-audit/references/code-smells.md +150 -0
- package/bundled-skills/swiftui-performance-audit/references/demystify-swiftui-performance-wwdc23.md +46 -0
- package/bundled-skills/swiftui-performance-audit/references/optimizing-swiftui-performance-instruments.md +29 -0
- package/bundled-skills/swiftui-performance-audit/references/profiling-intake.md +44 -0
- package/bundled-skills/swiftui-performance-audit/references/report-template.md +47 -0
- package/bundled-skills/swiftui-performance-audit/references/understanding-hangs-in-your-app.md +33 -0
- package/bundled-skills/swiftui-performance-audit/references/understanding-improving-swiftui-performance.md +52 -0
- package/bundled-skills/swiftui-ui-patterns/SKILL.md +103 -0
- package/bundled-skills/swiftui-ui-patterns/agents/openai.yaml +4 -0
- package/bundled-skills/swiftui-ui-patterns/references/app-wiring.md +201 -0
- package/bundled-skills/swiftui-ui-patterns/references/async-state.md +96 -0
- package/bundled-skills/swiftui-ui-patterns/references/components-index.md +50 -0
- package/bundled-skills/swiftui-ui-patterns/references/controls.md +57 -0
- package/bundled-skills/swiftui-ui-patterns/references/deeplinks.md +66 -0
- package/bundled-skills/swiftui-ui-patterns/references/focus.md +90 -0
- package/bundled-skills/swiftui-ui-patterns/references/form.md +97 -0
- package/bundled-skills/swiftui-ui-patterns/references/grids.md +71 -0
- package/bundled-skills/swiftui-ui-patterns/references/haptics.md +71 -0
- package/bundled-skills/swiftui-ui-patterns/references/input-toolbar.md +51 -0
- package/bundled-skills/swiftui-ui-patterns/references/lightweight-clients.md +93 -0
- package/bundled-skills/swiftui-ui-patterns/references/list.md +86 -0
- package/bundled-skills/swiftui-ui-patterns/references/loading-placeholders.md +38 -0
- package/bundled-skills/swiftui-ui-patterns/references/macos-settings.md +71 -0
- package/bundled-skills/swiftui-ui-patterns/references/matched-transitions.md +59 -0
- package/bundled-skills/swiftui-ui-patterns/references/media.md +73 -0
- package/bundled-skills/swiftui-ui-patterns/references/menu-bar.md +101 -0
- package/bundled-skills/swiftui-ui-patterns/references/navigationstack.md +159 -0
- package/bundled-skills/swiftui-ui-patterns/references/overlay.md +45 -0
- package/bundled-skills/swiftui-ui-patterns/references/performance.md +62 -0
- package/bundled-skills/swiftui-ui-patterns/references/previews.md +48 -0
- package/bundled-skills/swiftui-ui-patterns/references/scroll-reveal.md +133 -0
- package/bundled-skills/swiftui-ui-patterns/references/scrollview.md +87 -0
- package/bundled-skills/swiftui-ui-patterns/references/searchable.md +71 -0
- package/bundled-skills/swiftui-ui-patterns/references/sheets.md +155 -0
- package/bundled-skills/swiftui-ui-patterns/references/split-views.md +72 -0
- package/bundled-skills/swiftui-ui-patterns/references/tabview.md +114 -0
- package/bundled-skills/swiftui-ui-patterns/references/theming.md +71 -0
- package/bundled-skills/swiftui-ui-patterns/references/title-menus.md +93 -0
- package/bundled-skills/swiftui-ui-patterns/references/top-bar.md +49 -0
- package/bundled-skills/swiftui-view-refactor/SKILL.md +210 -0
- package/bundled-skills/swiftui-view-refactor/agents/openai.yaml +4 -0
- package/bundled-skills/swiftui-view-refactor/references/mv-patterns.md +161 -0
- package/package.json +1 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: project-skill-audit
|
|
3
|
+
description: Audit a project and recommend the highest-value skills to add or update.
|
|
4
|
+
risk: safe
|
|
5
|
+
source: "Dimillian/Skills (MIT)"
|
|
6
|
+
date_added: "2026-03-25"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Project Skill Audit
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Audit the project's real recurring workflows before recommending skills. Prefer evidence from memory, rollout summaries, existing skill folders, and current repo conventions over generic brainstorming.
|
|
14
|
+
|
|
15
|
+
Recommend updates before new skills when an existing project skill is already close to the needed behavior.
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
- When the user asks what skills a project needs or which existing skills should be updated.
|
|
20
|
+
- When recommendations should be grounded in project history, memory files, and local conventions.
|
|
21
|
+
|
|
22
|
+
## Workflow
|
|
23
|
+
|
|
24
|
+
1. Map the current project surface.
|
|
25
|
+
Identify the repo root and read the most relevant project guidance first, such as `AGENTS.md`, `README.md`, roadmap/ledger files, and local docs that define workflows or validation expectations.
|
|
26
|
+
|
|
27
|
+
2. Build the memory/session path first.
|
|
28
|
+
Resolve the memory base as `$CODEX_HOME` when set, otherwise default to `~/.codex`.
|
|
29
|
+
Use these locations:
|
|
30
|
+
- memory index: `$CODEX_HOME/memories/MEMORY.md` or `~/.codex/memories/MEMORY.md`
|
|
31
|
+
- rollout summaries: `$CODEX_HOME/memories/rollout_summaries/`
|
|
32
|
+
- raw sessions: `$CODEX_HOME/sessions/` or `~/.codex/sessions/`
|
|
33
|
+
|
|
34
|
+
3. Read project past sessions in this order.
|
|
35
|
+
If the runtime prompt already includes a memory summary, start there.
|
|
36
|
+
Then search `MEMORY.md` for:
|
|
37
|
+
- repo name
|
|
38
|
+
- repo basename
|
|
39
|
+
- current `cwd`
|
|
40
|
+
- important module or file names
|
|
41
|
+
Open only the 1-3 most relevant rollout summaries first.
|
|
42
|
+
Fall back to raw session JSONL only when the summaries are missing the exact evidence you need.
|
|
43
|
+
|
|
44
|
+
4. Scan existing project-local skills before suggesting anything new.
|
|
45
|
+
Check these locations relative to the current repo root:
|
|
46
|
+
- `.agents/skills`
|
|
47
|
+
- `.codex/skills`
|
|
48
|
+
- `skills`
|
|
49
|
+
Read both `SKILL.md` and `agents/openai.yaml` when present.
|
|
50
|
+
|
|
51
|
+
5. Compare project-local skills against recurring work.
|
|
52
|
+
Look for repeated patterns in past sessions:
|
|
53
|
+
- repeated validation sequences
|
|
54
|
+
- repeated failure shields
|
|
55
|
+
- recurring ownership boundaries
|
|
56
|
+
- repeated root-cause categories
|
|
57
|
+
- workflows that repeatedly require the same repo-specific context
|
|
58
|
+
If the pattern appears repeatedly and is not already well captured, it is a candidate skill.
|
|
59
|
+
|
|
60
|
+
6. Separate `new skill` from `update existing skill`.
|
|
61
|
+
Recommend an update when an existing skill is already the right bucket but has stale triggers, missing guardrails, outdated paths, weak validation instructions, or incomplete scope.
|
|
62
|
+
Recommend a new skill only when the workflow is distinct enough that stretching an existing skill would make it vague or confusing.
|
|
63
|
+
|
|
64
|
+
7. Check for overlap with global skills only after reviewing project-local skills.
|
|
65
|
+
Use `$CODEX_HOME/skills` and `$CODEX_HOME/skills/public` to avoid proposing project-local skills for workflows already solved well by a generic shared skill.
|
|
66
|
+
Do not reject a project-local skill just because a global skill exists; project-specific guardrails can still justify a local specialization.
|
|
67
|
+
|
|
68
|
+
## Session Analysis
|
|
69
|
+
|
|
70
|
+
### 1. Search memory index first
|
|
71
|
+
|
|
72
|
+
- Search `MEMORY.md` with `rg` using the repo name, basename, and `cwd`.
|
|
73
|
+
- Prefer entries that already cite rollout summaries with the same repo path.
|
|
74
|
+
- Capture:
|
|
75
|
+
- repeated workflows
|
|
76
|
+
- validation commands
|
|
77
|
+
- failure shields
|
|
78
|
+
- ownership boundaries
|
|
79
|
+
- milestone or roadmap coupling
|
|
80
|
+
|
|
81
|
+
### 2. Open targeted rollout summaries
|
|
82
|
+
|
|
83
|
+
- Open the most relevant summary files under `memories/rollout_summaries/`.
|
|
84
|
+
- Prefer summaries whose filenames, `cwd`, or `keywords` match the current project.
|
|
85
|
+
- Extract:
|
|
86
|
+
- what the user asked for repeatedly
|
|
87
|
+
- what steps kept recurring
|
|
88
|
+
- what broke repeatedly
|
|
89
|
+
- what commands proved correctness
|
|
90
|
+
- what project-specific context had to be rediscovered
|
|
91
|
+
|
|
92
|
+
### 3. Use raw sessions only as a fallback
|
|
93
|
+
|
|
94
|
+
- Only search `sessions/` JSONL files if rollout summaries are missing a concrete detail.
|
|
95
|
+
- Search by:
|
|
96
|
+
- exact `cwd`
|
|
97
|
+
- repo basename
|
|
98
|
+
- thread ID from a rollout summary
|
|
99
|
+
- specific file paths or commands
|
|
100
|
+
- Use raw sessions to recover exact prompts, command sequences, diffs, or failure text, not to replace the summary pass.
|
|
101
|
+
|
|
102
|
+
### 4. Turn session evidence into skill candidates
|
|
103
|
+
|
|
104
|
+
- A candidate `new skill` should correspond to a repeated workflow, not just a repeated topic.
|
|
105
|
+
- A candidate `skill update` should correspond to a workflow already covered by a local skill whose triggers, guardrails, or validation instructions no longer match the recorded sessions.
|
|
106
|
+
- Prefer concrete evidence such as:
|
|
107
|
+
- "this validation sequence appeared in 4 sessions"
|
|
108
|
+
- "this ownership confusion repeated across extractor and runtime fixes"
|
|
109
|
+
- "the same local script and telemetry probes had to be rediscovered repeatedly"
|
|
110
|
+
|
|
111
|
+
## Recommendation Rules
|
|
112
|
+
|
|
113
|
+
- Recommend a new skill when:
|
|
114
|
+
- the same repo-specific workflow or failure mode appears multiple times across sessions
|
|
115
|
+
- success depends on project-specific paths, scripts, ownership rules, or validation steps
|
|
116
|
+
- the workflow benefits from strong defaults or failure shields
|
|
117
|
+
|
|
118
|
+
- Recommend an update when:
|
|
119
|
+
- an existing project-local skill already covers most of the need
|
|
120
|
+
- `SKILL.md` and `agents/openai.yaml` drift from each other
|
|
121
|
+
- paths, scripts, validation commands, or milestone references are stale
|
|
122
|
+
- the skill body is too generic to reflect how the project is actually worked on
|
|
123
|
+
|
|
124
|
+
- Do not recommend a skill when:
|
|
125
|
+
- the pattern is a one-off bug rather than a reusable workflow
|
|
126
|
+
- a generic global skill already fits with no meaningful project-specific additions
|
|
127
|
+
- the workflow has not recurred enough to justify the maintenance cost
|
|
128
|
+
|
|
129
|
+
## What To Scan
|
|
130
|
+
|
|
131
|
+
- Past sessions and memory:
|
|
132
|
+
- memory summary already in context, if any
|
|
133
|
+
- `$CODEX_HOME/memories/MEMORY.md` or `~/.codex/memories/MEMORY.md`
|
|
134
|
+
- the 1-3 most relevant rollout summaries for the current repo
|
|
135
|
+
- raw `$CODEX_HOME/sessions` or `~/.codex/sessions` JSONL files only if summaries are insufficient
|
|
136
|
+
|
|
137
|
+
- Project-local skill surface:
|
|
138
|
+
- `./.agents/skills/*/SKILL.md`
|
|
139
|
+
- `./.agents/skills/*/agents/openai.yaml`
|
|
140
|
+
- `./.codex/skills/*/SKILL.md`
|
|
141
|
+
- `./skills/*/SKILL.md`
|
|
142
|
+
|
|
143
|
+
- Project conventions:
|
|
144
|
+
- `AGENTS.md`
|
|
145
|
+
- `README.md`
|
|
146
|
+
- roadmap, ledger, architecture, or validation docs
|
|
147
|
+
- current worktree or recent touched areas if needed for context
|
|
148
|
+
|
|
149
|
+
## Output Expectations
|
|
150
|
+
|
|
151
|
+
Return a compact audit with:
|
|
152
|
+
|
|
153
|
+
1. `Existing skills`
|
|
154
|
+
List the project-local skills found and the main workflow each one covers.
|
|
155
|
+
|
|
156
|
+
2. `Suggested updates`
|
|
157
|
+
For each update candidate, include:
|
|
158
|
+
- skill name
|
|
159
|
+
- why it is incomplete or stale
|
|
160
|
+
- the highest-value change to make
|
|
161
|
+
|
|
162
|
+
3. `Suggested new skills`
|
|
163
|
+
For each new skill, include:
|
|
164
|
+
- recommended skill name
|
|
165
|
+
- why it should exist
|
|
166
|
+
- what would trigger it
|
|
167
|
+
- the core workflow it should encode
|
|
168
|
+
|
|
169
|
+
4. `Priority order`
|
|
170
|
+
Rank the top recommendations by expected value.
|
|
171
|
+
|
|
172
|
+
## Naming Guidance
|
|
173
|
+
|
|
174
|
+
- Prefer short hyphen-case names.
|
|
175
|
+
- Use project prefixes for project-local skills when that improves clarity.
|
|
176
|
+
- Prefer verb-led or action-oriented names over vague nouns.
|
|
177
|
+
|
|
178
|
+
## Failure Shields
|
|
179
|
+
|
|
180
|
+
- Do not invent recurring patterns without session or repo evidence.
|
|
181
|
+
- Do not recommend duplicate skills when an update to an existing skill would suffice.
|
|
182
|
+
- Do not rely on a single memory note if the current repo clearly evolved since then.
|
|
183
|
+
- Do not bulk-load all rollout summaries; stay targeted.
|
|
184
|
+
- Do not skip rollout summaries and jump straight to raw sessions unless the summaries are insufficient.
|
|
185
|
+
- Do not recommend skills from themes alone; recommendations should come from repeated procedures, repeated validation flows, or repeated failure modes.
|
|
186
|
+
- Do not confuse a project's current implementation tasks with its reusable skill needs.
|
|
187
|
+
|
|
188
|
+
## Follow-up
|
|
189
|
+
|
|
190
|
+
If the user asks to actually create or update one of the recommended skills, switch to [$skill-creator](/Users/dimillian/.codex/skills/.system/skill-creator/SKILL.md) and implement the chosen skill rather than continuing the audit.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react-component-performance
|
|
3
|
+
description: Diagnose slow React components and suggest targeted performance fixes.
|
|
4
|
+
risk: safe
|
|
5
|
+
source: "Dimillian/Skills (MIT)"
|
|
6
|
+
date_added: "2026-03-25"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# React Component Performance
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Identify render hotspots, isolate expensive updates, and apply targeted optimizations without changing UI behavior.
|
|
14
|
+
|
|
15
|
+
## When to Use
|
|
16
|
+
|
|
17
|
+
- When the user asks to profile or improve a slow React component.
|
|
18
|
+
- When you need to reduce re-renders, list lag, or expensive render work in React UI.
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
1. Reproduce or describe the slowdown.
|
|
23
|
+
2. Identify what triggers re-renders (state updates, props churn, effects).
|
|
24
|
+
3. Isolate fast-changing state from heavy subtrees.
|
|
25
|
+
4. Stabilize props and handlers; memoize where it pays off.
|
|
26
|
+
5. Reduce expensive work (computation, DOM size, list length).
|
|
27
|
+
6. **Validate**: open React DevTools Profiler → record the interaction → inspect the Flamegraph for components rendering longer than ~16 ms → compare against a pre-optimization baseline recording.
|
|
28
|
+
|
|
29
|
+
## Checklist
|
|
30
|
+
|
|
31
|
+
- Measure: use React DevTools Profiler or log renders; capture baseline.
|
|
32
|
+
- Find churn: identify state updated on a timer, scroll, input, or animation.
|
|
33
|
+
- Split: move ticking state into a child; keep heavy lists static.
|
|
34
|
+
- Memoize: wrap leaf rows with `memo` only when props are stable.
|
|
35
|
+
- Stabilize props: use `useCallback`/`useMemo` for handlers and derived values.
|
|
36
|
+
- Avoid derived work in render: precompute, or compute inside memoized helpers.
|
|
37
|
+
- Control list size: window/virtualize long lists; avoid rendering hidden items.
|
|
38
|
+
- Keys: ensure stable keys; avoid index when order can change.
|
|
39
|
+
- Effects: verify dependency arrays; avoid effects that re-run on every render.
|
|
40
|
+
- Style/layout: watch for expensive layout thrash or large Markdown/diff renders.
|
|
41
|
+
|
|
42
|
+
## Optimization Patterns
|
|
43
|
+
|
|
44
|
+
### Isolate ticking state
|
|
45
|
+
|
|
46
|
+
Move a timer or animation counter into a child so the parent list never re-renders on each tick.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
// ❌ Before – entire parent (and list) re-renders every second
|
|
50
|
+
function Dashboard({ items }: { items: Item[] }) {
|
|
51
|
+
const [tick, setTick] = useState(0);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const id = setInterval(() => setTick(t => t + 1), 1000);
|
|
54
|
+
return () => clearInterval(id);
|
|
55
|
+
}, []);
|
|
56
|
+
return (
|
|
57
|
+
<>
|
|
58
|
+
<Clock tick={tick} />
|
|
59
|
+
<ExpensiveList items={items} /> {/* re-renders every second */}
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ✅ After – only <Clock> re-renders; list is untouched
|
|
65
|
+
function Clock() {
|
|
66
|
+
const [tick, setTick] = useState(0);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const id = setInterval(() => setTick(t => t + 1), 1000);
|
|
69
|
+
return () => clearInterval(id);
|
|
70
|
+
}, []);
|
|
71
|
+
return <span>{tick}s</span>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function Dashboard({ items }: { items: Item[] }) {
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
<Clock />
|
|
78
|
+
<ExpensiveList items={items} />
|
|
79
|
+
</>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Stabilize callbacks with `useCallback` + `memo`
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
// ❌ Before – new handler reference on every render busts Row memo
|
|
88
|
+
function List({ items }: { items: Item[] }) {
|
|
89
|
+
const handleClick = (id: string) => console.log(id); // new ref each render
|
|
90
|
+
return items.map(item => <Row key={item.id} item={item} onClick={handleClick} />);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ✅ After – stable handler; Row only re-renders when its own item changes
|
|
94
|
+
const Row = memo(({ item, onClick }: RowProps) => (
|
|
95
|
+
<li onClick={() => onClick(item.id)}>{item.name}</li>
|
|
96
|
+
));
|
|
97
|
+
|
|
98
|
+
function List({ items }: { items: Item[] }) {
|
|
99
|
+
const handleClick = useCallback((id: string) => console.log(id), []);
|
|
100
|
+
return items.map(item => <Row key={item.id} item={item} onClick={handleClick} />);
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Prefer derived data outside render
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
// ❌ Before – recomputes on every render
|
|
108
|
+
function Summary({ orders }: { orders: Order[] }) {
|
|
109
|
+
const total = orders.reduce((sum, o) => sum + o.amount, 0); // runs every render
|
|
110
|
+
return <p>Total: {total}</p>;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ✅ After – recomputes only when orders changes
|
|
114
|
+
function Summary({ orders }: { orders: Order[] }) {
|
|
115
|
+
const total = useMemo(() => orders.reduce((sum, o) => sum + o.amount, 0), [orders]);
|
|
116
|
+
return <p>Total: {total}</p>;
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Additional patterns
|
|
121
|
+
|
|
122
|
+
- **Split rows**: extract list rows into memoized components with narrow props.
|
|
123
|
+
- **Defer heavy rendering**: lazy-render or collapse expensive content until expanded.
|
|
124
|
+
|
|
125
|
+
## Profiling Validation Steps
|
|
126
|
+
|
|
127
|
+
1. Open **React DevTools → Profiler** tab.
|
|
128
|
+
2. Click **Record**, perform the slow interaction, then **Stop**.
|
|
129
|
+
3. Switch to **Flamegraph** view; any bar labeled with a component and time > ~16 ms is a candidate.
|
|
130
|
+
4. Use **Ranked chart** to sort by self render time and target the top offenders.
|
|
131
|
+
5. Apply one optimization at a time, re-record, and compare render counts and durations against the baseline.
|
|
132
|
+
|
|
133
|
+
## Example Reference
|
|
134
|
+
|
|
135
|
+
Load `references/examples.md` when the user wants a concrete refactor example.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
## Isolate a ticking timer from a long list
|
|
4
|
+
|
|
5
|
+
**Scenario:** A message list re-renders every second because a timer (`elapsedMs`) lives in the parent component. This causes visible jank on large lists.
|
|
6
|
+
|
|
7
|
+
**Goal:** Keep UI identical but limit re-renders to the timer area.
|
|
8
|
+
|
|
9
|
+
**Before (problematic pattern):**
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
function Messages({ items, isThinking, processingStartedAt }) {
|
|
13
|
+
const [elapsedMs, setElapsedMs] = useState(0);
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!isThinking || !processingStartedAt) {
|
|
17
|
+
setElapsedMs(0);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
setElapsedMs(Date.now() - processingStartedAt);
|
|
21
|
+
const interval = window.setInterval(() => {
|
|
22
|
+
setElapsedMs(Date.now() - processingStartedAt);
|
|
23
|
+
}, 1000);
|
|
24
|
+
return () => window.clearInterval(interval);
|
|
25
|
+
}, [isThinking, processingStartedAt]);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div>
|
|
29
|
+
{items.map((item) => (
|
|
30
|
+
<MessageRow key={item.id} item={item} />
|
|
31
|
+
))}
|
|
32
|
+
<div>{formatDurationMs(elapsedMs)}</div>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**After (isolated ticking state):**
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
type WorkingIndicatorProps = {
|
|
42
|
+
isThinking: boolean;
|
|
43
|
+
processingStartedAt?: number | null;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const WorkingIndicator = memo(function WorkingIndicator({
|
|
47
|
+
isThinking,
|
|
48
|
+
processingStartedAt = null,
|
|
49
|
+
}: WorkingIndicatorProps) {
|
|
50
|
+
const [elapsedMs, setElapsedMs] = useState(0);
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (!isThinking || !processingStartedAt) {
|
|
54
|
+
setElapsedMs(0);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
setElapsedMs(Date.now() - processingStartedAt);
|
|
58
|
+
const interval = window.setInterval(() => {
|
|
59
|
+
setElapsedMs(Date.now() - processingStartedAt);
|
|
60
|
+
}, 1000);
|
|
61
|
+
return () => window.clearInterval(interval);
|
|
62
|
+
}, [isThinking, processingStartedAt]);
|
|
63
|
+
|
|
64
|
+
return <div>{formatDurationMs(elapsedMs)}</div>;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
function Messages({ items, isThinking, processingStartedAt }) {
|
|
68
|
+
return (
|
|
69
|
+
<div>
|
|
70
|
+
{items.map((item) => (
|
|
71
|
+
<MessageRow key={item.id} item={item} />
|
|
72
|
+
))}
|
|
73
|
+
<WorkingIndicator
|
|
74
|
+
isThinking={isThinking}
|
|
75
|
+
processingStartedAt={processingStartedAt}
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Why it helps:** Only the `WorkingIndicator` subtree re-renders every second. The list remains stable unless its props change.
|
|
83
|
+
|
|
84
|
+
**Optional follow-ups:**
|
|
85
|
+
|
|
86
|
+
- Wrap `MessageRow` in `memo` if props are stable.
|
|
87
|
+
- Use `useCallback` for handlers passed to rows to avoid re-render churn.
|
|
88
|
+
- Consider list virtualization if the list is very large.
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: simplify-code
|
|
3
|
+
description: "Review a diff for clarity and safe simplifications, then optionally apply low-risk fixes."
|
|
4
|
+
risk: safe
|
|
5
|
+
source: "Dimillian/Skills (MIT)"
|
|
6
|
+
date_added: "2026-03-25"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Simplify Code
|
|
10
|
+
|
|
11
|
+
Review changed code for reuse, quality, efficiency, and clarity issues. Use Codex sub-agents to review in parallel, then optionally apply only high-confidence, behavior-preserving fixes.
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
- When the user asks to simplify, clean up, refactor, or review changed code.
|
|
16
|
+
- When you want high-confidence, behavior-preserving improvements on a scoped diff.
|
|
17
|
+
|
|
18
|
+
## Modes
|
|
19
|
+
|
|
20
|
+
Choose the mode from the user's request:
|
|
21
|
+
|
|
22
|
+
- `review-only`: user asks to review, audit, or check the changes
|
|
23
|
+
- `safe-fixes`: user asks to simplify, clean up, or refactor the changes
|
|
24
|
+
- `fix-and-validate`: same as `safe-fixes`, but also run the smallest relevant validation after edits
|
|
25
|
+
|
|
26
|
+
If the user does not specify, default to:
|
|
27
|
+
|
|
28
|
+
- `review-only` for "review", "audit", or "check"
|
|
29
|
+
- `safe-fixes` for "simplify", "clean up", or "refactor"
|
|
30
|
+
|
|
31
|
+
## Step 1: Determine the Scope and Diff Command
|
|
32
|
+
|
|
33
|
+
Prefer this scope order:
|
|
34
|
+
|
|
35
|
+
1. Files or paths explicitly named by the user
|
|
36
|
+
2. Current git changes
|
|
37
|
+
3. Files edited earlier in the current Codex turn
|
|
38
|
+
4. Most recently modified tracked files, only if the user asked for a review but there is no diff
|
|
39
|
+
|
|
40
|
+
If there is no clear scope, stop and say so briefly.
|
|
41
|
+
|
|
42
|
+
When using git changes, determine the smallest correct diff command based on the repo state:
|
|
43
|
+
|
|
44
|
+
- unstaged work: `git diff`
|
|
45
|
+
- staged work: `git diff --cached`
|
|
46
|
+
- branch or commit comparison explicitly requested by the user: use that exact diff target
|
|
47
|
+
- mixed staged and unstaged work: review both
|
|
48
|
+
|
|
49
|
+
Do not assume `git diff HEAD` is the right default when a smaller diff is available.
|
|
50
|
+
|
|
51
|
+
Before reviewing standards or applying fixes, read the repo's local instruction files and relevant project docs for the touched area. Prefer the closest applicable guidance, such as:
|
|
52
|
+
|
|
53
|
+
- `AGENTS.md`
|
|
54
|
+
- repo workflow docs
|
|
55
|
+
- architecture or style docs for the touched module
|
|
56
|
+
|
|
57
|
+
Use those instructions to distinguish real issues from intentional local patterns.
|
|
58
|
+
|
|
59
|
+
## Step 2: Launch Four Review Sub-Agents in Parallel
|
|
60
|
+
|
|
61
|
+
Use Codex sub-agents when the scope is large enough for parallel review to help. For a tiny diff or one very small file, it is acceptable to review locally instead.
|
|
62
|
+
|
|
63
|
+
When spawning sub-agents:
|
|
64
|
+
|
|
65
|
+
- give each sub-agent the same scope
|
|
66
|
+
- tell each sub-agent to inspect only its assigned review role
|
|
67
|
+
- ask for concise, structured findings only
|
|
68
|
+
- ask each sub-agent to report file, line or symbol, problem, recommended fix, and confidence
|
|
69
|
+
|
|
70
|
+
Use four review roles.
|
|
71
|
+
|
|
72
|
+
### Sub-Agent 1: Code Reuse Review
|
|
73
|
+
|
|
74
|
+
Review the changes for reuse opportunities:
|
|
75
|
+
|
|
76
|
+
1. Search for existing helpers, utilities, or shared abstractions that already solve the same problem.
|
|
77
|
+
2. Flag duplicated functions or near-duplicate logic introduced in the change.
|
|
78
|
+
3. Flag inline logic that should call an existing helper instead of re-implementing it.
|
|
79
|
+
|
|
80
|
+
Recommended sub-agent role: `explorer` for broad codebase lookup, or `reviewer` if a stronger review pass is more useful than wide search.
|
|
81
|
+
|
|
82
|
+
### Sub-Agent 2: Code Quality Review
|
|
83
|
+
|
|
84
|
+
Review the same changes for code quality issues:
|
|
85
|
+
|
|
86
|
+
1. Redundant state, cached values, or derived values stored unnecessarily
|
|
87
|
+
2. Parameter sprawl caused by threading new arguments through existing call chains
|
|
88
|
+
3. Copy-paste with slight variation that should become a shared abstraction
|
|
89
|
+
4. Leaky abstractions or ownership violations across module boundaries
|
|
90
|
+
5. Stringly-typed values where existing typed contracts, enums, or constants already exist
|
|
91
|
+
|
|
92
|
+
Recommended sub-agent role: `reviewer`
|
|
93
|
+
|
|
94
|
+
### Sub-Agent 3: Efficiency Review
|
|
95
|
+
|
|
96
|
+
Review the same changes for efficiency issues:
|
|
97
|
+
|
|
98
|
+
1. Repeated work, duplicate reads, duplicate API calls, or unnecessary recomputation
|
|
99
|
+
2. Sequential work that could safely run concurrently
|
|
100
|
+
3. New work added to startup, render, request, or other hot paths without clear need
|
|
101
|
+
4. Pre-checks for existence when the operation itself can be attempted directly and errors handled
|
|
102
|
+
5. Memory growth, missing cleanup, or listener/subscription leaks
|
|
103
|
+
6. Overly broad reads or scans when the code only needs a subset
|
|
104
|
+
|
|
105
|
+
Recommended sub-agent role: `reviewer`
|
|
106
|
+
|
|
107
|
+
### Sub-Agent 4: Clarity and Standards Review
|
|
108
|
+
|
|
109
|
+
Review the same changes for clarity, local standards, and balance:
|
|
110
|
+
|
|
111
|
+
1. Violations of local project conventions or module patterns
|
|
112
|
+
2. Unnecessary complexity, deep nesting, weak names, or redundant comments
|
|
113
|
+
3. Overly compact or clever code that reduces readability
|
|
114
|
+
4. Over-simplification that collapses separate concerns into one unclear unit
|
|
115
|
+
5. Dead code, dead abstractions, or indirection without value
|
|
116
|
+
|
|
117
|
+
Recommended sub-agent role: `reviewer`
|
|
118
|
+
|
|
119
|
+
Only report issues that materially improve maintainability, correctness, or cost. Do not churn code just to make it look different.
|
|
120
|
+
|
|
121
|
+
## Step 3: Aggregate Findings
|
|
122
|
+
|
|
123
|
+
Wait for all review sub-agents to complete, then merge their findings.
|
|
124
|
+
|
|
125
|
+
Normalize findings into this shape:
|
|
126
|
+
|
|
127
|
+
1. File and line or nearest symbol
|
|
128
|
+
2. Category: reuse, quality, efficiency, or clarity
|
|
129
|
+
3. Why it is a problem
|
|
130
|
+
4. Recommended fix
|
|
131
|
+
5. Confidence: high, medium, or low
|
|
132
|
+
|
|
133
|
+
Discard weak, duplicative, or instruction-conflicting findings before editing.
|
|
134
|
+
|
|
135
|
+
## Step 4: Fix Issues Carefully
|
|
136
|
+
|
|
137
|
+
In `review-only` mode, stop after reporting findings.
|
|
138
|
+
|
|
139
|
+
In `safe-fixes` or `fix-and-validate` mode:
|
|
140
|
+
|
|
141
|
+
- Apply only high-confidence, behavior-preserving fixes
|
|
142
|
+
- Skip subjective refactors that need product or architectural judgment
|
|
143
|
+
- Preserve local patterns when they are intentional or instruction-backed
|
|
144
|
+
- Keep edits scoped to the reviewed files unless a small adjacent change is required to complete the fix correctly
|
|
145
|
+
|
|
146
|
+
Prefer fixes like:
|
|
147
|
+
|
|
148
|
+
- replacing duplicated code with an existing helper
|
|
149
|
+
- removing redundant state or dead code
|
|
150
|
+
- simplifying control flow without changing behavior
|
|
151
|
+
- narrowing overly broad operations
|
|
152
|
+
- renaming unclear locals when the scope is contained
|
|
153
|
+
|
|
154
|
+
Do not stage, commit, or push changes as part of this skill.
|
|
155
|
+
|
|
156
|
+
## Step 5: Validate When Required
|
|
157
|
+
|
|
158
|
+
In `fix-and-validate` mode, run the smallest relevant validation for the touched scope after edits.
|
|
159
|
+
|
|
160
|
+
Examples:
|
|
161
|
+
|
|
162
|
+
- targeted tests for the touched module
|
|
163
|
+
- typecheck or compile for the touched target
|
|
164
|
+
- formatter or lint check if that is the project's real safety gate
|
|
165
|
+
|
|
166
|
+
Prefer fast, scoped validation over full-suite runs unless the change breadth justifies more.
|
|
167
|
+
|
|
168
|
+
If validation is skipped because the user asked not to run it, say so explicitly.
|
|
169
|
+
|
|
170
|
+
## Step 6: Summarize Outcome
|
|
171
|
+
|
|
172
|
+
Close with a brief result:
|
|
173
|
+
|
|
174
|
+
- what was reviewed
|
|
175
|
+
- what was fixed, if anything
|
|
176
|
+
- what was intentionally left alone
|
|
177
|
+
- whether validation ran
|
|
178
|
+
|
|
179
|
+
If the code is already clean for this rubric, say that directly instead of manufacturing edits.
|
|
@@ -11,6 +11,11 @@ date_added: "2026-03-24"
|
|
|
11
11
|
|
|
12
12
|
You are a Snowflake development expert. Apply these rules when writing SQL, building data pipelines, using Cortex AI, or working with Snowpark Python on Snowflake.
|
|
13
13
|
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
- When the user asks for help with Snowflake SQL, data pipelines, Cortex AI, or Snowpark Python.
|
|
17
|
+
- When you need Snowflake-specific guidance for dbt, performance tuning, or security hardening.
|
|
18
|
+
|
|
14
19
|
## SQL Best Practices
|
|
15
20
|
|
|
16
21
|
### Naming and Style
|