Skip to content

Commit a8a78a4

Browse files
committed
docs: update AI assistant guidelines
- Add clear ALWAYS/NEVER directives for AI assistants - Standardize formatting and linting requirements - Add explicit rules for development, templates, and testing
1 parent 9759b5e commit a8a78a4

File tree

2 files changed

+160
-122
lines changed

2 files changed

+160
-122
lines changed

.goosehints

Lines changed: 80 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,89 @@
1-
This is Essex, a Docker project template generator written in Rust. It helps create consistent and well-structured Docker projects.
1+
# Essex AI Assistant Guidelines
22

3-
# Project Context
4-
- Essex is designed to generate Docker projects from templates with a focus on best practices and consistency
5-
- The project uses Tera templating (Jinja2-like syntax) for template generation
6-
- The main binary is written in Rust and requires Rust 1.70 or later
3+
## Project Identity
4+
Essex is a Rust-based Docker project template generator focused on consistency and best practices.
75

8-
# Project Structure
9-
- `/src`: Contains the Rust source code for the Essex binary
10-
- `/templates`: Contains the template definitions
11-
- `/templates/basic`: The basic template which includes Dockerfile, Makefile, README.md, and runtime assets
12-
- Each generated project follows a consistent structure with:
13-
- Dockerfile (uses best practices and OCI-compliant labels)
14-
- Makefile (for common Docker operations)
15-
- README.md
16-
- runtime-assets (containing entrypoint scripts and other assets)
6+
## Code Style Requirements
7+
1. ALWAYS enforce these Rust formatting rules:
8+
```toml
9+
# .rustfmt.toml settings
10+
max_width = 100
11+
hard_tabs = false
12+
tab_spaces = 4
13+
newline_style = "Auto"
14+
use_small_heuristics = "Default"
15+
reorder_imports = true
16+
reorder_modules = true
17+
remove_nested_parens = true
18+
edition = "2021"
19+
merge_derives = true
20+
use_field_init_shorthand = true
21+
use_try_shorthand = true
22+
force_explicit_abi = true
23+
```
1724

18-
# Development Guidelines
19-
- Follow Test-Driven Development (TDD) practices:
20-
- Write tests first before implementing new features
21-
- Ensure each new feature or bug fix has corresponding tests
22-
- Keep test coverage high and meaningful
23-
- All code changes should maintain backward compatibility with existing templates
24-
- Follow Rust best practices and idiomatic code patterns
25-
- Ensure all templates follow Docker best practices:
26-
- Use multi-stage builds where appropriate
27-
- Include proper OCI labels
28-
- Follow principle of least privilege (run as non-root user)
29-
- Include proper documentation
30-
- Always ensure our cargo version matches our git tag for releases
25+
2. ALWAYS enforce these Clippy rules via RUSTFLAGS:
26+
```bash
27+
RUSTFLAGS="-D warnings -D clippy::redundant-pattern-matching -D clippy::needless-borrows-for-generic-args"
28+
```
3129

32-
# Testing Requirements
33-
- Run `cargo test` to ensure all tests pass before submitting changes
34-
- Test template generation with different parameters
35-
- Verify generated Dockerfiles can be built successfully
36-
- Check that Makefiles in templates work as expected
30+
## Development Rules
31+
1. NEVER skip running these checks before committing:
32+
- `cargo fmt --all -- --check`
33+
- `cargo clippy` with required RUSTFLAGS
34+
- `cargo test`
3735

38-
# Important Files
39-
- README.md: Primary documentation source
40-
- src/main.rs: Entry point for the Essex binary
41-
- templates/basic/*: Core template files that serve as examples
36+
2. ALWAYS maintain these standards:
37+
- Write tests before implementing features (TDD)
38+
- Keep backward compatibility with existing templates
39+
- Follow idiomatic Rust patterns
40+
- Match cargo version with git tags for releases
4241

43-
# Build Process
44-
- Use `cargo build --release` for production builds
45-
- Development builds can use `cargo build`
46-
- Generated projects use Make for building Docker images
42+
3. ALWAYS follow these Docker best practices:
43+
- Use multi-stage builds
44+
- Include OCI labels
45+
- Run as non-root user
46+
- Provide comprehensive documentation
4747

48-
# Template Variables
49-
The following variables are commonly used in templates:
50-
- repo_username: GitHub/container registry username
51-
- repo_namespace: Organization/namespace for the project
52-
- image_name: Name of the Docker image
53-
- vendor: Company/organization name
54-
- version: Project version
55-
- build_date: Build timestamp
56-
- vcs_ref: Git commit reference
48+
## Template Rules
49+
1. ALWAYS include these components in generated projects:
50+
- Dockerfile with best practices
51+
- Makefile for Docker operations
52+
- README.md
53+
- runtime-assets directory
5754

58-
# Best Practices
59-
- Keep templates minimal but functional
60-
- Ensure all generated projects include proper documentation
61-
- Follow security best practices in Dockerfile templates
62-
- Include comprehensive error handling in Rust code
63-
- Document any new template variables or features
55+
2. ALWAYS support these template variables:
56+
- repo_username
57+
- repo_namespace
58+
- image_name
59+
- vendor
60+
- version
61+
- build_date
62+
- vcs_ref
6463

65-
When working with this project, please:
66-
1. Consult the README.md first for basic information
67-
2. Run tests before making any changes
68-
3. Maintain the existing project structure
69-
4. Follow the established coding style and practices
70-
5. Update documentation when adding new features
64+
## Documentation Rules
65+
1. ALWAYS update documentation when:
66+
- Adding new features
67+
- Modifying template variables
68+
- Changing project structure
69+
- Updating dependencies
70+
71+
2. ALWAYS maintain these files:
72+
- README.md for project overview
73+
- CONTRIBUTING.md for development guidelines
74+
- Template-specific documentation
75+
76+
## Error Handling Rules
77+
1. ALWAYS provide:
78+
- Clear error messages
79+
- Proper error types
80+
- Recovery suggestions
81+
- Debug information when appropriate
82+
83+
## Testing Rules
84+
1. ALWAYS verify:
85+
- Template generation with various parameters
86+
- Docker build success for generated projects
87+
- Makefile functionality
88+
- Unit test coverage
89+
- Integration test coverage

.windsurfrules

Lines changed: 80 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,89 @@
1-
This is Essex, a Docker project template generator written in Rust. It helps create consistent and well-structured Docker projects.
1+
# Essex AI Assistant Guidelines
22

3-
# Project Context
4-
- Essex is designed to generate Docker projects from templates with a focus on best practices and consistency
5-
- The project uses Tera templating (Jinja2-like syntax) for template generation
6-
- The main binary is written in Rust and requires Rust 1.70 or later
3+
## Project Identity
4+
Essex is a Rust-based Docker project template generator focused on consistency and best practices.
75

8-
# Project Structure
9-
- `/src`: Contains the Rust source code for the Essex binary
10-
- `/templates`: Contains the template definitions
11-
- `/templates/basic`: The basic template which includes Dockerfile, Makefile, README.md, and runtime assets
12-
- Each generated project follows a consistent structure with:
13-
- Dockerfile (uses best practices and OCI-compliant labels)
14-
- Makefile (for common Docker operations)
15-
- README.md
16-
- runtime-assets (containing entrypoint scripts and other assets)
6+
## Code Style Requirements
7+
1. ALWAYS enforce these Rust formatting rules:
8+
```toml
9+
# .rustfmt.toml settings
10+
max_width = 100
11+
hard_tabs = false
12+
tab_spaces = 4
13+
newline_style = "Auto"
14+
use_small_heuristics = "Default"
15+
reorder_imports = true
16+
reorder_modules = true
17+
remove_nested_parens = true
18+
edition = "2021"
19+
merge_derives = true
20+
use_field_init_shorthand = true
21+
use_try_shorthand = true
22+
force_explicit_abi = true
23+
```
1724

18-
# Development Guidelines
19-
- Follow Test-Driven Development (TDD) practices:
20-
- Write tests first before implementing new features
21-
- Ensure each new feature or bug fix has corresponding tests
22-
- Keep test coverage high and meaningful
23-
- All code changes should maintain backward compatibility with existing templates
24-
- Follow Rust best practices and idiomatic code patterns
25-
- Ensure all templates follow Docker best practices:
26-
- Use multi-stage builds where appropriate
27-
- Include proper OCI labels
28-
- Follow principle of least privilege (run as non-root user)
29-
- Include proper documentation
30-
- Always ensure our cargo version matches our git tag for releases
25+
2. ALWAYS enforce these Clippy rules via RUSTFLAGS:
26+
```bash
27+
RUSTFLAGS="-D warnings -D clippy::redundant-pattern-matching -D clippy::needless-borrows-for-generic-args"
28+
```
3129

32-
# Testing Requirements
33-
- Run `cargo test` to ensure all tests pass before submitting changes
34-
- Test template generation with different parameters
35-
- Verify generated Dockerfiles can be built successfully
36-
- Check that Makefiles in templates work as expected
30+
## Development Rules
31+
1. NEVER skip running these checks before committing:
32+
- `cargo fmt --all -- --check`
33+
- `cargo clippy` with required RUSTFLAGS
34+
- `cargo test`
3735

38-
# Important Files
39-
- README.md: Primary documentation source
40-
- src/main.rs: Entry point for the Essex binary
41-
- templates/basic/*: Core template files that serve as examples
36+
2. ALWAYS maintain these standards:
37+
- Write tests before implementing features (TDD)
38+
- Keep backward compatibility with existing templates
39+
- Follow idiomatic Rust patterns
40+
- Match cargo version with git tags for releases
4241

43-
# Build Process
44-
- Use `cargo build --release` for production builds
45-
- Development builds can use `cargo build`
46-
- Generated projects use Make for building Docker images
42+
3. ALWAYS follow these Docker best practices:
43+
- Use multi-stage builds
44+
- Include OCI labels
45+
- Run as non-root user
46+
- Provide comprehensive documentation
4747

48-
# Template Variables
49-
The following variables are commonly used in templates:
50-
- repo_username: GitHub/container registry username
51-
- repo_namespace: Organization/namespace for the project
52-
- image_name: Name of the Docker image
53-
- vendor: Company/organization name
54-
- version: Project version
55-
- build_date: Build timestamp
56-
- vcs_ref: Git commit reference
48+
## Template Rules
49+
1. ALWAYS include these components in generated projects:
50+
- Dockerfile with best practices
51+
- Makefile for Docker operations
52+
- README.md
53+
- runtime-assets directory
5754

58-
# Best Practices
59-
- Keep templates minimal but functional
60-
- Ensure all generated projects include proper documentation
61-
- Follow security best practices in Dockerfile templates
62-
- Include comprehensive error handling in Rust code
63-
- Document any new template variables or features
55+
2. ALWAYS support these template variables:
56+
- repo_username
57+
- repo_namespace
58+
- image_name
59+
- vendor
60+
- version
61+
- build_date
62+
- vcs_ref
6463

65-
When working with this project, please:
66-
1. Consult the README.md first for basic information
67-
2. Run tests before making any changes
68-
3. Maintain the existing project structure
69-
4. Follow the established coding style and practices
70-
5. Update documentation when adding new features
64+
## Documentation Rules
65+
1. ALWAYS update documentation when:
66+
- Adding new features
67+
- Modifying template variables
68+
- Changing project structure
69+
- Updating dependencies
70+
71+
2. ALWAYS maintain these files:
72+
- README.md for project overview
73+
- CONTRIBUTING.md for development guidelines
74+
- Template-specific documentation
75+
76+
## Error Handling Rules
77+
1. ALWAYS provide:
78+
- Clear error messages
79+
- Proper error types
80+
- Recovery suggestions
81+
- Debug information when appropriate
82+
83+
## Testing Rules
84+
1. ALWAYS verify:
85+
- Template generation with various parameters
86+
- Docker build success for generated projects
87+
- Makefile functionality
88+
- Unit test coverage
89+
- Integration test coverage

0 commit comments

Comments
 (0)