Package Exports
- @malamute/ai-rules
- @malamute/ai-rules/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@malamute/ai-rules) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
AI Rules
Supercharge Claude Code with framework-specific rules, skills, and best practices.
AI Rules installs curated configuration boilerplates that teach Claude Code your stack's conventions, patterns, and guardrails. Stop explaining the same things over and over — let Claude understand your architecture from the start.
Why Use This?
| Without AI Rules | With AI Rules |
|---|---|
| Claude uses generic patterns | Claude follows your framework's idioms |
| You repeat "use signals, not decorators" | Angular 21 patterns are built-in |
| Security issues slip through | OWASP Top 10 rules catch vulnerabilities |
| Inconsistent code style | Consistent conventions across the team |
Quick Start
# Interactive setup (recommended)
npx @malamute/ai-rules init
# Or specify your stack directly
npx @malamute/ai-rules init angular nestjsThat's it. Claude Code now understands your stack.
Installation
# Global install
npm install -g @malamute/ai-rules
# Or use with npx (no install needed)
npx @malamute/ai-rules <command>Supported Technologies
| Technology | Stack | Version |
|---|---|---|
| Angular | Nx + NgRx + Signals + Vitest | 21+ |
| Next.js | App Router + React 19 + Server Components | 15+ |
| NestJS | Prisma/TypeORM + Passport + Vitest | 11+ |
| .NET | Clean Architecture + MediatR + EF Core | 9+ |
| FastAPI | Pydantic v2 + SQLAlchemy 2.0 + pytest | 0.115+ |
| Flask | Marshmallow + SQLAlchemy 2.0 + pytest | 3.0+ |
Commands
ai-rules init [tech...] # Install configs (interactive if no tech)
ai-rules add <tech> # Add technology to existing installation
ai-rules update # Update to latest rules
ai-rules status # Show installation info
ai-rules list # List available technologiesOptions
| Option | Description |
|---|---|
--minimal |
Skip skills and shared rules (only tech rules + settings) |
--dry-run |
Preview changes without writing files |
--target <dir> |
Install to a specific directory |
--force |
Overwrite without creating backups |
By default, init installs everything (skills + shared rules). Use --minimal to skip extras.
What Gets Installed
your-project/
├── CLAUDE.md # Your project-specific info (not touched)
└── .claude/
├── settings.json # Allowed/denied commands
├── rules/ # Framework-specific patterns
│ ├── nextjs/
│ │ ├── core.md # Stack, architecture, conventions
│ │ ├── components.md
│ │ └── ...
│ ├── conventions/ # Shared conventions
│ │ └── core.md
│ └── security/
└── skills/ # Optional workflows
├── learning/
├── review/
└── debug/Note: Your project's
CLAUDE.mdis never modified. Use it for project-specific context (business domain, team conventions, etc.).
Rules
Context-aware rules that activate based on file paths:
---
paths:
- '**/*.component.ts'
---
# Angular Component Rules
- Use `ChangeDetectionStrategy.OnPush`
- Use `input()`, `output()`, not decorators
- Template in separate `.html` fileSkills
Interactive workflows invoked with /skill-name:
| Skill | Description |
|---|---|
/learning |
Pedagogical mode — explains before coding |
/review |
Code review with security/perf checklist |
/debug |
Structured debugging workflow |
/spec |
Write technical spec before implementing |
/sudden-death |
Kill indecision with rapid-fire questions |
/fix-issue |
Analyze GitHub issue and implement fix |
/generate-tests |
Generate comprehensive tests |
See all 14 skills
| Skill | Usage | Description |
|---|---|---|
/learning |
/learning nextjs |
Explains concepts before implementing |
/review |
/review src/users/ |
Code review with checklist |
/spec |
/spec add auth |
Technical specification |
/sudden-death |
/sudden-death backend |
Kill indecision, get a verdict |
/debug |
/debug TypeError... |
Systematic debugging |
/fix-issue |
/fix-issue 123 |
Fix GitHub issue |
/review-pr |
/review-pr 456 |
Review pull request |
/generate-tests |
/generate-tests src/user.ts |
Generate tests |
/api-endpoint |
/api-endpoint POST /users |
Generate API endpoint |
/migration |
/migration add users |
Database migration |
/security-audit |
/security-audit |
Security analysis |
/docker |
/docker |
Dockerfile generation |
/deploy |
/deploy |
Deployment config |
/explore |
/explore |
Repository analysis |
Shared Rules
Cross-framework rules included with --with-rules:
| Rule | What It Covers |
|---|---|
| security.md | OWASP Top 10: injection, XSS, CSRF, secrets |
| performance.md | N+1 queries, caching, lazy loading |
| accessibility.md | WCAG 2.1, semantic HTML, ARIA |
| testing-patterns.md | AAA pattern, mocking, coverage |
| error-handling.md | Error categories, response formats |
| git.md | Conventional commits, branching, PRs |
| observability.md | Logging, metrics, tracing |
Examples
Fullstack Setup
# Angular frontend + NestJS backend
ai-rules init angular nestjs
# Next.js frontend + FastAPI backend
ai-rules init nextjs fastapi
# Add a technology to existing installation
ai-rules add nestjs
# Minimal install (no skills/shared rules)
ai-rules init angular --minimalPreview Before Installing
ai-rules init angular --dry-runOutput:
DRY RUN - No files will be modified
ℹ Would install to: /your/project
ℹ Would install angular...
○ settings.json (create)
○ rules/angular/ (9 files)
Summary:
10 file(s) would be created
0 file(s) would be modifiedUpdate Configs
# Check current version
ai-rules status
# Preview updates
ai-rules update --dry-run
# Apply updates (auto-backup enabled)
ai-rules updateTechnology Conventions
Angular
| Aspect | Convention |
|---|---|
| Components | Standalone, OnPush change detection |
| Signals | input(), output(), model() functions |
| State | NgRx with Entity Adapter + Functional Effects |
| Structure | Nx monorepo with feature/ui/data-access libs |
| Tests | Vitest + Marble testing |
Next.js
| Aspect | Convention |
|---|---|
| Components | Server Components by default |
| Client | 'use client' directive for interactivity |
| Data | Server Components + fetch, Server Actions |
| State | Zustand (simple) / Redux Toolkit (complex) |
| Structure | App Router with route groups |
NestJS
| Aspect | Convention |
|---|---|
| Architecture | Modular Monolith |
| Validation | class-validator + class-transformer |
| Database | Prisma (modern) / TypeORM (decorators) |
| Auth | Passport + JWT |
| Tests | Vitest + Supertest |
.NET
| Aspect | Convention |
|---|---|
| Architecture | Clean Architecture (Domain → App → Infra) |
| API | Minimal APIs (preferred) or Controllers |
| CQRS | MediatR for Commands/Queries |
| ORM | Entity Framework Core |
| Tests | xUnit + NSubstitute + FluentAssertions |
FastAPI
| Aspect | Convention |
|---|---|
| Framework | FastAPI with async/await |
| Validation | Pydantic v2 |
| ORM | SQLAlchemy 2.0 with async support |
| Tests | pytest + httpx |
| Migrations | Alembic |
Flask
| Aspect | Convention |
|---|---|
| Framework | Flask 3.0 with Application Factory |
| Validation | Marshmallow schemas |
| ORM | SQLAlchemy 2.0 |
| Tests | pytest |
| Extensions | Flask-SQLAlchemy, Flask-Migrate, Flask-JWT-Extended |
How It Works
- Rules are loaded by Claude Code based on file paths you're editing
rules/core.mdwithalwaysApply: trueprovides framework conventions- Skills are invoked on-demand with
/skill-name - Settings define what commands Claude can run
Your project's CLAUDE.md stays clean for project-specific context, while framework conventions live in rules.
Contributing
# Clone and install
git clone https://github.com/malamute/ai-rules.git
cd ai-rules
npm install
# Run tests
npm test
# Add a new technology
mkdir -p configs/your-tech/rules
# Add rules/core.md and other rulesAdding a Technology
- Create
configs/[tech]/rules/core.mdwith framework conventions - Add rules in
configs/[tech]/rules/ - Add
configs/[tech]/settings.jsonfor permissions - Add tests
- Submit a PR
See CONTRIBUTING.md for details on skills structure.
License
MIT © Mehdi Chaabi