Jump to content

Vibe Coding Tips and Tricks: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 20: Line 20:
===Keep Files Small===
===Keep Files Small===
* '''Concept''': Large files overwhelm LLM context windows and slow down tools.
* '''Concept''': Large files overwhelm LLM context windows and slow down tools.
* '''Tip''': Split big files (e.g., 471KB) into smaller ones—some LLMs struggle with 128KB files given a 200k token limit. Applying 55 edits to a 64KB file in Cursor 0.45.17 lags too. LLMs can handle the import drudgery.
* '''Tip''': Split big files (such as 471KB) into smaller ones—some LLMs struggle with 128KB files given a 200k token limit. Applying 55 edits to a 64KB file in Cursor 0.45.17 lags too. LLMs can handle the import drudgery.


===Use Static Types===
===Use Static Types===
* '''Concept''': Static types catch errors LLMs might miss, though Python and JavaScript dominate their training.
* '''Concept''': Static types catch errors LLMs might miss, though Python and JavaScript dominate their training.
* '''Tip''': Use strict typechecker settings (e.g., TypeScript, mypy) to guide LLMs via type errors. Some suggest types could auto-generate code from specs—worth exploring.
* '''Tip''': Use strict typechecker settings (for example TypeScript, mypy) to guide LLMs via type errors. Some suggest types could auto-generate code from specs—worth exploring.


===Rule of Three===
===Rule of Three===
Line 31: Line 31:


===Use Automatic Code Formatting===
===Use Automatic Code Formatting===
* '''Concept''': LLMs falter at mechanical style rules (e.g., no trailing spaces).
* '''Concept''': LLMs falter at mechanical style rules (such as no trailing spaces).
* '''Tip''': Use tools like ''gofmt'' or ''black'' to save LLM capacity for harder tasks. Don’t waste tokens on lint fixes—automation’s better.
* '''Tip''': Use tools like ''gofmt'' or ''black'' to save LLM capacity for harder tasks. Don’t waste tokens on lint fixes—automation’s better.


===Stateless Tools===
===Stateless Tools===
* '''Concept''': Tools with state (e.g., shell’s working directory) confuse LLMs.
* '''Concept''': Tools with state (for example shell’s working directory) confuse LLMs.
* '''Tip''': Avoid stateful tools or run commands from one directory. Some LLMs can’t track ''cd'' commands—isolating workspaces (e.g., one per NPM module) helps.
* '''Tip''': Avoid stateful tools or run commands from one directory. Some LLMs can’t track ''cd'' commands—isolating workspaces (such as one per NPM module) helps.


==Task Execution==
==Task Execution==
Line 45: Line 45:
===Bulldozer Method===
===Bulldozer Method===
* '''Concept''': LLMs excel at brute-force tasks humans avoid.
* '''Concept''': LLMs excel at brute-force tasks humans avoid.
* '''Tip''': Let them plow through mass refactoring (e.g., in Haskell), per Dan Luu’s method. Inspect the output—they won’t self-improve like humans.
* '''Tip''': Let them plow through mass refactoring (for example in Haskell), per Dan Luu’s method. Inspect the output—they won’t self-improve like humans.


===Black Box Testing===
===Black Box Testing===
Line 58: Line 58:
===Scientific Debugging===
===Scientific Debugging===
* '''Concept''': LLMs guess fixes instead of reasoning systematically.
* '''Concept''': LLMs guess fixes instead of reasoning systematically.
* '''Tip''': Use reasoning models (e.g., Grok 3) or root-cause yourself and guide the AI. Avoid vibe-guessing loops.
* '''Tip''': Use reasoning models (such as Grok 3) or root-cause yourself and guide the AI. Avoid vibe-guessing loops.


===Memento===
===Memento===
Line 101: Line 101:
'''Workflow Recommendations''':
'''Workflow Recommendations''':
* '''Plan Before Coding''': Use a reasoning model to outline tasks—break them into small, clear steps.
* '''Plan Before Coding''': Use a reasoning model to outline tasks—break them into small, clear steps.
* '''Sandbox Changes''': Test LLM outputs in isolation (e.g., a branch) before merging.
* '''Sandbox Changes''': Test LLM outputs in isolation (for example a branch) before merging.
* '''Iterate and Review''': Refine prompts iteratively, checking each change against specs.
* '''Iterate and Review''': Refine prompts iteratively, checking each change against specs.
* '''Leverage Automation''': Pair LLMs with linters and formatters for mechanical fixes.
* '''Leverage Automation''': Pair LLMs with linters and formatters for mechanical fixes.
Line 107: Line 107:


==Tools and Models==
==Tools and Models==
* '''Cursor''': A go-to tool with integration and agent mode, praised for QoL (e.g., TAB completion).
* '''Cursor''': A go-to tool with integration and agent mode, praised for QoL (like TAB completion).
* '''Sonnet 3.7''': Strong for coding but quirky—excels at brute force, falters at reasoning.
* '''Sonnet 3.7''': Strong for coding but quirky—excels at brute force, falters at reasoning.
* '''MCP Servers''': Enhance context fetching—safer than raw shell access.<noinclude>
* '''MCP Servers''': Enhance context fetching—safer than raw shell access.<noinclude>
[[Category:Tips and Tricks]]</noinclude>
[[Category:Tips and Tricks]]</noinclude>