behave

behave is a cursor rule for coding agents from sanjeed5/awesome-cursor-rules-mdc. It costs 2,206 tokens per session, scanned A, original, CC0-1.0.

A set of rules for writing behavior-driven tests in Python with behave. Behavior-driven development (BDD) describes software in plain-language scenarios, called Gherkin, before connecting those scenarios to test code.

In plain words
What is it for?
Use it to structure behave projects, write concise feature files, create reusable test steps, and manage fixtures and test hooks.
Why use it?
It keeps test scenarios focused on what the application should do instead of internal implementation details. It also helps keep step code, shared setup, and test files organized.

Cursor rule

About the project

awesome-cursor-rules-mdc is a generator that creates Cursor MDC rule files from structured library information, using semantic search and language models to gather and organize guidance. Developers use it to produce reusable rules for libraries in Cursor, and the catalogue includes 200 of those rules.

sanjeed5/awesome-cursor-rules-mdc · 3,571 stars · on GitHub

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.

agentmods
npx agentmods add rules/sanjeed5/awesome-cursor-rules-mdc/behave
Clone the repo
git clone --depth 1 https://github.com/sanjeed5/awesome-cursor-rules-mdc

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 behave

README.md
[![agentmods](https://agentmods.dev/badge/rules/sanjeed5/awesome-cursor-rules-mdc/behave.svg)](https://agentmods.dev/rules/sanjeed5/awesome-cursor-rules-mdc/behave)
Your own site
<a href="https://agentmods.dev/rules/sanjeed5/awesome-cursor-rules-mdc/behave"><img src="https://agentmods.dev/badge/rules/sanjeed5/awesome-cursor-rules-mdc/behave.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,206 This file is loaded in full into every session.
When invoked 2,206 The same file — it is already loaded in full.
Security scan A 1 finding. Scan, not verified.
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 $0.02206 $0.02206
Opus 5 $0.01103 $0.01103
Sonnet 5 $0.00441 $0.00441
Haiku 4.5 $0.00221 $0.00221

Measured 5d ago against content hash 7845121b7810, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

behave scanned grade A with 1 finding 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 5d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

response = requests.get(f"https://api.external.com/items/{item_id}")
rules-mdc/behave.mdc · 321 lines

How it starts

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

behave Best Practices

This guide outlines the definitive best practices for writing behave tests. Adhere to these standards for consistent, high-quality BDD automation.

1. Code Organization & Structure

Maintain a clear, predictable project structure.

✅ GOOD: Standard Project Layout

.
├── features/
│   ├── authentication.feature   # Gherkin feature files
│   ├── product_management.feature
│   ├── environment.py           # Global hooks and fixtures
│   └── steps/
│       ├── common_steps.py      # Reusable, generic steps
│       ├── auth_steps.py        # Authentication-specific steps
│       └── product_steps.py     # Product-specific steps
├── src/                         # Your application code
│   └── my_app/
│       ├── __init__.py
│       ├── models.py
│       └── services.py          # Business logic layer
└── pyproject.toml               # Project configuration

2. Feature Files: Clear, Business-Centric Gherkin

Feature files describe what the system does from a business perspective, not how it's implemented. Keep scenarios concise.

❌ BAD: Implementation Details in Gherkin

Feature: User Login
  Scenario: Successful login
    Given I am on the "/login" page
    When I fill in "username" with "testuser" and "password" with "password123"
    And I click the "Login" button with CSS selector ".login-form button"
    Then I should be redirected to "/dashboard"

✅ GOOD: Abstract, User-Focused Gherkin

Feature: User Login
  Scenario: Successful login with valid credentials
    Given a registered user "testuser" with password "password123"
    When "testuser" logs in
    Then "testuser" should be logged in successfully

3. Step Implementations: Thin & Pythonic

Steps should be thin wrappers that delegate complex logic to your application's service layer or dedicated helper modules. Follow PEP 8.

❌ BAD: Fat Steps with Business Logic

# features/steps/auth_steps.py
from behave import given
from my_app.models import User # Direct ORM access

@given('a registered user "{username}" with password "{password}"')
def step_impl(context, username, password):
    # Direct database manipulation and complex logic in step
    user = User.objects.create_user(username=username, password=password)
    context.user = user
    # ... more setup logic

Read the full file on GitHub · 321 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. 5d ago First seen · 321 lines · 0 tokens per session scan A 7845121b7810

Subscribe to this mod's changes

behave is a cursor rule published in the GitHub repository sanjeed5/awesome-cursor-rules-mdc (3,571 stars, last pushed 3mo ago), licensed CC0-1.0. It adds 2,206 tokens to every session, about $0.0110 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.