Skip to content

Commit 2572455

Browse files
committed
docs(nx-dev): more blog post tweaks
1 parent c5e7f02 commit 2572455

File tree

1 file changed

+54
-60
lines changed

1 file changed

+54
-60
lines changed

docs/blog/2025-05-27-practical-guide-effective-ai-coding.md

Lines changed: 54 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The AI space is awash with investment, making any list quickly outdated. Effecti
5555
For tasks outside specific coding work - research, planning, documentation, and general problem-solving - I rely on dedicated web/desktop applications that offer broader capabilities:
5656

5757
- **Claude Desktop** - Large context, web search, research capabilities, robust MCP support (some features require expensive Claude Max)
58-
- **ChatGPT** - Image creation, superior web search, research capabilities (less code-proficient than competitors)
58+
- **ChatGPT** - Image creation, web search, research capabilities (less code-proficient than competitors)
5959
- **AI Studio (Gemini)** - Massive context window, code-optimized models, Google search integration
6060
- **T3 Chat** - A fast web-based chat client that allows you to switch between multiple models and comes with a competitive, convenient pricing approach.
6161
- **ChatWise** - A desktop-based chat client that uses a bring-your-own-key strategy, allowing you to integrate with all the models out there. You can provision a key via [OpenRouter](https://openrouter.ai/) or directly plug in the key.
@@ -94,24 +94,26 @@ They get less attention online because most streamers do work that works well wi
9494

9595
Most of my work involves distributed systems, where interactive agents aren't particularly effective. In these systems, application behavior isn't easily derivable from source code—things operate at a higher level of abstraction.
9696

97-
I get significantly more leverage from tools like Claude Code (or Junie) than Cursor/Copilot, which create more robust plans and provide real value in my domain. Even with Claude Code I use specific patterns and prompt and keep it on a short leash.
97+
I get significantly more leverage from tools like Claude Code (or Junie) than Cursor/Copilot, which creates more robust plans and provide real value in my domain. But even with Claude Code I use specific patterns and prompt and keep it on a short leash.
9898

9999
For tasks like writing new scripts or building web UIs, I find Copilot or Cursor work better.
100100

101-
## The Main Rule: Understanding over Speed
101+
## The Main Rule: Understanding and Quality over Speed
102102

103103
> Never commit code you don't understand.
104104
105105
While AI may write it, you are responsible for every character. Understanding your code completely is essential. Read, understand, investigate the code that AI generates.
106106

107-
If AI generates subpar code, it's your duty to improve it and learn how to get better results. The goal is AI that produces what you would have written yourself.
107+
If AI generates subpar code, improve it and learn how to get better results. The goal is AI that produces what you would have written yourself.
108108

109109
**Effective AI use means:**
110110

111111
- More thinking and reading
112112
- Less typing
113113

114-
These tools create space for better engineering practices - not just cramming in more features. **Critical thinking and deep codebase familiarity remain essential. They're the foundation for effective AI use.**
114+
One of the greatest risks of using AI is generating large amounts of code that are poorly understood and do not integrate well with the overall system architecture. Mitigate this risk. **AI tools create space for better engineering practices - not just cramming in more features. **
115+
116+
**Critical thinking and deep codebase familiarity remain essential. They're the foundation for effective AI use.**
115117

116118
### Beyond "Vibing" with AI
117119

@@ -127,7 +129,9 @@ The most effective AI-assisted development follows a structured approach: **Plan
127129

128130
![Planning Phase Workflow](/blog/images/articles/ai-flow-planning-phase.avif)
129131

130-
Keep the agent in discussion mode - no code execution yet. Provide necessary context. For complex features, thorough planning preserves the necessary context between executions. Most tasks don't require this depth, but skipping planning virtually guarantees poor results.
132+
Keep the agent in discussion mode - no code execution yet. Provide necessary context. For complex features, thorough planning preserves the necessary context between executions.
133+
134+
The amount of planning needed depends on the task. Small tasks require minimal planning, but skipping planning for large tasks virtually guarantees poor results.
131135

132136
Planning needs substantial context. This is where tools like [Nx's AI integration](/features/enhance-AI) shine by providing agents with derived context about your codebase architecture, team responsibilities, and organizational boundaries. All of these helps LLMs and humans operate from the same architectural and organizational context.
133137

@@ -137,12 +141,11 @@ For large changes, it's a good idea to persist the created plan to disk.
137141

138142
![Acting Phase Workflow](/blog/images/articles/ai-flow-acting-phase.avif)
139143

140-
Release the agent to execute the plan.
141-
Stay engaged. Monitor execution and check work in progress. Halt immediately if problems arise or new information emerges, then return to planning.
144+
Ask the agent to execute the plan.
142145

143-
Agents can get stuck. If this happens, restart them. An Agent's effectiveness increases dramatically when it can use higher-level operations. Without these, ensuring consistency and adherence to best practices becomes much harder.
146+
Stay engaged. Monitor execution and check work in progress. Halt immediately if problems arise or new information emerges, then return to planning. Sometimes Agents can get stuck. If this happens, remind them of their original objective. A useful technique is to break the current task into smaller subtasks and have the agent focus on the first one.
144147

145-
This primarily affects real organizations, not demo projects, as demos don't need to be correct or follow best practices. That was a big focus for us when developing Nx MCP (which provides many tools that help guarantee consistency and compliance with standards) because of us working with a lot of large companies with 1000s of engineers working in the same org.
148+
An Agent's effectiveness increases dramatically when it can use higher-level operations. Without these, ensuring consistency and adherence to best practices becomes much harder. This primarily affects real organizations, not demo projects, as demos don't need to be correct or follow best practices. That was a big focus for us when developing Nx MCP (which provides many tools that help guarantee consistency and compliance with standards) because of us working with a lot of large companies with 1000s of engineers working in the same org.
146149

147150
Agents excel at being almost right but struggle with executing exactly what's required. Good interactions should include requesting user input for high-impact operations that are difficult to adjust later (like creating a new package). For instance, when using Nx, an Agent would open a UI with pre-filled generator options that users can modify and confirm. The Agent then continues the work from that point. Have a look at our [latest blog post for a deeper dive into what this looks like](/blog/nx-generators-ai-integration).
148151

@@ -152,116 +155,109 @@ If things go sideways, don't hesitate to reset: dump context, revert changes, an
152155

153156
![Review Phase Workflow](/blog/images/articles/ai-flow-review-phase.avif)
154157

155-
Even though I try to keep a document where I note things that will require a follow-up, most likely won't keep pace with the agent's output. That's why it's important to do thorough review afterward. Make small changes directly or ask the agent to make them.
158+
Even though I try to keep a document where I note things that will require a follow-up, most likely won't keep pace with the agent's output. That's why it's important to do a thorough review afterward. Most often I make small changes directly, but sometimes I ask the agent to make them for me.
156159

157160
### Repeat
158161

159-
The process is rarely linear and often varies, but follows this general pattern.
162+
The process can vary, but it follows this general pattern.
160163

161164
**Common mistakes**: skipping either "Plan" or "Repeat" - both are essential. Do not skip them when working on real projects.
162165

163166
## Using Rules and Persistent Context
164167

165168
Every AI coding assistant offers automatic prompt inclusion: Cursor rules, Windsurf rules etc. These are essential for consistent output.
166169

167-
Keep it manageable - a few hundred lines work well. Your rules should document coding style, recurring patterns, and architecture. If you repeat yourself during development, encode it in rules.
170+
Keep it manageable - a few hundred lines work well. Your rules should document coding style, recurring patterns, and in some cases architecture. If you repeat yourself during development, encode it in rules.
168171

169172
For persistent prompts, create a human-readable version and let AI optimize it for machines. AI excels at prompt engineering - focus on tweaking, not creating from scratch.
170173

171174
### Example Workflow for Rules
172175

173176
1. Create `STANDARDS.md` with coding standards
174177
2. Review with AI and request clarifications
175-
3. Identify gaps and address them
178+
3. Identify gaps (AI can help) and address them
176179
4. Format standards appropriately
177180
5. Update rules files
178181

179-
### For Working on Features
182+
I have a Claude project where I discuss coding standards and other topics that often end up in rules files.
180183

181-
Maintain a `PR.md` at project root. Start with issue instructions and update it with any relevant information about the PR you are working on. Use AI as pair programmer, rubber duck, and technical writer - handling grunt work while you focus on complex thinking.
184+
### For Working on Features
182185

183-
With your feature document ready, you can instantly provide context in any chat. Create implementation steps and save the checklist in `PR.md` or in a separate file.
186+
For every major PR I worked on, I often kept a notes document with the issue description, my thoughts, architecture notes, specs, TODOs, and progress. Turns out, wonderful things happen when you let AI see it.
184187

185-
Start separate chats for each step, checking off as you complete them. Remain flexible when pivots become necessary.
188+
Maintain a `PR.md` at project root. Start with issue instructions and update it with any relevant information about the PR you are working on. With this, you can instantly provide context in any chat.
186189

187-
These techniques amplify what great programmers already do, but AI assistance makes these practices significantly more powerful.
190+
Create implementation steps and save the checklist in `PR.md`. Start separate chats for each step, checking off as you complete them. Add new steps as things become clearer.
188191

189192
## Quick Recommendations
190193

191-
### Code Quality & Documentation
194+
### Documentation & Planning
192195

193-
- Maintain consistent code style - AI generates better matches when surrounding code is well-formatted
194196
- Use AI to document - documentation costs drop 10x with AI assistance
195197
- Leverage AI for planning - preparation costs decrease drastically
198+
- Explicitly reference examples to produce consistent documents
199+
- Use Claude Projects (or other similar affordances) to improve repeatability
196200

197-
### Debugging
201+
### Debugging & Fixing
198202

199-
- Always plan/ask before fixing - avoid tunnel vision and loops
200-
- When encountering errors, follow this sequence:
201-
1. Ask "What broke? Why?" and paste the stack trace
202-
2. If response makes sense, request "List 1-3 solutions that could fix this problem"
203-
- Be aware that AI excels at stack trace analysis but can get stuck in loops when autonomously fixing test failures
203+
- Always plan/ask before fixing a non-trivial issue
204+
- Paste a stack trace and ask to explain what caused it. AI is very good at this.
205+
- When dealing with non-trivial problems, ask for several solutions
204206

205207
### Session Management
206208

207-
- Commit code frequently to create recovery checkpoints
208-
- Keep chat sessions short to prevent instruction forgetting and context drift
209+
- Commit code frequently (you will undo often)
210+
- Keep chat sessions short to prevent context drift
209211
- Start fresh chats for each issue/task
210-
- For lengthy sessions, request a summary before starting a new chat
212+
- If you use Claude Code, use "/compact" to keep a summary in the context.
213+
- If not available, do an ad-hoc compact by requesting a summary before starting a new chat
211214

212215
### Task Structure
213216

214-
- Avoid building large features in single attempts
215217
- Plan first, then divide into incremental tasks
216218
- Keep individual tasks straightforward and simple
217219
- Focus on iterative tasks - AI performs better with focused objectives
218220

219221
### Coding Approach
220222

221-
- Avoid clever solutions - stay within community idioms
222-
- Remember AI performs pattern matching - code resembling internet examples gets better results
223-
- Use interactive agents for implementation, not questions
224-
- Seek answers in web interfaces or higher-quality agents before implementation
225-
- Learn to distinguish routine vs. non-routine tasks and adjust your approach accordingly
223+
- Maintain consistent code style - AI generates better matches when surrounding code is consistent
224+
- Avoid clever solutions - AI is much better at dealing with boring code
225+
- Use well-known idioms - AI knows them and can process them very effectively
226+
- Use AI to generate or modify tests. Tests are often linear, simple and formulaic. AI excels at manipulating such code.
226227

227228
## Handling Hallucinations
228229

229-
Hallucinations are one of the biggest issues with LLMs. You'll develop instincts for when you're in risky territory - like when AI suggests a perfect-sounding method that doesn't actually exist.
230-
231-
AI excels at inventing plausible solutions that match a library's style but aren't implemented, especially with less mainstream libraries. Standard libraries rarely trigger this issue.
232-
233-
Usually, asking "Is this correct?" prompts self-correction, though not always. When hallucinations persist, providing concrete information - official documentation or source code - typically resolves the problem.
230+
Hallucinations remain a significant challenge for LLMs, though the problem has improved over the past year. If a solution seems suspiciously perfect, prompting the AI with "are you sure?" often triggers self-correction. This issue is diminishing as more tools provide MCP servers with access to current documentation. The Nx MCP server, for example, reduces hallucinations by providing direct access to up-to-date documentation.
234231

235-
**Remember:** AI often surpasses human performance in many areas, creating a tendency toward excessive trust. Yet when AI makes mistakes, they're often errors no human would make. **Developing a balanced understanding of model capabilities is essential for effective AI-assisted development.**
232+
## Understand What Models are Good At
236233

237-
## AI's Sweet Spots
234+
Every AI journey follows the same arc: initial awe at its superhuman abilities, then disillusionment when it fails at basic math or fabricates facts, before finally reaching a balanced understanding of AI's strengths and limitations.
238235

239-
### Repetitive Code Tasks
236+
## AI as a Mighty Refactoring Tool
240237

241238
AI excels with formulaic, pattern-based code - much like a powerful template engine. **Tests represent the perfect application**: developers can achieve higher quality and greater coverage while investing significantly less time.
242239

243240
Similarly, AI transforms documentation from time-consuming to nearly effortless. The cost approaches zero for both inline module comments and comprehensive documentation files, eliminating any practical excuse for poor documentation.
244241

245242
Code translation tasks - converting between natural language and programming syntax - also benefit tremendously from AI assistance, dramatically accelerating these previously tedious processes.
246243

247-
### Complex Debugging Support
244+
Once you recognize that AI can make some operations almost free while others remain beyond its reach, you start structuring your work differently. You divide tasks into units where AI can handle specific parts in isolation. It's like refactoring tools—knowing they can make certain transformations free changes how you approach large code changes.
248245

249-
When tackling intricate problems spanning multiple systems, general-purpose AI chatbots won't deliver immediate solutions - but they remain valuable tools.
250-
251-
Think of AI as a sophisticated "rubber duck" - explaining complicated problems to a system capable of understanding often reveals connections your mind hasn't made.
246+
## AI as a Debugger
252247

248+
When I work on distributed systems and hit a problem, AI rarely offers an immediate solution, but it's still invaluable. Explaining complex problems to a system capable of understanding often reveals connections your mind hasn't made.
253249
Effective AI debugging strategies:
254250

255-
- Ask "What am I missing?" when evaluating hypotheses
256-
- Request alternative approaches when generating theories
251+
- Ask "What is missing?" when evaluating a theory
252+
- Ask for alternative theories
257253
- Use AI to organize and format disorganized thoughts
258-
- Have AI identify patterns in output
254+
- Also, AI excels at pattern matching, so feed it logs and see what it finds.
259255

260-
### Learning and Research
256+
Nx 21+ can pipe its terminal output (and other information) to your AI agent, so you can simply ask "Why is my command failing?"
261257

262-
Beyond code generation, AI delivers immense value as an educational tool. Think of it as an interactive Wikipedia or Stack Overflow, custom-tailored to your specific learning needs.
258+
## AI as Stack Overflow
263259

264-
Unlike static resources, AI enables true dialogue. You can:
260+
AI delivers immense value as an educational tool. Unlike static resources, AI enables true dialogue. You can:
265261

266262
- Ask questions in any format
267263
- Request simplified explanations when confused
@@ -270,15 +266,13 @@ Unlike static resources, AI enables true dialogue. You can:
270266
- Receive evaluations of your comprehension
271267
- Get recommendations for logical next learning steps
272268

273-
While AI doesn't replace a well-crafted book, it surpasses most online learning content. It adapts to your pace and style, filling gaps traditional resources leave.
269+
Make sure the AI gets this information through web search to provide up-to-date results.
274270

275-
This functionality extends beyond AI's training data - try pasting documentation or blog posts into Claude and engaging with that information through conversation. The ability to discuss and question transforms passive reading into active learning.
271+
Another technique I use is when learning a new tool, I provide the website URL and ask Claude to review the entire site to answer a set of questions. This saves me hours of research and lets me explore documentation in a very different way.
276272

277-
## The Long View: Building Sustainable AI Workflows
273+
Similar to Stack Overflow, AI can have a negative effect on learning because it provides answers without the supporting information needed to build a mental model and understand why the answer makes sense. For me, it's not a replacement for a good book or course, but a good complementary tool.
278274

279-
If things go sideways, don't hesitate to reset: dump context, revert changes, and start fresh. These tools drastically reduce "grunt work" costs, making restarts practical.
280-
281-
Remember to update your rules files with style corrections after each session - the AI can help review and integrate them.
275+
## The Long View: Building Sustainable AI Workflows
282276

283277
The trajectory is clear: developers who invest in proper AI workflows and understand the tools' capabilities will have a growing competitive advantage. **The key is being intentional about your approach rather than hoping that better prompts will magically solve workflow problems.**
284278

0 commit comments

Comments
 (0)