Extract and condense documentation for Attributes and Data Model from the Fulcro RAD Developer's Guide into a succinct, accurate, LLM-friendly markdown file.
/workspace/docs/DevelopersGuide.adoc/workspace/docs/ai/01-attributes-data-model.mdAll information must be verified against source code in /workspace/src/main/com/fulcrologic/rad/:
defattr signature in attributes.cljc:54-92attributes-options.cljc for all ::attr/* optionsattributes.cljc - Core attribute definitions (especially lines 1-100)attributes-options.cljc - All standard attribute options (read entire file)form.cljc - How forms use attributesreport.cljc - How reports use attributesThis is THE MOST IMPORTANT topic - the foundation of RAD. Emphasize:
defattr Macro
Identity Attributes
::attr/identity? true (primary/natural keys)Attribute Types
Schema/Clustering
::attr/schema - what it means and how it's usedReferential Attributes (Basic)
::attr/target for to-one::attr/cardinality :many for to-many::attr/targets for polymorphic refsModel Namespaces
What attributes are, why they're the center of RAD, RDF-style inspiration.
File:line references for key definitions
Before finalizing:
# Attributes and Data Model
## Overview
Fulcro RAD is attribute-centric. An attribute is an RDF-style description of a single fact about your domain...
## Defining Attributes with defattr
The `defattr` macro is the primary way to define attributes...
\`\`\`clojure
;; From attributes.cljc:54-92
(defattr symbol qualified-keyword data-type options-map)
;; Minimal example
(defattr id :item/id :uuid
{::attr/identity? true
::attr/schema :production})
\`\`\`
...
## Identity Attributes
Attributes marked with `::attr/identity? true` are special...
## Scalar Types
RAD supports these built-in scalar types:
- `:string` - Text data
- `:uuid` - Universally unique identifiers
...
## The Schema Concept
The `::attr/schema` option groups attributes into logical entities...
## Reference Attributes: Introduction
Attributes with type `:ref` connect entities...
\`\`\`clojure
;; To-one relationship
(defattr address :person/address :ref
{::attr/target :address/id
::attr/schema :production})
;; To-many relationship
(defattr friends :person/friends :ref
{::attr/target :person/id
::attr/cardinality :many
::attr/schema :production})
\`\`\`
For complete details on relationships, see [02-relationships-cardinality.md](02-relationships-cardinality.md).
## Model Organization
...
## Common Patterns
### Standard Entity Pattern
\`\`\`clojure
(ns com.example.model.account
(:require [com.fulcrologic.rad.attributes :as attr :refer [defattr]]))
;; Identity
(defattr id :account/id :uuid
{::attr/identity? true
::attr/schema :production})
;; Scalars
(defattr email :account/email :string
{::attr/schema :production
::attr/required? true})
;; References
(defattr addresses :account/addresses :ref
{::attr/target :address/id
::attr/cardinality :many
::attr/schema :production})
\`\`\`
## Important Notes
- **CLJC Files**: For full-stack RAD, attributes MUST be in .cljc files
- **Qualified Keywords**: Attribute names must be qualified (namespace/name)
- **Schema Grouping**: All attributes with the same ::attr/schema form an entity
...
## Related Topics
- **Relationships in Detail**: [02-relationships-cardinality.md](02-relationships-cardinality.md)
- **Complete Option Reference**: [03-attribute-options.md](03-attribute-options.md)
- **Using Attributes in Forms**: [04-forms-basics.md](04-forms-basics.md)
- **Using Attributes in Reports**: [08-reports-basics.md](08-reports-basics.md)
## Source References
- **Macro Definition**: `attributes.cljc:54-92` - defattr macro
- **Attribute Creation**: `attributes.cljc:29-51` - new-attribute function
- **Standard Options**: `attributes-options.cljc` - all ::attr/* options
- **Type Predicates**: `attributes.cljc:94-105` - to-many?, to-one?, etc.
Create this prompt file and run:
mkdir -p /workspace/docs/ai/prompts
# Save this content to prompts/01-attributes-prompt.md
# Then run:
claude --session-id ai-docs-attributes --print < /workspace/docs/ai/prompts/01-attributes-prompt.md
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |