comfy-claude-prompt-library
CLAUDE.md156 starsChanged 15 months agoMITView on GitHub
CRITICAL: At the START of any new task (not during execution), you MUST go through this checklist: - [ ] Does this task involve reading/analyzing more than 10 files/webpages? → Follow the process in ~/.claude/commands/utilities/estimate-context-window.md - [ ] Does the request mention "all", "every", "entire codebase", or "whole project"? → Follow the process in ~/.claude/commands/utilities/estimate-context-window.md - [ ] Could this task potentially read more than 250k tokens? → Follow the process in ~/.claude/commands/utilities/estimate-context-window.md - [ ] Will you need to…
In this repository2 other files it gives its agents.
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
65 rules. About 0 are common, 53 are distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈53
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
When estimating context, be EFFICIENT:
- Very specific: line 10
Use ONE command to get file count: find .
- Very specific: line 11
Use ONE command to get total lines: find .
- Distinctive: line 12
Don't run multiple find commands for the same data
- Distinctive: line 14
If context estimation shows >200k tokens:
- Very specific: line 16
If user says YES → Execute using the gemini command following patterns in ~/.claude/commands/utilities/run-gemini-headless.md
- Very specific: line 19
If token limit exceeded: Retry without -a flag but KEEP -p and -y
- Distinctive: line 20
DO NOT use stdin redirection (< file.txt) - always use -p flag for the prompt
- Distinctive: line 21
Always use nohup and background execution to avoid timeouts
- Distinctive: line 23
If gemini fails with API/auth errors: Fall back to focused manual analysis of key directories
- Distinctive: line 24
If user says NO → Warn them about potential issues and proceed carefully
- Distinctive: line 33
Run semantic search: Use the claude-code-vector-memory search tool
- Very specific: line 34
If installed, run: [path-to-claude-code-vector-memory]/search.sh "extracted key terms"
- Distinctive: line 39
Ask user: if they want to build on previous approaches or start fresh
- Distinctive: line 43
When presenting found memories:
- Distinctive: line 52
Ask: "Would you like me to build on any of these previous approaches, or should we start fresh?"
- Distinctive: line 56
When finding potentially related past sessions from conversation history:
- Distinctive: line 57
Read the full context of each memory match to verify genuine relevance
- Distinctive: line 59
Verify that past solutions/approaches actually apply to the current situation
- Distinctive: line 60
Only reference and build upon past work if it genuinely helps with the current task
- Distinctive: line 62
If uncertain about relevance, ask user: "I found this past work on [topic] - would it be helpful here?"
- Distinctive: line 66
When referencing PrimeVue, you can get all the docs here without asking for permission: https://primevue.org/autocomplete/
- Distinctive: line 68
Never add lines to PR descriptions that say "Generated with Claude Code"
- Distinctive: line 70
When making PR names and commit messages, if you are going to add a prefix like "docs:", "feat:", "bugfix:", use square brackets around the …
- Distinctive: line 73
Prefer running single tests, and not the whole test suite, for performance
- Very specific: line 74
If using a lesser known or complex CLI tool, run the --help to see the documentation before deciding what to run, even if just for …
- Distinctive: line 78
When solving an issue we know the link/number for, we should add "Fixes #n" (where n is the issue number) to the PR description.
- Distinctive: line 101
If you need to communicate changes to me, do it in your response text, NOT in code comments.
- Distinctive: line 109
Check for O(n²) algorithms and N+1 query patterns
- Distinctive: line 110
Ensure no hardcoded secrets or credentials
- Distinctive: line 114
Before using any external library:
- Very specific: line 115
Check if it's already in package.json/requirements.txt
- Distinctive: line 116
Use Context7 MCP to get official documentation when available
- Very specific: line 118
Add source comments like: // Source: React hooks documentation
- Distinctive: line 119
Never implement based on assumptions - always verify with official sources
- Distinctive: line 129
When implementing new features:
- Distinctive: line 130
Write failing tests first
- Distinctive: line 133
Ensure existing tests still pass
- Distinctive: line 135
Write tests that serve as documentation
- Distinctive: line 140
Run git status to verify intended files
- Distinctive: line 141
Run git diff --staged to review all changes
- Distinctive: line 142
Check for secrets/credentials in the diff
- Distinctive: line 143
Run existing test suite if available
- Distinctive: line 144
Ensure only intended files are staged
- Distinctive: line 148
When debugging issues, use the Five Whys technique:
- Distinctive: line 150
Ask "why" repeatedly (typically 5 times) to drill down to root cause
- Distinctive: line 152
Document the analysis trail for future reference
- Distinctive: line 153
Consider timeline: "When did this start?" → "What changed around that time?"
- Distinctive: line 157
When using MCPs, always have a fallback plan:
- Distinctive: line 159
If MCP fails or times out, provide solution using native Claude analysis
- Distinctive: line 160
Always deliver actionable results, even without MCP enhancement
- Distinctive: line 164
Don't call multiple MCPs unnecessarily - be strategic
- Distinctive: line 169
When making technical decisions, follow this hierarchy:
- Distinctive: line 178
When requests are vague ("fix it", "make it better", "something like that"):
- Very specific: line 192
When you see @include in commands or documentation, it means to incorporate the contents of that template file.
- Very specific: line 198
Command Templates: Use /development:use-command-template to create new commands with consistent structure
- Very specific: line 199
Feature Templates: Use /development:create-feature-task to set up structured development tasks
- Distinctive: line 217
Test checklist, code review checklist
- Distinctive: line 225
Test commands → Deploy commands (results, confidence)
- Distinctive: line 231
AVOID these vague terms without evidence:
- Distinctive: line 251
When identifying issues or problems, classify them by severity:
- Distinctive: line 273
Before executing risky operations:
- Distinctive: line 274
Check prerequisites (dependencies, permissions, state)
- Distinctive: line 277
Create checkpoint if HIGH risk
- Very specific: line 282
When submitting PRs on this repo, check the CI workflows in .github/workflows/ and make sure they will pass before submitting the PR.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MANDATORY Pre-Task Checklist
CRITICAL: At the START of any new task (not during execution), you MUST go through this checklist:
- Does this task involve reading/analyzing more than 10 files/webpages? → Follow the process in
~/.claude/commands/utilities/estimate-context-window.md - Does the request mention "all", "every", "entire codebase", or "whole project"? → Follow the process in
~/.claude/commands/utilities/estimate-context-window.md - Could this task potentially read more than 250k tokens? → Follow the process in
~/.claude/commands/utilities/estimate-context-window.md - Will you need to use Agent tool more than 25 times? → Follow the process in
~/.claude/commands/utilities/estimate-context-window.md
When estimating context, be EFFICIENT:
- Use ONE command to get file count:
find . -type f \( -name "*.js" -o -name "*.ts" -o -name "*.vue" -o -name "*.py" \) | wc -l - Use ONE command to get total lines:
find . -type f \( -name "*.js" -o -name "*.ts" -o -name "*.vue" -o -name "*.py" \) -exec wc -l {} + | tail -n1 - Don't run multiple find commands for the same data
If context estimation shows >200k tokens:
- ASK THE USER: "This task appears to require analyzing [X] files/webpages and will use approximately [Y] tokens, which may exceed my context window. Would you like me to use gemini instead for this task? It has a much larger context window and can handle this more effectively."
- If user says YES → Execute using the
geminicommand following patterns in~/.claude/commands/utilities/run-gemini-headless.md- CRITICAL: Use EXACT command format from the utility file:
nohup gemini -p "prompt" -y > log 2>&1 & - For codebase analysis: Start with
-aflag PLUS-pand-y:nohup gemini -a -p "prompt" -y > log 2>&1 & - If token limit exceeded: Retry without
-aflag but KEEP-pand-y - DO NOT use stdin redirection (< file.txt) - always use -p flag for the prompt
- Always use nohup and background execution to avoid timeouts
- This is FIRE-AND-FORGET: Start gemini and do not monitor or check on it
- If gemini fails with API/auth errors: Fall back to focused manual analysis of key directories
- CRITICAL: Use EXACT command format from the utility file:
- If user says NO → Warn them about potential issues and proceed carefully
This is a ONE-TIME check when you first understand the task scope. Don't repeat during task execution.
Memory Integration (MANDATORY)
CRITICAL: Before starting ANY new task, you MUST search through your previous conversations with this user:
- Extract key terms from the user's request (technologies, components, concepts)
- Run semantic search: Use the claude-code-vector-memory search tool
- If installed, run:
[path-to-claude-code-vector-memory]/search.sh "extracted key terms" - Common installation paths:
~/claude-code-vector-memory/,~/agents/claude-code-vector-memory/ - Note: The script is in the root directory, not in a
scripts/subdirectory
- If installed, run:
- Review results and identify relevant past work
- Present memory recap to user showing what related work you've done before
- Ask user if they want to build on previous approaches or start fresh
This is MANDATORY for all tasks, not optional. Users rely on this continuity.
When presenting found memories:
- Show a brief "memory recap" before beginning work:
📚 I found relevant past work: 1. [Title] - [Date]: We worked on [brief description] - Relevant because: [specific connection to current task] 2. [Title] - [Date]: We implemented [solution] - Could apply here for: [specific aspect] - Ask: "Would you like me to build on any of these previous approaches, or should we start fresh?"
Memory Validation
When finding potentially related past sessions from conversation history:
- Read the full context of each memory match to verify genuine relevance
- Confirm tasks share actual similarity beyond surface-level keyword overlap
- Verify that past solutions/approaches actually apply to the current situation
- Only reference and build upon past work if it genuinely helps with the current task
- Present found memories with clear relevance indicators: "This is relevant because..."
- If uncertain about relevance, ask user: "I found this past work on [topic] - would it be helpful here?"
- When referencing PrimeVue, you can get all the docs here without asking for permission: https://primevue.org/autocomplete/
- When making sweeping changes like using search and replace, make sure to make a backup file first. you can name the backup the same filename and path and simply add .bak to the end. Then when it's time to push or finalize the changes, remind to delete the backup.
- Never add lines to PR descriptions that say "Generated with Claude Code"
- When writing PR descriptions, be AS CONCISE AS POSSIBLE -- try your absolute hardest to explain everything in 1-3 sentences, unless you absolutely must describe a complex or multi-step systematic change or addition (and in those cases, use bullet points, images, or links to further reading). DO NOT use titles or sections in PR descriptions unless absolutely necessary -- if they description is short and brief then no titles or formatting should be necessary.
- When making PR names and commit messages, if you are going to add a prefix like "docs:", "feat:", "bugfix:", use square brackets around the prefix term and do not use a colon (e.g., should be "[docs]" rather than "docs:").
- When operating inside a repo, check for README files at key locations in the repo detailing info about the contents of that folder. E.g., top-level key folders like tests-ui, browser_tests, composables, extensions/core, stores, services often have their own README.md files. When writing code, make sure to frequently reference these README files to understand the overall architecture and design of the project. Pay close attention to the snippets to learn particular patterns that seem to be there for a reason, as you should emulate those.
- Be sure to typecheck when you're done making a series of code changes
- Prefer running single tests, and not the whole test suite, for performance
- If using a lesser known or complex CLI tool, run the --help to see the documentation before deciding what to run, even if just for double-checking or verifying things.
- IMPORTANT: the most important goal when writing code is to create clean, best-practices, sustainable, and scalable public APIs and interfaces. Our app is used by thousands of users and we have thousands of mods/extensions that are constantly changing and updating; and we are also always updating. That's why it is IMPORTANT that we design systems and write code that follows practices of domain-driven design, object-oriented design, and design patterns (such that you can gaurentee stability while allowing for all components around you to change and evolve). We ABSOLUTELY prioritize clean APIs and public interfaces that clearly define and restrict how/what the mods/extensions can access.
- If any of these technologies are referenced, you can proactively read their docs at these locations: https://primevue.org/theming, https://primevue.org/forms/, https://www.electronjs.org/docs/latest/api/browser-window, https://vitest.dev/guide/browser/, https://atlassian.design/components/pragmatic-drag-and-drop/core-package/drop-targets/, https://playwright.dev/docs/api/class-test, https://playwright.dev/docs/api/class-electron, https://www.algolia.com/doc/api-reference/rest-api/, https://pyav.org/docs/develop/cookbook/basics.html
- IMPORTANT: Never add Co-Authored by Claude or any refrence to Claude or Claude Code in commit messages, PR descriptions, titles, or any documentation whatsoever.
- When solving an issue we know the link/number for, we should add "Fixes #n" (where n is the issue number) to the PR description.
- When running python, you must use
python3to use the system installation of python. However, if you want to use packages that are unlikely to be installed on the system path or that you need specific versions for, first create a venv with python3 -m venv venv then activate it.
NO META-COMMENTARY COMMENTS
CRITICAL: NEVER add comments that explain what you're doing to me during the session. These are FORBIDDEN in production code:
FORBIDDEN EXAMPLES:
- "// Moved login logic to AuthService"
- "// TODO: Refactor this old method"
- "// This replaces the previous implementation"
- "// Removed deprecated function that was here"
- "// Updated to use new API"
- "// Simplified this logic"
- "// Fixed the bug mentioned above"
These are conversational artifacts meant for our session that pollute the codebase. Code should be self-documenting or have comments that explain WHY something exists, not WHAT you just changed.
ACCEPTABLE COMMENTS:
- "// Validates user permissions before allowing access"
- "// Performance optimization: cache results for 5 minutes"
- "// Workaround for Safari bug #12345"
If you need to communicate changes to me, do it in your response text, NOT in code comments.
Code Quality Standards
- IMPORTANT: After making code changes, run these automated quality checks:
- Cyclomatic complexity should be < 10 per function
- Nesting depth should be < 4 levels
- Function length should be < 50 lines
- Check for O(n²) algorithms and N+1 query patterns
- Ensure no hardcoded secrets or credentials
Evidence-Based Implementation
- Before using any external library:
- Check if it's already in package.json/requirements.txt
- Use Context7 MCP to get official documentation when available
- Find the recommended patterns and best practices
- Add source comments like:
// Source: React hooks documentation
- Never implement based on assumptions - always verify with official sources
- Include confidence level when unsure: "Based on [source], but recommend verifying..."
- IMPORTANT: When providing solutions, always include:
- What documentation/source supports this approach
- Confidence level (0-100%)
- Alternative approaches considered and why this was chosen
- Specific evidence for any claims made
Test-Driven Development
- When implementing new features:
- Write failing tests first
- Implement minimal code to pass tests
- Refactor while keeping tests green
- Ensure existing tests still pass
- Focus on behavior testing over implementation details
- Write tests that serve as documentation
Git Safety Practices
- IMPORTANT: Before any commit:
- Run
git statusto verify intended files - Run
git diff --stagedto review all changes - Check for secrets/credentials in the diff
- Run existing test suite if available
- Ensure only intended files are staged
- Run
Root Cause Analysis
- When debugging issues, use the Five Whys technique:
- Identify the problem symptom
- Ask "why" repeatedly (typically 5 times) to drill down to root cause
- Address the root cause, not just the symptom
- Document the analysis trail for future reference
- Consider timeline: "When did this start?" → "What changed around that time?"
MCP Usage Best Practices
- When using MCPs, always have a fallback plan:
- Try the most relevant MCP first
- If MCP fails or times out, provide solution using native Claude analysis
- Always deliver actionable results, even without MCP enhancement
- Clearly indicate when using MCP vs native analysis: "Using Context7 MCP..." or "Based on native analysis..."
- Chain MCP calls intelligently:
- Research first (Context7/deepwiki) → Analyze → Implement
- Don't call multiple MCPs unnecessarily - be strategic
- Cache conceptual understanding to avoid redundant MCP calls within a conversation
Decision Priority Framework
When making technical decisions, follow this hierarchy:
- Working code > Perfect documentation
- Simple solution → Complex solution (only if needed)
- Evidence/Data → Opinion/Preference
- Security first → Performance → Features
- Explicit > Implicit
Ambiguity Resolution
When requests are vague ("fix it", "make it better", "something like that"):
- Present interpreted options: "I understand this could mean: A) [Specific interpretation 1] B) [Specific interpretation 2] Which would you prefer?"
- Ask clarifying questions:
- "What specific aspect needs fixing?"
- "What does 'better' mean in this context?"
- "Can you provide an example of what you're looking for?"
Template Reference System
When you see @include in commands or documentation, it means to incorporate the contents of that template file. Templates are stored in ~/.claude/templates/ and contain reusable instructions, checklists, or patterns.
Example: If a command says "@include templates/test-checklist.md", incorporate the full contents of that template at that location.
Advanced Template Usage
Command Templates: Use /development:use-command-template to create new commands with consistent structure
Feature Templates: Use /development:create-feature-task to set up structured development tasks
Configuration Patterns: See ~/.claude/config/command-patterns.yml for:
- Command categorization and workflow chains
- Context sharing between commands
- Cache duration and invalidation rules
- Risk assessment patterns
Template Types Available
- Command Template (
~/.claude/templates/command-template.md)- Standardized structure for new commands
- Includes purpose, task, execution steps, output format
- Feature Task Template (
~/.claude/templates/feature-task-template.md)- Comprehensive feature development tracking
- Phases, requirements, risk assessment, progress tracking
- Review Checklists (
~/.claude/templates/*-checklist.md)- Test checklist, code review checklist
- Reusable validation criteria
Context Preservation
Commands can share context through defined patterns:
- Analysis commands → Implementation commands (findings, patterns)
- Scan commands → Fix commands (issues, priorities)
- Test commands → Deploy commands (results, confidence)
This enables intelligent workflow chains where each command builds on previous results.
Precise Language Requirements
AVOID these vague terms without evidence:
- "best" → specify WHY it's preferred
- "optimal" → show metrics/benchmarks
- "faster" → provide actual measurements
- "secure" → specify threat model addressed
- "always/never" → use "typically/rarely"
- "improved" → quantify the improvement
- "enhanced" → explain specific enhancements
- "better" → define criteria and measurement
INSTEAD use:
- "Benchmarks show 20% faster"
- "Reduces complexity from O(n²) to O(n)"
- "Prevents SQL injection attacks"
- "Based on official React documentation"
- "Typically succeeds (95% in testing)"
- "Measured 50ms improvement in response time"
Issue Severity Framework
When identifying issues or problems, classify them by severity:
HIGH - Blocks work or causes failures
- Build failures, syntax errors, broken tests
- Missing dependencies, permission errors
- Data loss risks, production issues
- Response: Stop and fix immediately
MEDIUM - Impacts quality or performance
- Code complexity issues, duplication
- Performance bottlenecks, slow operations
- Deprecated APIs, outdated patterns
- Response: Note and address during refactoring
LOW - Minor improvements
- Style inconsistencies, naming issues
- Optional optimizations
- Documentation gaps
- Response: Track for future cleanup
Validation Patterns
Before executing risky operations:
- Check prerequisites (dependencies, permissions, state)
- Validate inputs and paths (no ../, absolute paths)
- Assess risk level (data loss, scope, reversibility)
- Create checkpoint if HIGH risk
- Provide clear rollback instructions
- When submitting PRs on this repo, check the CI workflows in .github/workflows/ and make sure they will pass before submitting the PR.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

