ag-cortex 0.1.0

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.
Files changed (162) hide show
  1. package/.agent/commands/test-browser.md +339 -0
  2. package/.agent/rules/00-constitution.md +46 -0
  3. package/.agent/rules/project-rules.md +49 -0
  4. package/.agent/skills/agent-browser/SKILL.md +223 -0
  5. package/.agent/skills/agent-native-architecture/SKILL.md +435 -0
  6. package/.agent/skills/agent-native-architecture/references/action-parity-discipline.md +409 -0
  7. package/.agent/skills/agent-native-architecture/references/agent-execution-patterns.md +467 -0
  8. package/.agent/skills/agent-native-architecture/references/agent-native-testing.md +582 -0
  9. package/.agent/skills/agent-native-architecture/references/architecture-patterns.md +478 -0
  10. package/.agent/skills/agent-native-architecture/references/dynamic-context-injection.md +338 -0
  11. package/.agent/skills/agent-native-architecture/references/files-universal-interface.md +301 -0
  12. package/.agent/skills/agent-native-architecture/references/from-primitives-to-domain-tools.md +359 -0
  13. package/.agent/skills/agent-native-architecture/references/mcp-tool-design.md +506 -0
  14. package/.agent/skills/agent-native-architecture/references/mobile-patterns.md +871 -0
  15. package/.agent/skills/agent-native-architecture/references/product-implications.md +443 -0
  16. package/.agent/skills/agent-native-architecture/references/refactoring-to-prompt-native.md +317 -0
  17. package/.agent/skills/agent-native-architecture/references/self-modification.md +269 -0
  18. package/.agent/skills/agent-native-architecture/references/shared-workspace-architecture.md +680 -0
  19. package/.agent/skills/agent-native-architecture/references/system-prompt-design.md +250 -0
  20. package/.agent/skills/agent-native-reviewer/SKILL.md +246 -0
  21. package/.agent/skills/andrew-kane-gem-writer/SKILL.md +184 -0
  22. package/.agent/skills/andrew-kane-gem-writer/references/database-adapters.md +231 -0
  23. package/.agent/skills/andrew-kane-gem-writer/references/module-organization.md +121 -0
  24. package/.agent/skills/andrew-kane-gem-writer/references/rails-integration.md +183 -0
  25. package/.agent/skills/andrew-kane-gem-writer/references/resources.md +119 -0
  26. package/.agent/skills/andrew-kane-gem-writer/references/testing-patterns.md +261 -0
  27. package/.agent/skills/ankane-readme-writer/SKILL.md +50 -0
  28. package/.agent/skills/architecture-strategist/SKILL.md +52 -0
  29. package/.agent/skills/best-practices-researcher/SKILL.md +100 -0
  30. package/.agent/skills/bug-reproduction-validator/SKILL.md +67 -0
  31. package/.agent/skills/code-simplicity-reviewer/SKILL.md +85 -0
  32. package/.agent/skills/coding-tutor/.claude-plugin/plugin.json +9 -0
  33. package/.agent/skills/coding-tutor/README.md +37 -0
  34. package/.agent/skills/coding-tutor/commands/quiz-me.md +1 -0
  35. package/.agent/skills/coding-tutor/commands/sync-tutorials.md +25 -0
  36. package/.agent/skills/coding-tutor/commands/teach-me.md +1 -0
  37. package/.agent/skills/coding-tutor/skills/coding-tutor/SKILL.md +214 -0
  38. package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/create_tutorial.py +202 -0
  39. package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/index_tutorials.py +203 -0
  40. package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/quiz_priority.py +190 -0
  41. package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/setup_tutorials.py +132 -0
  42. package/.agent/skills/compound-docs/SKILL.md +510 -0
  43. package/.agent/skills/compound-docs/assets/critical-pattern-template.md +34 -0
  44. package/.agent/skills/compound-docs/assets/resolution-template.md +93 -0
  45. package/.agent/skills/compound-docs/references/yaml-schema.md +65 -0
  46. package/.agent/skills/compound-docs/schema.yaml +176 -0
  47. package/.agent/skills/create-agent-skills/SKILL.md +299 -0
  48. package/.agent/skills/create-agent-skills/references/api-security.md +226 -0
  49. package/.agent/skills/create-agent-skills/references/be-clear-and-direct.md +531 -0
  50. package/.agent/skills/create-agent-skills/references/best-practices.md +404 -0
  51. package/.agent/skills/create-agent-skills/references/common-patterns.md +595 -0
  52. package/.agent/skills/create-agent-skills/references/core-principles.md +437 -0
  53. package/.agent/skills/create-agent-skills/references/executable-code.md +175 -0
  54. package/.agent/skills/create-agent-skills/references/iteration-and-testing.md +474 -0
  55. package/.agent/skills/create-agent-skills/references/official-spec.md +185 -0
  56. package/.agent/skills/create-agent-skills/references/recommended-structure.md +168 -0
  57. package/.agent/skills/create-agent-skills/references/skill-structure.md +372 -0
  58. package/.agent/skills/create-agent-skills/references/using-scripts.md +113 -0
  59. package/.agent/skills/create-agent-skills/references/using-templates.md +112 -0
  60. package/.agent/skills/create-agent-skills/references/workflows-and-validation.md +510 -0
  61. package/.agent/skills/create-agent-skills/templates/router-skill.md +73 -0
  62. package/.agent/skills/create-agent-skills/templates/simple-skill.md +33 -0
  63. package/.agent/skills/create-agent-skills/workflows/add-reference.md +96 -0
  64. package/.agent/skills/create-agent-skills/workflows/add-script.md +93 -0
  65. package/.agent/skills/create-agent-skills/workflows/add-template.md +74 -0
  66. package/.agent/skills/create-agent-skills/workflows/add-workflow.md +120 -0
  67. package/.agent/skills/create-agent-skills/workflows/audit-skill.md +138 -0
  68. package/.agent/skills/create-agent-skills/workflows/create-domain-expertise-skill.md +605 -0
  69. package/.agent/skills/create-agent-skills/workflows/create-new-skill.md +191 -0
  70. package/.agent/skills/create-agent-skills/workflows/get-guidance.md +121 -0
  71. package/.agent/skills/create-agent-skills/workflows/upgrade-to-router.md +161 -0
  72. package/.agent/skills/create-agent-skills/workflows/verify-skill.md +204 -0
  73. package/.agent/skills/data-integrity-guardian/SKILL.md +70 -0
  74. package/.agent/skills/data-migration-expert/SKILL.md +97 -0
  75. package/.agent/skills/deployment-verification-agent/SKILL.md +159 -0
  76. package/.agent/skills/design-implementation-reviewer/SKILL.md +85 -0
  77. package/.agent/skills/design-iterator/SKILL.md +197 -0
  78. package/.agent/skills/dhh-rails-reviewer/SKILL.md +45 -0
  79. package/.agent/skills/dhh-rails-style/SKILL.md +184 -0
  80. package/.agent/skills/dhh-rails-style/references/architecture.md +653 -0
  81. package/.agent/skills/dhh-rails-style/references/controllers.md +303 -0
  82. package/.agent/skills/dhh-rails-style/references/frontend.md +510 -0
  83. package/.agent/skills/dhh-rails-style/references/gems.md +266 -0
  84. package/.agent/skills/dhh-rails-style/references/models.md +359 -0
  85. package/.agent/skills/dhh-rails-style/references/testing.md +338 -0
  86. package/.agent/skills/dspy-ruby/SKILL.md +594 -0
  87. package/.agent/skills/dspy-ruby/assets/config-template.rb +359 -0
  88. package/.agent/skills/dspy-ruby/assets/module-template.rb +326 -0
  89. package/.agent/skills/dspy-ruby/assets/signature-template.rb +143 -0
  90. package/.agent/skills/dspy-ruby/references/core-concepts.md +265 -0
  91. package/.agent/skills/dspy-ruby/references/optimization.md +623 -0
  92. package/.agent/skills/dspy-ruby/references/providers.md +305 -0
  93. package/.agent/skills/every-style-editor/SKILL.md +134 -0
  94. package/.agent/skills/every-style-editor/references/EVERY_WRITE_STYLE.md +529 -0
  95. package/.agent/skills/figma-design-sync/SKILL.md +166 -0
  96. package/.agent/skills/file-todos/SKILL.md +251 -0
  97. package/.agent/skills/file-todos/assets/todo-template.md +155 -0
  98. package/.agent/skills/framework-docs-researcher/SKILL.md +83 -0
  99. package/.agent/skills/frontend-design/SKILL.md +42 -0
  100. package/.agent/skills/gemini-imagegen/SKILL.md +237 -0
  101. package/.agent/skills/gemini-imagegen/requirements.txt +2 -0
  102. package/.agent/skills/gemini-imagegen/scripts/compose_images.py +168 -0
  103. package/.agent/skills/gemini-imagegen/scripts/edit_image.py +157 -0
  104. package/.agent/skills/gemini-imagegen/scripts/gemini_images.py +265 -0
  105. package/.agent/skills/gemini-imagegen/scripts/generate_image.py +147 -0
  106. package/.agent/skills/gemini-imagegen/scripts/multi_turn_chat.py +215 -0
  107. package/.agent/skills/git-history-analyzer/SKILL.md +42 -0
  108. package/.agent/skills/git-worktree/SKILL.md +302 -0
  109. package/.agent/skills/git-worktree/scripts/worktree-manager.sh +345 -0
  110. package/.agent/skills/julik-frontend-races-reviewer/SKILL.md +222 -0
  111. package/.agent/skills/kieran-python-reviewer/SKILL.md +104 -0
  112. package/.agent/skills/kieran-rails-reviewer/SKILL.md +86 -0
  113. package/.agent/skills/kieran-typescript-reviewer/SKILL.md +95 -0
  114. package/.agent/skills/lint/SKILL.md +16 -0
  115. package/.agent/skills/pattern-recognition-specialist/SKILL.md +57 -0
  116. package/.agent/skills/performance-oracle/SKILL.md +110 -0
  117. package/.agent/skills/pr-comment-resolver/SKILL.md +69 -0
  118. package/.agent/skills/rclone/SKILL.md +150 -0
  119. package/.agent/skills/rclone/scripts/check_setup.sh +60 -0
  120. package/.agent/skills/repo-research-analyst/SKILL.md +113 -0
  121. package/.agent/skills/security-sentinel/SKILL.md +93 -0
  122. package/.agent/skills/skill-creator/SKILL.md +209 -0
  123. package/.agent/skills/skill-creator/scripts/init_skill.py +304 -0
  124. package/.agent/skills/skill-creator/scripts/package_skill.py +112 -0
  125. package/.agent/skills/skill-creator/scripts/quick_validate.py +72 -0
  126. package/.agent/skills/spec-flow-analyzer/SKILL.md +113 -0
  127. package/.agent/skills/test-agent/SKILL.md +4 -0
  128. package/.agent/workflows/agent-native-audit.md +277 -0
  129. package/.agent/workflows/ask-user-question.md +21 -0
  130. package/.agent/workflows/changelog.md +137 -0
  131. package/.agent/workflows/compound.md +202 -0
  132. package/.agent/workflows/create-agent-skill.md +8 -0
  133. package/.agent/workflows/deepen-plan-research.md +334 -0
  134. package/.agent/workflows/deepen-plan-synthesis.md +182 -0
  135. package/.agent/workflows/deepen-plan.md +79 -0
  136. package/.agent/workflows/feature-video.md +342 -0
  137. package/.agent/workflows/generate-command.md +162 -0
  138. package/.agent/workflows/heal-skill.md +142 -0
  139. package/.agent/workflows/lfg.md +20 -0
  140. package/.agent/workflows/plan-analysis.md +67 -0
  141. package/.agent/workflows/plan-next-steps.md +63 -0
  142. package/.agent/workflows/plan-review.md +33 -0
  143. package/.agent/workflows/plan-synthesis.md +106 -0
  144. package/.agent/workflows/plan.md +49 -0
  145. package/.agent/workflows/report-bug.md +150 -0
  146. package/.agent/workflows/reproduce-bug.md +99 -0
  147. package/.agent/workflows/resolve-parallel.md +34 -0
  148. package/.agent/workflows/resolve-pr-parallel.md +49 -0
  149. package/.agent/workflows/resolve-todo-parallel.md +35 -0
  150. package/.agent/workflows/review-analysis.md +145 -0
  151. package/.agent/workflows/review-synthesis.md +262 -0
  152. package/.agent/workflows/review.md +64 -0
  153. package/.agent/workflows/ship.md +90 -0
  154. package/.agent/workflows/test-command.md +3 -0
  155. package/.agent/workflows/triage.md +310 -0
  156. package/.agent/workflows/work.md +157 -0
  157. package/.agent/workflows/xcode-test.md +332 -0
  158. package/LICENSE +22 -0
  159. package/README.md +49 -0
  160. package/bin/ag-cortex.js +54 -0
  161. package/lib/core.js +165 -0
  162. package/package.json +31 -0
@@ -0,0 +1,182 @@
1
+ ---
2
+ Description: Internal sub-workflow for the Deepen Plan synthesis phase. Updates the plan file and enforces safety constraints.
3
+ ---
4
+
5
+ # Deepen Plan - Phase 3: Synthesis Execution
6
+
7
+ ## Context
8
+ Target Plan: <plan_path> #$ARGUMENTS </plan_path>
9
+
10
+ ## Main Tasks
11
+
12
+ ### 6. Wait for ALL Agents and Synthesize Everything
13
+
14
+ <thinking>
15
+ Wait for ALL parallel agents to complete - skills, research agents, review agents, everything. Then synthesize all findings into a comprehensive enhancement.
16
+ </thinking>
17
+
18
+ **Collect outputs from ALL sources:**
19
+
20
+ 1. **Skill-based sub-agents** - Each skill's full output (code examples, patterns, recommendations)
21
+ 2. **Learnings/Solutions sub-agents** - Relevant documented learnings from /compound
22
+ 3. **Research agents** - Best practices, documentation, real-world examples
23
+ 4. **Review agents** - All feedback from every reviewer (architecture, security, performance, simplicity, etc.)
24
+ 5. **Context7 queries** - Framework documentation and patterns
25
+ 6. **Web searches** - Current best practices and articles
26
+
27
+ **For each agent's findings, extract:**
28
+ - [ ] Concrete recommendations (actionable items)
29
+ - [ ] Code patterns and examples (copy-paste ready)
30
+ - [ ] Anti-patterns to avoid (warnings)
31
+ - [ ] Performance considerations (metrics, benchmarks)
32
+ - [ ] Security considerations (vulnerabilities, mitigations)
33
+ - [ ] Edge cases discovered (handling strategies)
34
+ - [ ] Documentation links (references)
35
+ - [ ] Skill-specific patterns (from matched skills)
36
+ - [ ] Relevant learnings (past solutions that apply - prevent repeating mistakes)
37
+
38
+ **Deduplicate and prioritize:**
39
+ - Merge similar recommendations from multiple agents
40
+ - Prioritize by impact (high-value improvements first)
41
+ - Flag conflicting advice for human review
42
+ - Group by plan section
43
+
44
+ ### 7. Enhance Plan Sections
45
+
46
+ <thinking>
47
+ Merge research findings back into the plan, adding depth without changing the original structure.
48
+ </thinking>
49
+
50
+ **Enhancement format for each section:**
51
+
52
+ ```markdown
53
+ ## [Original Section Title]
54
+
55
+ [Original content preserved]
56
+
57
+ ### Research Insights
58
+
59
+ **Best Practices:**
60
+ - [Concrete recommendation 1]
61
+ - [Concrete recommendation 2]
62
+
63
+ **Performance Considerations:**
64
+ - [Optimization opportunity]
65
+ - [Benchmark or metric to target]
66
+
67
+ **Implementation Details:**
68
+ ```[language]
69
+ // Concrete code example from research
70
+ ```
71
+
72
+ **Edge Cases:**
73
+ - [Edge case 1 and how to handle]
74
+ - [Edge case 2 and how to handle]
75
+
76
+ **References:**
77
+ - [Documentation URL 1]
78
+ - [Documentation URL 2]
79
+ ```
80
+
81
+ ### 8. Add Enhancement Summary
82
+
83
+ At the top of the plan, add a summary section:
84
+
85
+ ```markdown
86
+ ## Enhancement Summary
87
+
88
+ **Deepened on:** [Date]
89
+ **Sections enhanced:** [Count]
90
+ **Research agents used:** [List]
91
+
92
+ ### Key Improvements
93
+ 1. [Major improvement 1]
94
+ 2. [Major improvement 2]
95
+ 3. [Major improvement 3]
96
+
97
+ ### New Considerations Discovered
98
+ - [Important finding 1]
99
+ - [Important finding 2]
100
+ ```
101
+
102
+ ### 9. Update Plan File
103
+
104
+ **Write the enhanced plan:**
105
+ - Preserve original filename
106
+ - Add `-deepened` suffix if user prefers a new file
107
+ - Update any timestamps or metadata
108
+
109
+ ## Output Format
110
+
111
+ **Update the plan:**
112
+
113
+ - If modifying an **Artifact**: Use `multi_replace_file_content` or `replace_file_content` on the artifact path. Ensure `ArtifactMetadata` is updated.
114
+ - If modifying a **Local File**: Update the file in place.
115
+
116
+ ## Quality Checks
117
+
118
+ Before finalizing:
119
+ - [ ] All original content preserved
120
+ - [ ] Research insights clearly marked and attributed
121
+ - [ ] Code examples are syntactically correct
122
+ - [ ] Links are valid and relevant
123
+ - [ ] No contradictions between sections
124
+ - [ ] Enhancement summary accurately reflects changes
125
+
126
+ ## Example Enhancement
127
+
128
+ **Before (from /plan):**
129
+ ```markdown
130
+ ## Technical Approach
131
+
132
+ Use React Query for data fetching with optimistic updates.
133
+ ```
134
+
135
+ **After (from /deepen-plan):**
136
+ ```markdown
137
+ ## Technical Approach
138
+
139
+ Use React Query for data fetching with optimistic updates.
140
+
141
+ ### Research Insights
142
+
143
+ **Best Practices:**
144
+ - Configure `staleTime` and `cacheTime` based on data freshness requirements
145
+ - Use `queryKey` factories for consistent cache invalidation
146
+ - Implement error boundaries around query-dependent components
147
+
148
+ **Performance Considerations:**
149
+ - Enable `refetchOnWindowFocus: false` for stable data to reduce unnecessary requests
150
+ - Use `select` option to transform and memoize data at query level
151
+ - Consider `placeholderData` for instant perceived loading
152
+
153
+ **Implementation Details:**
154
+
155
+ // Recommended query configuration
156
+ const queryClient = new QueryClient({
157
+ defaultOptions: {
158
+ queries: {
159
+ staleTime: 5 * 60 * 1000, // 5 minutes
160
+ retry: 2,
161
+ refetchOnWindowFocus: false,
162
+ },
163
+ },
164
+ });
165
+
166
+
167
+ **Edge Cases:**
168
+ - Handle race conditions with `cancelQueries` on component unmount
169
+ - Implement retry logic for transient network failures
170
+ - Consider offline support with `persistQueryClient`
171
+
172
+ **References:**
173
+ - https://tanstack.com/query/latest/docs/react/guides/optimistic-updates
174
+ - https://tkdodo.eu/blog/practical-react-query
175
+ ```
176
+
177
+ **NEVER CODE!**
178
+
179
+ Your job is to **research** and **enhance the plan**, not to implement the plan.
180
+ - Do not write implementation files.
181
+ - Do not modify source code.
182
+ - ONLY modify the markdown plan file.
@@ -0,0 +1,79 @@
1
+ ---
2
+ Description: Enhance a plan with parallel research agents for each section to add depth, best practices, and implementation details
3
+ ---
4
+
5
+ # Deepen Plan - Power Enhancement Mode
6
+
7
+ ## Introduction
8
+
9
+ **Note: The current year is 2026.** Use this when searching for recent documentation and best practices.
10
+
11
+ This command takes an existing plan (from `/plan`) and enhances each section with parallel research agents. Each major element gets its own dedicated research sub-agent to find:
12
+ - Best practices and industry patterns
13
+ - Performance optimizations
14
+ - UI/UX improvements (if applicable)
15
+ - Quality enhancements and edge cases
16
+ - Real-world implementation examples
17
+
18
+ The result is a deeply grounded, production-ready plan with concrete implementation details.
19
+
20
+ ## Phase 1: Setup
21
+
22
+ <plan_path> #$ARGUMENTS </plan_path>
23
+
24
+ **Validation Step:**
25
+ 1. **Analyze Input:**
26
+ - If `<plan_path>` is provided, check if it points to a file OR if the user is referring to the current artifact.
27
+ - If `<plan_path>` is EMPTY, perform a sequential check:
28
+
29
+ **A. Check Active Context (Priority):**
30
+ - Check your conversation metadata for an active `implementation_plan` artifact.
31
+ - If found, **extract its ABSOLUTE FILE PATH** (from your system metadata/reminders) and use that specifically as the `<plan_path>`.
32
+ - **IMPORTANT:** If using an artifact, you may proceed without explicit file paths in typical arguments, as long as tools know where to look.
33
+
34
+ **B. Search Local Files:**
35
+ - If no active artifact is found, run: `find . -maxdepth 3 -name "*plan*.md" -not -path "*/.*"`
36
+
37
+ 2. **User Interaction:**
38
+ - If you are using an **Active Plan Artifact**, log this action in your internal thought process or Task Status, but **DO NOT stop to notify the user**. Proceed immediately to Phase 2.
39
+ - If you found local files, list them and ask: "Which of these plans would you like to deepen?"
40
+ - If nothing is found, ask for the plan content or path manually.
41
+
42
+ 3. **Critical Check:**
43
+ - Ensure you have a valid path (artifact path or local file path) to read the plan from.
44
+
45
+ ## Phase 2: Research Execution
46
+
47
+ ### Execute Research Phase
48
+
49
+ Call `/deepen-plan-research` with the argument `<plan_path>`.
50
+
51
+ *Wait for the research phase to complete.*
52
+
53
+ ## Phase 3: Synthesis Execution
54
+
55
+ ### Execute Synthesis Phase
56
+
57
+ Call `/deepen-plan-synthesis` with the argument `<plan_path>`.
58
+
59
+ *Wait for the synthesis phase to complete.*
60
+
61
+ ## Phase 4: Post-Enhancement Options
62
+
63
+ After writing the enhanced plan, use the **workflows:ask-user-question** to present these options:
64
+
65
+ **Question:** "Plan deepened at `[plan_path]`. What would you like to do next?"
66
+
67
+ **Options:**
68
+ 1. **View diff** - Show what was added/changed
69
+ 2. **Run `/plan-review`** - Get feedback from reviewers on enhanced plan
70
+ 3. **Start `/work`** - Begin implementing this enhanced plan
71
+ 4. **Deepen further** - Run another round of research on specific sections
72
+ 5. **Revert** - Restore original plan (if backup exists)
73
+
74
+ Based on selection:
75
+ - **View diff** → Run `git diff [plan_path]` or show before/after
76
+ - **`/plan-review`** → Call the /plan-review command with the plan file path
77
+ - **`/work`** → Call the /work command with the plan file path
78
+ - **Deepen further** → Ask which sections need more research, then re-run those agents
79
+ - **Revert** → Restore from git or backup
@@ -0,0 +1,342 @@
1
+ ---
2
+ name: feature-video
3
+ description: Record a video walkthrough of a feature and add it to the PR description
4
+ argument-hint: "[PR number or 'current'] [optional: base URL, default localhost:3000]"
5
+ ---
6
+
7
+ # Feature Video Walkthrough
8
+
9
+ <command_purpose>Record a video walkthrough demonstrating a feature, upload it, and add it to the PR description.</command_purpose>
10
+
11
+ ## Introduction
12
+
13
+ <role>Developer Relations Engineer creating feature demo videos</role>
14
+
15
+ This command creates professional video walkthroughs of features for PR documentation:
16
+ - Records browser interactions using agent-browser CLI
17
+ - Demonstrates the complete user flow
18
+ - Uploads the video for easy sharing
19
+ - Updates the PR description with an embedded video
20
+
21
+ ## Prerequisites
22
+
23
+ <requirements>
24
+ - Local development server running (e.g., `bin/dev`, `rails server`)
25
+ - agent-browser CLI installed
26
+ - Git repository with a PR to document
27
+ - `ffmpeg` installed (for video conversion)
28
+ - `rclone` configured (optional, for cloud upload - see rclone skill)
29
+ </requirements>
30
+
31
+ ## Setup
32
+
33
+ **Check installation:**
34
+ ```bash
35
+ command -v agent-browser >/dev/null 2>&1 && echo "Installed" || echo "NOT INSTALLED"
36
+ ```
37
+
38
+ **Install if needed:**
39
+ ```bash
40
+ npm install -g agent-browser && agent-browser install
41
+ ```
42
+
43
+ See the `agent-browser` skill for detailed usage.
44
+
45
+ ## Main Tasks
46
+
47
+ ### 1. Parse Arguments
48
+
49
+ <parse_args>
50
+
51
+ **Arguments:** $ARGUMENTS
52
+
53
+ Parse the input:
54
+ - First argument: PR number or "current" (defaults to current branch's PR)
55
+ - Second argument: Base URL (defaults to `http://localhost:3000`)
56
+
57
+ ```bash
58
+ # Get PR number for current branch if needed
59
+ gh pr view --json number -q '.number'
60
+ ```
61
+
62
+ </parse_args>
63
+
64
+ ### 2. Gather Feature Context
65
+
66
+ <gather_context>
67
+
68
+ **Get PR details:**
69
+ ```bash
70
+ gh pr view [number] --json title,body,files,headRefName -q '.'
71
+ ```
72
+
73
+ **Get changed files:**
74
+ ```bash
75
+ gh pr view [number] --json files -q '.files[].path'
76
+ ```
77
+
78
+ **Map files to testable routes** (same as test-browser):
79
+
80
+ | File Pattern | Route(s) |
81
+ |-------------|----------|
82
+ | `app/views/users/*` | `/users`, `/users/:id`, `/users/new` |
83
+ | `app/controllers/settings_controller.rb` | `/settings` |
84
+ | `app/javascript/controllers/*_controller.js` | Pages using that Stimulus controller |
85
+ | `app/components/*_component.rb` | Pages rendering that component |
86
+
87
+ </gather_context>
88
+
89
+ ### 3. Plan the Video Flow
90
+
91
+ <plan_flow>
92
+
93
+ Before recording, create a shot list:
94
+
95
+ 1. **Opening shot**: Homepage or starting point (2-3 seconds)
96
+ 2. **Navigation**: How user gets to the feature
97
+ 3. **Feature demonstration**: Core functionality (main focus)
98
+ 4. **Edge cases**: Error states, validation, etc. (if applicable)
99
+ 5. **Success state**: Completed action/result
100
+
101
+ Ask user to confirm or adjust the flow:
102
+
103
+ ```markdown
104
+ **Proposed Video Flow**
105
+
106
+ Based on PR #[number]: [title]
107
+
108
+ 1. Start at: /[starting-route]
109
+ 2. Navigate to: /[feature-route]
110
+ 3. Demonstrate:
111
+ - [Action 1]
112
+ - [Action 2]
113
+ - [Action 3]
114
+ 4. Show result: [success state]
115
+
116
+ Estimated duration: ~[X] seconds
117
+
118
+ Does this look right?
119
+ 1. Yes, start recording
120
+ 2. Modify the flow (describe changes)
121
+ 3. Add specific interactions to demonstrate
122
+ ```
123
+
124
+ </plan_flow>
125
+
126
+ ### 4. Setup Video Recording
127
+
128
+ <setup_recording>
129
+
130
+ **Create videos directory:**
131
+ ```bash
132
+ mkdir -p tmp/videos
133
+ ```
134
+
135
+ **Recording approach: Use browser screenshots as frames**
136
+
137
+ agent-browser captures screenshots at key moments, then combine into video using ffmpeg:
138
+
139
+ ```bash
140
+ ffmpeg -framerate 2 -pattern_type glob -i 'tmp/screenshots/*.png' -vf "scale=1280:-1" tmp/videos/feature-demo.gif
141
+ ```
142
+
143
+ </setup_recording>
144
+
145
+ ### 5. Record the Walkthrough
146
+
147
+ <record_walkthrough>
148
+
149
+ Execute the planned flow, capturing each step:
150
+
151
+ **Step 1: Navigate to starting point**
152
+ ```bash
153
+ agent-browser open "[base-url]/[start-route]"
154
+ agent-browser wait 2000
155
+ agent-browser screenshot tmp/screenshots/01-start.png
156
+ ```
157
+
158
+ **Step 2: Perform navigation/interactions**
159
+ ```bash
160
+ agent-browser snapshot -i # Get refs
161
+ agent-browser click @e1 # Click navigation element
162
+ agent-browser wait 1000
163
+ agent-browser screenshot tmp/screenshots/02-navigate.png
164
+ ```
165
+
166
+ **Step 3: Demonstrate feature**
167
+ ```bash
168
+ agent-browser snapshot -i # Get refs for feature elements
169
+ agent-browser click @e2 # Click feature element
170
+ agent-browser wait 1000
171
+ agent-browser screenshot tmp/screenshots/03-feature.png
172
+ ```
173
+
174
+ **Step 4: Capture result**
175
+ ```bash
176
+ agent-browser wait 2000
177
+ agent-browser screenshot tmp/screenshots/04-result.png
178
+ ```
179
+
180
+ **Create video/GIF from screenshots:**
181
+
182
+ ```bash
183
+ # Create directories
184
+ mkdir -p tmp/videos tmp/screenshots
185
+
186
+ # Create MP4 video (RECOMMENDED - better quality, smaller size)
187
+ # -framerate 0.5 = 2 seconds per frame (slower playback)
188
+ # -framerate 1 = 1 second per frame
189
+ ffmpeg -y -framerate 0.5 -pattern_type glob -i 'tmp/screenshots/*.png' \
190
+ -c:v libx264 -pix_fmt yuv420p -vf "scale=1280:-2" \
191
+ tmp/videos/feature-demo.mp4
192
+
193
+ # Create low-quality GIF for preview (small file, for GitHub embed)
194
+ ffmpeg -y -framerate 0.5 -pattern_type glob -i 'tmp/screenshots/*.png' \
195
+ -vf "scale=640:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=128[p];[s1][p]paletteuse" \
196
+ -loop 0 tmp/videos/feature-demo-preview.gif
197
+ ```
198
+
199
+ **Note:**
200
+ - The `-2` in MP4 scale ensures height is divisible by 2 (required for H.264)
201
+ - Preview GIF uses 640px width and 128 colors to keep file size small (~100-200KB)
202
+
203
+ </record_walkthrough>
204
+
205
+ ### 6. Upload the Video
206
+
207
+ <upload_video>
208
+
209
+ **Upload with rclone:**
210
+
211
+ ```bash
212
+ # Check rclone is configured
213
+ rclone listremotes
214
+
215
+ # Upload video, preview GIF, and screenshots to cloud storage
216
+ # Use --s3-no-check-bucket to avoid permission errors
217
+ rclone copy tmp/videos/ r2:kieran-claude/pr-videos/pr-[number]/ --s3-no-check-bucket --progress
218
+ rclone copy tmp/screenshots/ r2:kieran-claude/pr-videos/pr-[number]/screenshots/ --s3-no-check-bucket --progress
219
+
220
+ # List uploaded files
221
+ rclone ls r2:kieran-claude/pr-videos/pr-[number]/
222
+ ```
223
+
224
+ Public URLs (R2 with public access):
225
+ ```
226
+ Video: https://pub-4047722ebb1b4b09853f24d3b61467f1.r2.dev/pr-videos/pr-[number]/feature-demo.mp4
227
+ Preview: https://pub-4047722ebb1b4b09853f24d3b61467f1.r2.dev/pr-videos/pr-[number]/feature-demo-preview.gif
228
+ ```
229
+
230
+ </upload_video>
231
+
232
+ ### 7. Update PR Description
233
+
234
+ <update_pr>
235
+
236
+ **Get current PR body:**
237
+ ```bash
238
+ gh pr view [number] --json body -q '.body'
239
+ ```
240
+
241
+ **Add video section to PR description:**
242
+
243
+ If the PR already has a video section, replace it. Otherwise, append:
244
+
245
+ **IMPORTANT:** GitHub cannot embed external MP4s directly. Use a clickable GIF that links to the video:
246
+
247
+ ```markdown
248
+ ## Demo
249
+
250
+ [![Feature Demo]([preview-gif-url])]([video-mp4-url])
251
+
252
+ *Click to view full video*
253
+ ```
254
+
255
+ Example:
256
+ ```markdown
257
+ [![Feature Demo](https://pub-4047722ebb1b4b09853f24d3b61467f1.r2.dev/pr-videos/pr-137/feature-demo-preview.gif)](https://pub-4047722ebb1b4b09853f24d3b61467f1.r2.dev/pr-videos/pr-137/feature-demo.mp4)
258
+ ```
259
+
260
+ **Update the PR:**
261
+ ```bash
262
+ gh pr edit [number] --body "[updated body with video section]"
263
+ ```
264
+
265
+ **Or add as a comment if preferred:**
266
+ ```bash
267
+ gh pr comment [number] --body "## Feature Demo
268
+
269
+ ![Demo]([video-url])
270
+
271
+ _Automated walkthrough of the changes in this PR_"
272
+ ```
273
+
274
+ </update_pr>
275
+
276
+ ### 8. Cleanup
277
+
278
+ <cleanup>
279
+
280
+ ```bash
281
+ # Optional: Clean up screenshots
282
+ rm -rf tmp/screenshots
283
+
284
+ # Keep videos for reference
285
+ echo "Video retained at: tmp/videos/feature-demo.gif"
286
+ ```
287
+
288
+ </cleanup>
289
+
290
+ ### 9. Summary
291
+
292
+ <summary>
293
+
294
+ Present completion summary:
295
+
296
+ ```markdown
297
+ ## Feature Video Complete
298
+
299
+ **PR:** #[number] - [title]
300
+ **Video:** [url or local path]
301
+ **Duration:** ~[X] seconds
302
+ **Format:** [GIF/MP4]
303
+
304
+ ### Shots Captured
305
+ 1. [Starting point] - [description]
306
+ 2. [Navigation] - [description]
307
+ 3. [Feature demo] - [description]
308
+ 4. [Result] - [description]
309
+
310
+ ### PR Updated
311
+ - [x] Video section added to PR description
312
+ - [ ] Ready for review
313
+
314
+ **Next steps:**
315
+ - Review the video to ensure it accurately demonstrates the feature
316
+ - Share with reviewers for context
317
+ ```
318
+
319
+ </summary>
320
+
321
+ ## Quick Usage Examples
322
+
323
+ ```bash
324
+ # Record video for current branch's PR
325
+ /feature-video
326
+
327
+ # Record video for specific PR
328
+ /feature-video 847
329
+
330
+ # Record with custom base URL
331
+ /feature-video 847 http://localhost:5000
332
+
333
+ # Record for staging environment
334
+ /feature-video current https://staging.example.com
335
+ ```
336
+
337
+ ## Tips
338
+
339
+ - **Keep it short**: 10-30 seconds is ideal for PR demos
340
+ - **Focus on the change**: Don't include unrelated UI
341
+ - **Show before/after**: If fixing a bug, show the broken state first (if possible)
342
+ - **Annotate if needed**: Add text overlays for complex features