Skip to content

DarKWinGTM/claude-code-rules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

64 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Claude Code Rules

πŸ›οΈ Claude Code Rules & Framework πŸ›οΈ

Your Claude Code AI assistant, elevated to professional standards



100%
Factual Accuracy


82%
Token Savings


50%
Faster Response


100%
Constitutional


πŸ“‘ Table of Contents


⚑ Quick Start

# πŸš€ One-line runtime-only installation - Clone and install active rules
git clone https://github.com/DarKWinGTM/claude-code-rules.git && \
mkdir -p ~/.claude/rules && \
for f in \
  accurate-communication.md \
  answer-presentation.md \
  anti-mockup.md \
  anti-sycophancy.md \
  authority-and-scope.md \
  dan-safe-normalization.md \
  document-consistency.md \
  document-changelog-control.md \
  document-design-control.md \
  document-patch-control.md \
  emergency-protocol.md \
  explanation-quality.md \
  flow-diagram-no-frame.md \
  functional-intent-verification.md \
  no-variable-guessing.md \
  phase-implementation.md \
  project-documentation-standards.md \
  recovery-contract.md \
  refusal-classification.md \
  refusal-minimization.md \
  safe-file-reading.md \
  safe-terminal-output.md \
  strict-file-hygiene.md \
  todo-standards.md \
  unified-version-control-system.md \
  zero-hallucination.md; do \
  cp "claude-code-rules/$f" ~/.claude/rules/; \
done

✨ That's it! This installs the 26 active runtime rules only.


πŸ“¦ Installation

🎯 Method 1: Full Installation (Recommended)

Complete setup with all rules:

# Step 1: Clone the repository
git clone https://github.com/DarKWinGTM/claude-code-rules.git
cd claude-code-rules

# Step 2: Create rules directory (if not exists)
mkdir -p ~/.claude/rules

# Step 3: Copy only active runtime rule files
for f in \
  accurate-communication.md \
  answer-presentation.md \
  anti-mockup.md \
  anti-sycophancy.md \
  authority-and-scope.md \
  dan-safe-normalization.md \
  document-consistency.md \
  document-changelog-control.md \
  document-design-control.md \
  document-patch-control.md \
  emergency-protocol.md \
  explanation-quality.md \
  flow-diagram-no-frame.md \
  functional-intent-verification.md \
  no-variable-guessing.md \
  phase-implementation.md \
  project-documentation-standards.md \
  recovery-contract.md \
  refusal-classification.md \
  refusal-minimization.md \
  safe-file-reading.md \
  safe-terminal-output.md \
  strict-file-hygiene.md \
  todo-standards.md \
  unified-version-control-system.md \
  zero-hallucination.md; do \
  cp "$f" ~/.claude/rules/; \
done

# Step 4: Verify installation
ls ~/.claude/rules/

# Step 5 (optional): Verify new governed rules exist
ls ~/.claude/rules/answer-presentation.md
ls ~/.claude/rules/phase-implementation.md

🎯 Method 2: Pick Your Rules

Install only what you need:

# Example: Install just the anti-sycophancy rule
curl -o ~/.claude/rules/anti-sycophancy.md \
  https://raw.githubusercontent.com/DarKWinGTM/claude-code-rules/master/anti-sycophancy.md

🎯 Method 3: Project-Specific

Add rules to a single project:

# In your project directory
mkdir -p .claude/rules
for f in \
  accurate-communication.md \
  answer-presentation.md \
  anti-mockup.md \
  anti-sycophancy.md \
  authority-and-scope.md \
  dan-safe-normalization.md \
  document-consistency.md \
  document-changelog-control.md \
  document-design-control.md \
  document-patch-control.md \
  emergency-protocol.md \
  explanation-quality.md \
  flow-diagram-no-frame.md \
  functional-intent-verification.md \
  no-variable-guessing.md \
  phase-implementation.md \
  project-documentation-standards.md \
  recovery-contract.md \
  refusal-classification.md \
  refusal-minimization.md \
  safe-file-reading.md \
  safe-terminal-output.md \
  strict-file-hygiene.md \
  todo-standards.md \
  unified-version-control-system.md \
  zero-hallucination.md; do \
  cp "/path/to/claude-code-rules/$f" .claude/rules/; \
done

πŸ“ Installation Paths

Location Scope Path Use Case
Global All projects ~/.claude/rules/*.md Default recommendation
Project Current project only ./.claude/rules/*.md Project-specific needs

πŸ“‚ Design Documentation Structure

Location Purpose File Type
./design/*.design.md Design specifications Design docs
*.md (root) Active runtime rules Rules files
./changelog/changelog.md Master repository-wide history Master changelog
./changelog/*.changelog.md Per-chain authoritative history Changelogs
./phase/SUMMARY.md Governed summary/index for live phase planning, design rollup, and review rollup Phase summary doc
./phase/phase-010-<phase-name>.md Governed child per-phase execution detail with design extraction and review state Child phase docs
./patches/*.patch.md Governed patch/review artifacts outside live phase planning Patch docs
./phase-implementation-template.md Root helper for phased planning Helper artifact

πŸ’‘ Single Source of Truth Principle:

  • Design files (.design.md) define active target state
  • Per-chain changelogs (*.changelog.md) are the authority for governed chain history
  • changelog/changelog.md records repository-level synchronization history
  • README.md remains overview-only, not chain authority

βœ… Verify Installation

# Check if rules are loaded
claude --version
head -20 ~/.claude/rules/anti-sycophancy.md
ls ~/.claude/rules/answer-presentation.md
ls ~/.claude/rules/phase-implementation.md

πŸ”— Integration Guide

This section defines how design, changelog, runtime rules, TODO, and governed phase-planning artifacts should be updated together.

Document Roles

Document Role Update Trigger
design/*.design.md Target behavior/specification Requirement or policy change
*.md (root runtime rules) Active runtime behavior Approved design change requires runtime sync
changelog/changelog.md Master repository-wide synchronization history Repository-level governed sync events
changelog/*.changelog.md Authoritative per-chain version history Any rule/design update with version impact
phase/SUMMARY.md Governed summary/index for live phased execution Phased implementation work requires one summary file that carries design extraction summary, overview flow, review summary, phase map, and global coordination
phase/phase-010-<phase-name>.md and peers Governed child phase-detail layer Multi-phase execution detail under the summary/index, including design extraction, review flow, reviewer checklist, review outcome, and execution detail
patches/*.patch.md Governed patch/review artifact layer Patch or review work that is separate from live phase planning
phase-implementation-template.md Root helper for phased planning readability Reusable authoring support when staged execution matters
TODO.md Execution and progress tracking Work starts/completes or task state changes

Recommended Update Flow

Change request received
  β†’ Update design target state
  β†’ Synchronize runtime rule wording
  β†’ Record per-chain changelog version + summary
  β†’ Record repository-level sync in changelog/changelog.md when applicable
  β†’ Update TODO pending/completed/history
  β†’ Verify links, versions, and consistency

Verification Checklist

  • Design file links to the correct changelog file
  • Changelog unified row maps to an existing detailed section
  • Runtime rule version/header aligns with changelog current version
  • phase/SUMMARY.md exists when phased execution is used
  • phase/SUMMARY.md includes:
    • design extraction summary table
    • overview flow diagram
    • review summary table
  • child phase files include:
    • design extraction
    • review flow diagram
    • reviewer checklist
    • standardized review outcome fields
  • TODO pending section contains pending-only items (- [ ])
  • TODO history has a dated entry for completed milestone work

Real Examples (This Repository)

Example 1: Deterministic Recovery Contract Synchronization (WS-1)

design/recovery-contract.design.md
  β†’ recovery-contract.md
  β†’ changelog/recovery-contract.changelog.md
  β†’ TODO.md (history/progress)

What was synchronized:

  • Deterministic response keys were aligned across design and runtime (decision_output, refusal_class, reason, what_can_be_done_now, how_to_proceed)
  • Changelog recorded the runtime/design version sync event
  • TODO recorded completion in the hardening program history

Example 2: Verification + Output-Cap Consolidation (WS-5)

design/safe-file-reading.design.md + design/safe-terminal-output.design.md
  β†’ safe-file-reading.md + safe-terminal-output.md
  β†’ changelog/safe-file-reading.changelog.md + changelog/safe-terminal-output.changelog.md
  β†’ TODO.md (WS-5 completion)

What was synchronized:

  • Shared verification-trigger model applied across related rules
  • Deterministic output-cap wording standardized (head -100 | head -c 5000, risky-file variant)
  • Changelog and TODO were updated to preserve traceability

Example 3: TODO Governance Alignment (WS-6)

TODO.md pending section audit
  β†’ remove completed items from pending block
  β†’ remove duplicate pending headings
  β†’ add closure row in TODO history

What was synchronized:

  • Pending section kept pending-only (- [ ])
  • Duplicate heading drift removed
  • Program closure logged in dated history row

Example 4: Final /phase Review Model Rollout

phase/SUMMARY.md
  β†’ design extraction summary table
  β†’ overview flow diagram
  β†’ review summary table
  β†’ phase/phase-010-*.md
  β†’ TODO.md history

What was synchronized:

  • /phase became the live phase-planning namespace
  • SUMMARY.md became the required summary/index for live phased execution
  • child phase files were required to carry design extraction, review flow, reviewer checklist, and standardized review outcomes
  • SUMMARY.md was extended to carry design rollup and review rollup views for faster approval
  • the model gained an explicit Definition of Done and stop rule so governance expansion does not continue by default after completion
  • communication rules were narrowed so next-step options are suggested only when genuinely useful rather than treated as a mandatory ending pattern

✨ Features

🎯 Core Capabilities

πŸ” Zero Hallucination

  • 100% verified information only
  • Evidence-based responses
  • No guessing or assumptions
  • Source citations always included

πŸ›‘οΈ Anti-Sycophancy

  • Truth over agreement
  • Direct corrections when needed
  • No false praise
  • Honest feedback, always

πŸ”’ Security First

  • Real systems over simulations
  • No mock implementations by default
  • Verified configurations only
  • Production-ready patterns

⚑ Performance Optimized

  • 30-50% faster responses
  • 40-82% token reduction
  • Adaptive complexity (TRAAC)
  • Cost-efficient operations

πŸ“ Rule Files

πŸ”΄ Core Policies (3 rules)

Fundamental principles that govern all AI behavior

Rule Purpose Key Benefit
anti-mockup.md Real systems over simulations No fake implementations
anti-sycophancy.md Truth over agreement Honest feedback always
zero-hallucination.md Verified information only 100% accuracy

🟑 Quality & Safety (17 rules)

Ensure consistent, safe, and well-documented outputs

Rule Purpose Key Benefit
accurate-communication.md Clear, honest communication No vague claims and no forced extra options after completed work
authority-and-scope.md Decision hierarchy User authority respected
dan-safe-normalization.md Prompt-wrapper normalization Safer intent evaluation before decisioning
document-consistency.md Cross-reference validation No contradictions
document-changelog-control.md Version tracking system Single Source of Truth
document-design-control.md Design document standards Standardized structure
document-patch-control.md Patch Control Tactical implementation plans
emergency-protocol.md Crisis response Fast, safe reactions
functional-intent-verification.md Intent validation Commands verified before run
phase-implementation.md Phase planning semantics First-class /phase + SUMMARY.md model with design rollups, review rollups, standardized review outcomes, and explicit completion boundary
recovery-contract.md Blocked-response contract Every constrained/refused path has actionable next steps
refusal-classification.md Deterministic refusal taxonomy Consistent block decisions and traceable output modes
refusal-minimization.md False-refusal reduction Prefer recoverable constrained/context paths when authorized
strict-file-hygiene.md File hygiene No unrequested docs
todo-standards.md Task management Focused work
project-documentation-standards.md Project documentation standards Standardized docs for all projects
unified-version-control-system.md Unified version governance Single deterministic UDVC-1 controller

πŸ”΅ Presentation & Readability (3 rules)

Improve answer structure, clarity, and visual scanability

Rule Purpose Key Benefit
answer-presentation.md Answer presentation standards Readable and orderly responses
explanation-quality.md Explanation structure quality Better reasoning flow and useful endings without forced extra options
flow-diagram-no-frame.md Clean ASCII diagrams Better readability

🟒 Best Practices (3 rules)

Optimize your daily workflow efficiency

Rule Purpose Key Benefit
no-variable-guessing.md Read before reference No wrong assumptions
safe-file-reading.md Plan-before-read Efficient file handling
safe-terminal-output.md Output management No terminal flooding

πŸ“Š Active Runtime Rules: 26

πŸ“Š Framework Summary: 26 active runtime rules


πŸ–ΌοΈ Visual Guide

πŸ”΄ Core Policies Visual


Anti-Sycophancy
Truth over pleasing

Anti-Mockup
Real systems only

Zero Hallucination
Verified info only

🟑 Quality & Safety Visual


Authority & Scope
User authority supreme

Emergency Protocol
Rapid response

Document Consistency
Cross-reference check

Functional Intent
Intent validation

Document Changelog Control
Version tracking system

Document Design Control
Design standards

Strict File Hygiene
No unrequested docs

Project Documentation Standards
Standardized docs

πŸ”΅ Presentation & Readability Visual


Flow Diagram
No frames, clean arrows
Answer Presentation
Active presentation-layer rule for readable, orderly response layout
Explanation Quality
Active explanation-layer rule for clearer reasoning and actionable endings

🟒 Best Practices Visual


No Guessing
Read before reference

Safe File Reading
Plan before read

Safe Terminal
Output management

πŸŽ“ Framework Highlights

🧭 Finalized Phase Review Model

The current phased execution model is now explicitly finalized and bounded.

phase/
  SUMMARY.md
    β†’ design extraction summary table
    β†’ overview flow diagram
    β†’ review summary table
    β†’ phase map
  phase-010-<phase-name>.md
    β†’ design extraction
    β†’ review flow diagram
    β†’ reviewer checklist
    β†’ review outcome

What this gives you:

  • reviewers can inspect the whole rollout from SUMMARY.md
  • reviewers can inspect one phase deeply from the child phase file
  • approvers can see sign-off status, severity, disposition, and blocker/follow-up state in one place
  • the model now has an explicit completion boundary and stop rule, so governance expansion does not continue by default after it is operationally complete

🧠 TRAAC (Task Runtime Adaptive AI Compression)

Dynamic complexity adjustment based on task requirements

Simple Tasks (Level 0-2)     β†’ Minimal Processing
     ↓
Standard Tasks (Level 3-5)   β†’ Balanced Approach
     ↓
Complex Tasks (Level 6-7)    β†’ Deep Analysis
Metric Improvement Impact
Response Speed +30-50% Faster answers
Token Efficiency +40-82% Lower costs
Cost Reduction -25-35% Budget-friendly

πŸ‘₯ TUMIX Multi-Agent System

Three expert perspectives analyzing every complex problem

Developer  ──┐
Security   ──┼──→ Unified Recommendation
Architect  β”€β”€β”˜

How It Works:

  1. Developer Agent β†’ Technical feasibility analysis
  2. Security Agent β†’ Security & privacy evaluation
  3. Architect Agent β†’ System design considerations
  4. Synthesis β†’ All perspectives merge into unified recommendation

Result: Comprehensive analysis from multiple angles


πŸ“š RoT (Retrieval of Thoughts)

Cache and reuse verified reasoning patterns

Action Benefit
Cache verified patterns Store successful approaches
Reuse for similar tasks 40% speed improvement
Validate before use Ensure accuracy maintained

Performance: 82% cache hit rate for recurring patterns


πŸ“Š Before & After

❌ Without Rules

User: "Set up database connection"
       ↓
AI: "Here's the connection string:
     DATABASE_URL=postgres://localhost:5432/mydb"

Result: ❌ Guessed values
        ❌ No verification
        ❌ Potentially wrong
        ❌ User frustrated

βœ… With Rules

User: "Set up database connection"
       ↓
AI: "Let me check your .env file first..."
     [Reading configuration...]
     "Found your existing config:
      DATABASE_URL=postgres://prod-server:5432/app_db

      Should I use this, or do you want to change it?"

Result: βœ… Verified from actual files
        βœ… No guessing
        βœ… User confirmation
        βœ… Professional interaction

The difference? Professional AI behavior that respects your existing configuration.


πŸ“Š Performance Metrics

Metric Target Status Impact
Factual Accuracy 100% βœ… Zero hallucinations
Constitutional Compliance 100% βœ… User sovereignty maintained
Token Efficiency +40-82% βœ… Cost reduction
Response Speed +30-50% βœ… Faster delivery
User Sovereignty Absolute βœ… User always in control

πŸ”’ Safety Guarantees

βœ… Our Commitment to You

Guarantee Description
No Mock/Stub Real implementations unless explicitly requested
No Guessing Always verify from actual sources
No Hallucinations 100% fact-based responses
No Sycophancy Truth over agreement, always
Constitutional Principles override everything

Your safety and accuracy are non-negotiable.


🀝 Contributing

These rules evolve based on real-world usage:

  • πŸ”„ Real-world usage patterns β†’ What actually works
  • πŸ’¬ User feedback β†’ Your experience matters
  • πŸ” Safety considerations β†’ Always improving
  • ⚑ Performance optimization β†’ Getting faster

πŸ“ Contribution Guidelines

Pull requests welcome! Please ensure:

  1. New rules follow existing format
  2. Include clear documentation
  3. Add visual assets if applicable
  4. Update changelog
  5. Respect completion boundaries β€” do not add new mandatory capability blocks to a completed governance model unless the change is explicitly justified and intentionally approved

We value: Quality over quantity, clarity over complexity, and bounded governance over endless expansion


πŸ“œ License

MIT License - Feel free to adapt for your own use case.

Attribution appreciated but not required.


πŸ™ Acknowledgments

Personal rule set and configuration framework for Claude Code CLI.

Inspired by:

  • Constitutional AI principles (Anthropic)
  • Best practices for AI assistant development
  • Real-world production experience
  • Community feedback and contributions

Built with ❀️ for the Claude Code community



Version: 2.2.0 | Last Updated: 2026-03-11 | Framework: Sophisticated AI Framework with Constitutional Governance

⬆️ Back to Top


Made with πŸ’™ by developers who care about AI quality

About

Comprehensive rule set and constitutional framework for Claude Code AI assistant

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors