Achieving 94% AI Code Generation: How a Single Skill Automates the Entire Development Pipeline
This article details how a structured "Skill" pipeline transforms AI‑assisted coding from a flaky helper into a reliable end‑to‑end development engine, achieving a 94% code‑generation rate by breaking the workflow into eight verifiable stages, building a three‑level knowledge base, and enforcing strict red‑line rules.
Problem Statement
When applying large language models (LLMs) to real‑world mobile projects, developers encounter recurring pain points: context overflow with thousands of source files, scattered assets across PRD, Figma, and documentation, inconsistent naming, vague instructions, lack of verification loops, and loss of context across sessions.
Core Insight
AI is not incapable of writing code; it merely lacks a disciplined, engineering‑grade workflow. The solution is to pipeline‑ify the entire requirement‑to‑code process into eight semantic stages, each with clear inputs, outputs, and machine‑checkable exit criteria.
Eight‑Stage Architecture
Design Draft : ingest Figma links and produce a curated list of candidate screens.
Breakdown : merge PRD, design, and CGI into a structured subtasks.json backlog.
Locate : apply a five‑step "narrow‑down" method (intent disambiguation, module locating, keyword search, call‑chain tracing, final verification) to pinpoint the exact code locations.
Implement : generate code bottom‑up (data → parse → enumerate → business → UI → log).
Validate : run bazel build and allow up to three self‑repair rounds.
Simulator Verify : automatically install the build on a simulator, execute scripted UI flows, capture screenshots, and compare against ui_alignment_spec.md.
Commit : enforce a three‑part commit message, a sentinel file for success, and a deterministic git log -1 hash.
Archive : persist the knowledge in a three‑level pyramid knowledge base and a TECH_SPEC.md document.
Three‑Level Pyramid Knowledge Base
L1 Overview : a project_wiki/overview.md (<5 KB) listing all modules and responsibilities.
L2 Module Wiki : per‑module <module>.md files containing file‑level metadata and a concise description.
L3 Semantic Bridge : figma_token_mapping.md that maps design tokens (e.g., Mobile/callout) to concrete code constructs ( xyz_styledLabel:).
These layers give the AI a "map" of the codebase, enabling deterministic searches instead of blind grep attempts.
Rule‑Based Requirement Translation
To bridge the semantic gap between product language and code, the pipeline enforces four deterministic rule groups:
Scope Identification : a hard‑keyword table forces any sentence containing mobile‑related terms to be treated as a mobile requirement.
Design‑Draft Assignment : every design draft must be classified into one of three categories; unassigned drafts trigger a red‑line error.
Intercept Point Validation : interaction rules require an explicit design reference (Figma node ID or TAPD quote); speculative links are rejected.
Semantic Expansion : a five‑dimensional search matrix (iOS event methods, functional synonyms, naming conventions, protocol/delegate, notification/callback) expands product phrases into high‑precision code search terms.
The output of this stage is a structured JSON backlog (e.g.,
{"id":"M1","title":"邮件列表顶部小红条","type":"新增 UI","data_source":"CGI字段..."}), which drives the subsequent implementation.
Red‑Line System
Critical and standard red‑lines are defined in a single YAML source and loaded hierarchically. When a rule is violated, the AI must stop and emit a templated report such as:
⛔ Triggered RL‑15: Compilation must pass
Current state: exit code non‑zero
Suggested action: rollback to previous stage or request human confirmationThis makes the AI’s missteps observable and prevents silent failures.
Compile‑Time Verification
After each code change, bazel build is executed. Successful compilation (exit code 0) is the sole proof of correctness; up to three automatic fix attempts are allowed before the pipeline aborts.
Simulator‑Based Runtime Verification
The pipeline automatically derives a UI path from git diff and the knowledge base, then runs scripted actions on the iOS simulator, captures screenshots, and validates visual alignment against ui_alignment_spec.md. Failures are classified as:
A – True bugs : code errors that require returning to the implementation stage.
B – Path issues : mismatched UI flow, prompting a revision of the verification plan.
C – Script glitches : transient problems (e.g., timing, coordinate conversion) that are retried up to two times.
Cross‑Session Knowledge Transfer
Three artifacts ensure continuity: TECH_SPEC.md (permanent, contains functional boundaries, module map, invariants, evolution log). subtasks.json (cross‑session task state and dependencies). timeline.txt (session‑level event log: start, human correction, commit).
Each new AI session reads the sections in order (AI self‑check, functional boundaries, module map, invariants, evolution) to pick up exactly where the previous run left off.
Results
In a six‑month internal study, the Skill pipeline reduced requirement‑breakdown time from 1–2 hours to 5–10 minutes, cut code‑location effort from 30 minutes–2 hours to under 15 minutes, and achieved a 94 % code‑generation rate. The knowledge base also accelerated onboarding: new engineers could start contributing after reading overview.md and a few module wikis.
Key Takeaways
Pipeline‑ify development into verifiable stages.
Delegate deterministic data handling to scripts; let LLMs focus on judgment.
Pre‑empt dangerous AI actions with a YAML‑driven red‑line system.
Use file‑based sentinel evidence instead of stdout for long‑running commands.
Persist both code and knowledge in git‑tracked documents to enable seamless cross‑session handoff.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
