
airalogy-protocol
by airalogy
SKILL.md
name: airalogy_protocol description: Expert guide for creating Airalogy Protocols (AIMD), Assigners (Python logic), and Validation Models. Use this to design digital workflows and experiments. input_schema: type: object properties: topic: type: string description: Specific area of the protocol to query. enum: [concepts, syntax, assigners, validation, templates] required: - topic
Airalogy Protocol Guide
Airalogy is a framework for data digitization. This skill teaches you how to build Protocols using AIMD (marked-up markdown) and Assigners (auto-computation logic).
1. Core Concepts
What is a Protocol? A document that defines a data collection workflow. It combines:
- UI/Content: Defined in
.aimdfiles. - Logic: Defined in Python "Assigners".
- Validation: Defined in Pydantic "Models".
2. Directory Structure
Airalogy protocols can be structured in two ways.
Standard Package (Recommended)
Atomic unit containing layout, logic, validation, and metadata.
my_protocol/
├── protocol.toml # Manifest: ID, version, name, description
├── protocol.aimd # UI layout and content
├── model.py # Pydantic models (validation)
├── assigner.py # Python logic (calculations)
├── requirements.txt # Python dependencies (optional)
├── README.md # Documentation for users
└── assets/ # Static resources (images, banner, logo)
Single File (Simple)
For simple tools without complex logic.
my_simple_protocol/
└── protocol.aimd
protocol.toml
Protocol Manifest (protocol.toml)
This file is mandatory for Standard Packages. It defines the protocol's identity and visual assets.
[airalogy_protocol]
id = "my_protocol_id" # Unique identifier (snake_case)
version = "1.0.0" # Semantic versioning
name = "My Protocol Name" # Human-readable title
description = "Brief description of what this protocol does."
logo = "assets/logo.png" # Path to square logo
banner = "assets/banner.png"# Path to rectangular banner
3. Consistency Rules (Naming Conventions)
To ensure your protocol works, variable names MUST match across files.
| Component | AIMD Syntax | Model Definition (model.py) | Assigner Logic (assigner.py) |
|---|---|---|---|
| Simple Var | {{var|my_var: type}} | my_var: type = ... | dep["my_var"] |
| Table | {{var|my_table, subvars=[...]}} | my_table: list[RowModel] | dep["my_table"] (list) |
| Check | {{check|my_check}} | my_check: CheckValue | assigned_fields={"my_check": ...} |
[!IMPORTANT] The
idyou define in{{var|id...}}is the single source of truth. It must be identical in your Pydantic model field name and your Assigner'sassigned_fields/dependent_fields.
4. AIMD Syntax (Practical Rules)
How to define variables, fields, and steps in markdown.
{{var|name: type, ...}}defines inputs.{{step}}and{{check}}define workflow and checks.- Tables use
subvarsinsidevar(...)blocks (do not use{{subvars}}).
✅ Correct variable definitions
Use title and description for all user-facing inputs.
{{var|sample_id: str, title="Sample ID", description="Unique identifier for the sample"}}
✅ Correct table (subvars) definitions
Define table rows using subvars=[var(...), var(...)] inside a parent var.
{{var|reaction_components,
title="Reaction Components",
description="PCR reaction mixture components",
subvars=[
var(
component: str,
title="Component",
description="Reagent name"
),
var(
volume: float,
title="Volume (µL)",
description="Volume to add (µL)",
ge=0
)
]
}}
✅ Constrained numeric inputs
Always apply sensible constraints to numeric inputs.
{{var|volume: float, ge=0, title="Volume (µL)", description="Volume to add in µL"}}
5. Assigners (Logic)
How to write Python functions to automate calculations.
@assignerdecorator.- Dependency graphs.
- Trigger modes (
auto,manual).
6. Validation Models
How to ensure data integrity using Pydantic.
- Constraining inputs (min/max).
- Custom validators.
7. Templates
Start with a template:
- Single File Protocol (Best for simple tools)
- Classic 3-File Protocol (Best for complex workflows)
8. Common Errors & Fixes (Based on Field Usage)
These are frequent issues observed when building protocols.
❌ Wrong variable definition syntax
{{var|sample_id: str}}
{{subvars|reaction_components:
- component: "5X Phusion™ Plus Buffer"
}}
✅ Fix: Use full var definition and subvars on the parent var.
{{var|sample_id: str, title="Sample ID", description="Unique identifier for the sample"}}
{{var|reaction_components, subvars=[var(component: str), var(volume: float)]}}
❌ Using {{subvars}}
{{subvars}} is not a valid AIMD tag. Use subvars=[...] inside a var.
❌ Missing metadata
All input variables should include title and description.
{{var|reaction_volume: str, options=["20 µL", "50 µL"],
default="20 µL",
title="Reaction Volume",
description="Total PCR reaction volume"}}
❌ Missing numeric constraints
Always constrain numeric inputs using ge, le, or other validators.
9. Validation & Quick Tests
Use these checks after editing a protocol:
AIMD syntax validation
python -c "
from airalogy.markdown import validate_aimd
with open('protocol.aimd', 'r') as f:
is_valid, errors = validate_aimd(f.read())
print('Valid:', is_valid)
print('Errors:', errors)
"
Model import validation
python -c "
from your_protocol.model import ProtocolModel
model = ProtocolModel()
print('Model created successfully')
"
Assigner smoke test
python -c "
from your_protocol.assigner import calculate_total_volume
# Mock standard reaction components
data = {
'reaction_components': [
{'component': 'Buffer', 'volume': 10.0},
{'component': 'Water', 'volume': 40.0}
]
}
result = calculate_total_volume(data)
print('Result:', result.assigned_fields)
"
10. Authoring Checklist
- All
varfields includetitleanddescription - Tables use
subvarsinside a parentvar(no{{subvars}}) - Numeric fields include constraints (
ge,le, etc.) - AIMD validation passes with no errors
- Model loads successfully
- Assigner outputs are as expected
スコア
総合スコア
リポジトリの品質指標に基づく評価
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
レビュー
レビュー機能は近日公開予定です