RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/we-promise/sure

Cursor rule

.cursor/rules/stimulus_conventions.mdc

[object Object]

Cursor rules

Quality

44/100

Scores the file, not the repository.

Length

279 words

0 headings · 3 code blocks

Repository

9.3k

— · pushed 0 days ago

Last changed

2 days ago

First indexed 2 days ago.
we-promise/sure/.cursor/rules/stimulus_conventions.mdcRawGitHub
1---
2description:
3globs:
4alwaysApply: false
5---
6This rule describes how to write Stimulus controllers.
7 
8- **Use declarative actions, not imperative event listeners**
9 - Instead of assigning a Stimulus target and binding it to an event listener in the initializer, always write Controllers + ERB views declaratively by using Stimulus actions in ERB to call methods in the Stimulus JS controller. Below are good vs. bad code.
10 
11 BAD code:
12 
13```js
14 // BAD!!!! DO NOT DO THIS!!
15 // Imperative - controller does all the work
16 export default class extends Controller {
17 static targets = ["button", "content"]
18 
19 connect() {
20 this.buttonTarget.addEventListener("click", this.toggle.bind(this))
21 }
22 
23 toggle() {
24 this.contentTarget.classList.toggle("hidden")
25 this.buttonTarget.textContent = this.contentTarget.classList.contains("hidden") ? "Show" : "Hide"
26 }
27 }
28```
29 
30 GOOD code:
31 
32```erb
33 <!-- Declarative - HTML declares what happens -->
34 
35 <div data-controller="toggle">
36 <button data-action="click->toggle#toggle" data-toggle-target="button">Show</button>
37 <div data-toggle-target="content" class="hidden">Hello World!</div>
38 </div>
39```
40 
41```js
42 // Declarative - controller just responds
43 export default class extends Controller {
44 static targets = ["button", "content"]
45 
46 toggle() {
47 this.contentTarget.classList.toggle("hidden")
48 this.buttonTarget.textContent = this.contentTarget.classList.contains("hidden") ? "Show" : "Hide"
49 }
50 }
51```
52 
53- **Keep Stimulus controllers lightweight and simple**
54 - Always aim for less than 7 controller targets. Any more is a sign of too much complexity.
55 - Use private methods and expose a clear public API
56 
57- **Keep Stimulus controllers focused on what they do best**
58 - Domain logic does NOT belong in a Stimulus controller
59 - Stimulus controllers should aim for a single responsibility, or a group of highly related responsibilities
60 - Make good use of Stimulus's callbacks, actions, targets, values, and classes
61 
62- **Component controllers should not be used outside the component**
63 - If a Stimulus controller is in the app/components directory, it should only be used in its component view. It should not be used anywhere in app/views.
64 

Stack — with the evidence

ruby

(1.00)

rails

(1.00)

biome

(1.00)

postgres

(0.70)

redis

(0.70)

vite

(0.70)

cloudflare

(0.70)

aws

(0.70)

desktop-app

(0.70)

typescript

(0.60)

javascript

(0.60)

swift

(0.60)

docker

(0.60)

kubernetes

(0.60)

github-actions

(0.60)

Glob targeting

  • [object Object]

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
we-promise
Language
—
License
—
Archived
no

All configs in this repo

Also in we-promise/sure

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
we-promise/sure.cursor/rules/api-endpoint-consistency.mdc · 9.3kCursor rulesrubyrails+13styletesting-strategygitsecurity+257/1002 days ago
we-promise/sure.cursor/rules/cursor_rules.mdc · 9.3kCursor rulesrubyrails+13no sections36/1002 days ago
we-promise/sure.cursor/rules/general-rules.mdc · 9.3kCursor rulesrubyrails+13styledo-not44/1002 days ago
we-promise/sure.cursor/rules/project-conventions.mdc · 9.3kCursor rulesrubyrails+13styledependenciesdatabaseui+259/1002 days ago
we-promise/sure.cursor/rules/project-design.mdc · 9.3kCursor rulesrubyrails+13style58/1002 days ago
we-promise/sure.cursor/rules/self_improve.mdc · 9.3kCursor rulesrubyrails+13no sections36/1002 days ago
we-promise/sure.cursor/rules/testing.mdc · 9.3kCursor rulesrubyrails+13styletesting-strategy52/1002 days ago
we-promise/sure.cursor/rules/ui-ux-design-guidelines.mdc · 9.3kCursor rulesrubyrails+13styledo-not49/1002 days ago
we-promise/sure.cursor/rules/view_conventions.mdc · 9.3kCursor rulesrubyrails+13style52/1002 days ago
we-promise/sure.github/copilot-instructions.md · 9.3kCopilot instructionsrubyrails+13setuptestlint-formatstyle+1088/1002 days ago
we-promise/sureAGENTS.md · 9.3kAGENTS.mdrubyrails+13buildtestlint-formatstyle+778/1002 days ago
we-promise/sureCLAUDE.md · 9.3kCLAUDE.mdrubyrails+13setuptestlint-formatstyle+1193/1002 days ago
Diff against .cursor/rules/api-endpoint-consistency.mdc Diff against .cursor/rules/cursor_rules.mdc Diff against .cursor/rules/general-rules.mdc Diff against .cursor/rules/project-conventions.mdc Diff against .cursor/rules/project-design.mdc Diff against .cursor/rules/self_improve.mdc Diff against .cursor/rules/testing.mdc Diff against .cursor/rules/ui-ux-design-guidelines.mdc Diff against .cursor/rules/view_conventions.mdc Diff against .github/copilot-instructions.md Diff against AGENTS.md Diff against CLAUDE.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
hiromaily/go-crypto-wallet.cursor/rules/proto.mdc · 126Cursor rulesgobiome+4buildlint-formatstylearch+396/1003 days ago
nerds-odd-e/doughnut.cursor/rules/cli.mdc · 49Cursor rulestypescriptcypress+14setupbuildteststyle+496/1003 days ago
K-Mistele/opensearch.cursor/rules/default.mdc · 30Cursor rulestypescriptbun+3buildtestlint-formatstyle+294/1003 days ago
hiromaily/go-crypto-wallet.cursor/rules/task-context-loading.mdc · 126Cursor rulesgobiome+4archtypesdatabasedo-not+193/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack