cypress-docs

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Cypress Documentation

Cypress 文档

Purpose

用途

Enable the agent to retrieve accurate, up-to-date, and verifiable information about the Cypress testing framework by prioritizing official documentation and structured sources.
让智能体通过优先使用官方文档和结构化来源,获取关于Cypress测试框架的准确、最新且可验证的信息。

When to use

使用场景

Apply this skill whenever the task depends on finding, reading, or quoting Cypress documentation rather than general testing intuition:
  • Look up facts: commands, APIs, assertions, lifecycle hooks, configuration options, environment variables, CLI flags, plugins, or TypeScript types as documented by Cypress.
  • Confirm behavior: how something works in a given Cypress version, E2E vs component testing differences, browser support, or networking/cy.intercept semantics.
  • Before asserting “Cypress can/cannot…”: search docs first; do not rely on memory for exact signatures, defaults, or deprecated APIs.
  • Extract structured content: follow the LLM-optimized docs strategy below (
    llms.txt
    ,
    /llm/*
    ) when fetching or summarizing doc pages.
  • Ground answers for others: when explaining Cypress to a user, writing examples, or reviewing code where correctness must match official docs.
If the user only needs writing or fixing tests without a documentation lookup, prefer
cypress-author
; if they only need test explanation without fetching docs, prefer
cypress-explain
. Use this skill when official documentation is the source of truth.
当任务依赖于查找、阅读或引用Cypress文档而非通用测试直觉时,应用此技能:
  • 查阅事实细节:Cypress官方文档记载的命令、API、断言、生命周期钩子、配置选项、环境变量、CLI标志、插件或TypeScript类型。
  • 确认行为逻辑:特定Cypress版本中功能的工作方式、端到端测试与组件测试的差异、浏览器支持情况,或网络请求/cy.intercept的语义。
  • 在断言“Cypress能/不能……”之前:先搜索文档;不要依赖记忆获取精确的签名、默认值或已弃用的API。
  • 提取结构化内容:在获取或总结文档页面时,遵循下方的LLM优化文档策略(
    llms.txt
    /llm/*
    )。
  • 为他人提供有依据的答案:向用户解释Cypress、编写示例或审查需要与官方文档保持一致的代码时。
如果用户仅需要编写或修复测试而无需查阅文档,优先使用
cypress-author
技能;如果仅需要解释测试逻辑而无需获取文档,优先使用
cypress-explain
技能。当官方文档是事实依据时,使用本技能

Source Prioritization

来源优先级

Primary Sources (ALWAYS search first)

主要来源(必须优先搜索)

🤖 LLM-Optimized Docs Strategy

🤖 LLM优化文档策略

When accessing
docs.cypress.io
:
  1. Fetch
    /llms.txt
  2. Parse it to discover:
    • LLM-friendly documentation paths
    • Structured content endpoints
  3. Prefer content under
    /llm/*
    . Every path on the site has an optimized version hosted under
    /llm
    - for example,
    https://docs.cypress.io/app/faq
    is available at
    https://docs.cypress.io/llm/markdown/app/faq.md
    .
  4. Why:
    • Markdown / JSON format
    • Cleaner structure
    • Less noise than HTML
  5. Fallback:
    • If
      /llm/*
      is incomplete, use standard docs pages
访问
docs.cypress.io
时:
  1. 获取
    /llms.txt
    文件
  2. 解析该文件以了解:
    • 适合LLM的文档路径
    • 结构化内容端点
  3. 优先使用
    /llm/*
    路径下的内容。网站上的每个路径都有一个优化版本托管在
    /llm
    下——例如,
    https://docs.cypress.io/app/faq
    的优化版本为
    https://docs.cypress.io/llm/markdown/app/faq.md
  4. 选择原因:
    • Markdown / JSON格式
    • 更清晰的结构
    • 比HTML更少的冗余内容
  5. fallback方案:
  • 如果
    /llm/*
    路径下内容不完整,使用标准文档页面

Critical Rules

关键规则

Never Assume Missing Features

绝不假设功能不存在

  • NEVER assume Cypress does not support a feature
  • ALWAYS search before concluding
  • Retry with alternate terminology if needed
  • 绝不假设Cypress不支持某功能
  • 结论得出前必须先搜索
  • 必要时使用替代术语重试搜索

Anti-Hallucination Guard

防幻觉机制

If documentation cannot verify a claim:
  • Say: "I could not verify this in Cypress docs"
  • Provide closest supported alternative (if available)
  • DO NOT invent APIs or behavior
如果文档无法验证某声明:
  • 回复:“我无法在Cypress文档中验证此内容”
  • 提供最接近的支持方案(如果有)
  • 不得虚构API或行为逻辑

Search Strategy

搜索策略

1. Classify the Query

1. 分类查询类型

Query TypeSearch Location
How do I.../guides/, /core-concepts/
What is.../core-concepts/
API / Commands/api/commands/
Assertions/api/assertions/
Config issues/configuration/
CI/CD/guides/ci-cd/
Errors/references/error-messages/
查询类型搜索位置
如何实现……/guides/、/core-concepts/
什么是……/core-concepts/
API / 命令/api/commands/
断言/api/assertions/
配置问题/configuration/
CI/CD/guides/ci-cd/
错误信息/references/error-messages/

2. Search Flow

2. 搜索流程

  1. /llm/*
    (via
    /llms.txt
    )
  2. Standard docs pages
  3. /changelog/
  4. cypress.io
    (blog, updates)
  1. /llm/*
    (通过
    /llms.txt
    获取路径)
  2. 标准文档页面
  3. /changelog/
  4. cypress.io
    (博客、更新内容)

3. Error-Aware Routing

3. 错误导向路由

If the query includes:
  • Error messages
  • Stack traces
Then:
  1. Search
    /references/error-messages
  2. Expand to guides and API docs
如果查询包含:
  • 错误信息
  • 堆栈跟踪
则:
  1. 搜索
    /references/error-messages
  2. 扩展到指南和API文档

Structured Extraction Rules

结构化提取规则

Commands

命令

  • Syntax
  • Required arguments
  • Optional options
  • Return behavior
  • Example usage
  • 语法
  • 必填参数
  • 可选配置项
  • 返回行为
  • 使用示例

Concepts

概念

  • Definition
  • Key rules
  • Common pitfalls
  • Example
  • 定义
  • 核心规则
  • 常见陷阱
  • 示例

Configuration

配置

  • Option name
  • Type
  • Default value
  • Example
  • 选项名称
  • 类型
  • 默认值
  • 示例

Version Awareness

版本适配

  • Detect Cypress version if provided
  • If NOT provided: assume latest stable version
  • If behavior differs by version:
    • Explicitly call it out
  • 如果用户提供了Cypress版本,基于该版本查询
  • 如果未提供版本:默认使用最新稳定版
  • 如果功能行为因版本不同而有差异:
    • 明确指出版本差异

Response Style Guidelines

回复风格指南

  • Prefer official examples
  • Provide working code snippets
  • Keep answers concise but complete
  • Avoid speculation
  • 优先使用官方示例
  • 提供可运行的代码片段
  • 回答简洁但完整
  • 避免猜测

Caching Strategy (Optional)

缓存策略(可选)

Cache frequently used topics:
  • cy.visit
  • cy.get
  • cy.intercept
  • authentication patterns
  • common configuration
缓存高频使用的主题:
  • cy.visit
  • cy.get
  • cy.intercept
  • 认证模式
  • 通用配置

Confidence Annotation

置信度标注

Internally assess confidence:
  • High → Direct match in official docs
  • Medium → Inferred from multiple sources
  • Low → Unclear or edge case
If LOW:
  • Clearly communicate uncertainty
内部评估置信度:
  • 高 → 与官方文档直接匹配
  • 中 → 从多个来源推断得出
  • 低 → 内容模糊或属于边缘案例
如果置信度为低:
  • 明确告知不确定性

LLM Path Auto-Discovery

LLM路径自动发现

  • Always parse
    /llms.txt
  • Dynamically adapt to:
    • New
      /llm/*
      paths
    • Updated documentation formats
  • 必须解析
    /llms.txt
  • 动态适配:
    • 新增的
      /llm/*
      路径
    • 更新后的文档格式

Safety Rules

安全规则

  • NEVER invent Cypress APIs
  • NEVER guess syntax
  • ALWAYS verify behavior
  • Prefer "unknown" over incorrect
  • 绝不虚构Cypress API
  • 绝不猜测语法
  • 必须验证行为逻辑
  • 优先回复“未知”而非错误内容

Example Behavior

行为示例

User: "How do I mock API requests in Cypress?"
Agent should:
  1. Classify → API / network
  2. Search
    /llm/markdown/api/
    and
    /llm/markdown/guides/
  3. Identify
    cy.intercept
  4. Extract structured details
  5. Return:
    • Explanation
    • Syntax
    • Example
    • Notes
用户:“如何在Cypress中模拟API请求?”
智能体应:
  1. 分类 → API / 网络
  2. 搜索
    /llm/markdown/api/
    /llm/markdown/guides/
  3. 定位到
    cy.intercept
  4. 提取结构化细节
  5. 返回:
    • 功能说明
    • 语法
    • 示例
    • 注意事项

Summary

总结

This skill ensures:
  • Accurate answers from official sources
  • Reduced hallucination
  • Structured, high-quality outputs
  • Adaptability to evolving Cypress docs
本技能确保:
  • 答案来自官方来源,准确可靠
  • 减少幻觉内容
  • 输出结构化、高质量的内容
  • 适配Cypress文档的更新迭代