PandaOSPandaOSby Pandata

Rules

Rules are instruction files that tell PandaOS how to behave when working on your code. They're the most powerful way to customize PandaOS's behavior for your specific project and workflow.

What Are Rules?

Rules are markdown files containing instructions that PandaOS reads at the start of every session. They can specify:

  • Coding conventions and style guides
  • Framework-specific patterns to follow
  • Files or patterns to avoid modifying
  • Testing requirements
  • Architectural decisions
  • Any other instructions for PandaOS

Rule Locations

Global Rules

Apply to all projects. Stored in:

~/.claude/rules/

Example: ~/.claude/rules/style.md

Project Rules

Apply to a specific project. Stored in:

your-project/.claude/rules/

Example: my-app/.claude/rules/testing.md

CLAUDE.md

The CLAUDE.md file in your project root is a special rule file that PandaOS always reads. It's the primary place for project-specific instructions.

my-app/CLAUDE.md

Opening the Rules page

Rules live on the Rules page in the sidebar.

  1. Click Rules in the sidebar
  2. Edit the global rules, or the rules that apply to the current project only

See Rules.

Managing Rules

The Rules settings show:

  • List of rule files, all .md files in the rules directory
  • File editor, click a file to view/edit its contents
  • Add, create a new rule file
  • Remove, delete a rule file

Writing Effective Rules

Example: Coding Style

# Coding Conventions

- Use TypeScript for all new files
- Use functional components with hooks (no class components)
- Use named exports (not default exports)
- File names: kebab-case (e.g., `user-profile.tsx`)
- Use Tailwind CSS for styling, no inline styles

Example: Project Architecture

# Architecture Rules

- All API routes go in `src/app/api/`
- Database queries use Prisma, never raw SQL
- State management uses Zustand stores in `src/stores/`
- All components must have a corresponding test file

Example: Safety

# Safety Rules

- NEVER modify `.env` or `.env.local` files
- NEVER commit secrets or API keys
- Always validate user input at API boundaries
- Run `npm test` after any code changes

Sync Rules

PandaOS copies your pandaos-*.md rule files from your global rules directory to all registered projects automatically, for example when you connect an app or the available tool list changes. This keeps your rules consistent across projects without a manual step.

Rule Priority

When multiple rules exist, they're all included. There's no override mechanism, all rules are additive. If rules conflict, the most specific (project-level) rules should take precedence in practice, but it's best to avoid contradictions.

PandaOS-Managed Sections

PandaOS may inject managed sections into your project's CLAUDE.md file (e.g., Browser MCP tool instructions). These sections are marked with special comments and are automatically maintained, don't edit them manually.

<!-- PANDAOS:START -->
... managed content ...
<!-- PANDAOS:END -->