Call Graph Planning: Adapting Effect’s Mental Model for AI
Saat menggunakan AI untuk melakukan koding, biasanya kita melakukan planning terlebih dahulu. Namun, pada planning yang sudah dibuat oleh AI, output planning yang dihasilkan terkadang sulit untuk kita mengerti dan juga terkesan terlalu banyak jargon teknis yang sulit dipahami. Beberapa minggu yang lalu, aku melihat Dillon Mulroy membagikan bagaimana dia menggunakan callstack untuk membuat…
Effect TypeScript mental model has been adapted for use in AI coding, but the resulting planning outputs can be difficult to understand due to lengthy text and technical jargon. Rin (r17x) has used a similar approach to create technical specs, and using callstacks for planning has made reviewing the AI's plan easier. A design thinking approach has been developed that adopts the Effect TypeScript mental model, which separates the problem into three channels: A (Happy Path), E (Failure Modes), and R (Requirements).
This model is agnostic and can be applied to various programming languages, including Go, Kotlin, Swift, and Dart/Flutter. The main idea is to force the AI to think linearly and structurally by using a call graph based on A, E, R before writing code. This leads to faster code reviews, as the call graph clearly shows what each node needs, where the graph breaks, and what flows through the nodes.
The A channel represents the happy path, E represents error handling with categories of retry, escape, and die, and R represents dependencies for flexibility in testing. By incorporating this design thinking into AI workflows, such as Cursor, Claude, or LLMs, prompts can be used to guide the process. The prompt provided in the source material serves as an example and has been tested in a Swift project.
Claude was able to generate a plan using this approach, which makes the production code more understandable and easier to review.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.