Introduction
Developing with AI is empowering for tackling both known-unknown and
unknown-unknown tasks, but it is challenging and painful to ensure the AI
follows directions without extensive rework and to verify changes without deep understanding.
Key Insight: Optimal or correct implementation cannot always be verified for
these tasks due to limited knowledge in other languages, but requirements can be validated by
having AI implement validation code and print the results.
Why AI Excels at Declarative Programs
Using AI for building declarative programs may be optimal since declarative programs focus on
what we need, not how we achieve it.
Approach:
- Specify both input and output requirements
- Use AI to confirm whether the need has been achieved
- Leverage AI's strength in iteration and pattern matching
- Find optimal solutions through convergence
Based on this assumption, the development process not only instructed the AI on requirements
but also used it in parallel to build various testing code to verify whether the requirements
were satisfied.
Verification Loops for Self-Validation
The key to successful AI-assisted development is creating verification loops where the AI can
self-validate its work.
Example 1: Normal Engine Verification
When generating the normal engine for HTML templates, the AI was requested to:
- Capture the implementation output
- Compare it with the input templates
- Compare it with the prompt requirements
- Check if it satisfies the needs
Example 2: PreProcess Engine Verification
When implementing the preprocess engine for HTML templates, the AI was requested to:
- Create a dump of the preprocess structure into the Analysis folder in JSON format
- Read that JSON and compare it with the template
- Compare the implementation output with requirements
- Verify the implementation satisfies the requirements
Iterative Process: By iteratively asking the AI to compare implementations in
other languages, test outputs, and prompt requirements, the assembler was successfully
re-implemented in various languages:
- Statically typed languages (C#, Rust, Go)
- Dynamically typed languages - server-side (Node.js, PHP)
- Client-side (JavaScript)
Getting Started from Scratch
Step 1: Minimal API
Started by building a minimal API in C# and creating test AppSites. Instructed AI to load
templates as an AppSite_AppFile key in a dictionary.
Step 2: Basic Processing
Asked AI to process the dictionary to merge templates, generate output, print the output,
and display it in the AppSite endpoint.
Step 3: Self-Correction Loop
When noticing issues in output, asked AI to run the program for a particular endpoint,
print the output, and review the result so it could see that the implementation was incorrect.
This forced the AI to iteratively correct its own mistakes.
Step 4: Structure Definition
After achieving initial success, started defining all rules and creating structure by
establishing three different projects:
- Assembler: Core logic
- AssemblerTest: Logical testing and AI self-verification
- AssemblerWeb: Visual verification
Conclusion: Using this iterative approach, the assembler can be implemented
in any language for which AI support is strong.
AI Model Comparison
Multiple AI models were used throughout development, each with different strengths.
Claude Sonnet 4
Best for: Solving major code and logical issues
- Superior debugging capability
- Better at complex problem-solving
- Higher cost but higher quality
- Recommended for critical issues
GPT-4.1
Best for: General development tasks
- Good for routine coding
- Solid performance overall
- Cost-effective for most tasks
- Used equally with Claude
Gork Code Fast 1
Best for: Quick iterations
- Equivalent to GPT-4.1
- Fast response times
- Good for rapid prototyping
- Preview version used
Key Takeaway: All AI model outputs must be carefully reviewed and context
recreated to ensure the prompt requirements are met. Claude Sonnet 4 was generally better for
solving coding issues, though at a higher cost.
Lessons Learned
What Works Well
- Declarative Requirements: Specify what you need, not how to achieve it
- Self-Validation Loops: Have AI verify its own work through testing
- Iterative Refinement: Continuously compare outputs across implementations
- Structure Dumps: Generate intermediate representations for verification
- Cross-Language Validation: Use multiple implementations to verify correctness
Challenges
- Following Directions: AI may deviate from instructions without careful prompting
- Verification Difficulty: Hard to verify implementation without deep language knowledge
- Rework Required: Extensive iteration needed to achieve correct results
- Context Management: Must recreate context carefully for consistent results
Best Practices
- Start with a minimal working implementation
- Build comprehensive test suites early
- Use AI to generate validation code, not just implementation code
- Compare outputs across language implementations
- Document requirements clearly before coding
- Use the right AI model for the task (debugging vs. routine coding)
Future of AI-Assisted Development
This project demonstrates that AI can successfully implement complex, multi-language projects
when given proper structure and verification mechanisms.
Vision: Find abstractions which improve reusability in developing applications
and can lead to implementing an independent supply chain in software development due to improved
abstractions that clearly separate building from assembly.
Key Enablers
- Strong AI models with coding capabilities
- Declarative programming paradigms
- Comprehensive automated testing
- Cross-implementation validation
- Clear separation of concerns
Collaboration Opportunities
Interested in exploring:
- AI-Assisted Development methodologies
- AI-Assisted Migration between languages
- Software Supply Chains with clear abstractions
- Sustainable Open Source development models
📧 Contact for Collaboration: srid68 [at] gmail.com
💻 Pair Programming with AI: $100 USD per 4-hour session
Disclaimer
"This repository is generated by AI based on my prompt requirements, with my focus primarily on
architecture, testing, validation, and performance. I have not deeply reviewed the AI-generated
implementation logic or data structures, so expect that each language's implementation may not
be optimal, but the implementation outputs are accurate and validated by me. I have done minimal
debugging of the working code."
Note: The author is only familiar with C#, which was used as the prompt for all
other languages. Not familiar with idioms or conventions in other languages, but AI handled the
translation while maintaining structural consistency.