AI-Powered Coding Efficiency: Find Existing Solutions First, Plan Second, Code Last

A three-step AI coding workflow: research open-source projects, define a plan, then code — not the other way around.
This article presents a practical AI-assisted programming workflow that addresses common issues like architectural chaos and endless code revisions. Instead of asking AI to code immediately, the method involves three steps: first have AI research similar open-source projects on GitHub, then define an implementation plan based on findings, and finally write code with clear constraints. This front-loads uncertainty and leverages community-validated solutions for better results.
When using AI-assisted programming (Vibe Coding / Web Coding), many people instinctively start by telling the AI "build me an XX app" and wait for the code to appear line by line. But this approach often leads to endless revisions and architectural chaos. A content creator on Bilibili shared a more efficient AI coding workflow that can be summarized in one sentence: Find existing solutions first, plan second, code last.
This method seems simple, but it directly addresses a core pain point of AI programming — AI excels at generating code, but struggles to make excellent architectural decisions without constraints. Introducing mature open-source projects into AI's thinking process can significantly improve output quality.
Vibe Coding is a concept proposed by OpenAI co-founder Andrej Karpathy in early 2025, referring to a programming approach where developers describe requirements in natural language and let AI generate the code. Developers no longer write code line by line but instead "direct" the AI by describing the desired outcome, while AI handles the implementation. This approach dramatically lowers the barrier to programming but also introduces issues like unpredictable code quality and lack of architectural design — which is exactly the core challenge this article addresses.
Don't Rush to Code — Let AI Search GitHub for Existing Solutions First
Traditional prompts often look like this: "Build me a to-do app." A better approach is to rewrite the prompt as a "research + decision" workflow:
I want to build a certain project. Don't start coding yet — go to GitHub and find several similar open-source projects, compare their architectures, tech stacks, and respective pros and cons, then give me an implementation plan. Wait for my confirmation before starting.
The brilliance of this prompt is that it transforms AI from a "heads-down code executor" into an "architect who does technical research first." Before actually writing anything, the AI will compare multiple mature solutions horizontally, weigh their trade-offs, and ultimately deliver a well-considered implementation plan.
Having AI search GitHub for projects relies on the internet access or Agent capabilities of current AI tools. Tools like Cursor, Claude, and ChatGPT already support real-time web search, enabling them to access GitHub APIs to retrieve repository information, READMEs, code structures, and more. Some tools even support importing entire repositories as context, allowing AI to deeply understand the implementation details of reference projects. This capability enables the "technical research" phase to be completed automatically within the conversation, rather than requiring developers to manually search and paste information to the AI.
The benefits are obvious: you avoid the pitfalls that come from AI designing architecture from scratch, and your final technology choices are built upon established industry best practices.
Why does AI struggle when designing architecture from scratch? This relates to how large language models work. Current LLMs generate the next token based on probability distributions during code generation, rather than making systematic design decisions based on engineering experience. Although models have seen massive amounts of code during training, they lack holistic consideration of a project's full lifecycle (development, testing, deployment, maintenance). Without explicit constraints, AI tends to generate solutions that "work" but aren't "optimal." Introducing open-source projects as references essentially provides AI with a high-quality "constraint space," making its output more controllable and reliable.
When AI Gets It Wrong, Find Working Implementations in Open-Source Projects
The second key technique addresses another common scenario in AI programming — when AI just can't get a particular feature right no matter how many times it tries.
Many people respond to this by repeatedly retrying and adding prompts, asking AI to revise again and again. But this often makes things messier, wasting large amounts of tokens and time. A better recommendation is:
When AI keeps failing to produce a certain feature, don't let it keep grinding away. Just have it search GitHub for existing projects that have already implemented this functionality, and use them as reference. This method is particularly effective.

It's worth understanding the technical implications behind "wasting tokens." Tokens are the basic units that large language models use to process text, and every conversation consumes a certain number of them. When developers repeatedly ask AI to modify the same piece of code, the accumulated context quickly fills up the model's Context Window, causing the model to "forget" earlier information and actually degrading output quality. Current mainstream models have context windows ranging from 128K to 200K tokens. Managing context wisely and avoiding ineffective retries is a critical skill for using AI coding tools efficiently. When you notice AI stuck in a loop of revisions, stepping back and switching strategies — such as introducing external references — is often more effective than continuing to grind within the same context.
In other words, when AI falls into a loop, the best approach isn't to keep forcing it to "think harder," but to provide it with a verified reference answer. The open-source community often already has mature projects implementing similar functionality. Having AI rewrite and adapt based on this existing code dramatically increases the success rate.
This is essentially a "standing on the shoulders of giants" approach: rather than having AI reinvent the wheel, let it find the wheel and mount it on your vehicle.
The Deeper Value of Referencing Open-Source Projects
Introducing open-source projects as references delivers value far beyond simply "saving time."

A core insight is:
Referencing others' open-source projects doesn't just help you avoid pitfalls — it also makes your architecture more stable and your code more maintainable.
This point deserves deeper understanding. An open-source project on GitHub with a significant number of stars and community validation typically has its code organization, module structure, and dependency choices refined through real-world practice. When AI uses such projects as references to build your application, the resulting code tends to have clearer structure and better maintainability.
Metrics like Star count, Fork count, Issue activity, and recent commit timestamps on GitHub form multi-dimensional signals for evaluating open-source project quality. A project with thousands of Stars and continuous maintenance typically means its architecture has been validated and iteratively improved through feedback from numerous real users. This code crystallizes the practical experience and Code Review outcomes of countless developers. Having AI reference such projects essentially leverages the collective wisdom of the open-source community — practical knowledge that no single AI model can fully acquire from its training data alone.
By contrast, code generated from scratch by AI may "run," but it can harbor architectural landmines — such as chaotic directory structures, unreasonable state management, or tightly coupled logic that's hard to extend. These issues aren't obvious in the early stages of a project but gradually surface as features iterate, becoming maintenance nightmares.
Three-Step Workflow: Find Solutions First, Plan Second, Code Last
Summarizing the methods above yields a clear three-step workflow.

Step One: Find Existing Solutions
Before writing anything, have AI search and compare similar open-source projects on GitHub to understand how the industry solves these types of problems. This step is equivalent to technical research.
Step Two: Define the Plan
Based on the research results, have AI provide a complete implementation plan, including tech stack selection, architecture design, and module breakdown. At this step, you perform human review and control the overall direction.
Step Three: Start Coding
After the plan is confirmed, have AI write code according to the established plan. At this point, AI has clear references and constraints, so output quality will be much more consistent.
The core logic of this sequence is: front-load the uncertainty. Solve the "how to build it" question before writing code, rather than agonizing over architecture while coding, thereby avoiding the steep cost of tearing everything down and starting over later.
The philosophy of "front-loading uncertainty" stems from classic software engineering methodology. Whether it's the requirements analysis and system design phases in the waterfall model, or Spikes in agile development (short-term experiments that validate technical feasibility at minimum cost before formal development), the core idea is resolving key technical risks before formal coding begins. Industry research shows that the cost of discovering and fixing an architectural issue during the design phase is only 1/100 to 1/1000 of fixing the same issue in production. This principle applies equally in the AI programming era — and is arguably even more important, because AI generates code extremely fast, and if the direction is wrong, "technical debt" accumulates at an unprecedented rate.
Final Thoughts

This "find solutions first, plan second, code last" methodology essentially transplants the mature "research — design — implement" workflow from software engineering into the AI programming context. It reminds us that AI programming isn't as simple as tossing requirements to AI and calling it done — it requires humans to provide guidance and make decisions at critical junctures.
For developers who regularly use AI tools for projects, leveraging the open-source community as a vast knowledge base and having AI work on top of mature projects often delivers results far beyond expectations. Next time you start a project, try remembering this sequence and see how it works for you.
Key Takeaways
Related articles

Transitioning to AI Agent Development: A Complete Three-Stage Learning Path for Programmers
Why do programmers keep failing at AI Agent development? This guide breaks down a 3-stage learning path: ReAct & Tool Calling fundamentals, LangChain engineering, and production-grade project delivery.

Getting Started with Agent Skills: A Complete Guide from Prompts to Intelligent Skills
Deep dive into AI Agent Skills' four components (skill.md, references, scripts, assets), explaining how Skills differ from prompts and how to build reusable intelligent skill systems.

Codex Beginner's Guide: Installation, Configuration & Connecting Chinese LLM APIs
Complete guide to installing OpenAI Codex, how it differs from Claude Code, and how to connect Chinese LLMs like DeepSeek via API keys with full setup steps and limitations.