agentleFS
kznr02kznr02/OpenTester-Skills/.cursor/rules/opentester.mdc

OpenTester-Skills / rules

Cursor rule4 starsChanged 8 months agoMITView on GitHub

OpenTester Testing Rules

We split this opentester.mdc into the rules it gives an agent

10 rules. About 0 are common, 3 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the user mentions:

    line 14
  2. Distinctive:

    Test files are modified

    line 19
  3. Very specific:

    Call opentester.listProjects to show available projects

    line 139
  4. Very specific:

    Call opentester.getProject(project_id) to show details

    line 140
  5. Very specific:

    Call opentester.getProject(project_id) to find the case

    line 146
  6. Very specific:

    Verify by calling opentester.getProject(project_id) again

    line 149
  7. Very specific:

    Call opentester.getTemplate(template_id) to see variables

    line 156
  8. Distinctive:

    Ask user for variable values

    line 157
  9. Very specific:

    Ask user which values should become ${variable} placeholders

    line 162
  10. Very specific:

    Use ${var_name} syntax in DSL templates

    line 166

≈ “Common” is an estimate: at least 1 in 5 of the 6,350 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
opentester.mdc
---
description: OpenTester Testing Rules
globs:
  - "**/*.test.yaml"
  - "**/tests/**"
  - "**/*_test.py"
alwaysApply: true
---

# OpenTester Testing Guidelines

## When to Use

When the user mentions:
- "/test" or "/t" - Create tests for code changes
- "run tests" - Execute existing tests
- "validate" - Check test syntax
- "delete project" or "delete test" - Remove test data
- Test files are modified

## DSL Validation Workflow (CRITICAL)

**ALWAYS validate DSL before saving!**

```
1. Generate DSL YAML
2. Call opentester.validateDSL(dsl_yaml) to check syntax
3. IF validation fails:
   - Read the error message
   - Fix the DSL (common: use assertion object instead of direct type/value)
   - Call validateDSL again
   - REPEAT until validation passes
4. IF validation passes:
   - Call opentester.saveCase to store the test
5. Call opentester.runCase to execute
```

## DSL Format

### Basic Structure
```yaml
version: "1.0"
meta:
  name: "Test Name"
  description: "What this test verifies"

target:
  type: cli  # cli, api, or tui

timeout: 10

steps:
  - name: "Step description"
    action: exec|assert|wait
    # action-specific fields
```

### Action: exec
```yaml
- name: "Execute command"
  action: exec
  command: "echo Hello"           # CLI
  # OR for API:
  method: GET
  path: "/endpoint"
```

### Action: assert (CRITICAL - USE assertion OBJECT!)

❌ WRONG - assert with direct type/value:
```yaml
- action: assert
  type: stdout_contains      # ❌ Wrong!
  value: "text"              # ❌ Wrong!
```

✅ CORRECT - assert with assertion object:
```yaml
- name: "Verify output"
  action: assert
  assertion:                 # ✅ Correct!
    type: stdout_contains
    expected: "text"         # ✅ Use 'expected', not 'value'!
```

**CLI Assertions:**
```yaml
- action: assert
  assertion:
    type: exit_code|stdout_contains|stderr_contains|stdout_matches|stderr_empty
    expected: value
```

**API Assertions:**
```yaml
- action: assert
  assertion:
    type: status_code|json_path
    path: "$.data.name"      # Required for json_path
    expected: value
```

**TUI Assertions:**
```yaml
- action: assert
  assertion:
    type: screen_contains|cursor_at|screen_stable
    expected: value
```

### Action: wait
```yaml
- name: "Wait"
  action: wait
  duration: 5
```

### Variables
- `${vars.name}` - Reference variable
- `${env.VAR}` - Environment variable

## Commands

| User Command | Response |
|-------------|----------|
| `/test [feature]` | Create and run tests |
| `/test-quick` | Quick test without PRD |
| `run tests` | Execute existing tests |
| `debug [test]` | Analyze failures |
| `delete project <id>` | Delete project and all its test cases |
| `delete test <id>` | Delete a specific test case |
| `list templates` | Show all DSL templates |
| `use template <id>` | Create test from a template |
| `save template` | Save test case as template |

## Delete Operations

### Delete Project Workflow
1. Call `opentester.listProjects` to show available projects
2. Call `opentester.getProject(project_id)` to show details
3. **CONFIRM** with user: "This will permanently delete the project and ALL its test cases"
4. Call `opentester.deleteProject(project_id)`
5. Report result

### Delete Test Case Workflow
1. Call `opentester.getProject(project_id)` to find the case
2. **CONFIRM** with user: Show case name and details
3. Call `opentester.deleteCase(project_id, case_id)`
4. Verify by calling `opentester.getProject(project_id)` again
5. Report result

### Template Workflows

**List and Use Template:**
1. Call `opentester.listTemplates(category?, target_type?, tag?)`
2. Call `opentester.getTemplate(template_id)` to see variables
3. Ask user for variable values
4. Call `opentester.instantiateTemplate(template_id, project_id, case_name, variables)`

**Create Template from Case:**
1. Call `opentester.getProject(project_id)` to find the case
2. Ask user which values should become `${variable}` placeholders
3. Call `opentester.createTemplateFromCase(project_id, case_id, template_name, variable_mappings)`

**Template Variables:**
- Use `${var_name}` syntax in DSL templates
- Variables are replaced when instantiating
- Common variables: `${base_url}`, `${endpoint}`, `${timeout}`, `${test_name}`

## Common Validation Errors

| Error | Fix |
|-------|-----|
| `Unknown assertion type` | Use `assertion: { type: ..., expected: ... }` instead of direct `type/value` |
| `field required` | Add missing required field |
| `YAML error` | Fix indentation |

Download now (ZIP)

  • Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.

    Of the Cursor rule files we read, the 3,978 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.