create-modern-react 2.3.4 → 2.3.6
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/bin/index.js +2 -1
- package/lib/install.js +12 -6
- package/lib/prompts.js +16 -2
- package/lib/setup.js +32 -2
- package/package.json +4 -2
- package/scripts/postinstall.js +18 -0
- package/templates/base/.claude/skills.tar.gz +0 -0
- package/templates/base/.claude/skills/agent-browser/SKILL.md +0 -356
- package/templates/base/.claude/skills/agent-browser/references/authentication.md +0 -188
- package/templates/base/.claude/skills/agent-browser/references/proxy-support.md +0 -175
- package/templates/base/.claude/skills/agent-browser/references/session-management.md +0 -181
- package/templates/base/.claude/skills/agent-browser/references/snapshot-refs.md +0 -186
- package/templates/base/.claude/skills/agent-browser/references/video-recording.md +0 -162
- package/templates/base/.claude/skills/agent-browser/templates/authenticated-session.sh +0 -91
- package/templates/base/.claude/skills/agent-browser/templates/capture-workflow.sh +0 -68
- package/templates/base/.claude/skills/agent-browser/templates/form-automation.sh +0 -64
- package/templates/base/.claude/skills/autoskill/skill.md +0 -134
- package/templates/base/.claude/skills/design-principles/skill.md +0 -237
- package/templates/base/.claude/skills/frontend-design/skill.md +0 -42
- package/templates/base/.claude/skills/learn-together/skill.md +0 -448
- package/templates/base/.claude/skills/question-me/skill.md +0 -175
- package/templates/base/.claude/skills/react-best-practices/AGENTS.md +0 -2410
- package/templates/base/.claude/skills/react-best-practices/README.md +0 -123
- package/templates/base/.claude/skills/react-best-practices/SKILL.md +0 -135
- package/templates/base/.claude/skills/react-best-practices/metadata.json +0 -15
- package/templates/base/.claude/skills/react-best-practices/rules/_sections.md +0 -46
- package/templates/base/.claude/skills/react-best-practices/rules/_template.md +0 -28
- package/templates/base/.claude/skills/react-best-practices/rules/advanced-event-handler-refs.md +0 -55
- package/templates/base/.claude/skills/react-best-practices/rules/advanced-use-latest.md +0 -49
- package/templates/base/.claude/skills/react-best-practices/rules/async-api-routes.md +0 -38
- package/templates/base/.claude/skills/react-best-practices/rules/async-defer-await.md +0 -80
- package/templates/base/.claude/skills/react-best-practices/rules/async-dependencies.md +0 -36
- package/templates/base/.claude/skills/react-best-practices/rules/async-parallel.md +0 -28
- package/templates/base/.claude/skills/react-best-practices/rules/async-suspense-boundaries.md +0 -99
- package/templates/base/.claude/skills/react-best-practices/rules/bundle-barrel-imports.md +0 -59
- package/templates/base/.claude/skills/react-best-practices/rules/bundle-conditional.md +0 -31
- package/templates/base/.claude/skills/react-best-practices/rules/bundle-defer-third-party.md +0 -49
- package/templates/base/.claude/skills/react-best-practices/rules/bundle-dynamic-imports.md +0 -35
- package/templates/base/.claude/skills/react-best-practices/rules/bundle-preload.md +0 -50
- package/templates/base/.claude/skills/react-best-practices/rules/client-event-listeners.md +0 -74
- package/templates/base/.claude/skills/react-best-practices/rules/client-localstorage-schema.md +0 -71
- package/templates/base/.claude/skills/react-best-practices/rules/client-passive-event-listeners.md +0 -48
- package/templates/base/.claude/skills/react-best-practices/rules/client-swr-dedup.md +0 -56
- package/templates/base/.claude/skills/react-best-practices/rules/js-batch-dom-css.md +0 -57
- package/templates/base/.claude/skills/react-best-practices/rules/js-cache-function-results.md +0 -80
- package/templates/base/.claude/skills/react-best-practices/rules/js-cache-property-access.md +0 -28
- package/templates/base/.claude/skills/react-best-practices/rules/js-cache-storage.md +0 -70
- package/templates/base/.claude/skills/react-best-practices/rules/js-combine-iterations.md +0 -32
- package/templates/base/.claude/skills/react-best-practices/rules/js-early-exit.md +0 -50
- package/templates/base/.claude/skills/react-best-practices/rules/js-hoist-regexp.md +0 -45
- package/templates/base/.claude/skills/react-best-practices/rules/js-index-maps.md +0 -37
- package/templates/base/.claude/skills/react-best-practices/rules/js-length-check-first.md +0 -49
- package/templates/base/.claude/skills/react-best-practices/rules/js-min-max-loop.md +0 -82
- package/templates/base/.claude/skills/react-best-practices/rules/js-set-map-lookups.md +0 -24
- package/templates/base/.claude/skills/react-best-practices/rules/js-tosorted-immutable.md +0 -57
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-activity.md +0 -26
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-conditional-render.md +0 -40
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-content-visibility.md +0 -38
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-hoist-jsx.md +0 -46
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-svg-precision.md +0 -28
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-defer-reads.md +0 -39
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-dependencies.md +0 -45
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-derived-state.md +0 -29
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-functional-setstate.md +0 -74
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-lazy-state-init.md +0 -58
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-memo.md +0 -44
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-transitions.md +0 -40
- package/templates/base/.claude/skills/react-best-practices/rules/server-after-nonblocking.md +0 -73
- package/templates/base/.claude/skills/react-best-practices/rules/server-cache-lru.md +0 -41
- package/templates/base/.claude/skills/react-best-practices/rules/server-cache-react.md +0 -76
- package/templates/base/.claude/skills/react-best-practices/rules/server-parallel-fetching.md +0 -83
- package/templates/base/.claude/skills/react-best-practices/rules/server-serialization.md +0 -38
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
# Snapshot + Refs Workflow
|
|
2
|
-
|
|
3
|
-
The core innovation of agent-browser: compact element references that reduce context usage dramatically for AI agents.
|
|
4
|
-
|
|
5
|
-
## How It Works
|
|
6
|
-
|
|
7
|
-
### The Problem
|
|
8
|
-
Traditional browser automation sends full DOM to AI agents:
|
|
9
|
-
```
|
|
10
|
-
Full DOM/HTML sent → AI parses → Generates CSS selector → Executes action
|
|
11
|
-
~3000-5000 tokens per interaction
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### The Solution
|
|
15
|
-
agent-browser uses compact snapshots with refs:
|
|
16
|
-
```
|
|
17
|
-
Compact snapshot → @refs assigned → Direct ref interaction
|
|
18
|
-
~200-400 tokens per interaction
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## The Snapshot Command
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
# Basic snapshot (shows page structure)
|
|
25
|
-
agent-browser snapshot
|
|
26
|
-
|
|
27
|
-
# Interactive snapshot (-i flag) - RECOMMENDED
|
|
28
|
-
agent-browser snapshot -i
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Snapshot Output Format
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
Page: Example Site - Home
|
|
35
|
-
URL: https://example.com
|
|
36
|
-
|
|
37
|
-
@e1 [header]
|
|
38
|
-
@e2 [nav]
|
|
39
|
-
@e3 [a] "Home"
|
|
40
|
-
@e4 [a] "Products"
|
|
41
|
-
@e5 [a] "About"
|
|
42
|
-
@e6 [button] "Sign In"
|
|
43
|
-
|
|
44
|
-
@e7 [main]
|
|
45
|
-
@e8 [h1] "Welcome"
|
|
46
|
-
@e9 [form]
|
|
47
|
-
@e10 [input type="email"] placeholder="Email"
|
|
48
|
-
@e11 [input type="password"] placeholder="Password"
|
|
49
|
-
@e12 [button type="submit"] "Log In"
|
|
50
|
-
|
|
51
|
-
@e13 [footer]
|
|
52
|
-
@e14 [a] "Privacy Policy"
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Using Refs
|
|
56
|
-
|
|
57
|
-
Once you have refs, interact directly:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
# Click the "Sign In" button
|
|
61
|
-
agent-browser click @e6
|
|
62
|
-
|
|
63
|
-
# Fill email input
|
|
64
|
-
agent-browser fill @e10 "user@example.com"
|
|
65
|
-
|
|
66
|
-
# Fill password
|
|
67
|
-
agent-browser fill @e11 "password123"
|
|
68
|
-
|
|
69
|
-
# Submit the form
|
|
70
|
-
agent-browser click @e12
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Ref Lifecycle
|
|
74
|
-
|
|
75
|
-
**IMPORTANT**: Refs are invalidated when the page changes!
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
# Get initial snapshot
|
|
79
|
-
agent-browser snapshot -i
|
|
80
|
-
# @e1 [button] "Next"
|
|
81
|
-
|
|
82
|
-
# Click triggers page change
|
|
83
|
-
agent-browser click @e1
|
|
84
|
-
|
|
85
|
-
# MUST re-snapshot to get new refs!
|
|
86
|
-
agent-browser snapshot -i
|
|
87
|
-
# @e1 [h1] "Page 2" ← Different element now!
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Best Practices
|
|
91
|
-
|
|
92
|
-
### 1. Always Snapshot Before Interacting
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
# CORRECT
|
|
96
|
-
agent-browser open https://example.com
|
|
97
|
-
agent-browser snapshot -i # Get refs first
|
|
98
|
-
agent-browser click @e1 # Use ref
|
|
99
|
-
|
|
100
|
-
# WRONG
|
|
101
|
-
agent-browser open https://example.com
|
|
102
|
-
agent-browser click @e1 # Ref doesn't exist yet!
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### 2. Re-Snapshot After Navigation
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
agent-browser click @e5 # Navigates to new page
|
|
109
|
-
agent-browser snapshot -i # Get new refs
|
|
110
|
-
agent-browser click @e1 # Use new refs
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### 3. Re-Snapshot After Dynamic Changes
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
agent-browser click @e1 # Opens dropdown
|
|
117
|
-
agent-browser snapshot -i # See dropdown items
|
|
118
|
-
agent-browser click @e7 # Select item
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### 4. Snapshot Specific Regions
|
|
122
|
-
|
|
123
|
-
For complex pages, snapshot specific areas:
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
# Snapshot just the form
|
|
127
|
-
agent-browser snapshot @e9
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## Ref Notation Details
|
|
131
|
-
|
|
132
|
-
```
|
|
133
|
-
@e1 [tag type="value"] "text content" placeholder="hint"
|
|
134
|
-
│ │ │ │ │
|
|
135
|
-
│ │ │ │ └─ Additional attributes
|
|
136
|
-
│ │ │ └─ Visible text
|
|
137
|
-
│ │ └─ Key attributes shown
|
|
138
|
-
│ └─ HTML tag name
|
|
139
|
-
└─ Unique ref ID
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### Common Patterns
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
@e1 [button] "Submit" # Button with text
|
|
146
|
-
@e2 [input type="email"] # Email input
|
|
147
|
-
@e3 [input type="password"] # Password input
|
|
148
|
-
@e4 [a href="/page"] "Link Text" # Anchor link
|
|
149
|
-
@e5 [select] # Dropdown
|
|
150
|
-
@e6 [textarea] placeholder="Message" # Text area
|
|
151
|
-
@e7 [div class="modal"] # Container (when relevant)
|
|
152
|
-
@e8 [img alt="Logo"] # Image
|
|
153
|
-
@e9 [checkbox] checked # Checked checkbox
|
|
154
|
-
@e10 [radio] selected # Selected radio
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## Troubleshooting
|
|
158
|
-
|
|
159
|
-
### "Ref not found" Error
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
# Ref may have changed - re-snapshot
|
|
163
|
-
agent-browser snapshot -i
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Element Not Visible in Snapshot
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
# Scroll to reveal element
|
|
170
|
-
agent-browser scroll --bottom
|
|
171
|
-
agent-browser snapshot -i
|
|
172
|
-
|
|
173
|
-
# Or wait for dynamic content
|
|
174
|
-
agent-browser wait 1000
|
|
175
|
-
agent-browser snapshot -i
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### Too Many Elements
|
|
179
|
-
|
|
180
|
-
```bash
|
|
181
|
-
# Snapshot specific container
|
|
182
|
-
agent-browser snapshot @e5
|
|
183
|
-
|
|
184
|
-
# Or use get text for content-only extraction
|
|
185
|
-
agent-browser get text @e5
|
|
186
|
-
```
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
# Video Recording
|
|
2
|
-
|
|
3
|
-
Capture browser automation sessions as video for debugging, documentation, or verification.
|
|
4
|
-
|
|
5
|
-
## Basic Recording
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# Start recording
|
|
9
|
-
agent-browser record start ./demo.webm
|
|
10
|
-
|
|
11
|
-
# Perform actions
|
|
12
|
-
agent-browser open https://example.com
|
|
13
|
-
agent-browser snapshot -i
|
|
14
|
-
agent-browser click @e1
|
|
15
|
-
agent-browser fill @e2 "test input"
|
|
16
|
-
|
|
17
|
-
# Stop and save
|
|
18
|
-
agent-browser record stop
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Recording Commands
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
# Start recording to file
|
|
25
|
-
agent-browser record start ./output.webm
|
|
26
|
-
|
|
27
|
-
# Stop current recording
|
|
28
|
-
agent-browser record stop
|
|
29
|
-
|
|
30
|
-
# Restart with new file (stops current + starts new)
|
|
31
|
-
agent-browser record restart ./take2.webm
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Use Cases
|
|
35
|
-
|
|
36
|
-
### Debugging Failed Automation
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
#!/bin/bash
|
|
40
|
-
# Record automation for debugging
|
|
41
|
-
|
|
42
|
-
agent-browser record start ./debug-$(date +%Y%m%d-%H%M%S).webm
|
|
43
|
-
|
|
44
|
-
# Run your automation
|
|
45
|
-
agent-browser open https://app.example.com
|
|
46
|
-
agent-browser snapshot -i
|
|
47
|
-
agent-browser click @e1 || {
|
|
48
|
-
echo "Click failed - check recording"
|
|
49
|
-
agent-browser record stop
|
|
50
|
-
exit 1
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
agent-browser record stop
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Documentation Generation
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
#!/bin/bash
|
|
60
|
-
# Record workflow for documentation
|
|
61
|
-
|
|
62
|
-
agent-browser record start ./docs/how-to-login.webm
|
|
63
|
-
|
|
64
|
-
agent-browser open https://app.example.com/login
|
|
65
|
-
agent-browser wait 1000 # Pause for visibility
|
|
66
|
-
|
|
67
|
-
agent-browser snapshot -i
|
|
68
|
-
agent-browser fill @e1 "demo@example.com"
|
|
69
|
-
agent-browser wait 500
|
|
70
|
-
|
|
71
|
-
agent-browser fill @e2 "password"
|
|
72
|
-
agent-browser wait 500
|
|
73
|
-
|
|
74
|
-
agent-browser click @e3
|
|
75
|
-
agent-browser wait --load networkidle
|
|
76
|
-
agent-browser wait 1000 # Show result
|
|
77
|
-
|
|
78
|
-
agent-browser record stop
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### CI/CD Test Evidence
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
#!/bin/bash
|
|
85
|
-
# Record E2E test runs for CI artifacts
|
|
86
|
-
|
|
87
|
-
TEST_NAME="${1:-e2e-test}"
|
|
88
|
-
RECORDING_DIR="./test-recordings"
|
|
89
|
-
mkdir -p "$RECORDING_DIR"
|
|
90
|
-
|
|
91
|
-
agent-browser record start "$RECORDING_DIR/$TEST_NAME-$(date +%s).webm"
|
|
92
|
-
|
|
93
|
-
# Run test
|
|
94
|
-
if run_e2e_test; then
|
|
95
|
-
echo "Test passed"
|
|
96
|
-
else
|
|
97
|
-
echo "Test failed - recording saved"
|
|
98
|
-
fi
|
|
99
|
-
|
|
100
|
-
agent-browser record stop
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
## Best Practices
|
|
104
|
-
|
|
105
|
-
### 1. Add Pauses for Clarity
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
# Slow down for human viewing
|
|
109
|
-
agent-browser click @e1
|
|
110
|
-
agent-browser wait 500 # Let viewer see result
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### 2. Use Descriptive Filenames
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
# Include context in filename
|
|
117
|
-
agent-browser record start ./recordings/login-flow-2024-01-15.webm
|
|
118
|
-
agent-browser record start ./recordings/checkout-test-run-42.webm
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### 3. Handle Recording in Error Cases
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
#!/bin/bash
|
|
125
|
-
set -e
|
|
126
|
-
|
|
127
|
-
cleanup() {
|
|
128
|
-
agent-browser record stop 2>/dev/null || true
|
|
129
|
-
agent-browser close 2>/dev/null || true
|
|
130
|
-
}
|
|
131
|
-
trap cleanup EXIT
|
|
132
|
-
|
|
133
|
-
agent-browser record start ./automation.webm
|
|
134
|
-
# ... automation steps ...
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### 4. Combine with Screenshots
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
# Record video AND capture key frames
|
|
141
|
-
agent-browser record start ./flow.webm
|
|
142
|
-
|
|
143
|
-
agent-browser open https://example.com
|
|
144
|
-
agent-browser screenshot ./screenshots/step1-homepage.png
|
|
145
|
-
|
|
146
|
-
agent-browser click @e1
|
|
147
|
-
agent-browser screenshot ./screenshots/step2-after-click.png
|
|
148
|
-
|
|
149
|
-
agent-browser record stop
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## Output Format
|
|
153
|
-
|
|
154
|
-
- Default format: WebM (VP8/VP9 codec)
|
|
155
|
-
- Compatible with all modern browsers and video players
|
|
156
|
-
- Compressed but high quality
|
|
157
|
-
|
|
158
|
-
## Limitations
|
|
159
|
-
|
|
160
|
-
- Recording adds slight overhead to automation
|
|
161
|
-
- Large recordings can consume significant disk space
|
|
162
|
-
- Some headless environments may have codec limitations
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Template: Authenticated Session Workflow
|
|
3
|
-
# Login once, save state, reuse for subsequent runs
|
|
4
|
-
#
|
|
5
|
-
# Usage:
|
|
6
|
-
# ./authenticated-session.sh <login-url> [state-file]
|
|
7
|
-
#
|
|
8
|
-
# Setup:
|
|
9
|
-
# 1. Run once to see your form structure
|
|
10
|
-
# 2. Note the @refs for your fields
|
|
11
|
-
# 3. Uncomment LOGIN FLOW section and update refs
|
|
12
|
-
|
|
13
|
-
set -euo pipefail
|
|
14
|
-
|
|
15
|
-
LOGIN_URL="${1:?Usage: $0 <login-url> [state-file]}"
|
|
16
|
-
STATE_FILE="${2:-./auth-state.json}"
|
|
17
|
-
|
|
18
|
-
echo "Authentication workflow for: $LOGIN_URL"
|
|
19
|
-
|
|
20
|
-
# ══════════════════════════════════════════════════════════════
|
|
21
|
-
# SAVED STATE: Skip login if we have valid saved state
|
|
22
|
-
# ══════════════════════════════════════════════════════════════
|
|
23
|
-
if [[ -f "$STATE_FILE" ]]; then
|
|
24
|
-
echo "Loading saved authentication state..."
|
|
25
|
-
agent-browser state load "$STATE_FILE"
|
|
26
|
-
agent-browser open "$LOGIN_URL"
|
|
27
|
-
agent-browser wait --load networkidle
|
|
28
|
-
|
|
29
|
-
CURRENT_URL=$(agent-browser get url)
|
|
30
|
-
if [[ "$CURRENT_URL" != *"login"* ]] && [[ "$CURRENT_URL" != *"signin"* ]]; then
|
|
31
|
-
echo "Session restored successfully!"
|
|
32
|
-
agent-browser snapshot -i
|
|
33
|
-
exit 0
|
|
34
|
-
fi
|
|
35
|
-
echo "Session expired, performing fresh login..."
|
|
36
|
-
rm -f "$STATE_FILE"
|
|
37
|
-
fi
|
|
38
|
-
|
|
39
|
-
# ══════════════════════════════════════════════════════════════
|
|
40
|
-
# DISCOVERY MODE: Show form structure (remove after setup)
|
|
41
|
-
# ══════════════════════════════════════════════════════════════
|
|
42
|
-
echo "Opening login page..."
|
|
43
|
-
agent-browser open "$LOGIN_URL"
|
|
44
|
-
agent-browser wait --load networkidle
|
|
45
|
-
|
|
46
|
-
echo ""
|
|
47
|
-
echo "┌─────────────────────────────────────────────────────────┐"
|
|
48
|
-
echo "│ LOGIN FORM STRUCTURE │"
|
|
49
|
-
echo "├─────────────────────────────────────────────────────────┤"
|
|
50
|
-
agent-browser snapshot -i
|
|
51
|
-
echo "└─────────────────────────────────────────────────────────┘"
|
|
52
|
-
echo ""
|
|
53
|
-
echo "Next steps:"
|
|
54
|
-
echo " 1. Note refs: @e? = username, @e? = password, @e? = submit"
|
|
55
|
-
echo " 2. Uncomment LOGIN FLOW section below"
|
|
56
|
-
echo " 3. Replace @e1, @e2, @e3 with your refs"
|
|
57
|
-
echo " 4. Delete this DISCOVERY MODE section"
|
|
58
|
-
echo ""
|
|
59
|
-
agent-browser close
|
|
60
|
-
exit 0
|
|
61
|
-
|
|
62
|
-
# ══════════════════════════════════════════════════════════════
|
|
63
|
-
# LOGIN FLOW: Uncomment and customize after discovery
|
|
64
|
-
# ══════════════════════════════════════════════════════════════
|
|
65
|
-
# : "${APP_USERNAME:?Set APP_USERNAME environment variable}"
|
|
66
|
-
# : "${APP_PASSWORD:?Set APP_PASSWORD environment variable}"
|
|
67
|
-
#
|
|
68
|
-
# agent-browser open "$LOGIN_URL"
|
|
69
|
-
# agent-browser wait --load networkidle
|
|
70
|
-
# agent-browser snapshot -i
|
|
71
|
-
#
|
|
72
|
-
# # Fill credentials (update refs to match your form)
|
|
73
|
-
# agent-browser fill @e1 "$APP_USERNAME"
|
|
74
|
-
# agent-browser fill @e2 "$APP_PASSWORD"
|
|
75
|
-
# agent-browser click @e3
|
|
76
|
-
# agent-browser wait --load networkidle
|
|
77
|
-
#
|
|
78
|
-
# # Verify login succeeded
|
|
79
|
-
# FINAL_URL=$(agent-browser get url)
|
|
80
|
-
# if [[ "$FINAL_URL" == *"login"* ]] || [[ "$FINAL_URL" == *"signin"* ]]; then
|
|
81
|
-
# echo "ERROR: Login failed - still on login page"
|
|
82
|
-
# agent-browser screenshot /tmp/login-failed.png
|
|
83
|
-
# agent-browser close
|
|
84
|
-
# exit 1
|
|
85
|
-
# fi
|
|
86
|
-
#
|
|
87
|
-
# # Save state for future runs
|
|
88
|
-
# echo "Saving authentication state to: $STATE_FILE"
|
|
89
|
-
# agent-browser state save "$STATE_FILE"
|
|
90
|
-
# echo "Login successful!"
|
|
91
|
-
# agent-browser snapshot -i
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Template: Content Capture Workflow
|
|
3
|
-
# Extract content from web pages with optional authentication
|
|
4
|
-
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
|
|
7
|
-
TARGET_URL="${1:?Usage: $0 <url> [output-dir]}"
|
|
8
|
-
OUTPUT_DIR="${2:-.}"
|
|
9
|
-
|
|
10
|
-
echo "Capturing content from: $TARGET_URL"
|
|
11
|
-
mkdir -p "$OUTPUT_DIR"
|
|
12
|
-
|
|
13
|
-
# Optional: Load authentication state if needed
|
|
14
|
-
# if [[ -f "./auth-state.json" ]]; then
|
|
15
|
-
# agent-browser state load "./auth-state.json"
|
|
16
|
-
# fi
|
|
17
|
-
|
|
18
|
-
# Navigate to target page
|
|
19
|
-
agent-browser open "$TARGET_URL"
|
|
20
|
-
agent-browser wait --load networkidle
|
|
21
|
-
|
|
22
|
-
# Get page metadata
|
|
23
|
-
echo "Page title: $(agent-browser get title)"
|
|
24
|
-
echo "Page URL: $(agent-browser get url)"
|
|
25
|
-
|
|
26
|
-
# Capture full page screenshot
|
|
27
|
-
agent-browser screenshot --full "$OUTPUT_DIR/page-full.png"
|
|
28
|
-
echo "Screenshot saved: $OUTPUT_DIR/page-full.png"
|
|
29
|
-
|
|
30
|
-
# Get page structure
|
|
31
|
-
agent-browser snapshot -i > "$OUTPUT_DIR/page-structure.txt"
|
|
32
|
-
echo "Structure saved: $OUTPUT_DIR/page-structure.txt"
|
|
33
|
-
|
|
34
|
-
# Extract main content
|
|
35
|
-
# Adjust selector based on target site structure
|
|
36
|
-
# agent-browser get text @e1 > "$OUTPUT_DIR/main-content.txt"
|
|
37
|
-
|
|
38
|
-
# Extract specific elements (uncomment as needed)
|
|
39
|
-
# agent-browser get text "article" > "$OUTPUT_DIR/article.txt"
|
|
40
|
-
# agent-browser get text "main" > "$OUTPUT_DIR/main.txt"
|
|
41
|
-
# agent-browser get text ".content" > "$OUTPUT_DIR/content.txt"
|
|
42
|
-
|
|
43
|
-
# Get full page text
|
|
44
|
-
agent-browser get text body > "$OUTPUT_DIR/page-text.txt"
|
|
45
|
-
echo "Text content saved: $OUTPUT_DIR/page-text.txt"
|
|
46
|
-
|
|
47
|
-
# Optional: Save as PDF
|
|
48
|
-
agent-browser pdf "$OUTPUT_DIR/page.pdf"
|
|
49
|
-
echo "PDF saved: $OUTPUT_DIR/page.pdf"
|
|
50
|
-
|
|
51
|
-
# Optional: Capture with scrolling for infinite scroll pages
|
|
52
|
-
# scroll_and_capture() {
|
|
53
|
-
# local count=0
|
|
54
|
-
# while [[ $count -lt 5 ]]; do
|
|
55
|
-
# agent-browser scroll down 1000
|
|
56
|
-
# agent-browser wait 1000
|
|
57
|
-
# ((count++))
|
|
58
|
-
# done
|
|
59
|
-
# agent-browser screenshot --full "$OUTPUT_DIR/page-scrolled.png"
|
|
60
|
-
# }
|
|
61
|
-
# scroll_and_capture
|
|
62
|
-
|
|
63
|
-
# Cleanup
|
|
64
|
-
agent-browser close
|
|
65
|
-
|
|
66
|
-
echo ""
|
|
67
|
-
echo "Capture complete! Files saved to: $OUTPUT_DIR"
|
|
68
|
-
ls -la "$OUTPUT_DIR"
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Template: Form Automation Workflow
|
|
3
|
-
# Fills and submits web forms with validation
|
|
4
|
-
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
|
|
7
|
-
FORM_URL="${1:?Usage: $0 <form-url>}"
|
|
8
|
-
|
|
9
|
-
echo "Automating form at: $FORM_URL"
|
|
10
|
-
|
|
11
|
-
# Navigate to form page
|
|
12
|
-
agent-browser open "$FORM_URL"
|
|
13
|
-
agent-browser wait --load networkidle
|
|
14
|
-
|
|
15
|
-
# Get interactive snapshot to identify form fields
|
|
16
|
-
echo "Analyzing form structure..."
|
|
17
|
-
agent-browser snapshot -i
|
|
18
|
-
|
|
19
|
-
# Example: Fill common form fields
|
|
20
|
-
# Uncomment and modify refs based on snapshot output
|
|
21
|
-
|
|
22
|
-
# Text inputs
|
|
23
|
-
# agent-browser fill @e1 "John Doe" # Name field
|
|
24
|
-
# agent-browser fill @e2 "user@example.com" # Email field
|
|
25
|
-
# agent-browser fill @e3 "+1-555-123-4567" # Phone field
|
|
26
|
-
|
|
27
|
-
# Password fields
|
|
28
|
-
# agent-browser fill @e4 "SecureP@ssw0rd!"
|
|
29
|
-
|
|
30
|
-
# Dropdowns
|
|
31
|
-
# agent-browser select @e5 "Option Value"
|
|
32
|
-
|
|
33
|
-
# Checkboxes
|
|
34
|
-
# agent-browser check @e6 # Check
|
|
35
|
-
# agent-browser uncheck @e7 # Uncheck
|
|
36
|
-
|
|
37
|
-
# Radio buttons
|
|
38
|
-
# agent-browser click @e8 # Select radio option
|
|
39
|
-
|
|
40
|
-
# Text areas
|
|
41
|
-
# agent-browser fill @e9 "Multi-line text content here"
|
|
42
|
-
|
|
43
|
-
# File uploads
|
|
44
|
-
# agent-browser upload @e10 /path/to/file.pdf
|
|
45
|
-
|
|
46
|
-
# Submit form
|
|
47
|
-
# agent-browser click @e11 # Submit button
|
|
48
|
-
|
|
49
|
-
# Wait for response
|
|
50
|
-
# agent-browser wait --load networkidle
|
|
51
|
-
# agent-browser wait --url "**/success" # Or wait for redirect
|
|
52
|
-
|
|
53
|
-
# Verify submission
|
|
54
|
-
echo "Form submission result:"
|
|
55
|
-
agent-browser get url
|
|
56
|
-
agent-browser snapshot -i
|
|
57
|
-
|
|
58
|
-
# Take screenshot of result
|
|
59
|
-
agent-browser screenshot /tmp/form-result.png
|
|
60
|
-
|
|
61
|
-
# Cleanup
|
|
62
|
-
agent-browser close
|
|
63
|
-
|
|
64
|
-
echo "Form automation complete"
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: autoskill
|
|
3
|
-
description: Analyze coding sessions to detect corrections and preferences, then propose targeted improvements to Skills used in the session. Use this skill when the user asks to "learn from this session", "update skills", or "remember this pattern". Extracts durable preferences and codifies them into the appropriate skill files.
|
|
4
|
-
license: Complete terms in LICENSE.txt
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
This skill analyzes coding sessions to extract durable preferences from corrections and approvals, then proposes targeted updates to Skills that were active during the session. It acts as a learning mechanism across sessions, ensuring Claude improves based on feedback.
|
|
8
|
-
|
|
9
|
-
The user triggers autoskill after a session where Skills were used. The skill detects signals, filters for quality, maps them to the relevant Skill files, and proposes minimal, reversible edits for review.
|
|
10
|
-
|
|
11
|
-
## When to activate
|
|
12
|
-
|
|
13
|
-
Trigger on explicit requests:
|
|
14
|
-
- "autoskill", "learn from this session", "update skills from these corrections"
|
|
15
|
-
- "remember this pattern", "make sure you do X next time"
|
|
16
|
-
|
|
17
|
-
Do NOT activate for one-off corrections or when the user declines skill modifications.
|
|
18
|
-
|
|
19
|
-
## Signal detection
|
|
20
|
-
|
|
21
|
-
Scan the session for:
|
|
22
|
-
|
|
23
|
-
**Corrections** (highest value)
|
|
24
|
-
- "No, use X instead of Y"
|
|
25
|
-
- "We always do it this way"
|
|
26
|
-
- "Don't do X in this codebase"
|
|
27
|
-
|
|
28
|
-
**Repeated patterns** (high value)
|
|
29
|
-
- Same feedback given 2+ times
|
|
30
|
-
- Consistent naming/structure choices across multiple files
|
|
31
|
-
|
|
32
|
-
**Approvals** (supporting evidence)
|
|
33
|
-
- "Yes, that's right"
|
|
34
|
-
- "Perfect, keep doing it this way"
|
|
35
|
-
|
|
36
|
-
**Ignore:**
|
|
37
|
-
- Context-specific one-offs ("use X here" without "always")
|
|
38
|
-
- Ambiguous feedback
|
|
39
|
-
- Contradictory signals (ask for clarification instead)
|
|
40
|
-
|
|
41
|
-
## Signal quality filter
|
|
42
|
-
|
|
43
|
-
Before proposing any change, ask:
|
|
44
|
-
1. Was this correction repeated, or stated as a general rule?
|
|
45
|
-
2. Would this apply to future sessions, or just this task?
|
|
46
|
-
3. Is it specific enough to be actionable?
|
|
47
|
-
4. Is this **new information** I wouldn't already know?
|
|
48
|
-
|
|
49
|
-
Only propose changes that pass all four.
|
|
50
|
-
|
|
51
|
-
### What counts as "new information"
|
|
52
|
-
|
|
53
|
-
**Worth capturing:**
|
|
54
|
-
- Project-specific conventions ("we use `cn()` not `clsx()` here")
|
|
55
|
-
- Custom component/utility locations ("buttons are in `@/components/ui`")
|
|
56
|
-
- Team preferences that differ from defaults ("we prefer explicit returns")
|
|
57
|
-
- Domain-specific terminology or patterns
|
|
58
|
-
- Non-obvious architectural decisions ("auth logic lives in middleware, not components")
|
|
59
|
-
- Integrations and API quirks specific to this stack
|
|
60
|
-
|
|
61
|
-
**NOT worth capturing (I already know this):**
|
|
62
|
-
- General best practices (DRY, separation of concerns)
|
|
63
|
-
- Language/framework conventions (React hooks rules, TypeScript basics)
|
|
64
|
-
- Common library usage (standard Tailwind classes, typical Next.js patterns)
|
|
65
|
-
- Universal security practices (input validation, SQL injection prevention)
|
|
66
|
-
- Standard accessibility guidelines
|
|
67
|
-
|
|
68
|
-
If I'd give the same advice to any project, it doesn't belong in a skill.
|
|
69
|
-
|
|
70
|
-
## Mapping signals to Skills
|
|
71
|
-
|
|
72
|
-
Match each signal to the Skill that was active and relevant during the session:
|
|
73
|
-
|
|
74
|
-
- If the signal relates to a Skill that was used, update that Skill's `SKILL.md`
|
|
75
|
-
- If 3+ related signals don't fit any active Skill, propose a new Skill
|
|
76
|
-
- Ignore signals that don't map to any Skill used in the session
|
|
77
|
-
|
|
78
|
-
## Proposing changes
|
|
79
|
-
|
|
80
|
-
For each proposed edit, provide:
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
File: path/to/SKILL.md
|
|
84
|
-
Section: [existing section or "new section: X"]
|
|
85
|
-
Confidence: HIGH | MEDIUM
|
|
86
|
-
|
|
87
|
-
Signal: "[exact user quote or paraphrase]"
|
|
88
|
-
|
|
89
|
-
Current text (if modifying):
|
|
90
|
-
> existing content
|
|
91
|
-
|
|
92
|
-
Proposed text:
|
|
93
|
-
> updated content
|
|
94
|
-
|
|
95
|
-
Rationale: [one sentence]
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
Group proposals by file. Present HIGH confidence changes first.
|
|
99
|
-
|
|
100
|
-
## Review flow
|
|
101
|
-
|
|
102
|
-
Always present changes for review before applying. Format:
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
## autoskill summary
|
|
106
|
-
|
|
107
|
-
Detected [N] durable preferences from this session.
|
|
108
|
-
|
|
109
|
-
### HIGH confidence (recommended to apply)
|
|
110
|
-
- [change 1]
|
|
111
|
-
- [change 2]
|
|
112
|
-
|
|
113
|
-
### MEDIUM confidence (review carefully)
|
|
114
|
-
- [change 3]
|
|
115
|
-
|
|
116
|
-
Apply high confidence changes? [y/n/selective]
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Wait for explicit approval before editing any file.
|
|
120
|
-
|
|
121
|
-
## Applying changes
|
|
122
|
-
|
|
123
|
-
When approved:
|
|
124
|
-
1. Edit the target file with minimal, focused changes
|
|
125
|
-
2. If git is available, commit with message: `chore(autoskill): [brief description]`
|
|
126
|
-
3. Report what was changed
|
|
127
|
-
|
|
128
|
-
## Constraints
|
|
129
|
-
|
|
130
|
-
- Never delete existing rules without explicit instruction
|
|
131
|
-
- Prefer additive changes over rewrites
|
|
132
|
-
- One concept per change (easy to revert)
|
|
133
|
-
- Preserve existing file structure and tone
|
|
134
|
-
- When uncertain, downgrade to MEDIUM confidence and ask
|