AI-generated code stabilization is becoming one of the most critical steps in modern software development as AI-built prototypes grow more common. After AgilityFeat conducted a technical audit of the FarmGAP AI-built POC, the findings were clear: the application had potential, but it was not yet stable, secure, or reliable enough for real users.
SG Farm Services brought the same AgilityFeat Builder Pod back to execute on the audit. Over four weeks, we turned the prioritized audit plan into a production-ready, offline-first web application that could confidently be put in front of real farms for the first time.
The Product
FarmGAP is a web-based application designed to help small and mid-sized farms manage GAP (Good Agricultural Practices) and Produce Safety Rule compliance. Farmers use it to complete audits, track records, and stay compliant.
This is most often done from a mobile device in the field with little or no connectivity. If the app does not work offline, it does not work.
The Technical Audit: What We Found in FarmGAP’s AI-Generated Code
AgilityFeat’s Phase 1 technical audit identified the core issues:
- Inconsistent authorization across the database
- A fragile, workaround-heavy authentication flow
- Missing features tied directly to the product’s value
- No reliable offline-first web app architecture
The audit gave SG Farm Services a clear, prioritized roadmap. But like many teams at this stage, they needed a partner to actually execute it.
They brought AgilityFeat back for Phase 2 to do exactly that.
Technical Audit Execution: Security and Stability Before Features
Our team treated the audit’s severity tiers as strict sequencing rules:
- Security first
- Critical bugs next
- Refactors after
- Prioritized Features last
This is where technical audit execution often breaks down—teams skip ahead to visible features. In this case, feature work did not begin until the system was stable enough to support it.
The team remained small and senior:
- One developer paired with AI for first-pass implementation
- One developer reviewing independently for architecture and maintainability
- UI Designer as needed
- QA as needed
This approach was particularly effective for stabilizing AI-generated code while maintaining speed.
How We Used AI for Development Without Letting It Run the Show
AI added leverage when the work was well-specified. With clear specs (inputs, outputs, edge cases, acceptance criteria), AI produced fast, usable first implementations and validated them against requirements. This reduced iteration time and kept developers focused on higher-level concerns.
However, AI could not:
- Ensure alignment with the broader system architecture
- Enforce consistency across the codebase
- Fully anticipate integration edge cases
Human review remained essential. AI accelerated execution, but senior developers ensured the system held together.
Key Decisions That Turned an Unstable Prototype into Production Software
Five decisions shaped the Phase 2 product.
1. Authorization enforced at the database layer
Authorization was inconsistent and partially implemented. The team moved enforcement into Postgres Row-Level Security policies, applied uniformly across all relevant tables. Previously unauthenticated endpoints were secured, and security headers were added at the infrastructure level.
2. Authentication flow rebuilt from scratch
The original auth flow relied on brittle workarounds. Instead of continuing to patch it, the team rebuilt it around a single canonical route handling email confirmation, password reset, and invite acceptance.
3. Offline-first web app architecture for real farm conditions
The team implemented a reliable offline-first web app that works in real farm conditions.
- Service worker caching using vite-plugin-pwa
- IndexedDB for offline data access
- Safe draft handling for unsynced work
- Conflict detection (HTTP 409) to prevent overwrites
- User safeguards for unsynced data
4. Notifications built as infrastructure
Rather than one-off reminders, the team created a reusable system:
- Daily scheduled jobs
- Batched processing
- Separate overdue and due-today flows
- Integration with Resend via Supabase Edge Functions
5. Mobile UX prioritized
The interface was refined for real-world usage:
- Improved navigation and layout
- Auto-focus on inputs
- Better scrolling behavior
- Mobile-specific rendering fixes
Technology Stack
- Frontend: React 18, TypeScript, Vite, Ionic React, Tailwind
- State and data: TanStack Query, Zustand, React Hook Form with Zod
- Backend: Supabase Edge Functions (Deno), Supabase Auth
- Database: Postgres with Row-Level Security
- Infrastructure: Railway, pnpm monorepo
- AI tooling: Claude Opus and Claude Sonnet
- Integrations: Resend, Nominatim
Results: From Not Safe to Show to Production-Ready
By the end of Phase 2, FarmGAP was no longer stuck in a pre-release state.
Security and stability
- Consistent Row-Level Security across the system
- Secured endpoints and improved deployment safety
- Clean, repeatable database migrations
Core functionality
- Unified, reliable authentication flow
- Removal of fragile workarounds
- Stable end-to-end user flows
Offline-first capability
- Farmers can complete workflows without connectivity
- Data syncs reliably when back online
- Conflicts handled explicitly
Usable feature set
- Reporting, inventory, and location workflows completed
- Cleaning and maintenance systems implemented
- Approval flows and onboarding functional
What This Project Shows
A technical audit creates clarity. But value only comes from execution. This project demonstrates what it takes to follow through: disciplined prioritization, strong architectural decisions, and the ability to stabilize AI-generated code into a cohesive system.
The difference between a prototype and a usable product is rarely visible in screenshots. It lives in the underlying systems—authorization, authentication, and data synchronization.
What’s Next: Validating with Real Users
A structured validation phase with a small group of real farms is now underway. This was the plan from the beginning: audit, then build and stabilize, then test with real users, then incorporate feedback. FarmGAP is following that sequence, and Phase 2 is what made the next step possible.
Work With AgilityFeat
Whether you are coming out of a technical audit, building an AI-powered product, or trying to stabilize an existing application, execution is where most teams get stuck. AgilityFeat helps teams design, build, and scale reliable software of all scales and sizes, through nearshore software development projects like these, and through nearshore staff augmentation and Build-Operate-Transfer. Talk to our team.
Further Reading:
- How a Technical Audit Turned FarmGAP’s AI-Built POC into a Stable Beta Product
- Building an Agentic Software Delivery Platform: AgilityFeat’s Work with Compounds.dev
- 2 Week Hybrid AI POC: Prototyping a Startup Concept with Smart Integrations and the Right Use of AI
- AI Video Editor Development: Building Verbolo’s Intelligent Content Creation Platform
- Introducing Builder Pods: AI-Native Squads Ready to Build
- Best Practices for AI-Assisted Software Development
- 3 Situations Where a Dedicated MVP Development Team Is the Right Call





