Skip to content

Commit fb531c0

Browse files
committed
Add new checklist maintenance rules and Git Bash scripting guidelines, update rules mostly for lint rules
- Introduce checklist maintenance rules for project organization - Create guidelines for Git Bash scripting best practices - Remove outdated PowerShell console commands rules - Update import organization rules for JavaScript/TypeScript - Add markdown best practices and PowerShell scripting guidelines - Establish shell choice guidelines for Windows tasks
1 parent 400338b commit fb531c0

9 files changed

+311
-36
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
description: Rules for maintaining project checklists
3+
globs: "**/*checklist.md"
4+
alwaysApply: true
5+
---
6+
7+
Checklist Maintenance Rules
8+
===========================
9+
10+
Status Indicators
11+
-----------------
12+
13+
- ✅ Completed: Task is fully implemented and verified
14+
- - [ ] Todo: Task not yet started or completed
15+
- 🔄 In-progress: Work has started but not completed
16+
- ⚠️ Blocked: Waiting on external dependency
17+
18+
Organization
19+
------------
20+
21+
- Group by functional area (Docker, Security, etc.)
22+
- List completed items first within each section
23+
- Place priority items immediately after completed items
24+
- Use logical workflow order for sections
25+
26+
Formatting
27+
----------
28+
29+
- Use h1 (`#`) for document title (Setext-style with `=====`)
30+
- Use h2 (`##`) for main sections (Setext-style with `-----`)
31+
- Use h3 (`###`) for subsections (`###` atx-style)
32+
- Use bullet lists for checklist items
33+
- Use 2-space indentation for nested items
34+
- Keep line length under 120 characters
35+
- Use code blocks with language identifiers
36+
37+
Example
38+
-------
39+
40+
```markdown
41+
## Security
42+
43+
✅ HTTPS redirection configured
44+
✅ Sensitive files excluded from source control
45+
46+
- [ ] Add rate limiting for API endpoints
47+
- [ ] Implement CORS policy configuration
48+
```
49+
50+
Update Process
51+
--------------
52+
53+
1. Review project status to identify completed items
54+
2. Update status indicators accordingly
55+
3. Add new requirements that have emerged
56+
4. Remove duplicate or obsolete items
57+
5. Ensure cross-references remain valid
58+
59+
Rule Types
60+
----------
61+
62+
- **Manual** (`alwaysApply: false`): Only applied when explicitly requested
63+
- **Always** (`alwaysApply: true`): Applied across all matching files automatically
64+
- **Auto Attached**: Automatically attaches to relevant files based on content (Cursor feature)
65+
- **Agent Requested**: Applied when the AI determines they're relevant (Cursor feature)
66+
67+
- **Manual** (`alwaysApply: false`): Only applied when explicitly requested
68+
- **Always** (`alwaysApply: true`): Applied across all matching files automatically
69+
- **Auto Attached**: Automatically attaches to relevant files based on content (Cursor feature)
70+
- **Agent Requested**: Applied when the AI determines they're relevant (Cursor feature)

.cursor/rules/console-commands-for-powershell.mdc

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
description: Guidelines for creating and using Git Bash scripts
3+
globs: "*.sh"
4+
alwaysApply: false
5+
---
6+
7+
Selected Git Bash Scripting Guidelines
8+
======================================
9+
10+
File Format
11+
-----------
12+
- Use LF line endings (not CRLF)
13+
- Use UTF-8 without BOM
14+
- Start with shebang: `#!/bin/bash`
15+
16+
Path Handling
17+
-------------
18+
- Use forward slashes in paths: `/path/to/dir`
19+
- Always quote paths with spaces
20+
- Use relative paths when possible
21+
22+
Error Handling
23+
--------------
24+
- Use `set -e` for immediate exit on error
25+
- Check exit codes: `if [ $? -ne 0 ]; then ... fi`
26+
- Log errors to stderr: `echo "Error: message" >&2`
27+
28+
PowerShell Integration
29+
----------------------
30+
- Use `Invoke-GitBash` helper
31+
- Example:
32+
```powershell
33+
Invoke-GitBash "./scripts/your-script.sh"
34+
```
35+
36+
- Example:
37+
```powershell
38+
Invoke-GitBash "./scripts/your-script.sh"
39+
```

.cursor/rules/import-groups-spacing.mdc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
description: Empty Lines Between Import Groups
32
globs: "**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"
4-
alwaysApply: true
3+
alwaysApply: false
54
---
6-
When organizing imports in JavaScript/TypeScript files, maintain at least one empty line between different import groups to follow the eslint import/order rule.
5+
When organizing imports in JavaScript/TypeScript files, maintain at least one empty line between different import
6+
groups to follow the eslint import/order rule.
77

88
Import groups are typically arranged in this order:
99
1. Built-in Node.js modules
@@ -41,4 +41,3 @@ This pattern:
4141
- Helps maintain consistent code organization
4242

4343
Benefits: Improves readability, makes code organization consistent, and satisfies linting requirements.
44-
Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
11
---
2-
description:
3-
globs:
4-
alwaysApply: false
5-
---
6-
---
7-
description: Import Order Requirements for React Components
82
globs: "**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"
9-
alwaysApply: true
3+
alwaysApply: false
104
---
11-
# Import Ordering Rules
5+
Import Ordering Rules
6+
=====================
127

138
For proper linting compliance, imports must follow this specific ordering pattern:
149

15-
## Order by Import Group
10+
Order by Import Group
11+
---------------------
1612
1. External/npm modules (React, react-router-dom, etc.)
1713
2. Blank line
1814
3. Internal project modules (components, utilities)
1915
4. Stylesheets (CSS, SCSS)
2016
5. Component imports in alphabetical order
2117
6. Image/asset imports according to specific pattern
2218

23-
## Image/Asset Import Order
19+
Image/Asset Import Order
20+
------------------------
2421
For image imports with different sizes and formats:
2522

2623
1. Group by size first (large, medium, small)
2724
2. For each size group, order by format (.jpg first, then .webp)
2825

29-
### Example
26+
Example
27+
-------
3028
```javascript
3129
// External packages
3230
import React from 'react';
@@ -47,7 +45,4 @@ import portraitImageSmall from '../images/portrait-small.jpg';
4745
import portraitImageSmallWebp from '../images/portrait-small.webp';
4846
```
4947

50-
This pattern satisfies ESLint import/order rules and maintains consistent code organization.
51-
```
52-
53-
</rewritten_file>
48+
This pattern satisfies ESLint import/order rules and maintains consistent code organization.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
2+
---
3+
4+
Markdown Best Practices
5+
=======================
6+
7+
Document Structure
8+
------------------
9+
- Use a single `# Title` at the top
10+
- Follow with a brief description
11+
- Organize content with hierarchical headings (`##`, `###`)
12+
- Include a TOC for documents longer than 3 sections
13+
14+
Formatting
15+
----------
16+
- Keep lines under 120 characters for readability
17+
- Break long lines at natural points (after periods, commas, or logical breaks)
18+
- Use **bold** for emphasis, *italics* for terminology
19+
- Code blocks: Triple backticks with language identifier (REQUIRED - prevents MD040)
20+
- Inline code: Single backticks for commands, variables
21+
- Horizontal rules (`---`) only to separate major sections
22+
23+
Lists
24+
-----
25+
- Use ordered lists (1. 2. 3.) for sequential steps
26+
- Use unordered lists (- or *) for non-sequential items
27+
- Maintain consistent indentation for nested lists
28+
29+
Links and References
30+
--------------------
31+
- Use descriptive link text: `[descriptive text](mdc:URL)`
32+
- Prefer relative links for project files
33+
- Group related references at document bottom
34+
35+
Images
36+
------
37+
- Include alt text: `![alt text](mdc:image-path)`
38+
- Keep width under 900px for readability
39+
- Store images in dedicated `/assets` or `/images` folder
40+
41+
Tables
42+
------
43+
- Use tables for structured data comparisons
44+
- Include header row and alignment indicators
45+
- Keep tables simple; avoid nested tables
46+
47+
Common Lint Errors to Avoid
48+
---------------------------
49+
- MD040: Always specify a language for fenced code blocks
50+
- MD013: Keep line length under 120 characters
51+
- MD022: Headers must be surrounded by blank lines
52+
- MD023: Headers must start at beginning of line
53+
- MD032: Lists should be surrounded by blank lines
54+
- MD041: First line should be a top-level header
55+
56+
---
57+
58+
Shell Command Context Specification
59+
-----------------------------------
60+
61+
Precede command blocks requiring a specific starting directory or shell
62+
environment with a single comment line specifying the required shell(s)
63+
and starting path.
64+
65+
**Starting Path**
66+
- Default: Relative paths from `repo-root` (top-level dir, e.g., with `.git`).
67+
- Use the most specific relevant directory (e.g., `repo-root/src/project`).
68+
- Allowed: Absolute paths if necessary (e.g., `C:\Tools`).
69+
- Use `.` for the specified root/absolute directory itself.
70+
71+
**Shell**
72+
- Default: Generic names (`PS`, `Bash`).
73+
- Specify versions (`PS7`) or types (`GitBash`, `Cmd`) ONLY if command depends on them.
74+
75+
Assume user is in the specified directory with the appropriate shell.
76+
77+
**Format**
78+
`# <ShellSpecifier>: <PathSpecifier>`
79+
- `<ShellSpecifier>`: Target shell(s) (`PS`, `Bash`, `Bash/GitBash`, `PS7`).
80+
- `<PathSpecifier>`: Starting path (relative or absolute). Use `\` or `/` matching shell/OS.
81+
82+
Commands in the block should use paths relative to the specified starting directory.
83+
84+
**Examples**
85+
86+
**Generic PS Command (from project dir):**
87+
```powershell
88+
# PS: repo-root\code\MatureWeb\Northwind.DataContext
89+
dotnet user-secrets list --project .\Northwind.DataContext.csproj
90+
```
91+
92+
**Generic Bash Command (from repo root):**
93+
```bash
94+
# Bash: repo-root/.
95+
git submodule update --init
96+
```
97+
98+
**PowerShell 7 Specific Command:**
99+
```powershell
100+
# PS7: repo-root\scripts
101+
Get-ChildItem .\*.log | ForEach-Object -Parallel { Remove-Item $_.FullName } -ThrottleLimit 4
102+
```
103+
104+
**GitBash Specific Scenario:**
105+
```bash
106+
# GitBash: repo-root/.
107+
# Assumes a specific credential helper configured only for GitBash
108+
git push origin main
109+
```
110+
111+
**Absolute Path Example (Windows):**
112+
```powershell
113+
# PS: C:\ProgramData\MyTool
114+
.\mytool-config.exe --update-settings
115+
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
PowerShell Scripting Guidelines
2+
===============================
3+
4+
Prefer PowerShell 7 commands for Windows 11, not Bash syntax.
5+
Prefer PowerShell-native approaches over cmd.exe commands.
6+
7+
Command Syntax
8+
--------------
9+
- Use PowerShell cmdlets: `Get-ChildItem` (not `ls`), `Set-Location` (not `cd`)
10+
- Flags use single hyphen (`-Force`)
11+
- Command separation: `;` (not `&&`)
12+
13+
Path Handling
14+
-------------
15+
- Use backslashes in Windows paths: `C:\Users\`
16+
- Use `Join-Path` for path construction
17+
- Always quote paths with spaces
18+
19+
Variables and Environment
20+
-------------------------
21+
- Variables: `$variable`, string interpolation: `"$(...)"`
22+
- Environment variables: `$env:VARIABLE`
23+
24+
Input/Output
25+
------------
26+
- Piping: `|` (with proper object handling)
27+
- Redirection: `>`, `>>`, `2>`
28+
29+
Error Handling
30+
--------------
31+
- Check `$LASTEXITCODE` after external commands
32+
- Use try/catch blocks for risky operations
33+
- Log errors with `Write-Error` to stderr
34+
35+
Git Bash Integration
36+
--------------------
37+
- Use `Invoke-GitBash.ps1` for bash scripts
38+
- Handle path conversions
39+
- Propagate exit codes correctly

.cursor/rules/shell-choice.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Shell Choice Guidelines
2+
=======================
3+
4+
- Use PowerShell for Windows-specific tasks and system automation
5+
- Use Git Bash for cross-platform scripts and git operations
6+
- Prefer PowerShell when working with .NET or Windows services

.cursor/rules/standards-first.mdc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Standards-First Rule
2+
====================
3+
4+
The Rule
5+
--------
6+
7+
**Always default to established industry standards and conventions unless they introduce
8+
unnecessary overhead or complexity for the specific context. Prefer simplicity and
9+
familiarity over novel approaches unless there's a compelling reason to deviate.**
10+
11+
Application Examples
12+
--------------------
13+
14+
- Use `.cursor/rules` instead of `cursor-rules/` for Cursor IDE configuration
15+
- Follow standard naming conventions for files and folders (e.g., `.vscode`, `.git`)
16+
- Adopt established coding conventions for the primary language/framework
17+
- Use standard project structures unless project-specific needs dictate otherwise
18+
- Implement common design patterns rather than inventing alternatives
19+
20+
When to Deviate
21+
---------------
22+
23+
Deviation from standards is appropriate when:
24+
25+
1. The standard introduces significant unnecessary complexity
26+
2. Project requirements strongly conflict with the standard approach
27+
3. Performance or resource constraints necessitate a different solution
28+
4. The standard is obsolete or being replaced by a newer standard
29+
5. The team has established a well-documented alternative that provides clear benefits

0 commit comments

Comments
 (0)