behat-ai-guide

behat-ai-guide is a cursor rule for Cursor from ivangrynenko/cursorrules. It costs 9,740 tokens per session, scanned A, original, MIT.

A guide for AI assistants writing Behat tests for Drupal, a content-management system, using the existing `drevops/behat-steps` package.

In plain words
What is it for?
Use it when creating or changing Drupal Behat tests, especially when setting up `FeatureContext.php` and choosing steps from the installed package.
Why use it?
It reduces duplicated test code by directing assistants to reuse the package’s traits and step definitions before creating custom ones.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when creating or changing Drupal Behat tests, especially when setting up FeatureContext.php and choosing steps from the installed package.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/ivangrynenko/cursorrules/behat-ai-guide
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/ivangrynenko/cursorrules

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for behat-ai-guide

README.md
[![agentmods](https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/behat-ai-guide/github.svg)](https://agentmods.dev/rules/ivangrynenko/cursorrules/behat-ai-guide)
Your own site
<a href="https://agentmods.dev/rules/ivangrynenko/cursorrules/behat-ai-guide"><img src="https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/behat-ai-guide/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for behat-ai-guide

Your own site · 80×15
<a href="https://agentmods.dev/rules/ivangrynenko/cursorrules/behat-ai-guide"><img src="https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/behat-ai-guide.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 9,740 This file is loaded in full into every session.
When invoked 9,740 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.09740 $0.09740
Opus 5.5 $0.03896 $0.03896
Sonnet 5.5 $0.01948 $0.01948
Haiku 4.5 $0.00974 $0.00974

Measured 1mo ago against content hash 8c44afa42402, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

behat-ai-guide scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/behat-ai-guide.mdc · 883 lines

How it starts

The opening of the file, as written. The whole thing — 883 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AI Behat Test Writing Guide for Drupal Projects

🎯 Primary Directive

ALWAYS prioritize using drevops/behat-steps traits and step definitions over writing custom steps. The drevops/behat-steps package provides comprehensive test coverage for most Drupal testing scenarios.

📦 Essential Resources

Before writing ANY Behat test:

  1. Check available steps in the drevops/behat-steps STEPS.md file or refer to the embedded reference below
  2. Review trait source code in vendor/drevops/behat-steps/src/ directory
  3. Only create custom steps when absolutely necessary (functionality not covered by existing traits)

🔧 Setting Up FeatureContext

When creating or modifying FeatureContext.php, include the necessary traits from drevops/behat-steps. The traits are located in vendor/drevops/behat-steps/src/:

<?php

namespace DrupalProject\Tests\Behat;

use Drupal\DrupalExtension\Context\DrupalContext;
// Generic traits from vendor/drevops/behat-steps/src/
use DrevOps\BehatSteps\CookieTrait;
use DrevOps\BehatSteps\DateTrait;
use DrevOps\BehatSteps\ElementTrait;
use DrevOps\BehatSteps\FieldTrait;
use DrevOps\BehatSteps\FileDownloadTrait;
use DrevOps\BehatSteps\KeyboardTrait;
use DrevOps\BehatSteps\LinkTrait;
use DrevOps\BehatSteps\PathTrait;
use DrevOps\BehatSteps\ResponseTrait;
use DrevOps\BehatSteps\WaitTrait;

// Drupal-specific traits from vendor/drevops/behat-steps/src/Drupal/
use DrevOps\BehatSteps\Drupal\BigPipeTrait;
use DrevOps\BehatSteps\Drupal\BlockTrait;
use DrevOps\BehatSteps\Drupal\ContentBlockTrait;
use DrevOps\BehatSteps\Drupal\ContentTrait;
use DrevOps\BehatSteps\Drupal\DraggableviewsTrait;
use DrevOps\BehatSteps\Drupal\EckTrait;
use DrevOps\BehatSteps\Drupal\EmailTrait;
use DrevOps\BehatSteps\Drupal\FieldTrait as DrupalFieldTrait;
use DrevOps\BehatSteps\Drupal\FileTrait;
use DrevOps\BehatSteps\Drupal\MediaTrait;
use DrevOps\BehatSteps\Drupal\MenuTrait;
use DrevOps\BehatSteps\Drupal\MetatagTrait;
use DrevOps\BehatSteps\Drupal\OverrideTrait;
use DrevOps\BehatSteps\Drupal\ParagraphsTrait;
use DrevOps\BehatSteps\Drupal\SearchApiTrait;
use DrevOps\BehatSteps\Drupal\TaxonomyTrait;
use DrevOps\BehatSteps\Drupal\TestmodeTrait;
use DrevOps\BehatSteps\Drupal\UserTrait;
use DrevOps\BehatSteps\Drupal\WatchdogTrait;

class FeatureContext extends DrupalContext {
    // Include only the traits you need for your tests
    // Generic traits
    use CookieTrait;
    use DateTrait;
    use ElementTrait;
    use FieldTrait;
    use FileDownloadTrait;
    use KeyboardTrait;
    use LinkTrait;
    use PathTrait;
    use ResponseTrait;
    use WaitTrait;
    
    // Drupal-specific traits
    use BlockTrait;
    use ContentTrait;
    use EmailTrait;
    use FileTrait;
    use MediaTrait;
    use TaxonomyTrait;
    use UserTrait;
    
    // Only add custom methods when drevops/behat-steps doesn't provide the functionality
}

Read the full file on GitHub · 883 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 883 lines · 9,740 tokens per session scan A 8c44afa42402

Subscribe to this mod's changes

behat-ai-guide is a cursor rule published in the GitHub repository ivangrynenko/cursorrules (88 stars, last pushed 11mo ago), licensed MIT. It adds 9,740 tokens to every session, about $0.0390 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.