opencastle 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 (224) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +215 -0
  3. package/bin/cli.mjs +69 -0
  4. package/dist/cli/adapters/claude-code.d.ts +22 -0
  5. package/dist/cli/adapters/claude-code.d.ts.map +1 -0
  6. package/dist/cli/adapters/claude-code.js +237 -0
  7. package/dist/cli/adapters/claude-code.js.map +1 -0
  8. package/dist/cli/adapters/cursor.d.ts +20 -0
  9. package/dist/cli/adapters/cursor.d.ts.map +1 -0
  10. package/dist/cli/adapters/cursor.js +231 -0
  11. package/dist/cli/adapters/cursor.js.map +1 -0
  12. package/dist/cli/adapters/vscode.d.ts +20 -0
  13. package/dist/cli/adapters/vscode.d.ts.map +1 -0
  14. package/dist/cli/adapters/vscode.js +132 -0
  15. package/dist/cli/adapters/vscode.js.map +1 -0
  16. package/dist/cli/copy.d.ts +14 -0
  17. package/dist/cli/copy.d.ts.map +1 -0
  18. package/dist/cli/copy.js +62 -0
  19. package/dist/cli/copy.js.map +1 -0
  20. package/dist/cli/dashboard.d.ts +3 -0
  21. package/dist/cli/dashboard.d.ts.map +1 -0
  22. package/dist/cli/dashboard.js +183 -0
  23. package/dist/cli/dashboard.js.map +1 -0
  24. package/dist/cli/diff.d.ts +3 -0
  25. package/dist/cli/diff.d.ts.map +1 -0
  26. package/dist/cli/diff.js +27 -0
  27. package/dist/cli/diff.js.map +1 -0
  28. package/dist/cli/eject.d.ts +3 -0
  29. package/dist/cli/eject.d.ts.map +1 -0
  30. package/dist/cli/eject.js +27 -0
  31. package/dist/cli/eject.js.map +1 -0
  32. package/dist/cli/init.d.ts +3 -0
  33. package/dist/cli/init.d.ts.map +1 -0
  34. package/dist/cli/init.js +92 -0
  35. package/dist/cli/init.js.map +1 -0
  36. package/dist/cli/manifest.d.ts +14 -0
  37. package/dist/cli/manifest.d.ts.map +1 -0
  38. package/dist/cli/manifest.js +34 -0
  39. package/dist/cli/manifest.js.map +1 -0
  40. package/dist/cli/mcp.d.ts +14 -0
  41. package/dist/cli/mcp.d.ts.map +1 -0
  42. package/dist/cli/mcp.js +35 -0
  43. package/dist/cli/mcp.js.map +1 -0
  44. package/dist/cli/prompt.d.ts +12 -0
  45. package/dist/cli/prompt.d.ts.map +1 -0
  46. package/dist/cli/prompt.js +104 -0
  47. package/dist/cli/prompt.js.map +1 -0
  48. package/dist/cli/run/adapters/claude-code.d.ts +16 -0
  49. package/dist/cli/run/adapters/claude-code.d.ts.map +1 -0
  50. package/dist/cli/run/adapters/claude-code.js +82 -0
  51. package/dist/cli/run/adapters/claude-code.js.map +1 -0
  52. package/dist/cli/run/adapters/copilot.d.ts +16 -0
  53. package/dist/cli/run/adapters/copilot.d.ts.map +1 -0
  54. package/dist/cli/run/adapters/copilot.js +84 -0
  55. package/dist/cli/run/adapters/copilot.js.map +1 -0
  56. package/dist/cli/run/adapters/cursor.d.ts +16 -0
  57. package/dist/cli/run/adapters/cursor.d.ts.map +1 -0
  58. package/dist/cli/run/adapters/cursor.js +81 -0
  59. package/dist/cli/run/adapters/cursor.js.map +1 -0
  60. package/dist/cli/run/adapters/index.d.ts +14 -0
  61. package/dist/cli/run/adapters/index.d.ts.map +1 -0
  62. package/dist/cli/run/adapters/index.js +35 -0
  63. package/dist/cli/run/adapters/index.js.map +1 -0
  64. package/dist/cli/run/executor.d.ts +15 -0
  65. package/dist/cli/run/executor.d.ts.map +1 -0
  66. package/dist/cli/run/executor.js +249 -0
  67. package/dist/cli/run/executor.js.map +1 -0
  68. package/dist/cli/run/reporter.d.ts +10 -0
  69. package/dist/cli/run/reporter.d.ts.map +1 -0
  70. package/dist/cli/run/reporter.js +112 -0
  71. package/dist/cli/run/reporter.js.map +1 -0
  72. package/dist/cli/run/schema.d.ts +28 -0
  73. package/dist/cli/run/schema.d.ts.map +1 -0
  74. package/dist/cli/run/schema.js +511 -0
  75. package/dist/cli/run/schema.js.map +1 -0
  76. package/dist/cli/run.d.ts +6 -0
  77. package/dist/cli/run.d.ts.map +1 -0
  78. package/dist/cli/run.js +123 -0
  79. package/dist/cli/run.js.map +1 -0
  80. package/dist/cli/stack-config.d.ts +12 -0
  81. package/dist/cli/stack-config.d.ts.map +1 -0
  82. package/dist/cli/stack-config.js +146 -0
  83. package/dist/cli/stack-config.js.map +1 -0
  84. package/dist/cli/types.d.ts +169 -0
  85. package/dist/cli/types.d.ts.map +1 -0
  86. package/dist/cli/types.js +2 -0
  87. package/dist/cli/types.js.map +1 -0
  88. package/dist/cli/update.d.ts +3 -0
  89. package/dist/cli/update.d.ts.map +1 -0
  90. package/dist/cli/update.js +50 -0
  91. package/dist/cli/update.js.map +1 -0
  92. package/package.json +48 -0
  93. package/src/cli/adapters/claude-code.ts +287 -0
  94. package/src/cli/adapters/cursor.ts +377 -0
  95. package/src/cli/adapters/vscode.ts +168 -0
  96. package/src/cli/copy.ts +79 -0
  97. package/src/cli/dashboard.ts +225 -0
  98. package/src/cli/diff.ts +44 -0
  99. package/src/cli/eject.ts +39 -0
  100. package/src/cli/init.ts +120 -0
  101. package/src/cli/manifest.ts +45 -0
  102. package/src/cli/mcp.ts +49 -0
  103. package/src/cli/prompt.ts +115 -0
  104. package/src/cli/run/adapters/claude-code.ts +95 -0
  105. package/src/cli/run/adapters/copilot.ts +97 -0
  106. package/src/cli/run/adapters/cursor.ts +94 -0
  107. package/src/cli/run/adapters/index.ts +40 -0
  108. package/src/cli/run/executor.ts +292 -0
  109. package/src/cli/run/reporter.ts +129 -0
  110. package/src/cli/run/schema.ts +595 -0
  111. package/src/cli/run.ts +137 -0
  112. package/src/cli/stack-config.ts +180 -0
  113. package/src/cli/types.ts +207 -0
  114. package/src/cli/update.ts +75 -0
  115. package/src/dashboard/astro.config.mjs +6 -0
  116. package/src/dashboard/package-lock.json +5455 -0
  117. package/src/dashboard/package.json +14 -0
  118. package/src/dashboard/public/data/delegations.ndjson +35 -0
  119. package/src/dashboard/public/data/panels.ndjson +13 -0
  120. package/src/dashboard/public/data/sessions.ndjson +50 -0
  121. package/src/dashboard/public/icon-192.png +0 -0
  122. package/src/dashboard/scripts/generate-seed-data.ts +355 -0
  123. package/src/dashboard/src/layouts/Layout.astro +25 -0
  124. package/src/dashboard/src/pages/index.astro +1070 -0
  125. package/src/dashboard/src/styles/dashboard.css +1078 -0
  126. package/src/dashboard/tsconfig.json +6 -0
  127. package/src/orchestrator/agent-workflows/README.md +22 -0
  128. package/src/orchestrator/agent-workflows/bug-fix.md +128 -0
  129. package/src/orchestrator/agent-workflows/data-pipeline.md +145 -0
  130. package/src/orchestrator/agent-workflows/database-migration.md +159 -0
  131. package/src/orchestrator/agent-workflows/feature-implementation.md +223 -0
  132. package/src/orchestrator/agent-workflows/performance-optimization.md +125 -0
  133. package/src/orchestrator/agent-workflows/refactoring.md +142 -0
  134. package/src/orchestrator/agent-workflows/schema-changes.md +164 -0
  135. package/src/orchestrator/agent-workflows/security-audit.md +148 -0
  136. package/src/orchestrator/agent-workflows/shared-delivery-phase.md +33 -0
  137. package/src/orchestrator/agents/api-designer.agent.md +68 -0
  138. package/src/orchestrator/agents/architect.agent.md +129 -0
  139. package/src/orchestrator/agents/content-engineer.agent.md +57 -0
  140. package/src/orchestrator/agents/copywriter.agent.md +95 -0
  141. package/src/orchestrator/agents/data-expert.agent.md +63 -0
  142. package/src/orchestrator/agents/database-engineer.agent.md +62 -0
  143. package/src/orchestrator/agents/developer.agent.md +66 -0
  144. package/src/orchestrator/agents/devops-expert.agent.md +57 -0
  145. package/src/orchestrator/agents/documentation-writer.agent.md +60 -0
  146. package/src/orchestrator/agents/performance-expert.agent.md +58 -0
  147. package/src/orchestrator/agents/release-manager.agent.md +72 -0
  148. package/src/orchestrator/agents/researcher.agent.md +145 -0
  149. package/src/orchestrator/agents/reviewer.agent.md +62 -0
  150. package/src/orchestrator/agents/security-expert.agent.md +64 -0
  151. package/src/orchestrator/agents/seo-specialist.agent.md +67 -0
  152. package/src/orchestrator/agents/team-lead.agent.md +644 -0
  153. package/src/orchestrator/agents/testing-expert.agent.md +85 -0
  154. package/src/orchestrator/agents/ui-ux-expert.agent.md +63 -0
  155. package/src/orchestrator/copilot-instructions.md +3 -0
  156. package/src/orchestrator/customizations/AGENT-EXPERTISE.md +325 -0
  157. package/src/orchestrator/customizations/AGENT-FAILURES.md +69 -0
  158. package/src/orchestrator/customizations/AGENT-PERFORMANCE.md +58 -0
  159. package/src/orchestrator/customizations/DISPUTES.md +162 -0
  160. package/src/orchestrator/customizations/KNOWLEDGE-GRAPH.md +10 -0
  161. package/src/orchestrator/customizations/LESSONS-LEARNED.md +70 -0
  162. package/src/orchestrator/customizations/README.md +59 -0
  163. package/src/orchestrator/customizations/agents/agent-registry.md +46 -0
  164. package/src/orchestrator/customizations/agents/skill-matrix.md +142 -0
  165. package/src/orchestrator/customizations/logs/README.md +181 -0
  166. package/src/orchestrator/customizations/logs/delegations.ndjson +1 -0
  167. package/src/orchestrator/customizations/logs/panels.ndjson +1 -0
  168. package/src/orchestrator/customizations/logs/sessions.ndjson +1 -0
  169. package/src/orchestrator/customizations/project/docs-structure.md +23 -0
  170. package/src/orchestrator/customizations/project/tracker-config.md +45 -0
  171. package/src/orchestrator/customizations/project.instructions.md +64 -0
  172. package/src/orchestrator/customizations/stack/api-config.md +37 -0
  173. package/src/orchestrator/customizations/stack/cms-config.md +26 -0
  174. package/src/orchestrator/customizations/stack/data-pipeline-config.md +41 -0
  175. package/src/orchestrator/customizations/stack/database-config.md +44 -0
  176. package/src/orchestrator/customizations/stack/deployment-config.md +45 -0
  177. package/src/orchestrator/customizations/stack/testing-config.md +56 -0
  178. package/src/orchestrator/instructions/ai-optimization.instructions.md +143 -0
  179. package/src/orchestrator/instructions/general.instructions.md +194 -0
  180. package/src/orchestrator/mcp.json +55 -0
  181. package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +235 -0
  182. package/src/orchestrator/prompts/brainstorm.prompt.md +115 -0
  183. package/src/orchestrator/prompts/bug-fix.prompt.md +141 -0
  184. package/src/orchestrator/prompts/create-skill.prompt.md +103 -0
  185. package/src/orchestrator/prompts/generate-task-spec.prompt.md +154 -0
  186. package/src/orchestrator/prompts/implement-feature.prompt.md +124 -0
  187. package/src/orchestrator/prompts/metrics-report.prompt.md +142 -0
  188. package/src/orchestrator/prompts/quick-refinement.prompt.md +137 -0
  189. package/src/orchestrator/prompts/resolve-pr-comments.prompt.md +100 -0
  190. package/src/orchestrator/skills/accessibility-standards/SKILL.md +164 -0
  191. package/src/orchestrator/skills/agent-hooks/SKILL.md +147 -0
  192. package/src/orchestrator/skills/agent-memory/SKILL.md +144 -0
  193. package/src/orchestrator/skills/api-patterns/SKILL.md +106 -0
  194. package/src/orchestrator/skills/browser-testing/SKILL.md +203 -0
  195. package/src/orchestrator/skills/code-commenting/SKILL.md +133 -0
  196. package/src/orchestrator/skills/contentful-cms/SKILL.md +43 -0
  197. package/src/orchestrator/skills/context-map/SKILL.md +135 -0
  198. package/src/orchestrator/skills/convex-database/SKILL.md +80 -0
  199. package/src/orchestrator/skills/data-engineering/SKILL.md +99 -0
  200. package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +49 -0
  201. package/src/orchestrator/skills/documentation-standards/SKILL.md +85 -0
  202. package/src/orchestrator/skills/fast-review/SKILL.md +327 -0
  203. package/src/orchestrator/skills/frontend-design/SKILL.md +42 -0
  204. package/src/orchestrator/skills/jira-management/SKILL.md +168 -0
  205. package/src/orchestrator/skills/memory-merger/SKILL.md +123 -0
  206. package/src/orchestrator/skills/nextjs-patterns/SKILL.md +75 -0
  207. package/src/orchestrator/skills/nx-workspace/SKILL.md +192 -0
  208. package/src/orchestrator/skills/panel-majority-vote/SKILL.md +184 -0
  209. package/src/orchestrator/skills/panel-majority-vote/panel-report.template.md +38 -0
  210. package/src/orchestrator/skills/performance-optimization/SKILL.md +101 -0
  211. package/src/orchestrator/skills/react-development/SKILL.md +117 -0
  212. package/src/orchestrator/skills/sanity-cms/SKILL.md +18 -0
  213. package/src/orchestrator/skills/security-hardening/SKILL.md +118 -0
  214. package/src/orchestrator/skills/self-improvement/SKILL.md +137 -0
  215. package/src/orchestrator/skills/seo-patterns/SKILL.md +40 -0
  216. package/src/orchestrator/skills/session-checkpoints/SKILL.md +205 -0
  217. package/src/orchestrator/skills/slack-notifications/SKILL.md +211 -0
  218. package/src/orchestrator/skills/strapi-cms/SKILL.md +43 -0
  219. package/src/orchestrator/skills/supabase-database/SKILL.md +24 -0
  220. package/src/orchestrator/skills/task-management/SKILL.md +143 -0
  221. package/src/orchestrator/skills/team-lead-reference/SKILL.md +317 -0
  222. package/src/orchestrator/skills/teams-notifications/SKILL.md +249 -0
  223. package/src/orchestrator/skills/testing-workflow/SKILL.md +134 -0
  224. package/src/orchestrator/skills/validation-gates/SKILL.md +100 -0
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: react-development
3
+ description: "React development standards for functional components, hooks, TypeScript integration, state management, styling with CSS Modules/Sass, and testing patterns. Use when creating or modifying React components, custom hooks, or component tests."
4
+ ---
5
+
6
+ # React Development Standards
7
+
8
+ Modern React patterns following the official React documentation at https://react.dev.
9
+
10
+ ## Architecture
11
+
12
+ - Functional components with hooks as primary pattern.
13
+ - Component composition over inheritance.
14
+ - Organize by feature/domain, not by type.
15
+ - Separate presentational and container components.
16
+ - Custom hooks for reusable stateful logic.
17
+
18
+ ## TypeScript Integration
19
+
20
+ - Interfaces for props, state, and component definitions.
21
+ - Proper types for API responses, event handlers, and refs.
22
+ - Generic components where appropriate.
23
+ - Strict mode in `tsconfig.json`.
24
+ - Leverage built-in types (`React.FC`, `React.ComponentProps`, etc.).
25
+ - Union types for component variants and states.
26
+ - Shared types in `interfaces/` folder of appropriate project.
27
+
28
+ ## Component Design
29
+
30
+ - Single responsibility principle.
31
+ - Descriptive, consistent PascalCase naming.
32
+ - Props validation via TypeScript.
33
+ - Small, focused, testable, reusable.
34
+ - Use `<>...</>` or `React.Fragment` to avoid extra DOM nodes.
35
+ - Never mutate props or state directly.
36
+ - Destructure props in function signature.
37
+
38
+ ## State Management
39
+
40
+ - `useState` for local state.
41
+ - `useReducer` for complex state logic.
42
+ - `useContext` for cross-tree state sharing.
43
+ - React Query for server state.
44
+
45
+ ## Hooks and Effects
46
+
47
+ - `useEffect` with proper dependency arrays.
48
+ - Cleanup functions in effects to prevent memory leaks.
49
+ - `useMemo`/`useCallback` for performance optimization when needed.
50
+ - Custom hooks for reusable logic.
51
+ - Rules of hooks: only call at top level.
52
+ - `useRef` for DOM access and mutable values.
53
+
54
+ ## Styling
55
+
56
+ - **CSS Modules** with `.module.scss` files.
57
+ - **Sass** for advanced features.
58
+ - Scoped styles to avoid global conflicts.
59
+ - Responsive design with mobile-first approach.
60
+ - CSS custom properties for theming.
61
+ - Consistent spacing, typography, color systems.
62
+ - Sass variables and mixins from shared libraries.
63
+ - Co-locate styles with components.
64
+
65
+ ## Performance
66
+
67
+ - Stable `key` props in lists.
68
+ - `React.memo` when appropriate.
69
+ - Code splitting with `React.lazy` and `Suspense`.
70
+ - Tree shaking and dynamic imports.
71
+ - Virtual scrolling for large lists.
72
+ - Profile with React DevTools.
73
+ - Avoid anonymous functions in render.
74
+ - `ErrorBoundary` for graceful error handling.
75
+
76
+ ## Data Fetching
77
+
78
+ - Libraries: React Query, SWR, Apollo Client.
79
+ - Loading, error, and success states.
80
+ - Handle race conditions and request cancellation.
81
+ - Optimistic updates.
82
+ - Caching strategies.
83
+ - Offline/network error handling.
84
+
85
+ ## Error Handling
86
+
87
+ - Error Boundaries for component-level errors.
88
+ - Proper error states in data fetching.
89
+ - Fallback UI for error scenarios.
90
+ - Meaningful error messages to users.
91
+
92
+ ## Forms
93
+
94
+ - Controlled components.
95
+ - React Hook Form + Zod for validation.
96
+ - Form submission and error states.
97
+ - Accessibility: labels, ARIA attributes.
98
+ - Debounced validation.
99
+
100
+ ## Testing
101
+
102
+ - React Testing Library: test behavior, not implementation.
103
+ - Jest as test runner.
104
+ - Mock external dependencies and API calls.
105
+ - Test accessibility and keyboard navigation.
106
+ - Co-locate tests in `__tests__` subdirectory.
107
+ - **CRITICAL**: Never mix static imports and `require()` for lazy-loaded libraries in tests.
108
+ - Use `jest.requireMock()` instead of `require()` in test functions.
109
+ - Use `jest.requireActual()` in mock setup.
110
+
111
+ ## Security
112
+
113
+ - Sanitize user inputs (XSS prevention).
114
+ - Validate/escape data before rendering.
115
+ - HTTPS for external APIs.
116
+ - Avoid storing sensitive data in localStorage/sessionStorage.
117
+ - CSP headers.
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: sanity-cms
3
+ description: "Sanity CMS development rules, GROQ query patterns, and content management best practices. Use when working with Sanity schemas, writing GROQ queries, modifying content models, or managing CMS configuration."
4
+ ---
5
+
6
+ # Sanity CMS
7
+
8
+ Generic Sanity CMS development methodology. For project-specific configuration, schemas, plugins, document types, and GROQ examples, see [sanity-config.md](../../customizations/stack/sanity-config.md).
9
+
10
+ ## Critical Development Rules
11
+
12
+ 1. **Always check the schema before querying** — use `get_schema` to understand document types and field structures before writing GROQ queries
13
+ 2. **Array vs single reference** — always verify whether a field is an array of references or a single reference; using the wrong query operator causes silent failures
14
+ 3. **Local schema files are source of truth** — the Studio schema directory takes precedence over deployed schemas; deploying schemas from a local Studio context creates drift
15
+ 4. **Follow `defineType` and `defineField` patterns** — always use Sanity helpers for type safety and consistency
16
+ 5. **Test GROQ queries in Vision** — validate queries against real data in the Vision plugin before deploying
17
+ 6. **Handle draft/publish workflow** — remember drafts have `drafts.` prefix; mutations create drafts, not published documents
18
+ 7. **Keep queries in the shared library** — queries belong in a shared queries library, never inline in components
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: security-hardening
3
+ description: "Security architecture including authentication, authorization, RLS policies, security headers, CSP, input validation, API security, and OAuth patterns. Use when implementing auth flows, writing RLS policies, configuring security headers, validating inputs, or auditing security."
4
+ ---
5
+
6
+ # Security Hardening
7
+
8
+ ## Security Architecture
9
+
10
+ ```
11
+ Vercel Edge Network (WAF, DDoS)
12
+ → Security Headers (next.config.js: HSTS, CSP, X-Frame-Options)
13
+ → Middleware (proxy.ts: session refresh)
14
+ → Server Actions (Supabase Auth: CSRF protection)
15
+ → RLS Policies (row-level authorization)
16
+ ```
17
+
18
+ | Layer | Technology | Protection |
19
+ |-------|-----------|------------|
20
+ | Edge | Vercel WAF | DDoS, bot detection |
21
+ | Headers | Next.js config | HSTS, CSP, XSS protection |
22
+ | Middleware | proxy.ts | Session management |
23
+ | Server Actions | Supabase Auth | Authentication, CSRF |
24
+ | Database | RLS Policies | Row-level authorization |
25
+ | API Routes | CRON_SECRET | Cron job authorization |
26
+ | Input | Zod | Schema validation |
27
+ | Rate Limiting | Proxy layer | IP-based throttling |
28
+
29
+ ## Authentication
30
+
31
+ **Platform:** Supabase Auth with Server Actions pattern.
32
+
33
+ - **Server Actions** for sign in/up/out, session management.
34
+ - **Middleware** for session refresh, protected routes.
35
+ - **RLS Policies** in Postgres.
36
+ - **OAuth providers:** Google, Facebook (configured in Supabase dashboard)
37
+ - **User roles:** `user`, `moderator`, `admin` (stored in `profiles.roles TEXT[]`)
38
+ - **Key auth files:** `libs/supabase-auth/src/actions/auth.ts`, `apps/*/proxy.ts`
39
+ - **Cron authorization:** `CRON_SECRET` env var, `Bearer` token in `authorization` header
40
+
41
+ ### Server Actions Pattern Benefits
42
+
43
+ - Automatic CSRF protection (Next.js POST-only Server Actions).
44
+ - No exposed API endpoints for auth.
45
+ - Server-side session management.
46
+
47
+ ### Session Management
48
+
49
+ - HTTP-only cookies (Supabase client managed).
50
+ - Automatic refresh via middleware (`updateSession()`).
51
+ - Sign out clears cookie and invalidates session.
52
+
53
+ ## Content Security Policy
54
+
55
+ ### Allowed External Domains (`next.config.js`)
56
+
57
+ | Purpose | Domains |
58
+ |---------|--------|
59
+ | Scripts | `challenges.cloudflare.com`, `cdn.jsdelivr.net`, `cdn.sanity.io`, `maps.googleapis.com` |
60
+ | Styles | `cdn.jsdelivr.net`, `fonts.googleapis.com` |
61
+ | Fonts | `fonts.gstatic.com` |
62
+ | Frames | `challenges.cloudflare.com` |
63
+
64
+ ### Directives
65
+
66
+ General CSP directives follow the principle of least privilege:
67
+ - `default-src 'self'` — deny by default.
68
+ - Whitelist only required external domains per directive.
69
+ - `object-src 'none'` — block plugins.
70
+ - `frame-ancestors 'self'` — prevent clickjacking.
71
+ - `upgrade-insecure-requests` — enforce HTTPS.
72
+
73
+ **Known weaknesses:** `'unsafe-inline'` and `'unsafe-eval'` in script-src (required for Next.js dev mode). Consider nonces/hashes for production inline scripts.
74
+
75
+ ## RLS Policy Patterns
76
+
77
+ > **Detailed RLS patterns and SQL examples:** See the **supabase-database** skill, which is the authoritative source for RLS policies, role systems, and migration rules.
78
+
79
+ ### Best Practices
80
+
81
+ - Enable RLS on all tables: `ALTER TABLE x ENABLE ROW LEVEL SECURITY;`
82
+ - Test policies with different user roles.
83
+ - Use `auth.uid()` for authentication checks.
84
+ - EXISTS subqueries for role checks.
85
+ - Never rely solely on client-side authorization.
86
+ - Never disable RLS in production.
87
+
88
+ ## API Security
89
+
90
+ ### Cron Job Authorization
91
+
92
+ ```typescript
93
+ export async function GET(request: NextRequest) {
94
+ const authHeader = request.headers.get('authorization');
95
+ if (!authHeader || authHeader !== `Bearer ${process.env.CRON_SECRET}`) {
96
+ return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
97
+ }
98
+ }
99
+ ```
100
+
101
+ - Strong random CRON_SECRET: `openssl rand -hex 32`
102
+ - Rotate quarterly.
103
+
104
+ ### Input Validation
105
+
106
+ - Zod schemas for all request validation.
107
+ - React Hook Form for client-side validation.
108
+ - Server-side validation in all Server Actions and route handlers.
109
+
110
+ ## Critical Rules
111
+
112
+ 1. Never commit secrets — use Vercel environment variables.
113
+ 2. Always use Server Actions for auth operations.
114
+ 3. Enable RLS on all tables — default-deny, explicit-allow.
115
+ 4. Validate all inputs with Zod before database operations.
116
+ 5. Sanitize user content — escape HTML in reviews/descriptions.
117
+ 6. Parameterized queries (Supabase client handles automatically).
118
+ 7. Rotate secrets regularly (quarterly).
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: self-improvement
3
+ description: "Protocol for reading and updating the lessons-learned knowledge base. MUST be followed by ALL agents — read lessons before work, write lessons after retries. This makes the agent team self-improving across sessions."
4
+ ---
5
+
6
+ # Self-Improvement Protocol
7
+
8
+ This skill defines how agents learn from mistakes and share knowledge so the same pitfalls are never repeated.
9
+
10
+ ## Core Principle
11
+
12
+ **If you retry something with a different approach and it works, document the lesson immediately.** The cost of writing a lesson (2 minutes) is always less than the cost of someone else hitting the same pitfall (5-30 minutes).
13
+
14
+ ## The Lessons File
15
+
16
+ Location: `.github/customizations/LESSONS-LEARNED.md`
17
+
18
+ This is the team's collective memory — a structured log of tool/command pitfalls, workarounds, and correct approaches discovered through execution.
19
+
20
+ ## Protocol for All Agents
21
+
22
+ ### BEFORE Starting Work (Mandatory)
23
+
24
+ 1. **Read `.github/customizations/LESSONS-LEARNED.md`** — scan the full file or at minimum the categories relevant to your task
25
+ 2. **Apply relevant lessons proactively** — don't wait to hit the same wall; use the documented correct approach from the start
26
+ 3. **Check the Index by Category table** at the bottom of the file to quickly find relevant sections
27
+
28
+ ### DURING Execution (Trigger-Based)
29
+
30
+ A lesson MUST be written when **any** of these triggers occur:
31
+
32
+ | Trigger | Example |
33
+ |---------|---------|
34
+ | **Retry with different approach** | Command fails, you try a different flag/syntax and it works |
35
+ | **Tool call fails unexpectedly** | MCP tool returns error, you discover the correct parameter format |
36
+ | **Workaround needed** | Platform limitation requires non-obvious solution |
37
+ | **Docs are misleading** | Official docs say X but reality is Y |
38
+ | **Configuration surprise** | Default behavior differs from expectation |
39
+ | **Error message is unhelpful** | Error says "failed" but the real cause was something else |
40
+
41
+ ### AFTER Completing Work
42
+
43
+ 1. If you wrote any new lessons during execution, **update the Index by Category table** at the bottom of `.github/customizations/LESSONS-LEARNED.md` to include the new lesson IDs.
44
+
45
+ 2. **Log the session** — append one JSON line to `.github/customizations/logs/sessions.ndjson` with: `timestamp`, `agent`, `model`, `task`, `linear_issue`, `outcome` (success/partial/failed), `files_changed`, `retries`, `lessons_added`, `discoveries`. See `.github/customizations/logs/README.md` for the full schema.
46
+
47
+ ```bash
48
+ echo '{"timestamp":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","agent":"Agent Name","model":"model-id","task":"Short description","outcome":"success","files_changed":N,"retries":0}' >> .github/customizations/logs/sessions.ndjson
49
+ ```
50
+
51
+ This is **mandatory** — session logging fuels the metrics dashboard (`metrics-report` prompt).
52
+
53
+ ## How to Write a Lesson
54
+
55
+ ### Step 1: Determine the next lesson ID
56
+
57
+ Look at the last `LES-XXX` entry in `.github/customizations/LESSONS-LEARNED.md` and increment by 1.
58
+
59
+ ### Step 2: Write the entry
60
+
61
+ Add it **before** the `## Index by Category` section, following this template:
62
+
63
+ ```markdown
64
+ ### LES-XXX: Short descriptive title
65
+
66
+ | Field | Value |
67
+ |-------|-------|
68
+ | **Category** | `category-name` |
69
+ | **Added** | YYYY-MM-DD |
70
+ | **Severity** | `high` / `medium` / `low` |
71
+
72
+ **Problem:** What went wrong and what error/behavior was observed.
73
+
74
+ **Wrong approach:** The obvious/intuitive approach that fails (with code block).
75
+
76
+ **Correct approach:** The working solution (with code block).
77
+
78
+ **Why:** Root cause explanation (if known).
79
+ ```
80
+
81
+ ### Step 3: Update the index
82
+
83
+ Add the lesson ID to the appropriate category row in the `## Index by Category` table.
84
+
85
+ ### Step 4: Update related instruction files (if applicable)
86
+
87
+ If the lesson reveals a gap in existing instruction/skill files, **also update those files** to include the correct approach. This prevents the pitfall at the source level, not just as a retroactive note.
88
+
89
+ Examples:
90
+ - Lesson about Linear tool → update `task-management/SKILL.md`
91
+ - Lesson about NX commands → update `nx-workspace/SKILL.md`
92
+ - Lesson about Sanity queries → update `sanity-cms/SKILL.md`
93
+ - Lesson about browser testing → update `browser-testing/SKILL.md`
94
+
95
+ ## Categories
96
+
97
+ | Category | Covers |
98
+ |----------|--------|
99
+ | `linear` | Linear MCP tools, issue management, workflow states |
100
+ | `mcp-tools` | Any MCP server tool quirks (deferred loading, parameters) |
101
+ | `nx-commands` | NX CLI commands, task runner, caching |
102
+ | `terminal` | Shell commands, port management, process management |
103
+ | `next-js` | Next.js App Router, build, dev server, SSR |
104
+ | `sanity` | Sanity CMS, GROQ queries, schema deployment |
105
+ | `supabase` | Supabase auth, migrations, RLS, SQL |
106
+ | `git` | Git operations, branching, merge conflicts |
107
+ | `vercel` | Deployment, environment variables, edge config |
108
+ | `browser-testing` | E2E testing, screenshots, browser automation |
109
+ | `general` | Anything that doesn't fit above |
110
+
111
+ ## Severity Guide
112
+
113
+ | Level | Meaning | Impact |
114
+ |-------|---------|--------|
115
+ | `high` | Blocks work entirely | Agent cannot proceed without the workaround |
116
+ | `medium` | Wastes 5+ minutes | Agent will eventually figure it out but wastes time |
117
+ | `low` | Minor friction | Slight annoyance, easy to work around |
118
+
119
+ ## Quality Standards
120
+
121
+ - **Be specific** — include exact error messages, exact commands, exact tool parameters
122
+ - **Show both wrong and right** — the contrast is what makes lessons actionable
123
+ - **Explain why** — root cause helps agents reason about similar situations
124
+ - **Keep it concise** — one lesson per entry, no essays
125
+ - **Code blocks are mandatory** — for commands, tool calls, and configurations
126
+
127
+ ## Anti-Patterns
128
+
129
+ - **Never skip reading lessons** before starting work — this is the #1 cause of repeated mistakes
130
+ - **Never "fix it and move on"** without documenting — your fix dies with your session
131
+ - **Never write vague lessons** like "Linear is tricky" — be specific about what fails and what works
132
+ - **Never duplicate existing lessons** — check the index first
133
+ - **Never wait until the end of a session** to write lessons — write them immediately when the retry succeeds
134
+
135
+ ## Agent Memory Protocol
136
+
137
+ For agent expertise tracking and cross-session knowledge graphs, load the **agent-memory** skill. It covers memory templates, update triggers, retrieval protocols, and the knowledge graph format.
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: seo-patterns
3
+ description: "Technical SEO patterns for meta tags, structured data, sitemaps, URL strategy, and rendering. Use when optimizing pages for search engines or implementing SEO features."
4
+ ---
5
+
6
+ # SEO Patterns
7
+
8
+ ## Meta Tags & Open Graph
9
+ - `<title>`, `<meta name="description">` for every page template
10
+ - Open Graph tags (`og:title`, `og:description`, `og:image`, `og:type`)
11
+ - Twitter Card tags (`twitter:card`, `twitter:title`, `twitter:image`)
12
+ - Canonical URLs (`<link rel="canonical">`)
13
+ - Robots directives (`noindex`, `nofollow` where appropriate)
14
+
15
+ ## Structured Data (JSON-LD)
16
+ - **LocalBusiness** / **Restaurant** / **CafeOrCoffeeShop** for venue pages
17
+ - **BreadcrumbList** for navigation hierarchy
18
+ - **WebSite** with **SearchAction** for sitelinks search box
19
+ - **ItemList** for venue listing pages
20
+ - **Organization** for the site entity
21
+ - Validate against schema.org and Google's requirements
22
+
23
+ ## Sitemap & Crawlability
24
+ - Dynamic XML sitemap generation for all venue pages
25
+ - Sitemap index for large venue counts (705+ and growing)
26
+ - `robots.txt` configuration
27
+ - Internal linking structure
28
+ - Page speed impact on crawl budget
29
+
30
+ ## URL Strategy
31
+ - Clean, keyword-relevant slugs for venue pages
32
+ - Consistent URL patterns across venue categories
33
+ - Redirect handling for renamed/moved venues (301 redirects)
34
+ - Trailing slash consistency
35
+
36
+ ## Rendering & Indexability
37
+ - Ensure critical content is server-rendered (not client-only)
38
+ - Verify pages are indexable with `fetch as Googlebot`
39
+ - Check hydration doesn't break structured data
40
+ - Image optimization for search (alt text, file names, lazy loading below fold)
@@ -0,0 +1,205 @@
1
+ ---
2
+ name: session-checkpoints
3
+ description: "Protocol for saving and restoring session state across agent sessions. Enables replay, fork, and resume of interrupted work — inspired by Sandcastle Run Time Machine."
4
+ ---
5
+
6
+ # Skill: Session Checkpoints
7
+
8
+ Use this skill when working on multi-session features or when a session may be interrupted. Checkpoints allow any future session to resume work without re-analyzing the entire codebase.
9
+
10
+ ## When to Checkpoint
11
+
12
+ Create a checkpoint:
13
+
14
+ - **Before delegation** — After decomposition but before first agent delegation
15
+ - **After each phase** — When a group of parallel tasks completes
16
+ - **Before risky work** — Before DB migrations, large refactors, or security changes
17
+ - **On session end** — Always checkpoint before ending a session with incomplete work
18
+ - **On interruption** — If context is running low, checkpoint immediately
19
+
20
+ ## Checkpoint Format
21
+
22
+ Create or update the file `docs/SESSION-CHECKPOINT.md` with this structure:
23
+
24
+ ```markdown
25
+ # Session Checkpoint
26
+
27
+ **Last Updated:** YYYY-MM-DD HH:MM
28
+ **Feature:** Short feature name
29
+ **Branch:** git branch name
30
+ **Linear Issues:** TAS-XX, TAS-YY, TAS-ZZ
31
+
32
+ ## Current Phase
33
+
34
+ Phase N of M — Brief description of what this phase does
35
+
36
+ ## Completed Work
37
+
38
+ | Task | Linear | Agent | Status | Files |
39
+ |------|--------|-------|--------|-------|
40
+ | Description | TAS-XX | Agent Name | ✅ Done | file1.ts, file2.ts |
41
+ | Description | TAS-YY | Agent Name | ✅ Done | file3.ts |
42
+
43
+ ## In Progress
44
+
45
+ | Task | Linear | Agent | Status | Notes |
46
+ |------|--------|-------|--------|-------|
47
+ | Description | TAS-ZZ | Agent Name | 🔄 In Progress | What's been done so far |
48
+
49
+ ## Remaining Work
50
+
51
+ | Task | Linear | Agent | Dependencies | Files |
52
+ |------|--------|-------|-------------|-------|
53
+ | Description | TAS-AA | Agent Name | TAS-ZZ | file4.ts, file5.ts |
54
+
55
+ ## Key Decisions Made
56
+
57
+ - Decision 1: Why this approach was chosen
58
+ - Decision 2: Why alternative X was rejected
59
+
60
+ ## Blockers & Issues
61
+
62
+ - Blocker 1: Description and what's needed to unblock
63
+ - Issue found: DLQ-XXX reference if logged
64
+
65
+ ## Delegation Cost Log
66
+
67
+ Track each delegation to monitor budget and optimize future model assignments:
68
+
69
+ | # | Agent | Linear | Model Tier | Est. Tokens | Duration | Status |
70
+ |---|-------|--------|------------|-------------|----------|--------|
71
+ | 1 | Content Engineer | TAS-XX | Standard | ~20K | 8 min | ✅ Done |
72
+ | 2 | DB Engineer | TAS-YY | Standard | ~25K | 12 min | ✅ Done |
73
+ | 3 | UI Expert | TAS-ZZ | Standard | ~30K | ❌ Failed → retry |
74
+
75
+ **Running totals:** 3 delegations / ~75K tokens / 0 panel reviews
76
+
77
+ ## File Partitions
78
+
79
+ ```
80
+ Agent A: dir1/, dir2/
81
+ Agent B: dir3/, dir4/
82
+ Agent C: docs/
83
+ ```
84
+
85
+ ## Resume Instructions
86
+
87
+ Step-by-step instructions for a new session to pick up where this one left off:
88
+
89
+ 1. Check out branch `feat/xxx`
90
+ 2. Read Linear issues TAS-XX, TAS-YY for context
91
+ 3. Start Phase N+1: [specific instructions]
92
+ ```
93
+
94
+ ## Resuming from a Checkpoint
95
+
96
+ When starting a new session:
97
+
98
+ 1. **Check for checkpoint** — Read `docs/SESSION-CHECKPOINT.md` if it exists
99
+ 2. **Verify state** — Run `git status`, check branch, verify files match checkpoint
100
+ 3. **Check Linear** — List in-progress and todo issues for current feature
101
+ 4. **Follow resume instructions** — Execute the specific steps listed in the checkpoint
102
+ 5. **Update checkpoint** — After resuming, update the checkpoint with current progress
103
+
104
+ ## Fork Points
105
+
106
+ When a checkpoint reveals multiple possible paths forward, document them as fork points:
107
+
108
+ ```markdown
109
+ ## Fork Point: Feature X Implementation
110
+
111
+ ### Option A: Server-side approach
112
+ - Pros: Better SEO, simpler client code
113
+ - Cons: More server load, slower interactions
114
+ - Files: api/route.ts, lib/server-utils/
115
+
116
+ ### Option B: Client-side approach
117
+ - Pros: Faster interactions, less server load
118
+ - Cons: No SEO, complex client state
119
+ - Files: components/Feature.tsx, hooks/useFeature.ts
120
+
121
+ **Decision needed from:** User or Architect agent
122
+ ```
123
+
124
+ ## Cleanup
125
+
126
+ After a feature is fully complete (all Linear issues Done):
127
+
128
+ 1. Archive the checkpoint content to the relevant Linear issue comments
129
+ 2. Delete `docs/SESSION-CHECKPOINT.md` to keep the workspace clean
130
+ 3. The next feature starts with a fresh checkpoint
131
+
132
+ ## Integration with Team Lead
133
+
134
+ The Team Lead should:
135
+
136
+ - Create a checkpoint after Step 2 (Decompose & Partition) of the Decomposition Flow
137
+ - Update the checkpoint after each verification pass
138
+ - Include checkpoint reading in session resume workflow
139
+ - Reference the checkpoint file in delegation prompts for context
140
+
141
+ ## Step Output Log (Time-Travel Replay)
142
+
143
+ Record the output of each completed delegation step. When a later step fails, replay from the failure point using cached outputs instead of re-running everything.
144
+
145
+ ### Why This Matters
146
+
147
+ A multi-phase feature might complete phases 1-3 successfully before phase 4 fails. Without step logs, retrying requires re-running all 4 phases. With logs, the retry starts at phase 4 with cached context from phases 1-3.
148
+
149
+ ### Step Log Format
150
+
151
+ Add a `## Step Output Log` section to the checkpoint file:
152
+
153
+ ```markdown
154
+ ## Step Output Log
155
+
156
+ ### Step 1: [Short description]
157
+ - **Agent:** [Agent Name]
158
+ - **Linear:** TAS-XX
159
+ - **Status:** ✅ Completed
160
+ - **Duration:** ~X minutes
161
+ - **Key Outputs:**
162
+ - Created `path/to/file.ts` — [description]
163
+ - Modified `path/to/other.ts` — [what changed]
164
+ - **Verification:** Lint ✅ | Tests ✅ | Build ✅
165
+ - **Cached Context:** [1-3 sentence summary of what this step produced that downstream steps depend on]
166
+
167
+ ### Step 2: [Short description]
168
+ - **Agent:** [Agent Name]
169
+ - **Linear:** TAS-YY
170
+ - **Status:** ❌ Failed (attempt 1)
171
+ - **Error:** [Specific error message or failure reason]
172
+ - **Cached Context from Step 1:** [Reference what Step 1 produced]
173
+ ```
174
+
175
+ ### Replay Protocol
176
+
177
+ When retrying a failed step:
178
+
179
+ 1. **Read the step log** — identify the last successful step and its cached context
180
+ 2. **Build replay context** — concatenate cached context from all completed steps into the retry prompt
181
+ 3. **Scope the retry** — only re-delegate the failed step, not earlier completed steps
182
+ 4. **Include the error** — add the specific failure reason to the retry prompt so the agent knows what went wrong
183
+ 5. **Update the log** — record the retry attempt with attempt number
184
+
185
+ ### Replay Prompt Template
186
+
187
+ ```
188
+ **Retry: TAS-XX (attempt N)**
189
+
190
+ Previous steps completed successfully. Here is the cached context:
191
+ - Step 1 produced: [cached context from log]
192
+ - Step 2 produced: [cached context from log]
193
+
194
+ Step 3 failed with: [error from log]
195
+
196
+ Your task: [re-state the failed step's objective with additional guidance based on the error]
197
+
198
+ [Include the original delegation spec/prompt with corrections]
199
+ ```
200
+
201
+ ### When NOT to Replay
202
+
203
+ - If the failure invalidates earlier steps (e.g., Step 1's output is wrong), re-run from Step 1
204
+ - If 3+ steps need replay, consider checkpointing and starting a fresh session instead
205
+ - If the codebase changed significantly since the cached steps ran (e.g., another PR merged)