@agility/create-next-app 1.0.0-beta.2

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 (213) hide show
  1. package/.claude/settings.json +7 -0
  2. package/.claude/settings.local.json +24 -0
  3. package/FEATURE_ROADMAP.md +343 -0
  4. package/README.md +205 -0
  5. package/TESTING.md +131 -0
  6. package/bin/create-agility-app.js +48 -0
  7. package/dist/agility/api-keys/generateApiKeys.d.ts +9 -0
  8. package/dist/agility/api-keys/generateApiKeys.d.ts.map +1 -0
  9. package/dist/agility/api-keys/generateApiKeys.js +99 -0
  10. package/dist/agility/api-keys/generateApiKeys.js.map +1 -0
  11. package/dist/agility/api-keys/getApiKeys.d.ts +9 -0
  12. package/dist/agility/api-keys/getApiKeys.d.ts.map +1 -0
  13. package/dist/agility/api-keys/getApiKeys.js +14 -0
  14. package/dist/agility/api-keys/getApiKeys.js.map +1 -0
  15. package/dist/agility/index.d.ts +3 -0
  16. package/dist/agility/index.d.ts.map +1 -0
  17. package/dist/agility/index.js +8 -0
  18. package/dist/agility/index.js.map +1 -0
  19. package/dist/agility/instance/createNewInstance.d.ts +8 -0
  20. package/dist/agility/instance/createNewInstance.d.ts.map +1 -0
  21. package/dist/agility/instance/createNewInstance.js +65 -0
  22. package/dist/agility/instance/createNewInstance.js.map +1 -0
  23. package/dist/agility/instance/getAvailableInstances.d.ts +8 -0
  24. package/dist/agility/instance/getAvailableInstances.d.ts.map +1 -0
  25. package/dist/agility/instance/getAvailableInstances.js +43 -0
  26. package/dist/agility/instance/getAvailableInstances.js.map +1 -0
  27. package/dist/agility/instance/manageInstance.d.ts +9 -0
  28. package/dist/agility/instance/manageInstance.d.ts.map +1 -0
  29. package/dist/agility/instance/manageInstance.js +82 -0
  30. package/dist/agility/instance/manageInstance.js.map +1 -0
  31. package/dist/agility/utils/getMgmtAPIUrl.d.ts +20 -0
  32. package/dist/agility/utils/getMgmtAPIUrl.d.ts.map +1 -0
  33. package/dist/agility/utils/getMgmtAPIUrl.js +61 -0
  34. package/dist/agility/utils/getMgmtAPIUrl.js.map +1 -0
  35. package/dist/auth/api-key/authenticateWithApiKey.d.ts +6 -0
  36. package/dist/auth/api-key/authenticateWithApiKey.d.ts.map +1 -0
  37. package/dist/auth/api-key/authenticateWithApiKey.js +28 -0
  38. package/dist/auth/api-key/authenticateWithApiKey.js.map +1 -0
  39. package/dist/auth/index.d.ts +3 -0
  40. package/dist/auth/index.d.ts.map +1 -0
  41. package/dist/auth/index.js +8 -0
  42. package/dist/auth/index.js.map +1 -0
  43. package/dist/auth/oauth/authenticate.d.ts +6 -0
  44. package/dist/auth/oauth/authenticate.d.ts.map +1 -0
  45. package/dist/auth/oauth/authenticate.js +162 -0
  46. package/dist/auth/oauth/authenticate.js.map +1 -0
  47. package/dist/auth/oauth/constants.d.ts +5 -0
  48. package/dist/auth/oauth/constants.d.ts.map +1 -0
  49. package/dist/auth/oauth/constants.js +9 -0
  50. package/dist/auth/oauth/constants.js.map +1 -0
  51. package/dist/auth/oauth/exchangeCodeForToken.d.ts +7 -0
  52. package/dist/auth/oauth/exchangeCodeForToken.d.ts.map +1 -0
  53. package/dist/auth/oauth/exchangeCodeForToken.js +39 -0
  54. package/dist/auth/oauth/exchangeCodeForToken.js.map +1 -0
  55. package/dist/cli/index.d.ts +3 -0
  56. package/dist/cli/index.d.ts.map +1 -0
  57. package/dist/cli/index.js +290 -0
  58. package/dist/cli/index.js.map +1 -0
  59. package/dist/cli/promptForMissingOptions.d.ts +8 -0
  60. package/dist/cli/promptForMissingOptions.d.ts.map +1 -0
  61. package/dist/cli/promptForMissingOptions.js +92 -0
  62. package/dist/cli/promptForMissingOptions.js.map +1 -0
  63. package/dist/config/env/createEnvFile.d.ts +6 -0
  64. package/dist/config/env/createEnvFile.d.ts.map +1 -0
  65. package/dist/config/env/createEnvFile.js +31 -0
  66. package/dist/config/env/createEnvFile.js.map +1 -0
  67. package/dist/config/index.d.ts +2 -0
  68. package/dist/config/index.d.ts.map +1 -0
  69. package/dist/config/index.js +6 -0
  70. package/dist/config/index.js.map +1 -0
  71. package/dist/config/mcp/createMcpConfig.d.ts +5 -0
  72. package/dist/config/mcp/createMcpConfig.d.ts.map +1 -0
  73. package/dist/config/mcp/createMcpConfig.js +32 -0
  74. package/dist/config/mcp/createMcpConfig.js.map +1 -0
  75. package/dist/config/packages/installAgilityPackages.d.ts +6 -0
  76. package/dist/config/packages/installAgilityPackages.d.ts.map +1 -0
  77. package/dist/config/packages/installAgilityPackages.js +61 -0
  78. package/dist/config/packages/installAgilityPackages.js.map +1 -0
  79. package/dist/config/setupProject.d.ts +8 -0
  80. package/dist/config/setupProject.d.ts.map +1 -0
  81. package/dist/config/setupProject.js +32 -0
  82. package/dist/config/setupProject.js.map +1 -0
  83. package/dist/create-next-app/createNextApp.d.ts +9 -0
  84. package/dist/create-next-app/createNextApp.d.ts.map +1 -0
  85. package/dist/create-next-app/createNextApp.js +83 -0
  86. package/dist/create-next-app/createNextApp.js.map +1 -0
  87. package/dist/create-next-app/index.d.ts +3 -0
  88. package/dist/create-next-app/index.d.ts.map +1 -0
  89. package/dist/create-next-app/index.js +8 -0
  90. package/dist/create-next-app/index.js.map +1 -0
  91. package/dist/scaffold/components/createPageComponents.d.ts +6 -0
  92. package/dist/scaffold/components/createPageComponents.d.ts.map +1 -0
  93. package/dist/scaffold/components/createPageComponents.js +62 -0
  94. package/dist/scaffold/components/createPageComponents.js.map +1 -0
  95. package/dist/scaffold/containers/createContainers.d.ts +6 -0
  96. package/dist/scaffold/containers/createContainers.d.ts.map +1 -0
  97. package/dist/scaffold/containers/createContainers.js +48 -0
  98. package/dist/scaffold/containers/createContainers.js.map +1 -0
  99. package/dist/scaffold/index.d.ts +2 -0
  100. package/dist/scaffold/index.d.ts.map +1 -0
  101. package/dist/scaffold/index.js +6 -0
  102. package/dist/scaffold/index.js.map +1 -0
  103. package/dist/scaffold/instance/createBlankInstance.d.ts +8 -0
  104. package/dist/scaffold/instance/createBlankInstance.d.ts.map +1 -0
  105. package/dist/scaffold/instance/createBlankInstance.js +51 -0
  106. package/dist/scaffold/instance/createBlankInstance.js.map +1 -0
  107. package/dist/scaffold/models/createContentModels.d.ts +6 -0
  108. package/dist/scaffold/models/createContentModels.d.ts.map +1 -0
  109. package/dist/scaffold/models/createContentModels.js +70 -0
  110. package/dist/scaffold/models/createContentModels.js.map +1 -0
  111. package/dist/templates/copyDirectory.d.ts +5 -0
  112. package/dist/templates/copyDirectory.d.ts.map +1 -0
  113. package/dist/templates/copyDirectory.js +28 -0
  114. package/dist/templates/copyDirectory.js.map +1 -0
  115. package/dist/templates/copyTemplates.d.ts +8 -0
  116. package/dist/templates/copyTemplates.d.ts.map +1 -0
  117. package/dist/templates/copyTemplates.js +58 -0
  118. package/dist/templates/copyTemplates.js.map +1 -0
  119. package/dist/templates/index.d.ts +2 -0
  120. package/dist/templates/index.d.ts.map +1 -0
  121. package/dist/templates/index.js +6 -0
  122. package/dist/templates/index.js.map +1 -0
  123. package/dist/types/index.d.ts +50 -0
  124. package/dist/types/index.d.ts.map +1 -0
  125. package/dist/types/index.js +3 -0
  126. package/dist/types/index.js.map +1 -0
  127. package/dist/utils/git.d.ts +9 -0
  128. package/dist/utils/git.d.ts.map +1 -0
  129. package/dist/utils/git.js +71 -0
  130. package/dist/utils/git.js.map +1 -0
  131. package/dist/utils/validation.d.ts +45 -0
  132. package/dist/utils/validation.d.ts.map +1 -0
  133. package/dist/utils/validation.js +180 -0
  134. package/dist/utils/validation.js.map +1 -0
  135. package/package.json +45 -0
  136. package/src/agility/api-keys/generateApiKeys.ts +100 -0
  137. package/src/agility/api-keys/getApiKeys.ts +13 -0
  138. package/src/agility/index.ts +3 -0
  139. package/src/agility/instance/createNewInstance.ts +67 -0
  140. package/src/agility/instance/getAvailableInstances.ts +49 -0
  141. package/src/agility/instance/manageInstance.ts +90 -0
  142. package/src/agility/utils/getMgmtAPIUrl.ts +68 -0
  143. package/src/auth/api-key/authenticateWithApiKey.ts +24 -0
  144. package/src/auth/index.ts +3 -0
  145. package/src/auth/oauth/authenticate.ts +165 -0
  146. package/src/auth/oauth/constants.ts +6 -0
  147. package/src/auth/oauth/exchangeCodeForToken.ts +43 -0
  148. package/src/cli/index.ts +281 -0
  149. package/src/cli/promptForMissingOptions.ts +104 -0
  150. package/src/config/env/createEnvFile.ts +30 -0
  151. package/src/config/index.ts +2 -0
  152. package/src/config/mcp/createMcpConfig.ts +30 -0
  153. package/src/config/packages/installAgilityPackages.ts +63 -0
  154. package/src/config/setupProject.ts +31 -0
  155. package/src/create-next-app/createNextApp.ts +75 -0
  156. package/src/create-next-app/index.ts +3 -0
  157. package/src/scaffold/components/createPageComponents.ts +74 -0
  158. package/src/scaffold/containers/createContainers.ts +55 -0
  159. package/src/scaffold/index.ts +2 -0
  160. package/src/scaffold/instance/createBlankInstance.ts +55 -0
  161. package/src/scaffold/models/createContentModels.ts +83 -0
  162. package/src/templates/copyDirectory.ts +24 -0
  163. package/src/templates/copyTemplates.ts +57 -0
  164. package/src/templates/index.ts +2 -0
  165. package/src/types/index.ts +55 -0
  166. package/src/utils/git.ts +74 -0
  167. package/src/utils/validation.ts +184 -0
  168. package/templates/.claude/QUICK-START.md +230 -0
  169. package/templates/.claude/README.md +32 -0
  170. package/templates/.claude/settings.json +8 -0
  171. package/templates/BLANK-INSTANCE-SETUP.md +375 -0
  172. package/templates/DEVELOPMENT.md +160 -0
  173. package/templates/EXAMPLE-PROMPTS.md +643 -0
  174. package/templates/PROMPTS.md +410 -0
  175. package/templates/README.md +281 -0
  176. package/templates/agents.md +429 -0
  177. package/templates/app/[locale]/[...slug]/error.tsx +17 -0
  178. package/templates/app/[locale]/[...slug]/not-found.tsx +9 -0
  179. package/templates/app/[locale]/[...slug]/page.tsx +102 -0
  180. package/templates/app/[locale]/layout.tsx +22 -0
  181. package/templates/app/[locale]/page.tsx +12 -0
  182. package/templates/app/api/dynamic-redirect/route.ts +24 -0
  183. package/templates/app/api/preview/exit/route.ts +34 -0
  184. package/templates/app/api/preview/route.ts +63 -0
  185. package/templates/app/api/revalidate/route.ts +118 -0
  186. package/templates/components/agility-components/RichTextArea.tsx +66 -0
  187. package/templates/components/agility-components/index.ts +30 -0
  188. package/templates/components/agility-pages/MainTemplate.tsx +36 -0
  189. package/templates/components/agility-pages/index.ts +11 -0
  190. package/templates/docs/01-agility-cms-overview.md +139 -0
  191. package/templates/docs/02-page-routing.md +251 -0
  192. package/templates/docs/03-creating-components.md +462 -0
  193. package/templates/docs/04-data-fetching.md +484 -0
  194. package/templates/docs/05-containers-and-lists.md +596 -0
  195. package/templates/docs/06-localization.md +561 -0
  196. package/templates/docs/07-caching-strategies.md +410 -0
  197. package/templates/docs/08-common-components.md +756 -0
  198. package/templates/docs/09-whats-included.md +279 -0
  199. package/templates/docs/10-mcp-server-setup.md +153 -0
  200. package/templates/docs/11-linked-nested-content.md +611 -0
  201. package/templates/docs/README.md +164 -0
  202. package/templates/lib/cms/getAgilityContext.ts +28 -0
  203. package/templates/lib/cms/getAgilityPage.ts +51 -0
  204. package/templates/lib/cms/getAgilitySDK.ts +22 -0
  205. package/templates/lib/cms/getContentItem.ts +20 -0
  206. package/templates/lib/cms/getContentList.ts +19 -0
  207. package/templates/lib/cms/getRedirections.ts +85 -0
  208. package/templates/lib/cms/getSitemapFlat.ts +19 -0
  209. package/templates/lib/cms/getSitemapNested.ts +19 -0
  210. package/templates/lib/env.ts +99 -0
  211. package/templates/lib/i18n/config.ts +28 -0
  212. package/templates/proxy.ts +101 -0
  213. package/tsconfig.json +21 -0
@@ -0,0 +1,410 @@
1
+ # Prompt Engineering Guide for AI-Assisted Website Building
2
+
3
+ This guide helps you write effective prompts to build a complete website with AI assistance and Agility CMS.
4
+
5
+ ## 🎯 Quick Start: Building from Scratch
6
+
7
+ If you're starting with a **blank Agility CMS instance**, follow this workflow:
8
+
9
+ ### Phase 1: Initial Setup
10
+ ```
11
+ "I'm starting with a blank Agility CMS instance. Help me set up the content structure for a [type of website]. What content models and page templates should I create in Agility CMS?"
12
+ ```
13
+
14
+ ### Phase 2: Create the Components
15
+ ```
16
+ "Create the [component name] component with [specific features]. It should include [fields list] and use [design requirements]."
17
+ ```
18
+
19
+ ### Phase 3: Build the Pages
20
+ ```
21
+ "Now that I have my components, help me build the [page name] page that uses [list of components]."
22
+ ```
23
+
24
+ ## 📋 The Perfect Prompt Formula
25
+
26
+ For best results, structure your prompts with these elements:
27
+
28
+ ### 1. **What** (Component Type)
29
+ Be specific about what you want to build:
30
+ - ❌ BAD: "Add a blog"
31
+ - ✅ GOOD: "Add a blog listing component"
32
+
33
+ ### 2. **Where** (Location)
34
+ Specify if it's a component, page, or feature:
35
+ - ❌ BAD: "Add navigation"
36
+ - ✅ GOOD: "Add a navigation component to the MainTemplate"
37
+
38
+ ### 3. **How** (Behavior/Design)
39
+ Include specific requirements:
40
+ - ❌ BAD: "Add a hero"
41
+ - ✅ GOOD: "Add a hero component with a background image, heading, subtitle, and CTA button"
42
+
43
+ ### 4. **Fields** (CMS Fields)
44
+ List the Agility CMS fields you want:
45
+ - ❌ BAD: "Add a testimonial carousel"
46
+ - ✅ GOOD: "Add a testimonials carousel that fetches from a 'testimonials' content list with fields: quote, author, title, photo"
47
+
48
+ ### 5. **Style** (Visual Design)
49
+ Include design specifics when relevant:
50
+ - ✅ BETTER: "Add a testimonials carousel with cards, 3-column grid on desktop, centered text, and rounded images"
51
+
52
+ ## 🌟 Example Prompts (From Worst to Best)
53
+
54
+ ### Prompt Quality: ⭐ Poor
55
+ ```
56
+ "Add a blog"
57
+ ```
58
+ **Problem**: Too vague. AI doesn't know:
59
+ - Is this a listing page or single post?
60
+ - What fields should posts have?
61
+ - Should it have pagination?
62
+ - What's the design?
63
+
64
+ ### Prompt Quality: ⭐⭐ Basic
65
+ ```
66
+ "Add a blog listing component with pagination"
67
+ ```
68
+ **Better**: Specifies component type and a feature.
69
+ **Still Missing**: Field structure, design requirements.
70
+
71
+ ### Prompt Quality: ⭐⭐⭐ Good
72
+ ```
73
+ "Add a blog listing component with pagination that shows 9 posts per page. Each post should display title, excerpt, featured image, date, and author name."
74
+ ```
75
+ **Much Better**: Includes specific requirements and data structure.
76
+ **Could Add**: Design details, filtering, categories.
77
+
78
+ ### Prompt Quality: ⭐⭐⭐⭐ Excellent
79
+ ```
80
+ "Add a blog listing component with the following requirements:
81
+
82
+ **Data Source**: Fetch from 'blogPosts' content list in Agility CMS
83
+ **Fields per post**: title, slug, excerpt, featuredImage, date, author (linked content), categories (linked content list)
84
+ **Layout**: 3-column grid on desktop, 2 on tablet, 1 on mobile
85
+ **Pagination**: Show 9 posts per page with next/prev buttons
86
+ **Filtering**: Add category filter buttons at the top
87
+ **Design**: Cards with rounded corners, hover effect, featured image at top
88
+ **Sort**: Most recent first (date descending)"
89
+ ```
90
+ **Excellent**: Complete specification, AI can build this perfectly!
91
+
92
+ ## 🏗️ Building a Complete Website: Step-by-Step Prompts
93
+
94
+ ### Starting Fresh with a Blank Agility Instance
95
+
96
+ #### Step 1: Plan Your Content Structure
97
+ ```
98
+ "I'm building a [business/portfolio/blog] website with a blank Agility CMS instance. Help me plan:
99
+ 1. What content models should I create? (Pages, Blog Posts, Team Members, etc.)
100
+ 2. What fields should each model have?
101
+ 3. What page components (modules) will I need?
102
+
103
+ The site should have:
104
+ - [List your main pages: Home, About, Blog, Contact, etc.]
105
+ - [List your content types: Blog posts, team members, testimonials, etc.]
106
+ - [List your requirements: multi-language, e-commerce, etc.]"
107
+ ```
108
+
109
+ #### Step 2: Set Up Content Models in Agility CMS
110
+ The AI will give you a plan. **You manually create these in Agility CMS**:
111
+ 1. Go to Settings > Content Definitions
112
+ 2. Create each content model with the suggested fields
113
+ 3. Come back and confirm it's done
114
+
115
+ #### Step 3: Build Components One by One
116
+ ```
117
+ "Create the Hero component for the homepage with these requirements:
118
+ - Background image field (use AgilityPic)
119
+ - Heading (h1)
120
+ - Subheading
121
+ - CTA button with text and link
122
+ - Full-width layout
123
+ - Dark overlay on background image for text readability
124
+ - Centered text alignment"
125
+ ```
126
+
127
+ #### Step 4: Create Content Lists
128
+ ```
129
+ "Create a Blog Listing component:
130
+ - Fetches from 'blogPosts' content list
131
+ - Shows 9 posts per page in 3-column grid
132
+ - Each card shows: featured image, title, excerpt (100 chars), date, author name, category
133
+ - Pagination with next/prev buttons
134
+ - Category filter dropdown
135
+ - Responsive: 3 cols desktop, 2 tablet, 1 mobile"
136
+ ```
137
+
138
+ #### Step 5: Build Individual Content Pages
139
+ ```
140
+ "Create a blog post detail page component that:
141
+ - Receives slug from URL params
142
+ - Fetches single post from 'blogPosts' by slug
143
+ - Shows: featured image, title, date, author with photo, content (rich text)
144
+ - Displays categories as badges
145
+ - Shows related posts at bottom (same category, limit 3)
146
+ - Responsive layout with max-width container"
147
+ ```
148
+
149
+ #### Step 6: Navigation & Layout
150
+ ```
151
+ "Create a header component with:
152
+ - Logo on the left (image field)
153
+ - Navigation menu items from Agility sitemap
154
+ - Mobile hamburger menu
155
+ - Sticky header on scroll
156
+ - Desktop: horizontal menu, Mobile: slide-out drawer"
157
+ ```
158
+
159
+ ## 🎨 Prompt Templates by Component Type
160
+
161
+ ### Hero Sections
162
+ ```
163
+ "Create a [full-width/contained] hero component with:
164
+ - [Background image/solid color/gradient]
165
+ - [Heading/subheading/body text]
166
+ - [CTA buttons count and style]
167
+ - [Image position: left/right/background/none]
168
+ - [Text alignment: left/center/right]
169
+ - [Additional elements: badges/icons/stats]"
170
+ ```
171
+
172
+ ### Content Lists (Blog, Team, Products, etc.)
173
+ ```
174
+ "Create a [content type] listing component:
175
+ - Content list: '[referenceName]'
176
+ - Fields to display: [field1, field2, field3]
177
+ - Layout: [grid/list/masonry] - [X columns]
178
+ - Items per page: [number]
179
+ - Sorting: [field name] [asc/desc]
180
+ - Filtering: [by category/tag/custom field]
181
+ - Search: [yes/no]
182
+ - Pagination: [numbered/next-prev/infinite-scroll]
183
+ - Card design: [specific styling requirements]"
184
+ ```
185
+
186
+ ### Forms
187
+ ```
188
+ "Create a [contact/newsletter/registration] form with:
189
+ - Fields: [list fields with types]
190
+ - Validation: [required fields, email format, etc.]
191
+ - Submit action: [email/API/database]
192
+ - Success message: [custom message]
193
+ - Error handling: [inline/toast/modal]
194
+ - Design: [styling requirements]"
195
+ ```
196
+
197
+ ### Carousels/Sliders
198
+ ```
199
+ "Create a [testimonials/images/featured content] carousel:
200
+ - Data source: [content list/static/mixed]
201
+ - Items to show: [number] at a time
202
+ - Auto-play: [yes/no] - [interval]
203
+ - Navigation: [arrows/dots/both/none]
204
+ - Transition: [slide/fade]
205
+ - Responsive breakpoints: [mobile/tablet/desktop counts]"
206
+ ```
207
+
208
+ ### Navigation
209
+ ```
210
+ "Create a [header/footer/sidebar] navigation:
211
+ - Menu items from: [Agility sitemap/custom list]
212
+ - Layout: [horizontal/vertical/mega-menu]
213
+ - Mobile behavior: [hamburger/bottom-nav/slide-out]
214
+ - Styling: [specific design requirements]
215
+ - Active page indicator: [yes/no]
216
+ - Dropdown submenus: [yes/no]"
217
+ ```
218
+
219
+ ## 🚀 Advanced Prompt Techniques
220
+
221
+ ### Multi-Step Features
222
+ Break complex features into smaller prompts:
223
+
224
+ ```
225
+ Step 1: "Create the data structure for a blog with categories and tags"
226
+ Step 2: "Create the blog listing component with category filtering"
227
+ Step 3: "Create the single blog post page"
228
+ Step 4: "Add related posts section to single post page"
229
+ Step 5: "Add a blog archive/category page"
230
+ ```
231
+
232
+ ### Referencing Existing Components
233
+ ```
234
+ "Create a Team Members grid similar to the Blog Listing component but:
235
+ - Fetches from 'teamMembers' instead
236
+ - Shows 4 columns instead of 3
237
+ - No pagination (show all)
238
+ - Different card style: circular images, name, title, bio"
239
+ ```
240
+
241
+ ### Iterative Improvements
242
+ ```
243
+ "Update the Hero component to add:
244
+ - A background video option (alternative to image)
245
+ - Animated text reveal on page load
246
+ - Parallax scrolling effect
247
+ - Keep all existing functionality"
248
+ ```
249
+
250
+ ## ✅ Pre-Build Checklist
251
+
252
+ Before asking AI to build components, make sure you have:
253
+
254
+ ### In Agility CMS:
255
+ - [ ] Content models created (Pages, Posts, Team, etc.)
256
+ - [ ] Fields defined for each model
257
+ - [ ] Sample content added (at least 2-3 items per list)
258
+ - [ ] Page templates created (if needed)
259
+ - [ ] Sitemap structure planned
260
+
261
+ ### In Your Prompt:
262
+ - [ ] Specific component name
263
+ - [ ] Data source (content list reference name)
264
+ - [ ] All field names spelled exactly as in Agility CMS
265
+ - [ ] Layout requirements (grid columns, responsive behavior)
266
+ - [ ] Specific design requirements
267
+ - [ ] Any interactive behaviors needed
268
+
269
+ ## 🎓 Learning from Examples
270
+
271
+ ### Example: Building a Portfolio Site
272
+
273
+ **Prompt 1 - Planning:**
274
+ ```
275
+ "I'm building a portfolio website for a freelance designer with a blank Agility CMS instance. Help me plan the content structure. The site needs:
276
+ - Homepage with hero, about section, featured projects showcase
277
+ - Projects page showing all projects in a grid
278
+ - Individual project detail pages
279
+ - About page with bio and skills
280
+ - Contact page with form
281
+
282
+ What content models, modules, and fields should I create in Agility CMS?"
283
+ ```
284
+
285
+ **Prompt 2 - Hero Component:**
286
+ ```
287
+ "Create a Hero component for the homepage with:
288
+ - Full-width background image (AgilityPic)
289
+ - Centered text with h1 heading 'headline' field
290
+ - Subheading 'tagline' field
291
+ - Two CTA buttons: 'primaryCTA' and 'secondaryCTA' (with text and link)
292
+ - Dark overlay on image for text contrast (40% opacity)
293
+ - Height: 80vh on desktop, 60vh on mobile"
294
+ ```
295
+
296
+ **Prompt 3 - Projects Grid:**
297
+ ```
298
+ "Create a Projects Grid component:
299
+ - Fetches from 'projects' content list (referenceName: 'projects')
300
+ - Shows 6 projects in 3-column grid (desktop), 2 columns (tablet), 1 column (mobile)
301
+ - Each project card displays:
302
+ - Thumbnail image (use AgilityPic)
303
+ - Project title
304
+ - Client name
305
+ - Category badge
306
+ - Hover effect: scale up slightly and show "View Project" overlay
307
+ - Links to individual project pages using slug
308
+ - No pagination, show all projects"
309
+ ```
310
+
311
+ **Prompt 4 - Project Detail Page:**
312
+ ```
313
+ "Create a Project Detail component for individual project pages:
314
+ - Fetches single project by slug from URL
315
+ - Layout:
316
+ - Full-width hero image (project.featuredImage)
317
+ - Container with max-width for content:
318
+ - Project title (h1)
319
+ - Client name and date
320
+ - Category badges
321
+ - Project description (rich text)
322
+ - Image gallery grid (3 columns)
323
+ - Technologies used (list with icons)
324
+ - Link to live site (if available)
325
+ - Related projects at bottom (same category, limit 3)
326
+ - Responsive: single column on mobile"
327
+ ```
328
+
329
+ ## 🔍 Troubleshooting Prompts
330
+
331
+ If the AI's output isn't quite right, use these follow-up prompts:
332
+
333
+ ### Component Not Rendering
334
+ ```
335
+ "The [component name] isn't showing up. Can you check:
336
+ 1. Is it registered in the index.ts file?
337
+ 2. Does the reference name match Agility CMS exactly?
338
+ 3. Are there any TypeScript errors?
339
+ 4. Show me the current registration code"
340
+ ```
341
+
342
+ ### Wrong Data Structure
343
+ ```
344
+ "The [component name] is showing [undefined/error]. The actual field structure in Agility CMS is:
345
+ - field1: [type]
346
+ - field2: [type]
347
+ Please update the component to match this exact structure."
348
+ ```
349
+
350
+ ### Styling Issues
351
+ ```
352
+ "Update the [component name] styling to:
353
+ - [Specific change 1]
354
+ - [Specific change 2]
355
+ Keep all existing functionality unchanged."
356
+ ```
357
+
358
+ ## 💡 Pro Tips
359
+
360
+ 1. **Start Small**: Build one component at a time, test it, then move to the next
361
+ 2. **Be Specific**: The more details you provide, the better the result
362
+ 3. **Reference Existing**: Point to similar components when asking for new ones
363
+ 4. **Test Often**: Build, test in Agility CMS, then iterate
364
+ 5. **Use Exact Names**: Always use the exact reference names from Agility CMS
365
+ 6. **Think Responsive**: Always mention mobile/tablet/desktop requirements
366
+ 7. **Content First**: Create content in Agility CMS before building components
367
+ 8. **Type Safety**: Ask for TypeScript interfaces when needed
368
+
369
+ ## 📚 Common Patterns Quick Reference
370
+
371
+ | What You Want | Prompt Template |
372
+ |---------------|-----------------|
373
+ | Page Module | "Create a [name] component with fields: [list]. Layout: [description]" |
374
+ | Content List | "Create a [type] listing from '[referenceName]' with [X] items per page" |
375
+ | Single Item | "Create a [type] detail page that fetches by slug from '[referenceName]'" |
376
+ | Form | "Create a [purpose] form with fields: [list]. Submit to [destination]" |
377
+ | Navigation | "Create [header/footer] nav from Agility sitemap with [behavior]" |
378
+ | Interactive | "Create a [component] with [interaction] using client component pattern" |
379
+
380
+ ## 🎯 Your First Website Prompt
381
+
382
+ Ready to start? Try this comprehensive first prompt:
383
+
384
+ ```
385
+ "I have a blank Agility CMS instance and want to build a [business type] website. Help me set up the initial structure:
386
+
387
+ **Pages Needed:**
388
+ 1. Homepage (hero, services overview, testimonials, CTA)
389
+ 2. About page (team members, company story)
390
+ 3. Services page (list of services)
391
+ 4. Blog (listing and detail pages)
392
+ 5. Contact page (form)
393
+
394
+ **Content to Manage:**
395
+ - Service items (title, description, icon, features list)
396
+ - Team members (name, title, bio, photo, social links)
397
+ - Blog posts (title, content, featured image, author, date, categories)
398
+ - Testimonials (quote, author, company, photo)
399
+
400
+ Please provide:
401
+ 1. A list of content models to create in Agility CMS with their fields
402
+ 2. A list of page modules (components) I'll need
403
+ 3. The order I should build them in
404
+
405
+ After I confirm I've created the content models in Agility CMS, we'll build each component step by step."
406
+ ```
407
+
408
+ ---
409
+
410
+ **Remember**: The AI can't create content models in Agility CMS for you, but it can tell you exactly what to create and then build all the code to display that content beautifully! 🎨✨
@@ -0,0 +1,281 @@
1
+ # Agility CMS + Next.js Project
2
+
3
+ This project was created with [`create-next-agility-app`](https://github.com/agility/create-next-agility-app).
4
+
5
+ **✨ Built for AI-assisted development** - Includes comprehensive documentation for Claude Code, Cursor, GitHub Copilot, and all AI coding tools.
6
+
7
+ ## 🚀 Quick Start
8
+
9
+ ```bash
10
+ npm install
11
+ npm run dev
12
+ ```
13
+
14
+ Open [http://localhost:3000](http://localhost:3000) to see your site.
15
+
16
+ ## 📋 Prerequisites
17
+
18
+ You need an **Agility CMS instance** to use this project. Most users will already have an existing instance with content.
19
+
20
+ ### Need a Blank Instance?
21
+ If you want to start completely from scratch with a blank Agility CMS instance, contact **support@agilitycms.com** to request one. Then follow the [BLANK-INSTANCE-SETUP.md](./BLANK-INSTANCE-SETUP.md) guide.
22
+
23
+ ### Have an Existing Instance?
24
+ If you already have an Agility CMS instance with content, you're ready to go! Just configure your `.env.local` with your API keys and start building components for your existing content models.
25
+
26
+ ## 📚 Documentation
27
+
28
+ This project includes extensive documentation optimized for both developers and AI assistants:
29
+
30
+ ### 🚀 Start Here
31
+ - **[PROMPTS.md](./PROMPTS.md)** - How to write effective prompts for AI assistants
32
+ - **[EXAMPLE-PROMPTS.md](./EXAMPLE-PROMPTS.md)** - Copy-paste prompt library
33
+ - **[.claude/QUICK-START.md](./.claude/QUICK-START.md)** - Get started in 5 minutes
34
+ - **[BLANK-INSTANCE-SETUP.md](./BLANK-INSTANCE-SETUP.md)** - For blank instances (contact support@agilitycms.com first)
35
+
36
+ ### 📖 Guides
37
+ - **[DEVELOPMENT.md](./DEVELOPMENT.md)** - Complete development guide
38
+ - **[agents.md](./agents.md)** - AI assistant guide (for Claude Code, Cursor, etc.)
39
+ - **[.claude/README.md](./.claude/README.md)** - Full documentation index
40
+ - **[docs/README.md](./docs/README.md)** - Detailed documentation
41
+
42
+ ### For Building with AI
43
+ - [Prompt Engineering Guide](./PROMPTS.md) - Write better prompts
44
+ - [Example Prompts Library](./EXAMPLE-PROMPTS.md) - Ready-to-use prompts
45
+
46
+ ### For Developers
47
+ - [Agility CMS Overview](./docs/01-agility-cms-overview.md) - How Agility CMS works
48
+ - [Creating Components](./docs/03-creating-components.md) - Build features
49
+ - [Common Components](./docs/08-common-components.md) - Ready-to-use examples
50
+
51
+ ## 🤖 AI-Assisted Development
52
+
53
+ This project is designed for AI-assisted development.
54
+
55
+ **Getting started with AI?**
56
+ 1. **[PROMPTS.md](./PROMPTS.md)** - Learn how to write effective prompts
57
+ 2. **[EXAMPLE-PROMPTS.md](./EXAMPLE-PROMPTS.md)** - Copy and customize ready-made prompts
58
+
59
+ **Quick Examples:**
60
+ ```
61
+ "Add a blog listing component with pagination"
62
+ "Create a hero section with background image"
63
+ "Implement a testimonials carousel"
64
+ "Add a contact form with validation"
65
+ ```
66
+
67
+ 💡 **Tip**: The more specific your prompts, the better the results! See [PROMPTS.md](./PROMPTS.md) for the formula.
68
+
69
+ ### Platform-Specific Tips
70
+
71
+ **Claude Code:**
72
+ ```
73
+ Just ask naturally - documentation is auto-discovered!
74
+ "Add a blog with categories"
75
+ ```
76
+
77
+ **Cursor:**
78
+ ```
79
+ Reference docs explicitly:
80
+ @.claude/docs/03-creating-components.md create a testimonials carousel
81
+ ```
82
+
83
+ **GitHub Copilot:**
84
+ ```
85
+ Use workspace context:
86
+ @workspace /new Create a team members grid following Agility CMS patterns
87
+ ```
88
+
89
+ ## 📂 Project Structure
90
+
91
+ ```
92
+ src/
93
+ ├── app/
94
+ │ ├── api/ # API routes for Agility CMS
95
+ │ │ ├── preview/ # Preview mode endpoints
96
+ │ │ ├── revalidate/ # Webhook for cache revalidation
97
+ │ │ └── dynamic-redirect/ # Dynamic page redirects
98
+ │ └── [locale]/
99
+ │ └── [...slug]/
100
+ │ └── page.tsx # All pages route through here
101
+ ├── components/
102
+ │ ├── agility-components/ # CMS components (add yours here)
103
+ │ │ ├── index.ts # Component registry
104
+ │ │ └── RichTextArea.tsx # Example component
105
+ │ └── agility-pages/ # Page templates
106
+ │ ├── index.ts # Template registry
107
+ │ └── MainTemplate.tsx # Main template
108
+ └── lib/
109
+ ├── cms/ # CMS helper functions
110
+ │ ├── getAgilityPage.ts
111
+ │ ├── getContentItem.ts
112
+ │ ├── getContentList.ts
113
+ │ └── ...
114
+ └── i18n/
115
+ └── config.ts # Locale configuration
116
+ ```
117
+
118
+ ## 🔗 API Routes
119
+
120
+ This project includes built-in API routes for Agility CMS:
121
+
122
+ ### Preview Mode
123
+ - **`/api/preview`** - Enables preview/draft mode for viewing unpublished content
124
+ - **`/api/preview/exit`** - Exits preview mode and returns to published content
125
+
126
+ ### Cache Revalidation
127
+ - **`/api/revalidate`** - Webhook endpoint for on-demand cache revalidation when content changes in Agility CMS
128
+
129
+ ### Dynamic Redirects
130
+ - **`/api/dynamic-redirect`** - Redirects to the correct URL for a dynamic page based on ContentID
131
+
132
+ **Configure webhooks in Agility CMS:** Settings > Webhooks > Add Webhook → Point to `https://yourdomain.com/api/revalidate`
133
+
134
+ ## 🔧 Environment Variables
135
+
136
+ Configure your Agility CMS connection in `.env.local`:
137
+
138
+ ```env
139
+ AGILITY_GUID=your-instance-guid
140
+ AGILITY_API_FETCH_KEY=your-fetch-api-key
141
+ AGILITY_API_PREVIEW_KEY=your-preview-api-key
142
+ AGILITY_LOCALES=en-us
143
+ AGILITY_SITEMAP=website
144
+ ```
145
+
146
+ ## 🎯 Common Tasks
147
+
148
+ ### Add a New Component
149
+
150
+ 1. Create file: `src/components/agility-components/YourComponent.tsx`
151
+ 2. Register in: `src/components/agility-components/index.ts`
152
+ 3. Create component model in Agility CMS (Settings > Content Definitions > New Module)
153
+ 4. Add to page in CMS
154
+
155
+ **See:** [.claude/docs/03-creating-components.md](./.claude/docs/03-creating-components.md)
156
+
157
+ ### Fetch Content Lists
158
+
159
+ ```typescript
160
+ import { getContentList } from "@/lib/cms/getContentList";
161
+
162
+ const posts = await getContentList({
163
+ referenceName: "posts",
164
+ locale: "en-us",
165
+ take: 10,
166
+ });
167
+ ```
168
+
169
+ **See:** [.claude/docs/04-data-fetching.md](./.claude/docs/04-data-fetching.md)
170
+
171
+ ### Add Multi-Language Support
172
+
173
+ 1. Update `AGILITY_LOCALES` in `.env.local`
174
+ 2. Update `src/lib/i18n/config.ts`
175
+ 3. Add locale content in Agility CMS
176
+
177
+ **See:** [.claude/docs/06-localization.md](./.claude/docs/06-localization.md)
178
+
179
+ ## 🏗️ Development Commands
180
+
181
+ ```bash
182
+ npm run dev # Start development server
183
+ npm run build # Build for production
184
+ npm run start # Start production server
185
+ npm run lint # Run ESLint
186
+ ```
187
+
188
+ ## 📦 What's Included
189
+
190
+ - ✅ **Agility CMS Integration** - Full SDK with type-safe helpers
191
+ - ✅ **Next.js 15** - App Router with Server Components
192
+ - ✅ **Multi-Locale Support** - Built-in internationalization
193
+ - ✅ **TypeScript** - Full type safety
194
+ - ✅ **Caching** - ISR with on-demand revalidation
195
+ - ✅ **Preview Mode** - See draft content before publishing
196
+ - ✅ **AI-Friendly Docs** - Optimized for all AI coding tools
197
+
198
+ ## 🔗 Key Concepts
199
+
200
+ ### Components (Called "Modules" in CMS)
201
+ Reusable building blocks that editors add to pages. Created in Agility CMS, implemented as React components.
202
+
203
+ ### Page Templates
204
+ Define page layout with zones. Components are placed in these zones.
205
+
206
+ ### Content Lists
207
+ Collections like blog posts, testimonials, team members. Fetched with `getContentList()`.
208
+
209
+ ### Locales
210
+ Multi-language support. Default locale (en-us) has clean URLs, others are prefixed (/fr/, /es/).
211
+
212
+ ## 📖 Learn More
213
+
214
+ ### Documentation
215
+ - **[Development Guide](./DEVELOPMENT.md)** - Comprehensive dev guide
216
+ - **[Quick Start](./.claude/QUICK-START.md)** - 5-minute setup
217
+ - **[Full Docs](./.claude/README.md)** - Complete documentation
218
+
219
+ ### Agility CMS Resources
220
+ - [Agility CMS Documentation](https://agilitycms.com/docs)
221
+ - [Agility CMS Help Center](https://help.agilitycms.com)
222
+ - [Agility CMS Community](https://community.agilitycms.com)
223
+
224
+ ### Next.js Resources
225
+ - [Next.js Documentation](https://nextjs.org/docs)
226
+ - [Learn Next.js](https://nextjs.org/learn)
227
+ - [Next.js GitHub](https://github.com/vercel/next.js)
228
+
229
+ ## 🚢 Deployment
230
+
231
+ ### Deploy on Vercel
232
+
233
+ The easiest way to deploy:
234
+
235
+ [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new)
236
+
237
+ 1. Push your code to GitHub
238
+ 2. Import repository in Vercel
239
+ 3. Add environment variables
240
+ 4. Deploy!
241
+
242
+ ### Environment Variables for Production
243
+
244
+ Set these in your hosting platform:
245
+ - `AGILITY_GUID`
246
+ - `AGILITY_API_FETCH_KEY`
247
+ - `AGILITY_API_PREVIEW_KEY`
248
+ - `AGILITY_SECURITY_KEY` (for webhooks)
249
+ - `AGILITY_LOCALES`
250
+ - `AGILITY_SITEMAP`
251
+
252
+ ## 🐛 Troubleshooting
253
+
254
+ ### Build Fails
255
+ - Check all environment variables are set
256
+ - Ensure components are registered in `index.ts`
257
+ - Verify Agility CMS content exists
258
+
259
+ ### Preview Mode Not Working
260
+ - Check `AGILITY_API_PREVIEW_KEY` is set
261
+ - Verify preview key matches in CMS
262
+ - Clear cookies and try again
263
+
264
+ ### Components Not Rendering
265
+ - Verify component is registered in `agility-components/index.ts`
266
+ - Check component reference name matches CMS exactly (case-sensitive)
267
+ - Ensure component model exists in Agility CMS
268
+
269
+ **More help:** See [.claude/docs/11-troubleshooting.md](./.claude/docs/11-troubleshooting.md) (if available)
270
+
271
+ ## 🤝 Contributing
272
+
273
+ Contributions are welcome! Please read the [contribution guidelines](https://github.com/agility/create-next-agility-app/blob/main/CONTRIBUTING.md) first.
274
+
275
+ ## 📄 License
276
+
277
+ MIT
278
+
279
+ ---
280
+
281
+ **Built with [Agility CMS](https://agilitycms.com) ❤️**