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
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -435,3 +435,14 @@ dist

# GeoLite city database
*/GeoLite2-City/*


# START Ruler Generated Files
*.bak
.github/copilot-instructions.md
.github/copilot-instructions.md.bak
.junie/guidelines.md
.junie/guidelines.md.bak
.vscode/mcp.json
.vscode/mcp.json.bak
# END Ruler Generated Files
62 changes: 62 additions & 0 deletions .ruler/backend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# AI Agent Instructions for backend/

All the following instructions must be followed when writing code in the ./backend/ directory.
This includes all Python code, tests, and any other files related to the backend project.

## Coding Standards

- Use Python 3.14 and Django 5.2 conventions.
- Always follow PEP8 and Python best practices for style and structure with a line length of 120.
- Name variables, functions, and classes descriptively and consistently.
- Write modular code: split logic into reusable functions and classes.
- Add concise docstrings to all public functions and classes.
- Don't use hardcoded strings, if possible.
If a function exists to generate that string, use it.
If the string is a constant, define it in its (or another appropriate) module.
- Never use `__future__` imports.
- Use type hints for all arguments and return values.
- Use type annotations for all variables, and functions.
- When having to run code, use uv to run the project and always use the `--active` flag: `uv run --active`.
- The code is formatted using `ruff` exclusively. The most used command to run is:
`ruff format . && ruff check --select I --fix ./ && ruff check --fix ./`

## Template Standards

- Use Django's template language for all HTML templates.
- Use Tailwind CSS 4 for styling, and ensure it is properly integrated with Django templates.
- Use Alpine.js 3 for any necessary JavaScript interactivity in templates.
- Follow best practices for template structure and organization.
- Use template inheritance to avoid duplication.
- Name templates descriptively and consistently.
- Avoid logic in templates; keep it in views or template tags.

## Testing Requirements

- Store tests in `tests.py` or a `tests/` directory within each app.
- Use Django's `TestCase` for all unit and integration tests.
- Write tests for every new feature, model, and view.
- Ensure tests are independent and do not rely on external state.
- Name test methods clearly and assert expected results.

## Dependency Management

- Add dependencies using uv: `uv pip install <package>`.
- Let uv update `pyproject.toml` and `uv.lock` automatically.
- Never manually edit `uv.lock`.
Comment on lines +43 to +45
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Incorrect uv dependency management instructions.

The command uv pip install <package> does not automatically update pyproject.toml. The uv pip subcommand is a pip-compatible interface that installs into the environment without modifying project files.

To add dependencies and update pyproject.toml, the correct command is uv add <package>.

📝 Proposed fix
 ## Dependency Management
 
-- Add dependencies using uv: `uv pip install <package>`.
-- Let uv update `pyproject.toml` and `uv.lock` automatically.
+- Add dependencies using uv: `uv add <package>`.
+- This will update `pyproject.toml` and `uv.lock` automatically.
 - Never manually edit `uv.lock`.
📝 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
- Add dependencies using uv: `uv pip install <package>`.
- Let uv update `pyproject.toml` and `uv.lock` automatically.
- Never manually edit `uv.lock`.
- Add dependencies using uv: `uv add <package>`.
- This will update `pyproject.toml` and `uv.lock` automatically.
- Never manually edit `uv.lock`.
🤖 Prompt for AI Agents
In @.ruler/backend.md around lines 43 - 45, Update the wording in
.ruler/backend.md to correct the uv workflow: replace the incorrect instruction
that says to use `uv pip install <package>` for adding dependencies with the
correct `uv add <package>` command, and clarify that `uv pip install` only
installs into the environment and does not modify pyproject.toml or uv.lock;
keep the guidance that uv should update pyproject.toml and uv.lock automatically
and that uv.lock must not be edited manually.


## Django Project Practices

- Register new models in `admin.py` for admin access.
- Create and apply migrations for model changes.
- Keep Django settings modular and environment-specific in `settings/`.

## Commit and Workflow

- Ensure code is formatted and linted before commit.
- Include tests for new features and bug fixes.
- Write clear commit messages describing changes.

## Summary

Follow these instructions to ensure code quality, maintainability, and reliability in the backend project.
All code, tests, formatting, and dependencies must comply with these rules.
50 changes: 50 additions & 0 deletions .ruler/ruler.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Ruler Configuration File
# See https://ai.intellectronica.net/ruler for documentation.

# To specify which agents are active by default when --agents is not used,
# uncomment and populate the following line. If omitted, all agents are active.
default_agents = ["copilot", "junie"]

# --- Agent Specific Configurations ---
# You can enable/disable agents and override their default output paths here.
# Use lowercase agent identifiers: amp, copilot, claude, codex, cursor, windsurf, cline, aider, kilocode

[agents.copilot]
enabled = true
output_path = ".github/copilot-instructions.md"

# [agents.claude]
# enabled = true
# output_path = "CLAUDE.md"

# [agents.codex]
# enabled = true
# output_path = "AGENTS.md"

# [agents.cursor]
# enabled = true
# output_path = ".cursor/rules/ruler_cursor_instructions.mdc"

# [agents.windsurf]
# enabled = true
# output_path = ".windsurf/rules/ruler_windsurf_instructions.md"

# [agents.cline]
# enabled = true
# output_path = ".clinerules"

# [agents.aider]
# enabled = true
# output_path_instructions = "ruler_aider_instructions.md"
# output_path_config = ".aider.conf.yml"

# [agents.firebase]
# enabled = true
# output_path = ".idx/airules.md"

# [agents.gemini-cli]
# enabled = true

# [agents.kilocode]
# enabled = true
# output_path = ".kilocode/rules/ruler_kilocode_instructions.md"
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,50 @@ If you managed to find a solution, please open a PR with the changes.
3. Run `make run` to start the containers with an PostgreSQL database
4. Open http://localhost:8080 in your browser

### Managing Coding Assistants' instructions

The instructions for the coding assistants are stored in the `.ruler/` directory.
Each file corresponds to a specific part of the codebase and contains instructions for the coding assistants on how to
write code, tests, and manage dependencies for that part of the codebase.

More information can be found in the [ruler.toml](.ruler/ruler.toml) file and in
the [GitHub repository](https://github.com/intellectronica/ruler) of the project.

#### Updating the instructions

If you want to update the instructions for the coding assistants, please update the corresponding file in the `.ruler/`
directory and make a pull request with the changes.

#### Installing Ruler

Having NPM installed, run the following command to install Ruler globally:

```
npm install -g @intellectronica/ruler
```

or with NPX:

```
npx @intellectronica/ruler apply
```

#### Generating the instructions for the coding assistants

1. Go to the root of the project
2. Run `ruler apply` to generate the instructions for the coding assistants

#### Adding new Coding Assistants

You can find the enabled coding assistants in the `ruler.toml` file.
To add a new coding assistant, edit the `ruler.toml` file
and add a new agent to the `default_agents` list.
Please check the Ruler docs if there are any agent-specific configurations that need to be added.

1. Uncomment the corresponding section in the `ruler.toml` file
2. Run `ruler apply` to generate the instructions for the coding assistants and `.gitignore` changes
3. Make a pull request with the changes.

## Creating a new release

The production deployment is done through a CI/CD pipeline using GitHub Actions.
Expand Down