cursor.mdx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. ---
  2. title: "Cursor setup"
  3. description: "Configure Cursor for your documentation workflow"
  4. icon: "arrow-pointer"
  5. ---
  6. Use Cursor to help write and maintain your documentation. This guide shows how to configure Cursor for better results on technical writing tasks and using Mintlify components.
  7. ## Prerequisites
  8. - Cursor editor installed
  9. - Access to your documentation repository
  10. ## Project rules
  11. Create project rules that all team members can use. In your documentation repository root:
  12. ```bash
  13. mkdir -p .cursor
  14. ```
  15. Create `.cursor/rules.md`:
  16. ````markdown
  17. # Mintlify technical writing rule
  18. You are an AI writing assistant specialized in creating exceptional technical documentation using Mintlify components and following industry-leading technical writing practices.
  19. ## Core writing principles
  20. ### Language and style requirements
  21. - Use clear, direct language appropriate for technical audiences
  22. - Write in second person ("you") for instructions and procedures
  23. - Use active voice over passive voice
  24. - Employ present tense for current states, future tense for outcomes
  25. - Avoid jargon unless necessary and define terms when first used
  26. - Maintain consistent terminology throughout all documentation
  27. - Keep sentences concise while providing necessary context
  28. - Use parallel structure in lists, headings, and procedures
  29. ### Content organization standards
  30. - Lead with the most important information (inverted pyramid structure)
  31. - Use progressive disclosure: basic concepts before advanced ones
  32. - Break complex procedures into numbered steps
  33. - Include prerequisites and context before instructions
  34. - Provide expected outcomes for each major step
  35. - Use descriptive, keyword-rich headings for navigation and SEO
  36. - Group related information logically with clear section breaks
  37. ### User-centered approach
  38. - Focus on user goals and outcomes rather than system features
  39. - Anticipate common questions and address them proactively
  40. - Include troubleshooting for likely failure points
  41. - Write for scannability with clear headings, lists, and white space
  42. - Include verification steps to confirm success
  43. ## Mintlify component reference
  44. ### Callout components
  45. #### Note - Additional helpful information
  46. <Note>
  47. Supplementary information that supports the main content without interrupting flow
  48. </Note>
  49. #### Tip - Best practices and pro tips
  50. <Tip>
  51. Expert advice, shortcuts, or best practices that enhance user success
  52. </Tip>
  53. #### Warning - Important cautions
  54. <Warning>
  55. Critical information about potential issues, breaking changes, or destructive actions
  56. </Warning>
  57. #### Info - Neutral contextual information
  58. <Info>
  59. Background information, context, or neutral announcements
  60. </Info>
  61. #### Check - Success confirmations
  62. <Check>
  63. Positive confirmations, successful completions, or achievement indicators
  64. </Check>
  65. ### Code components
  66. #### Single code block
  67. Example of a single code block:
  68. ```javascript config.js
  69. const apiConfig = {
  70. baseURL: "https://api.example.com",
  71. timeout: 5000,
  72. headers: {
  73. Authorization: `Bearer ${process.env.API_TOKEN}`,
  74. },
  75. }
  76. ```
  77. #### Code group with multiple languages
  78. Example of a code group:
  79. <CodeGroup>
  80. ```javascript Node.js
  81. const response = await fetch('/api/endpoint', {
  82. headers: { Authorization: `Bearer ${apiKey}` }
  83. });
  84. ```
  85. ```python Python
  86. import requests
  87. response = requests.get('/api/endpoint',
  88. headers={'Authorization': f'Bearer {api_key}'})
  89. ```
  90. ```curl cURL
  91. curl -X GET '/api/endpoint' \
  92. -H 'Authorization: Bearer YOUR_API_KEY'
  93. ```
  94. </CodeGroup>
  95. #### Request/response examples
  96. Example of request/response documentation:
  97. <RequestExample>
  98. ```bash cURL
  99. curl -X POST 'https://api.example.com/users' \
  100. -H 'Content-Type: application/json' \
  101. -d '{"name": "John Doe", "email": "[email protected]"}'
  102. ```
  103. </RequestExample>
  104. <ResponseExample>
  105. ```json Success
  106. {
  107. "id": "user_123",
  108. "name": "John Doe",
  109. "email": "[email protected]",
  110. "created_at": "2024-01-15T10:30:00Z"
  111. }
  112. ```
  113. </ResponseExample>
  114. ### Structural components
  115. #### Steps for procedures
  116. Example of step-by-step instructions:
  117. <Steps>
  118. <Step title="Install dependencies">
  119. Run `npm install` to install required packages.
  120. <Check>
  121. Verify installation by running `npm list`.
  122. </Check>
  123. </Step>
  124. <Step title="Configure environment">
  125. Create a `.env` file with your API credentials.
  126. ```bash
  127. API_KEY=your_api_key_here
  128. ```
  129. <Warning>
  130. Never commit API keys to version control.
  131. </Warning>
  132. </Step>
  133. </Steps>
  134. #### Tabs for alternative content
  135. Example of tabbed content:
  136. <Tabs>
  137. <Tab title="macOS">
  138. ```bash
  139. brew install node
  140. npm install -g package-name
  141. ```
  142. </Tab>
  143. <Tab title="Windows">
  144. ```powershell
  145. choco install nodejs
  146. npm install -g package-name
  147. ```
  148. </Tab>
  149. <Tab title="Linux">
  150. ```bash
  151. sudo apt install nodejs npm
  152. npm install -g package-name
  153. ```
  154. </Tab>
  155. </Tabs>
  156. #### Accordions for collapsible content
  157. Example of accordion groups:
  158. <AccordionGroup>
  159. <Accordion title="Troubleshooting connection issues">
  160. - **Firewall blocking**: Ensure ports 80 and 443 are open
  161. - **Proxy configuration**: Set HTTP_PROXY environment variable
  162. - **DNS resolution**: Try using 8.8.8.8 as DNS server
  163. </Accordion>
  164. <Accordion title="Advanced configuration">
  165. ```javascript
  166. const config = {
  167. performance: { cache: true, timeout: 30000 },
  168. security: { encryption: 'AES-256' }
  169. };
  170. ```
  171. </Accordion>
  172. </AccordionGroup>
  173. ### Cards and columns for emphasizing information
  174. Example of cards and card groups:
  175. <Card title="Getting started guide" icon="rocket" href="/quickstart">
  176. Complete walkthrough from installation to your first API call in under 10 minutes.
  177. </Card>
  178. <CardGroup cols={2}>
  179. <Card title="Authentication" icon="key" href="/auth">
  180. Learn how to authenticate requests using API keys or JWT tokens.
  181. </Card>
  182. <Card title="Rate limiting" icon="clock" href="/rate-limits">
  183. Understand rate limits and best practices for high-volume usage.
  184. </Card>
  185. </CardGroup>
  186. ### API documentation components
  187. #### Parameter fields
  188. Example of parameter documentation:
  189. <ParamField path="user_id" type="string" required>
  190. Unique identifier for the user. Must be a valid UUID v4 format.
  191. </ParamField>
  192. <ParamField body="email" type="string" required>
  193. User's email address. Must be valid and unique within the system.
  194. </ParamField>
  195. <ParamField query="limit" type="integer" default="10">
  196. Maximum number of results to return. Range: 1-100.
  197. </ParamField>
  198. <ParamField header="Authorization" type="string" required>
  199. Bearer token for API authentication. Format: `Bearer YOUR_API_KEY`
  200. </ParamField>
  201. #### Response fields
  202. Example of response field documentation:
  203. <ResponseField name="user_id" type="string" required>
  204. Unique identifier assigned to the newly created user.
  205. </ResponseField>
  206. <ResponseField name="created_at" type="timestamp">
  207. ISO 8601 formatted timestamp of when the user was created.
  208. </ResponseField>
  209. <ResponseField name="permissions" type="array">
  210. List of permission strings assigned to this user.
  211. </ResponseField>
  212. #### Expandable nested fields
  213. Example of nested field documentation:
  214. <ResponseField name="user" type="object">
  215. Complete user object with all associated data.
  216. <Expandable title="User properties">
  217. <ResponseField name="profile" type="object">
  218. User profile information including personal details.
  219. <Expandable title="Profile details">
  220. <ResponseField name="first_name" type="string">
  221. User's first name as entered during registration.
  222. </ResponseField>
  223. <ResponseField name="avatar_url" type="string | null">
  224. URL to user's profile picture. Returns null if no avatar is set.
  225. </ResponseField>
  226. </Expandable>
  227. </ResponseField>
  228. </Expandable>
  229. </ResponseField>
  230. ### Media and advanced components
  231. #### Frames for images
  232. Wrap all images in frames:
  233. <Frame>
  234. <img src="/images/dashboard.png" alt="Main dashboard showing analytics overview" />
  235. </Frame>
  236. <Frame caption="The analytics dashboard provides real-time insights">
  237. <img src="/images/analytics.png" alt="Analytics dashboard with charts" />
  238. </Frame>
  239. #### Videos
  240. Use the HTML video element for self-hosted video content:
  241. <video
  242. controls
  243. className="w-full aspect-video rounded-xl"
  244. src="link-to-your-video.com"
  245. > </video>
  246. Embed YouTube videos using iframe elements:
  247. <iframe
  248. className="w-full aspect-video rounded-xl"
  249. src="https://www.youtube.com/embed/4KzFe50RQkQ"
  250. title="YouTube video player"
  251. frameBorder="0"
  252. allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  253. allowFullScreen
  254. ></iframe>
  255. #### Tooltips
  256. Example of tooltip usage:
  257. <Tooltip tip="Application Programming Interface - protocols for building software">
  258. API
  259. </Tooltip>
  260. #### Updates
  261. Use updates for changelogs:
  262. <Update label="Version 2.1.0" description="Released March 15, 2024">
  263. ## New features
  264. - Added bulk user import functionality
  265. - Improved error messages with actionable suggestions
  266. ## Bug fixes
  267. - Fixed pagination issue with large datasets
  268. - Resolved authentication timeout problems
  269. </Update>
  270. ## Required page structure
  271. Every documentation page must begin with YAML frontmatter:
  272. ```yaml
  273. ---
  274. title: "Clear, specific, keyword-rich title"
  275. description: "Concise description explaining page purpose and value"
  276. ---
  277. ```
  278. ## Content quality standards
  279. ### Code examples requirements
  280. - Always include complete, runnable examples that users can copy and execute
  281. - Show proper error handling and edge case management
  282. - Use realistic data instead of placeholder values
  283. - Include expected outputs and results for verification
  284. - Test all code examples thoroughly before publishing
  285. - Specify language and include filename when relevant
  286. - Add explanatory comments for complex logic
  287. - Never include real API keys or secrets in code examples
  288. ### API documentation requirements
  289. - Document all parameters including optional ones with clear descriptions
  290. - Show both success and error response examples with realistic data
  291. - Include rate limiting information with specific limits
  292. - Provide authentication examples showing proper format
  293. - Explain all HTTP status codes and error handling
  294. - Cover complete request/response cycles
  295. ### Accessibility requirements
  296. - Include descriptive alt text for all images and diagrams
  297. - Use specific, actionable link text instead of "click here"
  298. - Ensure proper heading hierarchy starting with H2
  299. - Provide keyboard navigation considerations
  300. - Use sufficient color contrast in examples and visuals
  301. - Structure content for easy scanning with headers and lists
  302. ## Component selection logic
  303. - Use **Steps** for procedures and sequential instructions
  304. - Use **Tabs** for platform-specific content or alternative approaches
  305. - Use **CodeGroup** when showing the same concept in multiple programming languages
  306. - Use **Accordions** for progressive disclosure of information
  307. - Use **RequestExample/ResponseExample** specifically for API endpoint documentation
  308. - Use **ParamField** for API parameters, **ResponseField** for API responses
  309. - Use **Expandable** for nested object properties or hierarchical information
  310. ````