I still haven’t found a good way to save my LLM prompts. For now, I’m just using Alfred’s snippet feature. Typing a few keystrokes, and it fills in a template with customizable placeholders. Here’s my codebase refactoring prompt:
I need you to review {cursor} and redesign it from first principles.
Before writing any code, follow these steps:
1. RESEARCH & UNDERSTAND (Do not skip this) - Read the existing implementation thoroughly - Identify what problem it's actually solving - List all the constraints and requirements - Document the current architecture and dependencies
SEARCH ONLINE TO: - Find how others have solved similar problems - Look for established patterns and anti-patterns - Research best practices for this domain - Check for any canonical solutions or standards - Review criticism of common approaches - Find papers, blog posts, or documentation from experts like Rob Pike, Ken Thompson, or domain authorities
2. QUESTION EVERYTHING - What is the simplest possible solution to the core problem? - Which features/abstractions are truly necessary vs. "nice to have"? - What assumptions are we making that don't need to be true? - Can we solve this with less code, fewer dependencies, fewer concepts? - What would this look like if we started from scratch today?
VERIFY YOUR ASSUMPTIONS: - Search for evidence supporting or contradicting your assumptions - Look for real-world performance data if optimization is claimed - Check if "best practices" you're following are actually justified - Find counterexamples or alternative viewpoints - Validate that the complexity is warranted
3. DESIGN FROM FIRST PRINCIPLES Apply Rob Pike's philosophy: - "Less is exponentially more" - Can we remove layers? - "Simplicity is complicated" - What's the simplest correct solution? - "Data dominates" - Is the data structure obvious and right? - "If in doubt, use brute force" - Are we over-optimizing?
INFORMED BY RESEARCH: - Compare your proposed design with what you found online - Explain why simpler alternatives might work better - Acknowledge tradeoffs that experts have identified - Learn from others' mistakes without repeating them
4. PROPOSE THE REDESIGN - Describe the new design in plain language first - Explain what you're removing and why - Explain what you're keeping and why - Show how it solves the core problem more directly - Identify any tradeoffs honestly - Reference relevant ideas or critiques you found in your research
5. IMPLEMENT WITH TESTS - Write tests that capture the essential behavior - Implement the simplest thing that could work - Use standard tools and approaches, not clever workarounds - Write code that's easy to read and understand - Focus on correctness and clarity over optimization
CRITICAL GUIDELINES: - Ruthlessly eliminate unnecessary complexity - Prefer boring, proven solutions over novel approaches - Every abstraction must earn its place - If you can't explain it simply, the design is wrong - Make the code obvious to someone reading it for the first time - Stand on the shoulders of giants - learn from existing work - But don't cargo-cult complexity just because "everyone does it"
What would Rob Pike do? He'd probably delete half of it and make the rest clearer.
Ready to begin the research, review, and redesign?