AI-Assisted Development Guide

Table of contents


How to use this guide

This guide collects the rules, conventions and hard-won lessons for changing the V5 code on the develop branch with an AI coding agent. It is written for both people and agents: each rule says what to do and why, so an agent can apply it and a person can judge when it doesn't fit.

To use it, point your agent at this file at the start of a session. For example:

Before making any change, read version5/doc/dev/aiGuide.md and follow it. Also read the documents it links to when a task touches their area.

Agents that read a project instruction file find this guide on their own: CLAUDE.md in the repository root imports it for Claude Code, and AGENTS.md points other agents to it. When version5/ moves to the repository root, drop the version5/ prefix from these paths and from both files.

Developers: you are expected to have good coding skills and to know this codebase and its rules. AI agents are your development partners. They know general best practices widely, but their working memory doesn't hold the whole codebase, so they sometimes patch a symptom where a higher-level change is needed. Review all AI-generated code before you check it in.

Agents: act as a trusted development partner, not just an order-taker. Treat the rules in this document as project policy: where one conflicts with a general habit of yours (for example committing after every change, or adding explanatory comments), the rule here wins. If a request conflicts with this guide or with general good practice, or a fix looks like a local patch for a problem that belongs at a higher level, say so before acting: name the rule or practice, explain the risk and suggest an alternative. Raise real problems, not matters of taste. The developer has the final say. Once they decide, do it their way without reopening the question, and never quietly do something different. If they overrule a rule in this guide, mention it in your report so a reviewer can see it.

The project in brief

Working rules

Version control

Changes usually apply to every aircraft app

The aircraft apps share near-duplicate files: page/aircraft.js, page/weightBalance.js, page/enroute.js, aircraftData/typeData.js and their siblings exist in each app with small differences. A fix in one app's file almost always belongs in the others.

Ask, don't guess

Aircraft data rules

Aircraft data lives in source/app/<App>/buildStamp/aircraftData/. The main reference is How to Make a New Aircraft App.

Numbers must match the POH literally

A reviewer must be able to open the POH page and see the same digits in the code.

Base methods and model methods

Each aircraft type's typeData.js holds a set of base methods for each phase of flight (tko.roll, climb.rate, cruise.tas and so on). They fit a large set of the type's models, usually the newer ones, and every model gets them without declaring them. See Create the type data and Type-wide data.

Model inheritance

Ptable details

Aircraft-specific behavior must be data-driven

Options

Code rules

Follow the Coding Style Guide. The points agents most often miss:

State variables and templates

Native platform constraints

These matter even for web-only changes because the same code ships natively.

Testing and verification

Verify every change before reporting it as done, and say exactly what you checked and what you could not.

Commands

Run these from the V5 project root:

Command Purpose
make lint ESLint plus tmlLint.js for every app. Run before handing back any code change.
make lintClean Clears the incremental lint cache. Use it when a lint error looks stale (for example "assigned but never used" for a variable that is used).
make <App>.test Builds the app and runs its self-test suite in headless Chrome; prints <App>: PASS or FAIL and exits non-zero on failure. Also fails on any app assert().
make test The same for every app with a suite.
make <App>.tableCoverage Lists Ptables that no calculation reads, in build/tableCoverage/<App>.json. An unread table is a dead-data bug or a test gap.
make <App>.ptables model=<model> Lists a model's Ptables with their data paths, titles, inputs and outputs.
make checkMdLinks Checks documentation links after editing doc/.

Writing tests

Tests are written with unitTest. A complete aircraft model has all three kinds:

  1. System tests, in the page files: set SVs the way a user would (setAc(), selectAcOption(), sv.x.valSync()) and check output SVs. Most expensive; covers the most.
  2. Method tests, in the model files: call aircraft methods directly (acData.tko.roll(conditions)).
  3. Table tests: call Ptable.interpolate() directly. Cheapest.

Rules for tests:

Checking against V4

Until version4/ is removed, tools/upgradeToV5/*Diff.js (for example node tools/upgradeToV5/baronDiff.js --all) runs the same scenarios through the V4 and V5 engines and passes when every difference is on its KNOWN list of deliberate changes. When a harness and V5 disagree, check the harness's V4 expression against the V4 page code before blaming V5. A V4 installedOn option that became optionOn in V5 is drift that the self-tests can't see.

Checking the UI

Documentation

Known behaviors that are not bugs

Don't report these as findings:

Before you hand back a change

Prompts for common tasks

Each prompt assumes the agent has already read this guide. Replace the angle-bracket parts.

Some POH tasks are also skills, in .claude/skills/ at the repository root:

Run them in Claude Code as shown. Tell any other agent to read and follow the skill's SKILL.md.

Start a session

Read version5/doc/dev/aiGuide.md and the documents it links to for this task. Summarize the rules that apply before you start, then wait for my go-ahead.

Fix a bug

In the V5 <App> app, <describe symptom and how to reproduce>. Find the root cause before changing anything and explain it. Then check whether the same code exists in the other aircraft apps and fix it everywhere it applies. Add a self-test that fails without the fix, run make lint and make test, and report which apps you changed. Don't commit.

Digitize a POH's graphs

First have the agent list what the POH has and map it to a reference model's data paths, then correct the list it makes and give it as <list>. See Starting an agent for that prompt. The digitize-poh skill runs both steps and stops for your corrections in between.

Build the Digitizer project digitized/<App>/<document>.ppdig from the POH at <path>, following doc/dev/aiDigitizing.md. Calibrate and sample the graphs in this list, with the data paths it gives, and leave out the items it marks to leave out: <list>. Give each graph its POH title and source, and look at a ppdig render of each one. Run ppdig check, and report your confidence in each graph and anything you left out. Don't change aircraftData.

Extract POH tables for audit

Transcribe the tables in this list, with the data paths it gives, from the POH at <path> into the Digitizer project digitized/<App>/<document>.ppdig, following doc/dev/aiDigitizing.md: <list>. Run ppdig check, then compare the project with the <model> model using make <App>.ppdigCompare. List each difference with the POH page, the POH value and the code value. Don't change anything else.

Add or port an aircraft model

Add the <model> to the V5 <App> app from the POH at <path>, following doc/dev/newAircraft.md. Take graph data only from a Digitizer project the developer has checked; if there isn't one, stop and digitize the graphs first. Keep every number as printed in the POH with units: on the Ptable axes, cite the figure or page on each table, and use modelDataMergeUnder only for data that is identical in both POHs. Where the model computes differently from the base methods in typeData.js, override them in the model file rather than adding cases to the base methods. Declare maxAltitude explicitly within the climb and cruise table extents. Add system, method and table tests with expected values taken from the POH examples, then run make <App>.test and make <App>.tableCoverage.

When the graphs and tables are in a checked Digitizer project, the ppdig-to-model skill starts the model file from it with ppdig model, as described in Making a model file.

Add an aircraft option

Add the <option> option to the V5 <App> app for serials <range>, from <POH supplement>. Decide whether it is optionOn or installedOn, and how it relates to existing options (optClass, includes, incompatibleWith, enabledBy). Test it by looking up values that differ from the base model through acData, not by checking options.installed.

Audit data against the POH

Check every table in <model file> against the POH at <path>, digit by digit. List each discrepancy with the POH page, the POH value and the code value. Don't change anything yet.

Review a change

Review the uncommitted changes against doc/dev/aiGuide.md. Look for correctness bugs, missed sibling apps, data that doesn't match the POH, model-specific cases added to base methods, missing tests and style violations. Verify each finding before reporting it, and rank them by severity.

Write or update documentation

Update the documentation in doc/ for <change>, following the Markdown style in doc/dev/style.md. Run make doc and make checkMdLinks.