Cursor Rules TemplatesCursor Rules Template

Cursor Rules Template: Markdown Docs Portal for Cursor AI

Cursor Rules Template for a Markdown powered developer documentation portal with search, versioning, API references, and AI Q&A powered by Cursor AI.

cursor-rules-templatecursor-rulesmarkdowndocumentationdocs-portalapi-referencessearchversioningai-q&acursor-ai

Target User

Developers building a Markdown based developer documentation portal

Use Cases

  • Define a consistent structure for Markdown based docs with versioning
  • Wire in OpenAPI references to automatically render API docs
  • Integrate a search index for fast querying
  • Provide AI Q&A on docs with Cursor AI
  • Enforce style and architecture rules for maintaining docs

Markdown Template

Cursor Rules Template: Markdown Docs Portal for Cursor AI

// Cursor rules block for the Markdown Docs Portal
(
  frameworkRole: 'Cursor AI assistant for a Markdown based dev docs portal',
  context: 'You enforce a standard across docs with versioned Markdown files, API references, search index, and AI Q&A',
  codeStyleAndGuides: 'markdownlint and YAML front matter per document',
  architectureAndDirectories: {
    root: '/docs',
    versionsDir: '/docs/versions',
    apiRefs: '/docs/api/openapi.yaml',
    searchIndex: '/docs/search/index.json'
  },
  authenticationAndSecurity: {
    publicDocsAccess: 'read-only',
    adminTokens: 'CI tokens only'
  },
  databaseAndORM: {
    storage: 'markdown files in docs',
    index: 'optional JSON search index'
  },
  testingAndLinting: {
    unit: ['markdownlint --config .markdownlint.json'],
    integration: ['doc-generator-test'],
    ci: ['github-actions']
  },
  prohibitedActionsAndAntiPatterns: [
    'Do not fetch private data without authorization',
    'Do not execute code from docs',
    'Do not embed secrets in content',
    'Do not skip versioning'
  ]
)

Overview

Cursor rules template for building a Markdown based developer documentation portal with search, versioning, API references, and AI Q&A using Cursor AI. This Cursor rules template targets a stack where docs are authored in Markdown, API references are integrated via OpenAPI, and Cursor AI guides authors to produce consistent, safe content.

When to Use These Cursor Rules

  • When building a large developer portal that hosts Markdown content with API references
  • When you need versioned docs for multiple API releases
  • When search indexing and fast query results are required for discovery
  • When you want AI assisted Q&A over documentation for developers
  • When enforcing a consistent style, structure, and security posture across docs

Copyable .cursorrules Configuration

// Cursor rules block for the Markdown Docs Portal
(
  frameworkRole: 'Cursor AI assistant for a Markdown based dev docs portal',
  context: 'You enforce a standard across docs with versioned Markdown files, API references, search index, and AI Q&A',
  codeStyleAndGuides: 'markdownlint and YAML front matter per document',
  architectureAndDirectories: {
    root: '/docs',
    versionsDir: '/docs/versions',
    apiRefs: '/docs/api/openapi.yaml',
    searchIndex: '/docs/search/index.json'
  },
  authenticationAndSecurity: {
    publicDocsAccess: 'read-only',
    adminTokens: 'CI tokens only'
  },
  databaseAndORM: {
    storage: 'markdown files in docs',
    index: 'optional JSON search index'
  },
  testingAndLinting: {
    unit: ['markdownlint --config .markdownlint.json'],
    integration: ['doc-generator-test'],
    ci: ['github-actions']
  },
  prohibitedActionsAndAntiPatterns: [
    'Do not fetch private data without authorization',
    'Do not execute code from docs',
    'Do not embed secrets in content',
    'Do not skip versioning'
  ]
)

Recommended Project Structure

// Recommended project structure for a Markdown based docs portal
docs/
  v1/
    index.md
    api/
      openapi.yaml
  v2/
    index.md
  search/
    config.json
  qa/
    faq.json
  assets/

Core Engineering Principles

  • Single source of truth: versioned Markdown docs as the canonical content
  • Deterministic generation: doc rendering and API refs should be reproducible
  • Accessible and semantic content: semantic headings, ALT text, and accessible components
  • Safe AI assisted authoring: Cursor AI helps but cannot alter source truth
  • Clear separation of content and presentation: content lives in docs, UI in a separate layer
  • Security by default: public docs are read only; admin changes go through CI

Code Construction Rules

  • Store content as Markdown with YAML front matter for version, last updated, and API references
  • File naming follows the pattern docs/vX/slug.md where X is the version
  • OpenAPI specs must be placed under docs/api/openapi.yaml and referenced in API pages
  • All docs must be linted with markdownlint; enforce a consistent style across files
  • Use a centralized search index (docs/search/index.json) for fast retrieval
  • Use a dedicated AI Q&A page that pulls from the docs and API refs with safe prompts
  • Do not embed executable code or secrets in Markdown content

Security and Production Rules

  • Public docs are read-only; any admin actions require CI controlled tokens
  • Do not commit secrets or API keys in repository files
  • Set strict Content-Security-Policy headers in hosting configuration
  • Validate OpenAPI specs against a schema and run API reference tests in CI
  • Audit dependencies and keep tooling up to date in CI pipelines

Testing Checklist

  • Lint all Markdown files with markdownlint and fix reported issues
  • Validate API references against the OpenAPI spec
  • Run doc generation to ensure renderer outputs stable HTML
  • Run search index build and verify search results are relevant
  • Perform smoke tests on AI Q&A responses for accuracy and safety

Common Mistakes to Avoid

  • Mixing content with presentation logic in Markdown files
  • Forgetting to version docs and breaking API reference alignment
  • Storing secrets in Markdown or in repo configuration
  • Skipping linting and tests in CI for speed of delivery

Related Cursor rules templates

Explore adjacent Cursor rules templates for similar stacks, workflows, and production constraints.

FAQ

What is a Cursor Rules Template page for a Markdown based developer docs portal?

A Cursor Rules Template page provides a structured, copyable .cursorrules configuration and HTML guidance to build a Markdown driven developer docs portal. It covers versioning, API references, search, and AI Q&A, all while enforcing safe AI assisted development patterns with Cursor AI.

How do I enable search and versioning in the docs portal?

Versioning is achieved by storing docs under versioned folders (eg v1, v2) and exposing a docs/versions index. Search uses a dedicated index file at docs/search/index.json that the renderer queries to deliver fast results. Cursor rules guide how to surface versioned content consistently.

How do I integrate API references into the portal?

API references are authored via OpenAPI specs placed at docs/api/openapi.yaml. The Cursor rules enforce linking of OpenAPI data into API reference pages and validating them against a schema, ensuring accuracy and consistency across versions and pages.

How does AI Q&A operate within the docs portal?

AI Q&A uses Cursor AI to fetch and summarize information from Markdown docs and API references. The rules ensure responses remain grounded in source docs, avoid leaking secrets, and present concise, developer-focused answers.

What are the core constraints for Cursor AI in this setup?

The Cursor AI rules restrict actions to reading and aggregating content from Markdown docs and OpenAPI specs, enforce no code execution in docs, require read-only public access, and mandate CI controlled changes for admin actions. It also promotes safe prompts and validates outputs against the content corpus.