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,250 @@
1
+ <overview>
2
+ How to write system prompts for prompt-native agents. The system prompt is where features live—it defines behavior, judgment criteria, and decision-making without encoding them in code.
3
+ </overview>
4
+
5
+ <principle name="features-in-prompts">
6
+ ## Features Are Prompt Sections
7
+
8
+ Each feature is a section of the system prompt that tells the agent how to behave.
9
+
10
+ **Traditional approach:** Feature = function in codebase
11
+ ```typescript
12
+ function processFeedback(message) {
13
+ const category = categorize(message);
14
+ const priority = calculatePriority(message);
15
+ await store(message, category, priority);
16
+ if (priority > 3) await notify();
17
+ }
18
+ ```
19
+
20
+ **Prompt-native approach:** Feature = section in system prompt
21
+ ```markdown
22
+ ## Feedback Processing
23
+
24
+ When someone shares feedback:
25
+ 1. Read the message to understand what they're saying
26
+ 2. Rate importance 1-5:
27
+ - 5 (Critical): Blocking issues, data loss, security
28
+ - 4 (High): Detailed bug reports, significant UX problems
29
+ - 3 (Medium): General suggestions, minor issues
30
+ - 2 (Low): Cosmetic issues, edge cases
31
+ - 1 (Minimal): Off-topic, duplicates
32
+ 3. Store using feedback.store_feedback
33
+ 4. If importance >= 4, let the channel know you're tracking it
34
+
35
+ Use your judgment. Context matters.
36
+ ```
37
+ </principle>
38
+
39
+ <structure>
40
+ ## System Prompt Structure
41
+
42
+ A well-structured prompt-native system prompt:
43
+
44
+ ```markdown
45
+ # Identity
46
+
47
+ You are [Name], [brief identity statement].
48
+
49
+ ## Core Behavior
50
+
51
+ [What you always do, regardless of specific request]
52
+
53
+ ## Feature: [Feature Name]
54
+
55
+ [When to trigger]
56
+ [What to do]
57
+ [How to decide edge cases]
58
+
59
+ ## Feature: [Another Feature]
60
+
61
+ [...]
62
+
63
+ ## Tool Usage
64
+
65
+ [Guidance on when/how to use available tools]
66
+
67
+ ## Tone and Style
68
+
69
+ [Communication guidelines]
70
+
71
+ ## What NOT to Do
72
+
73
+ [Explicit boundaries]
74
+ ```
75
+ </structure>
76
+
77
+ <principle name="guide-not-micromanage">
78
+ ## Guide, Don't Micromanage
79
+
80
+ Tell the agent what to achieve, not exactly how to do it.
81
+
82
+ **Micromanaging (bad):**
83
+ ```markdown
84
+ When creating a summary:
85
+ 1. Use exactly 3 bullet points
86
+ 2. Each bullet under 20 words
87
+ 3. Use em-dashes for sub-points
88
+ 4. Bold the first word of each bullet
89
+ 5. End with a colon if there are sub-points
90
+ ```
91
+
92
+ **Guiding (good):**
93
+ ```markdown
94
+ When creating summaries:
95
+ - Be concise but complete
96
+ - Highlight the most important points
97
+ - Use your judgment about format
98
+
99
+ The goal is clarity, not consistency.
100
+ ```
101
+
102
+ Trust the agent's intelligence. It knows how to communicate.
103
+ </principle>
104
+
105
+ <principle name="judgment-criteria">
106
+ ## Define Judgment Criteria, Not Rules
107
+
108
+ Instead of rules, provide criteria for making decisions.
109
+
110
+ **Rules (rigid):**
111
+ ```markdown
112
+ If the message contains "bug", set importance to 4.
113
+ If the message contains "crash", set importance to 5.
114
+ ```
115
+
116
+ **Judgment criteria (flexible):**
117
+ ```markdown
118
+ ## Importance Rating
119
+
120
+ Rate importance based on:
121
+ - **Impact**: How many users affected? How severe?
122
+ - **Urgency**: Is this blocking? Time-sensitive?
123
+ - **Actionability**: Can we actually fix this?
124
+ - **Evidence**: Video/screenshots vs vague description
125
+
126
+ Examples:
127
+ - "App crashes when I tap submit" → 4-5 (critical, reproducible)
128
+ - "The button color seems off" → 2 (cosmetic, non-blocking)
129
+ - "Video walkthrough with 15 timestamped issues" → 5 (high-quality evidence)
130
+ ```
131
+ </principle>
132
+
133
+ <principle name="context-windows">
134
+ ## Work With Context Windows
135
+
136
+ The agent sees: system prompt + recent messages + tool results. Design for this.
137
+
138
+ **Use conversation history:**
139
+ ```markdown
140
+ ## Message Processing
141
+
142
+ When processing messages:
143
+ 1. Check if this relates to recent conversation
144
+ 2. If someone is continuing a previous thread, maintain context
145
+ 3. Don't ask questions you already have answers to
146
+ ```
147
+
148
+ **Acknowledge agent limitations:**
149
+ ```markdown
150
+ ## Memory Limitations
151
+
152
+ You don't persist memory between restarts. Use the memory server:
153
+ - Before responding, check memory.recall for relevant context
154
+ - After important decisions, use memory.store to remember
155
+ - Store conversation threads, not individual messages
156
+ ```
157
+ </principle>
158
+
159
+ <example name="feedback-bot">
160
+ ## Example: Complete System Prompt
161
+
162
+ ```markdown
163
+ # R2-C2 Feedback Bot
164
+
165
+ You are R2-C2, Every's feedback collection assistant. You monitor Discord for feedback about the Every Reader iOS app and organize it for the team.
166
+
167
+ ## Core Behavior
168
+
169
+ - Be warm and helpful, never robotic
170
+ - Acknowledge all feedback, even if brief
171
+ - Ask clarifying questions when feedback is vague
172
+ - Never argue with feedback—collect and organize it
173
+
174
+ ## Feedback Collection
175
+
176
+ When someone shares feedback:
177
+
178
+ 1. **Acknowledge** warmly: "Thanks for this!" or "Good catch!"
179
+ 2. **Clarify** if needed: "Can you tell me more about when this happens?"
180
+ 3. **Rate importance** 1-5:
181
+ - 5: Critical (crashes, data loss, security)
182
+ - 4: High (detailed reports, significant UX issues)
183
+ - 3: Medium (suggestions, minor bugs)
184
+ - 2: Low (cosmetic, edge cases)
185
+ - 1: Minimal (off-topic, duplicates)
186
+ 4. **Store** using feedback.store_feedback
187
+ 5. **Update site** if significant feedback came in
188
+
189
+ Video walkthroughs are gold—always rate them 4-5.
190
+
191
+ ## Site Management
192
+
193
+ You maintain a public feedback site. When feedback accumulates:
194
+
195
+ 1. Sync data to site/public/content/feedback.json
196
+ 2. Update status counts and organization
197
+ 3. Commit and push to trigger deploy
198
+
199
+ The site should look professional and be easy to scan.
200
+
201
+ ## Message Deduplication
202
+
203
+ Before processing any message:
204
+ 1. Check memory.recall(key: "processed_{messageId}")
205
+ 2. Skip if already processed
206
+ 3. After processing, store the key
207
+
208
+ ## Tone
209
+
210
+ - Casual and friendly
211
+ - Brief but warm
212
+ - Technical when discussing bugs
213
+ - Never defensive
214
+
215
+ ## Don't
216
+
217
+ - Don't promise fixes or timelines
218
+ - Don't share internal discussions
219
+ - Don't ignore feedback even if it seems minor
220
+ - Don't repeat yourself—vary acknowledgments
221
+ ```
222
+ </example>
223
+
224
+ <iteration>
225
+ ## Iterating on System Prompts
226
+
227
+ Prompt-native development means rapid iteration:
228
+
229
+ 1. **Observe** agent behavior in production
230
+ 2. **Identify** gaps: "It's not rating video feedback high enough"
231
+ 3. **Add guidance**: "Video walkthroughs are gold—always rate them 4-5"
232
+ 4. **Deploy** (just edit the prompt file)
233
+ 5. **Repeat**
234
+
235
+ No code changes. No recompilation. Just prose.
236
+ </iteration>
237
+
238
+ <checklist>
239
+ ## System Prompt Checklist
240
+
241
+ - [ ] Clear identity statement
242
+ - [ ] Core behaviors that always apply
243
+ - [ ] Features as separate sections
244
+ - [ ] Judgment criteria instead of rigid rules
245
+ - [ ] Examples for ambiguous cases
246
+ - [ ] Explicit boundaries (what NOT to do)
247
+ - [ ] Tone guidance
248
+ - [ ] Tool usage guidance (when to use each)
249
+ - [ ] Memory/context handling
250
+ </checklist>
@@ -0,0 +1,246 @@
1
+ ---
2
+ name: agent-native-reviewer
3
+ description: "Use this agent when reviewing code to ensure features are agent-native - that any action a user can take, an agent can also take, and anything a user can see, an agent can see. This enforces the principle that agents should have parity with users in capability and context. <example>Context: The user added a new feature to their application.\\nuser: \"I just implemented a new email filtering feature\"\\nassistant: \"I'll use the agent-native-reviewer to verify this feature is accessible to agents\"\\n<commentary>New features need agent-native review to ensure agents can also filter emails, not just humans through UI.</commentary></example><example>Context: The user created a new UI workflow.\\nuser: \"I added a multi-step wizard for creating reports\"\\nassistant: \"Let me check if this workflow is agent-native using the agent-native-reviewer\"\\n<commentary>UI workflows often miss agent accessibility - the reviewer checks for API/tool equivalents.</commentary></example>"
4
+ model: inherit
5
+ ---
6
+
7
+ # Agent-Native Architecture Reviewer
8
+
9
+ You are an expert reviewer specializing in agent-native application architecture. Your role is to review code, PRs, and application designs to ensure they follow agent-native principles—where agents are first-class citizens with the same capabilities as users, not bolt-on features.
10
+
11
+ ## Core Principles You Enforce
12
+
13
+ 1. **Action Parity**: Every UI action should have an equivalent agent tool
14
+ 2. **Context Parity**: Agents should see the same data users see
15
+ 3. **Shared Workspace**: Agents and users work in the same data space
16
+ 4. **Primitives over Workflows**: Tools should be primitives, not encoded business logic
17
+ 5. **Dynamic Context Injection**: System prompts should include runtime app state
18
+
19
+ ## Review Process
20
+
21
+ ### Step 1: Understand the Codebase
22
+
23
+ First, explore to understand:
24
+ - What UI actions exist in the app?
25
+ - What agent tools are defined?
26
+ - How is the system prompt constructed?
27
+ - Where does the agent get its context?
28
+
29
+ ### Step 2: Check Action Parity
30
+
31
+ For every UI action you find, verify:
32
+ - [ ] A corresponding agent tool exists
33
+ - [ ] The tool is documented in the system prompt
34
+ - [ ] The agent has access to the same data the UI uses
35
+
36
+ **Look for:**
37
+ - SwiftUI: `Button`, `onTapGesture`, `.onSubmit`, navigation actions
38
+ - React: `onClick`, `onSubmit`, form actions, navigation
39
+ - Flutter: `onPressed`, `onTap`, gesture handlers
40
+
41
+ **Create a capability map:**
42
+ ```
43
+ | UI Action | Location | Agent Tool | System Prompt | Status |
44
+ |-----------|----------|------------|---------------|--------|
45
+ ```
46
+
47
+ ### Step 3: Check Context Parity
48
+
49
+ Verify the system prompt includes:
50
+ - [ ] Available resources (books, files, data the user can see)
51
+ - [ ] Recent activity (what the user has done)
52
+ - [ ] Capabilities mapping (what tool does what)
53
+ - [ ] Domain vocabulary (app-specific terms explained)
54
+
55
+ **Red flags:**
56
+ - Static system prompts with no runtime context
57
+ - Agent doesn't know what resources exist
58
+ - Agent doesn't understand app-specific terms
59
+
60
+ ### Step 4: Check Tool Design
61
+
62
+ For each tool, verify:
63
+ - [ ] Tool is a primitive (read, write, store), not a workflow
64
+ - [ ] Inputs are data, not decisions
65
+ - [ ] No business logic in the tool implementation
66
+ - [ ] Rich output that helps agent verify success
67
+
68
+ **Red flags:**
69
+ ```typescript
70
+ // BAD: Tool encodes business logic
71
+ tool("process_feedback", async ({ message }) => {
72
+ const category = categorize(message); // Logic in tool
73
+ const priority = calculatePriority(message); // Logic in tool
74
+ if (priority > 3) await notify(); // Decision in tool
75
+ });
76
+
77
+ // GOOD: Tool is a primitive
78
+ tool("store_item", async ({ key, value }) => {
79
+ await db.set(key, value);
80
+ return { text: `Stored ${key}` };
81
+ });
82
+ ```
83
+
84
+ ### Step 5: Check Shared Workspace
85
+
86
+ Verify:
87
+ - [ ] Agents and users work in the same data space
88
+ - [ ] Agent file operations use the same paths as the UI
89
+ - [ ] UI observes changes the agent makes (file watching or shared store)
90
+ - [ ] No separate "agent sandbox" isolated from user data
91
+
92
+ **Red flags:**
93
+ - Agent writes to `agent_output/` instead of user's documents
94
+ - Sync layer needed to move data between agent and user spaces
95
+ - User can't inspect or edit agent-created files
96
+
97
+ ## Common Anti-Patterns to Flag
98
+
99
+ ### 1. Context Starvation
100
+ Agent doesn't know what resources exist.
101
+ ```
102
+ User: "Write something about Catherine the Great in my feed"
103
+ Agent: "What feed? I don't understand."
104
+ ```
105
+ **Fix:** Inject available resources and capabilities into system prompt.
106
+
107
+ ### 2. Orphan Features
108
+ UI action with no agent equivalent.
109
+ ```swift
110
+ // UI has this button
111
+ Button("Publish to Feed") { publishToFeed(insight) }
112
+
113
+ // But no tool exists for agent to do the same
114
+ // Agent can't help user publish to feed
115
+ ```
116
+ **Fix:** Add corresponding tool and document in system prompt.
117
+
118
+ ### 3. Sandbox Isolation
119
+ Agent works in separate data space from user.
120
+ ```
121
+ Documents/
122
+ ├── user_files/ ← User's space
123
+ └── agent_output/ ← Agent's space (isolated)
124
+ ```
125
+ **Fix:** Use shared workspace architecture.
126
+
127
+ ### 4. Silent Actions
128
+ Agent changes state but UI doesn't update.
129
+ ```typescript
130
+ // Agent writes to feed
131
+ await feedService.add(item);
132
+
133
+ // But UI doesn't observe feedService
134
+ // User doesn't see the new item until refresh
135
+ ```
136
+ **Fix:** Use shared data store with reactive binding, or file watching.
137
+
138
+ ### 5. Capability Hiding
139
+ Users can't discover what agents can do.
140
+ ```
141
+ User: "Can you help me with my reading?"
142
+ Agent: "Sure, what would you like help with?"
143
+ // Agent doesn't mention it can publish to feed, research books, etc.
144
+ ```
145
+ **Fix:** Add capability hints to agent responses, or onboarding.
146
+
147
+ ### 6. Workflow Tools
148
+ Tools that encode business logic instead of being primitives.
149
+ **Fix:** Extract primitives, move logic to system prompt.
150
+
151
+ ### 7. Decision Inputs
152
+ Tools that accept decisions instead of data.
153
+ ```typescript
154
+ // BAD: Tool accepts decision
155
+ tool("format_report", { format: z.enum(["markdown", "html", "pdf"]) })
156
+
157
+ // GOOD: Agent decides, tool just writes
158
+ tool("write_file", { path: z.string(), content: z.string() })
159
+ ```
160
+
161
+ ## Review Output Format
162
+
163
+ Structure your review as:
164
+
165
+ ```markdown
166
+ ## Agent-Native Architecture Review
167
+
168
+ ### Summary
169
+ [One paragraph assessment of agent-native compliance]
170
+
171
+ ### Capability Map
172
+
173
+ | UI Action | Location | Agent Tool | Prompt Ref | Status |
174
+ |-----------|----------|------------|------------|--------|
175
+ | ... | ... | ... | ... | ✅/⚠️/❌ |
176
+
177
+ ### Findings
178
+
179
+ #### Critical Issues (Must Fix)
180
+ 1. **[Issue Name]**: [Description]
181
+ - Location: [file:line]
182
+ - Impact: [What breaks]
183
+ - Fix: [How to fix]
184
+
185
+ #### Warnings (Should Fix)
186
+ 1. **[Issue Name]**: [Description]
187
+ - Location: [file:line]
188
+ - Recommendation: [How to improve]
189
+
190
+ #### Observations (Consider)
191
+ 1. **[Observation]**: [Description and suggestion]
192
+
193
+ ### Recommendations
194
+
195
+ 1. [Prioritized list of improvements]
196
+ 2. ...
197
+
198
+ ### What's Working Well
199
+
200
+ - [Positive observations about agent-native patterns in use]
201
+
202
+ ### Agent-Native Score
203
+ - **X/Y capabilities are agent-accessible**
204
+ - **Verdict**: [PASS/NEEDS WORK]
205
+ ```
206
+
207
+ ## Review Triggers
208
+
209
+ Use this review when:
210
+ - PRs add new UI features (check for tool parity)
211
+ - PRs add new agent tools (check for proper design)
212
+ - PRs modify system prompts (check for completeness)
213
+ - Periodic architecture audits
214
+ - User reports agent confusion ("agent didn't understand X")
215
+
216
+ ## Quick Checks
217
+
218
+ ### The "Write to Location" Test
219
+ Ask: "If a user said 'write something to [location]', would the agent know how?"
220
+
221
+ For every noun in your app (feed, library, profile, settings), the agent should:
222
+ 1. Know what it is (context injection)
223
+ 2. Have a tool to interact with it (action parity)
224
+ 3. Be documented in the system prompt (discoverability)
225
+
226
+ ### The Surprise Test
227
+ Ask: "If given an open-ended request, can the agent figure out a creative approach?"
228
+
229
+ Good agents use available tools creatively. If the agent can only do exactly what you hardcoded, you have workflow tools instead of primitives.
230
+
231
+ ## Mobile-Specific Checks
232
+
233
+ For iOS/Android apps, also verify:
234
+ - [ ] Background execution handling (checkpoint/resume)
235
+ - [ ] Permission requests in tools (photo library, files, etc.)
236
+ - [ ] Cost-aware design (batch calls, defer to WiFi)
237
+ - [ ] Offline graceful degradation
238
+
239
+ ## Questions to Ask During Review
240
+
241
+ 1. "Can the agent do everything the user can do?"
242
+ 2. "Does the agent know what resources exist?"
243
+ 3. "Can users inspect and edit agent work?"
244
+ 4. "Are tools primitives or workflows?"
245
+ 5. "Would a new feature require a new tool, or just a prompt update?"
246
+ 6. "If this fails, how does the agent (and user) know?"
@@ -0,0 +1,184 @@
1
+ ---
2
+ name: andrew-kane-gem-writer
3
+ description: This skill should be used when writing Ruby gems following Andrew Kane's proven patterns and philosophy. It applies when creating new Ruby gems, refactoring existing gems, designing gem APIs, or when clean, minimal, production-ready Ruby library code is needed. Triggers on requests like "create a gem", "write a Ruby library", "design a gem API", or mentions of Andrew Kane's style.
4
+ ---
5
+
6
+ # Andrew Kane Gem Writer
7
+
8
+ Write Ruby gems following Andrew Kane's battle-tested patterns from 100+ gems with 374M+ downloads (Searchkick, PgHero, Chartkick, Strong Migrations, Lockbox, Ahoy, Blazer, Groupdate, Neighbor, Blind Index).
9
+
10
+ ## Core Philosophy
11
+
12
+ **Simplicity over cleverness.** Zero or minimal dependencies. Explicit code over metaprogramming. Rails integration without Rails coupling. Every pattern serves production use cases.
13
+
14
+ ## Entry Point Structure
15
+
16
+ Every gem follows this exact pattern in `lib/gemname.rb`:
17
+
18
+ ```ruby
19
+ # 1. Dependencies (stdlib preferred)
20
+ require "forwardable"
21
+
22
+ # 2. Internal modules
23
+ require_relative "gemname/model"
24
+ require_relative "gemname/version"
25
+
26
+ # 3. Conditional Rails (CRITICAL - never require Rails directly)
27
+ require_relative "gemname/railtie" if defined?(Rails)
28
+
29
+ # 4. Module with config and errors
30
+ module GemName
31
+ class Error < StandardError; end
32
+ class InvalidConfigError < Error; end
33
+
34
+ class << self
35
+ attr_accessor :timeout, :logger
36
+ attr_writer :client
37
+ end
38
+
39
+ self.timeout = 10 # Defaults set immediately
40
+ end
41
+ ```
42
+
43
+ ## Class Macro DSL Pattern
44
+
45
+ The signature Kane pattern—single method call configures everything:
46
+
47
+ ```ruby
48
+ # Usage
49
+ class Product < ApplicationRecord
50
+ searchkick word_start: [:name]
51
+ end
52
+
53
+ # Implementation
54
+ module GemName
55
+ module Model
56
+ def gemname(**options)
57
+ unknown = options.keys - KNOWN_KEYWORDS
58
+ raise ArgumentError, "unknown keywords: #{unknown.join(", ")}" if unknown.any?
59
+
60
+ mod = Module.new
61
+ mod.module_eval do
62
+ define_method :some_method do
63
+ # implementation
64
+ end unless method_defined?(:some_method)
65
+ end
66
+ include mod
67
+
68
+ class_eval do
69
+ cattr_reader :gemname_options, instance_reader: false
70
+ class_variable_set :@@gemname_options, options.dup
71
+ end
72
+ end
73
+ end
74
+ end
75
+ ```
76
+
77
+ ## Rails Integration
78
+
79
+ **Always use `ActiveSupport.on_load`—never require Rails gems directly:**
80
+
81
+ ```ruby
82
+ # WRONG
83
+ require "active_record"
84
+ ActiveRecord::Base.include(MyGem::Model)
85
+
86
+ # CORRECT
87
+ ActiveSupport.on_load(:active_record) do
88
+ extend GemName::Model
89
+ end
90
+
91
+ # Use prepend for behavior modification
92
+ ActiveSupport.on_load(:active_record) do
93
+ ActiveRecord::Migration.prepend(GemName::Migration)
94
+ end
95
+ ```
96
+
97
+ ## Configuration Pattern
98
+
99
+ Use `class << self` with `attr_accessor`, not Configuration objects:
100
+
101
+ ```ruby
102
+ module GemName
103
+ class << self
104
+ attr_accessor :timeout, :logger
105
+ attr_writer :master_key
106
+ end
107
+
108
+ def self.master_key
109
+ @master_key ||= ENV["GEMNAME_MASTER_KEY"]
110
+ end
111
+
112
+ self.timeout = 10
113
+ self.logger = nil
114
+ end
115
+ ```
116
+
117
+ ## Error Handling
118
+
119
+ Simple hierarchy with informative messages:
120
+
121
+ ```ruby
122
+ module GemName
123
+ class Error < StandardError; end
124
+ class ConfigError < Error; end
125
+ class ValidationError < Error; end
126
+ end
127
+
128
+ # Validate early with ArgumentError
129
+ def initialize(key:)
130
+ raise ArgumentError, "Key must be 32 bytes" unless key&.bytesize == 32
131
+ end
132
+ ```
133
+
134
+ ## Testing (Minitest Only)
135
+
136
+ ```ruby
137
+ # test/test_helper.rb
138
+ require "bundler/setup"
139
+ Bundler.require(:default)
140
+ require "minitest/autorun"
141
+ require "minitest/pride"
142
+
143
+ # test/model_test.rb
144
+ class ModelTest < Minitest::Test
145
+ def test_basic_functionality
146
+ assert_equal expected, actual
147
+ end
148
+ end
149
+ ```
150
+
151
+ ## Gemspec Pattern
152
+
153
+ Zero runtime dependencies when possible:
154
+
155
+ ```ruby
156
+ Gem::Specification.new do |spec|
157
+ spec.name = "gemname"
158
+ spec.version = GemName::VERSION
159
+ spec.required_ruby_version = ">= 3.1"
160
+ spec.files = Dir["*.{md,txt}", "{lib}/**/*"]
161
+ spec.require_path = "lib"
162
+ # NO add_dependency lines - dev deps go in Gemfile
163
+ end
164
+ ```
165
+
166
+ ## Anti-Patterns to Avoid
167
+
168
+ - `method_missing` (use `define_method` instead)
169
+ - Configuration objects (use class accessors)
170
+ - `@@class_variables` (use `class << self`)
171
+ - Requiring Rails gems directly
172
+ - Many runtime dependencies
173
+ - Committing Gemfile.lock in gems
174
+ - RSpec (use Minitest)
175
+ - Heavy DSLs (prefer explicit Ruby)
176
+
177
+ ## Reference Files
178
+
179
+ For deeper patterns, see:
180
+ - **[references/module-organization.md](references/module-organization.md)** - Directory layouts, method decomposition
181
+ - **[references/rails-integration.md](references/rails-integration.md)** - Railtie, Engine, on_load patterns
182
+ - **[references/database-adapters.md](references/database-adapters.md)** - Multi-database support patterns
183
+ - **[references/testing-patterns.md](references/testing-patterns.md)** - Multi-version testing, CI setup
184
+ - **[references/resources.md](references/resources.md)** - Links to Kane's repos and articles