Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 168 additions & 0 deletions .cursor/commands/cmt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
---
description: v7 - Generate commit message from chat changes
(note to LLMs: increment version when you make changes to this file)
---

# Commit Message Generator

Generate a commit message for changes in this chat. **Do not commit or push** (staging allowed with flag).

---

## ⚙️ REPO-SPECIFIC CONFIGURATION

> **Edit this section when using in a new repository.**

### Valid Scopes

Scopes must match package/app names. No scope is also valid. Invalid scope = commitlint rejection.

- **Packages:** agent-toolkit, astro, backend, chrome-extension, clerk-js, dev-cli, elements, expo, expo-passkeys, express, fastify, localizations, nextjs, nuxt, react, react-router, remix, shared, tanstack-react-start, testing, themes, types, ui, upgrade, vue
- **Other:** docs, repo, release, e2e, \*
Comment on lines +20 to +21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should ask the agent to derive this from a source of truth instead of also having this list to maintain

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that it takes a few more seconds each time to go through the commitlint config and all package.json files
This acts as a "cache" - if we add a new package, commitlint will most likely fail so we/the llm will update the list accordingly - maybe this is something we can add to the prompt as an explicit instruction?


---

## Flags

- `noask` — skip questions, generate immediately
- `stage` — stage affected files after showing message
- `all` — include all git changes (default: only files discussed in chat)
- `staged` — include staged files in addition to chat context (default: only files discussed in chat)

**Examples:** `/cmd cmt`, `/cmd cmt noask`, `/cmd cmt stage all`, `/cmd cmt noask stage`

## Valid Types

**Types (REQUIRED - ALWAYS FIRST):** feat | fix | build | chore | ci | perf | refactor | revert | style | test

## FORMAT - READ THIS CAREFULLY

**CRITICAL: Type is MANDATORY and ALWAYS comes FIRST**

```
type(scope): description ← CORRECT: type first, scope optional
type: description ← CORRECT: type without scope
```

**WRONG FORMATS:**

```
docs: description ← WRONG: "docs" is a SCOPE, not a type!
scope: description ← WRONG: missing type!
```

**If working with docs:**

```
feat(docs): add new guide ← CORRECT
chore(docs): update readme ← CORRECT
docs: something ← WRONG
```
Comment on lines +42 to +60
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Add language specifiers to all fenced code blocks.

Markdown linting standards (MD040) require language specifiers on fenced code blocks for syntax highlighting and clarity. This improves readability for users viewing the file in markdown renderers.

✏️ Add language specifiers to code blocks

Lines 42, 49, 56, 83, 98, 114, 123, 138, 145, 152 need language specifiers. Since these are example commit messages/formats, use `text` or leave generic:

-\`\`\`
+\`\`\`text
 type(scope): description    ← CORRECT: type first, scope optional
 type: description           ← CORRECT: type without scope
-\`\`\`
+\`\`\`text

Apply the same pattern to all remaining code blocks (especially lines 49, 56, 83, 98, 114, 123, 138, 145, 152).

Alternatively, if the blocks are meant to be copied literally (no specific language), use ```text or ```diff as appropriate for the content type.

Also applies to: 83-150

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

42-42: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


49-49: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


56-56: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In @.cursor/commands/cmt.md around lines 42 - 60, Add explicit language
specifiers to every fenced code block in .cursor/commands/cmt.md (the blocks
showing examples like "type(scope): description", "type: description", the WRONG
FORMATS block with "docs: description" / "scope: description", and the "If
working with docs:" example block). For each triple-backtick block (including
the examples at the mentioned lines), change the fence to include a language
token such as text (e.g., ```text) so MD040 is satisfied and the literal
commit-message examples render correctly; ensure you apply the same `text`
specifier to all remaining example blocks referenced (lines 42, 49, 56, 83, 98,
114, 123, 138, 145, 152).


## Process

1. If "noask" present → skip to step 4
2. Review conversation for problem/decisions/rationale
3. Determine scope:
- If "all" flag present → run `git diff` for all changes
- Otherwise → only consider files/changes mentioned in the chat conversation
4. Classify impact:
- **High:** API/breaking changes, security, new features, architecture, bug fixes, deps
- **Low:** typos, formatting, refactors, docs, comments, linting
5. If **high impact** AND conversation lacks clear "why" → ask:

> "Significant changes detected. Please explain: Why needed? What problem solved? Any trade-offs?"

Then **STOP and wait** for response.

6. Generate commit message (TYPE FIRST, then optional scope in parentheses)
7. If "stage" present → run `git add` on affected files (only chat-mentioned files unless "all" flag present)

## Format Rules

```
type(scope): description
```

- **TYPE IS REQUIRED** - one of: feat, fix, build, chore, ci, perf, refactor, revert, style, test
- **SCOPE IS OPTIONAL** - if present, wrap in parentheses after type
- All lowercase, ≤72 chars
- Title = "what it does", body = "why"
- Be specific (use domain terms from conversation, not generic words)
- No filler: avoid "update", "changes", "code" when meaningless

## Templates

**High impact (with context):**

```
type(scope): short description

Why:
[Problem/requirement that prompted this]

What changed:
[Key decisions, trade-offs, non-obvious choices]

Context (optional):

[Future work, related issues, caveats]
```

**Low impact or limited context:**

```
type(scope): short description

Why:
[1 sentence if not obvious from title]
```

## Examples

```
feat(api): add rate limiting to auth endpoints

Why:
DDoS attacks on /api/sign-in caused production degradation.

What changed:
Redis over in-memory for multi-instance support.
Sliding window with exponential backoff for better UX.

Context:

May need IP allowlist for trusted services (CLERK-5678).
```

```
chore(docs): fix typo in authentication guide

Why:
Users reported confusion from misspelling.
```

```
ci: consolidate test job into checks to speed up pipeline

Why:
Reduce CI overhead by running tests in same job as lint/type checks.
```

```
feat(docs): document commitlint scope validation system

Why:
Added clear documentation to help contributors understand scope requirements.
```

## Remember

- Important:Do not add unnecessary new lines or paragraphs to sentences. Let the editor wrap lines as needed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix spacing in inline formatting.

Line 161 has a missing space after the colon: "Important:Do" should be "Important: Do".

✏️ Proposed fix
-- Important:Do not add unnecessary new lines or paragraphs to sentences. Let the editor wrap lines as needed.
+- Important: Do not add unnecessary new lines or paragraphs to sentences. Let the editor wrap lines as needed.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Important:Do not add unnecessary new lines or paragraphs to sentences. Let the editor wrap lines as needed.
- Important: Do not add unnecessary new lines or paragraphs to sentences. Let the editor wrap lines as needed.
🤖 Prompt for AI Agents
In @.cursor/commands/cmt.md at line 161, Fix the missing space after the colon
in the inline sentence by changing the string "Important:Do not add unnecessary
new lines or paragraphs to sentences. Let the editor wrap lines as needed." to
"Important: Do not add unnecessary new lines or paragraphs to sentences. Let the
editor wrap lines as needed." — update the exact line content (the "Important:Do
not add..." string) without adding extra newlines or paragraph breaks.

- **TYPE FIRST, ALWAYS** - never start with a scope
- **NEVER COMMIT OR PUSH**
- Type is REQUIRED, scope is optional
- **Always explain WHY changes were made** - what problem was being solved, what issues were identified, what motivated the change
- **Provide enough context** - someone reading the commit in 2 years should understand the reasoning without access to the conversation
- Only ask questions for high-impact changes
- Prioritize conversation context over diff analysis
15 changes: 11 additions & 4 deletions .cursor/rules/global.mdc
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
---
description:
globs:
description:
globs:
alwaysApply: true
---

Clerk JavaScript SDK Monorepo

1. Package Manager

- This project is a monorepo that uses pnpm
- Turbo is used for build orchestration and caching
- Node.js is required

2. Repository Overview

- All packages published under @clerk namespace
- Supports 10+ JavaScript frameworks and platforms
- Comprehensive testing with unit, integration, and E2E tests

3. Key Directories
- `packages/` - All publishable packages (@clerk/*)

- `packages/` - All publishable packages (@clerk/\*)
- `integration/` - Framework integration templates and E2E tests
- `playground/` - Development and testing applications
- `scripts/` - Build automation and utilities
- `.cursor/rules/` - Additional rule files for specific domains

4. Core Commands

- `pnpm dev` - Start development mode for all packages
- `pnpm build` - Build all packages
- `pnpm test` - Run unit tests
Expand All @@ -31,7 +36,9 @@ Clerk JavaScript SDK Monorepo
- `pnpm format` - Format code with Prettier

5. Development Workflow

- Make changes in relevant package under packages/
- Use playground apps for testing changes
- Follow established testing and documentation requirements
- Use Changesets for version management and releases
- Use Changesets for version management and releases
- If you are provided a commit SHA, always read the commit message and description for extra context.
Loading