plugins/superclaude/core/RULES.md
Actionable rules for enhanced Claude Code framework operation.
š“ CRITICAL: Security, data safety, production breaks - Never compromise
š” IMPORTANT: Quality, maintainability, professionalism - Strong preference
š¢ RECOMMENDED: Optimization, style, best practices - Apply when practical
Priority: š“ Triggers: Task execution and post-implementation
Task Execution Layer (Existing Auto-Activation):
.py, .jsx, .ts, etc. trigger language/framework specialists@agent-[name] prefix routes directly to specified agentSelf-Improvement Layer (PM Agent Meta-Layer):
Orchestration Flow:
ā
Right: User request ā backend-architect implements ā PM Agent documents patterns
ā
Right: Error detected ā PM Agent stops work ā Root cause analysis ā Documentation updated
ā
Right: @agent-security "review auth" ā Direct to security-engineer (manual override)
ā Wrong: Skip documentation after implementation (no PM Agent activation)
ā Wrong: Continue implementing after mistake (no root cause analysis)
Priority: š” Triggers: All development tasks
ā Right: Plan ā TodoWrite ā Execute ā Validate ā Wrong: Jump directly to implementation without planning
Priority: š“ Triggers: All planning phases, TodoWrite operations, multi-step tasks
ā
Right: "Plan: 1) Parallel: [Read 5 files] 2) Sequential: analyze ā 3) Parallel: [Edit all files]"
ā Wrong: "Plan: Read file1 ā Read file2 ā Read file3 ā analyze ā edit file1 ā edit file2"
Priority: š” Triggers: Creating features, writing functions, code generation
ā
Right: function calculate() { return price * tax; }
ā Wrong: function calculate() { throw new Error("Not implemented"); }
ā Wrong: // TODO: implement tax calculation
Priority: š” Triggers: Vague requirements, feature expansion, architecture decisions
ā
Right: "Build login form" ā Just login form
ā Wrong: "Build login form" ā Login + registration + password reset + 2FA
Priority: š¢ Triggers: Creating files, structuring projects, naming decisions
ā
Right: getUserData(), user_data.py, components/auth/
ā Wrong: get_userData(), userdata.py, files/everything/
Priority: š” Triggers: After operations, session end, temporary file creation
ā
Right: rm temp_script.py after use
ā Wrong: Leaving debug.sh, test.log, temp/ directories
Priority: š“ Triggers: Errors, test failures, unexpected behavior, tool failures
ā
Right: Analyze stack trace ā identify root cause ā fix properly
ā Wrong: Comment out failing test to make build pass
Detection: grep -r "skip\|disable\|TODO" tests/
Priority: š” Triggers: Assessments, reviews, recommendations, technical claims
ā
Right: "This approach has trade-offs: faster but uses more memory"
ā Wrong: "This magnificent solution is blazingly fast and 100% secure!"
Priority: š“ Triggers: Session start, before changes, risky operations
git status and git branchgit diff to review changes before stagingā
Right: git checkout -b feature/auth ā work ā commit ā PR
ā Wrong: Work directly on main/master branch
Detection: git branch should show feature branch, not main/master
Priority: š¢ Triggers: Multi-step operations, performance needs, complex tasks
ā
Right: Use MultiEdit for 3+ file changes, parallel Read calls
ā Wrong: Sequential Edit calls, bash grep instead of Grep tool
Priority: š” Triggers: File creation, project structuring, documentation
claudedocs/ directorytests/, __tests__/, or test/ directoriesscripts/, tools/, or bin/ directoriesā
Right: tests/auth.test.js, scripts/deploy.sh, claudedocs/analysis.md
ā Wrong: auth.test.js next to auth.js, debug.sh in project root
Priority: š“ Triggers: File operations, library usage, codebase changes
ā
Right: Check dependencies ā follow patterns ā execute safely
ā Wrong: Ignore existing conventions, make unplanned changes
Priority: š“ Triggers: Date/time references, version checks, deadline calculations, "latest" keywords
ā
Right: "Checking env: Today is 2025-08-15, so the Q3 deadline is..."
ā Wrong: "Since it's January 2025..." (without checking)
Detection: Any date reference without prior env verification
š“ Before Any File Operations
File operation needed?
āā Writing/Editing? ā Read existing first ā Understand patterns ā Edit
āā Creating new? ā Check existing structure ā Place appropriately
āā Safety check ā Absolute paths only ā No auto-commit
š” Starting New Feature
New feature request?
āā Scope clear? ā No ā Brainstorm mode first
āā >3 steps? ā Yes ā TodoWrite required
āā Patterns exist? ā Yes ā Follow exactly
āā Tests available? ā Yes ā Run before starting
āā Framework deps? ā Check package.json first
š¢ Tool Selection Matrix
Task type ā Best tool:
āā Multi-file edits ā MultiEdit > individual Edits
āā Complex analysis ā Task agent > native reasoning
āā Code search ā Grep > bash grep
āā UI components ā Magic MCP > manual coding
āā Documentation ā Context7 MCP > web search
āā Browser testing ā Playwright MCP > unit tests
git status && git branch before starting