Rules in CodeLLM help you guide your AI coding agent with specific instructions - from coding style preferences to architectural decisions, project templates, and even how the assistant talks to you. Think of them as reusable, always-on instructions that act like a persistent memory for your assistant - ensuring consistency in your workflows, across files and sessions.
Large language models don’t retain memory between tasks. Rules solve this by injecting persistent context into your AI prompts — helping the assistant respond consistently across your files and projects.
Whenever a Rule applies, its contents are included automatically at the start of the model’s context.
Rules apply in:
They are scoped using two settings:
routes/api/*.ts
)You may find the different rules here in this Rule directory and add them to the list - https://rules.abacusai.app/
Help CodeLLM understand project-specific terms and logic while helping you coding and providing suggestions.
description: "Domain-specific terminology and conventions"
globs: ["*"]
ruleType: always
---
- In our app, 'Tenant' refers to an organization, not an individual user.
- The 'Account' model handles billing relationships.
- 'Subscription' controls feature access levels and is always linked to a Tenant.
📌 Tip: Add to .codellm/rules to apply across the project.
Define reusable templates for common tasks.
description: "API endpoint boilerplate"
globs: ["routes/api/*.ts"]
ruleType: auto-attached
---
Use this template for new API routes:
```ts
import { NextApiRequest, NextApiResponse } from 'next'
import { withAuth } from '@/lib/auth'
export default withAuth(async function handler(req: NextApiRequest, res: NextApiResponse) {
// Your code here
})
```
- All endpoints must use withAuth
- Validate request payloads using zod
Enforce how code should be structured across the team.
description: "React component guidelines"
globs: ["components/**/*.tsx"]
ruleType: always
---
- Use functional components (avoid class components)
- Follow PascalCase for naming (e.g., `UserProfile`)
- Component file layout:
- Main component
- Subcomponents
- Styles
- Tests
- Avoid inline styles; prefer styled-components
Control how the assistant talks — great for teams or non-English settings.
description: "Formal French tone"
globs: ["*"]
ruleType: always
---
- Respond in fluent French
- Use a formal, documentation-style tone
- Keep responses short and precise with code examples
Adapt the response style to your coding proficiency and learning style. Really helpful for non-technical users and beginners for setting up the style in a manner that you can understand
description: "Non-technical communication style and support"
globs: ["*"]
ruleType: always
---
- Adjust responses to match the proficiency of a non-technical user.
- When suggesting a tool, code, or task, always include brief background context to explain:
- Why the task is important
- When it is typically needed
- How it fits into the bigger picture
- If the task involves manual steps (e.g., command-line use, file changes, or UI navigation), provide:
- Clear step-by-step instructions
- Expected outcomes or changes after each step
- Any prerequisites, dependencies, or files the user should check beforehand
- Use code comments to explain logic instead of long paragraphs
Open a Folder in CodeLLM
Navigate to CodeLLM's Settings in the top right corner on the sidebar by clicking the gear.
Click on the Rules settings tab on the left section of the settings page.
Click on 'Create Rule"
Add the Rule File name in the Top bar
This adds a .codellm/rules/
folder to your project with the given file name
Fill out the following details:
📌 Tip: You can also copy-paste existing rule files between projects!
✅ Good Practice | ❌ Avoid This |
---|---|
Be specific and actionable | Vague guidance like "write clean code" |
Keep rules modular | One giant rule covering everything |
Add concrete examples | Generic instructions without context |
Use globs smartly | Overusing * everywhere |
Test your rules on sample files | Assuming it works without trying |
Yes, absolutely! Just make sure they don’t conflict with each other and are not ambiguous.
Yes, just mention it in your prompt with @file
to attach it manually.
For further assistance, please contact our support team: support@abacus.ai.