July 4, 2025
Tl:Dr
Codespell’s Rules are reusable, project-aligned templates that embed your team’s coding standards directly into the AI generation engine. Instead of just fixing code after it's written, Rules proactively shape the code before it’s generated—ensuring consistency in naming, structure, patterns, and practices from the start. Teams use them to accelerate delivery, reduce rework, enforce architecture, and scale standards across developers and projects. Whether it’s a Node.js API or Python async service, Rules ensure the output is production-ready by default.
In most dev teams, standards are written down but rarely followed consistently.
AI assistants have only made this gap more visible. You get fast code generation, but with a catch: inconsistent naming, disorganized folders, and patterns that don’t match your system. What started as acceleration ends up adding rework.
Codespell’s Rules were built to fix that.
This isn’t another style guide or linter. Rules in Codespell actually shape the way code is generated before it ever reaches your editor.
What Are Rules?
Rules in Codespell are reusable, project-aligned templates that embed your team’s coding standards into the AI generation engine.
They define:
- How functions are named
- Which design patterns to follow
- Where generated files should go
- Whether to use async, classes, middleware, or decorators
- And much more
When a Rule is active, every prompt is processed through it resulting in code that aligns with your conventions by default.
How Do Rules Work?
The workflow is simple and repeatable:
1. Create or select a Rule
Choose from existing rules (e.g. Node REST, Python Async, React Hooks) or create one tailored to your team.
2. Apply it to your workspace
In Codespell’s interface, activate the Rule for your current session or project.
3. Prompt as usual
Request whatever you need—API routes, services, tests, components. No extra formatting or custom prompting required.
4. Get context-aware code
The AI outputs code that respects your Rule: file structure, patterns, naming, even error handling preferences.
Example: With vs. Without Rules
Prompt: “Create an Express route for user registration”
Without Rules:
router.post('/register', (req, res) => {
// logic here
});
With Rules:
userRouter.post('/register', validateUserSchema, async (req, res, next) => {
try {
const user = await userService.create(req.body);
res.status(201).json(user);
} catch (err) {
next(err);
}
});
Notice:
- Correct router name
- Validation middleware
- Async/await style
- Structured error handling
That’s not just helpful—it’s production-ready.
Why Teams Use Rules
- Faster Code Reviews — Less time fixing small issues
- Better Onboarding — New hires write consistent code from day one
- Reduced Refactoring — Code is right the first time
- Architecture Enforcement — Patterns are applied automatically
- Scalability — Even large, distributed teams stay consistent
Frequently Asked Questions
Q: Can I create custom Rules for my team’s internal patterns?
Yes. Codespell allows you to define and save Rules based on your naming, folder structure, design style, and tech stack.
Q: What types of Rules are available out of the box?
Examples include:
- ReactJS Component Conventions
- Node.js RESTful API Pattern
- Python Async Patterns
- Folder Structure Templates
You can modify or create your own based on these templates.
Q: Do Rules apply to testing code as well?
Yes. If you generate test cases, the structure and assertions will follow the conventions defined in your Rule.
Q: Can different teams have different Rules?
Absolutely. You can assign Rules per project, per workspace, or per developer role.
Q: Is there version control for Rules?
Yes. Codespell maintains a version history for Rules so you can roll back or update as your standards evolve.
Q: Do Rules override prompt instructions?
They guide and constrain the AI output. Your prompts still matter, but the output will adhere to the active Rule wherever possible.
Final Thoughts
Your AI assistant should understand your codebase, not work against it.
Rules in Codespell give you the ability to codify standards once and apply them every time across teams, projects, and stages of development.
It's how growing teams stay fast without sacrificing consistency.
Explore Rules in Codespell and start generating code that’s already aligned with your architecture.