For a person or a model about to write an app; a model gets the same text from oad guide.
# The guide to writing an app
Topics short enough to read on their own, in reading order. Each is also printed by `oad guide <topic>`.
1. [Writing your first app](https://openappdefinition.org/guide/start.html): What an app is, the smallest complete app, a list you can add to and change, the fields of a record, the controls and list functions a first app uses, the examples to start from, how to work, and the mistakes every newcomer makes; enough for a first app.
2. [State](https://openappdefinition.org/guide/state.html): Stored, derived and sourced values, their types, where each value lives (scope) and who sees it.
3. [Expressions](https://openappdefinition.org/guide/expressions.html): The expression language: where the leading = goes, operators, functions, dates and times, list macros, and the habits from other languages that break here.
4. [Actions and steps](https://openappdefinition.org/guide/actions.html): Actions with input, allow, require and confirm, every step kind, handling failures, and doing an outside effect once.
5. [Views](https://openappdefinition.org/guide/views.html): The visual surface: views, nodes, props, bindings, handlers, view state, forms, navigation and main sections, and the card an app of one view is drawn as.
6. [Controls](https://openappdefinition.org/guide/controls.html): Every core control with its props, events and slots, generated from the core catalog, with advice on which to use.
7. [Capabilities and grants](https://openappdefinition.org/guide/capabilities.html): Using the outside world through a capability contract, asking for permission with a grant request, when each request is asked, and every core capability with its operations, generated from the core catalog.
8. [Sample data](https://openappdefinition.org/guide/sample-data.html): How a sample document answers for a service so an app runs without one, and how to write it.
9. [Mistakes and their fixes](https://openappdefinition.org/guide/mistakes.html): The mistakes nothing reports, then the diagnostics a writer meets most, each with its cause and its fix.
10. [Rules](https://openappdefinition.org/guide/rules.html): Reacting to changes, events, time and the app opening: triggers, edges and timers.
11. [Flows](https://openappdefinition.org/guide/flows.html): State machines for processes with named stages: singleton and collection flows, transitions, guards and timers.
12. [Code modules](https://openappdefinition.org/guide/code.html): Logic that expressions cannot say, or would have to say in several places, written once as a small sandboxed function: when to write one and when not, how an action calls it, and its limits and failures.
13. [People and roles](https://openappdefinition.org/guide/people.html): Several people on one app: shared state, ids and names, roles, only the owner may, who uses the app, and who may act.
14. [Agents](https://openappdefinition.org/guide/agents.html): What an app gives an agent: tools, resources, events and instructions, and how to keep what is private off the agent surface.
15. [Parts: apps inside apps](https://openappdefinition.org/guide/parts.html): Including a whole app inside another, for a piece several apps share or one that is useful alone and inside a larger app (most apps need none): exports, uses.definitions, parts, and how to work with both apps as drafts.
16. [Changing an app](https://openappdefinition.org/guide/changing.html): Editing an app in small steps with patches, the changes that need a person's yes, history, versions, and what happens to the data of people who use it.
17. [Texts in several languages](https://openappdefinition.org/guide/languages.html): An app's own texts in several languages: the localization table, keys, blanks and forms, t() in expressions and =t('key') in fixed places, adding a language or a key, right to left, looking as a reader of a language, and what each check of it means.
18. [Example apps](https://openappdefinition.org/guide/examples.html): the small apps the topics quote, each a whole definition.
What a person or a model needs to write an Open App Definition app without the specification at hand: topics short enough to read on their own, whose every example is checked against the reference implementation.
It is written for a reader who has never seen OAD and has nothing else at hand. A reader with only the first topic should be able to write a small app that passes oad validate at the first or second try; one who also reads two or three more should be able to write an app with records, a form, a flow and a permission. It is the same text a model reads through oad author before it writes an app, and it is in full in llms-full.txt. The text on these pages is the repository’s, from packages/authoring/guide/, with the reference parts generated from the core catalog.
Where the guide is short, the specification says everything.
What an app is, the smallest complete app, a list you can add to and change, the fields of a record, the controls and list functions a first app uses, the examples to start from, how to work, and the mistakes every newcomer makes; enough for a first app.
The expression language: where the leading = goes, operators, functions, dates and times, list macros, and the habits from other languages that break here.
The visual surface: views, nodes, props, bindings, handlers, view state, forms, navigation and main sections, and the card an app of one view is drawn as.
Using the outside world through a capability contract, asking for permission with a grant request, when each request is asked, and every core capability with its operations, generated from the core catalog.
Logic that expressions cannot say, or would have to say in several places, written once as a small sandboxed function: when to write one and when not, how an action calls it, and its limits and failures.
Including a whole app inside another, for a piece several apps share or one that is useful alone and inside a larger app (most apps need none): exports, uses.definitions, parts, and how to work with both apps as drafts.
Editing an app in small steps with patches, the changes that need a person's yes, history, versions, and what happens to the data of people who use it.
An app's own texts in several languages: the localization table, keys, blanks and forms, t() in expressions and =t('key') in fixed places, adding a language or a key, right to left, looking as a reader of a language, and what each check of it means.