ecological-agent-skills 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT_CONTEXT.md +191 -0
- package/CATALOG.md +329 -0
- package/LICENSE +692 -0
- package/README.md +347 -0
- package/bin/install.mjs +168 -0
- package/docs/comparison-with-alternatives.md +38 -0
- package/docs/global-examples-index.md +103 -0
- package/docs/repository-statistics.md +101 -0
- package/docs/theoretical-foundations.md +188 -0
- package/environment.yaml +106 -0
- package/examples/community/arctic_tundra_vegetation_example.md +247 -0
- package/examples/community/bird_landuse_example.md +63 -0
- package/examples/community/phytoplankton_reservoir_example.md +60 -0
- package/examples/community/reef_fish_indopacific_example.md +221 -0
- package/examples/impact/baci_road_example.md +57 -0
- package/examples/impact/ecosystem_services_atlantic_forest.md +83 -0
- package/examples/impact/forest_loss_borneo_timeseries_example.md +225 -0
- package/examples/occupancy/puma_camera_example.md +61 -0
- package/examples/occupancy/snow_leopard_himalayas_example.md +204 -0
- package/examples/reproducible/whittaker_biome_sdm_example.md +406 -0
- package/examples/sdm/anteater_cerrado_example.md +69 -0
- package/examples/sdm/jaguar_amazon_example.md +80 -0
- package/examples/sdm/koala_climate_change_example.md +170 -0
- package/examples/sdm/wolf_recolonization_europe_example.md +193 -0
- package/package.json +43 -0
- package/renv.lock +194 -0
- package/skills/SKILL_INDEX.json +1020 -0
- package/skills/acoustic-monitoring/SKILL.md +163 -0
- package/skills/acoustic-monitoring/examples/example-prompts.md +100 -0
- package/skills/acoustic-monitoring/examples/temperate_forest_birds_example.md +285 -0
- package/skills/acoustic-monitoring/resources/acoustic-indices-reference.md +93 -0
- package/skills/acoustic-monitoring/resources/soundscape-ecology-guide.md +90 -0
- package/skills/acoustic-monitoring/resources/species-id-tools-comparison.md +89 -0
- package/skills/acoustic-monitoring/scripts/batch_species_detection.py +360 -0
- package/skills/acoustic-monitoring/scripts/compute_acoustic_indices.R +235 -0
- package/skills/acoustic-monitoring/scripts/compute_acoustic_indices.py +374 -0
- package/skills/biostatistics-workbench/SKILL.md +140 -0
- package/skills/biostatistics-workbench/examples/example-prompts.md +39 -0
- package/skills/biostatistics-workbench/resources/effect-size-reference.md +81 -0
- package/skills/biostatistics-workbench/resources/glm-family-link-reference.md +47 -0
- package/skills/biostatistics-workbench/resources/test-selection-guide.md +93 -0
- package/skills/biostatistics-workbench/scripts/glm_pipeline.R +78 -0
- package/skills/biostatistics-workbench/scripts/glm_pipeline.py +210 -0
- package/skills/camera-trap-processing/SKILL.md +159 -0
- package/skills/camera-trap-processing/examples/example-prompts.md +103 -0
- package/skills/camera-trap-processing/examples/leopard_serengeti_example.md +231 -0
- package/skills/camera-trap-processing/resources/activity-patterns-reference.md +113 -0
- package/skills/camera-trap-processing/resources/camtrapR-workflow-guide.md +130 -0
- package/skills/camera-trap-processing/resources/detection-event-definition-guide.md +89 -0
- package/skills/camera-trap-processing/scripts/estimate_activity.R +169 -0
- package/skills/camera-trap-processing/scripts/process_camtrap_data.R +179 -0
- package/skills/camera-trap-processing/scripts/process_camtrap_data.py +192 -0
- package/skills/community-ecology-ordination/SKILL.md +133 -0
- package/skills/community-ecology-ordination/examples/example-prompts.md +35 -0
- package/skills/community-ecology-ordination/resources/dissimilarity-metric-guide.md +53 -0
- package/skills/community-ecology-ordination/resources/nmds-interpretation-guide.md +104 -0
- package/skills/community-ecology-ordination/scripts/__pycache__/community_analysis.cpython-311.pyc +0 -0
- package/skills/community-ecology-ordination/scripts/community_analysis.R +143 -0
- package/skills/community-ecology-ordination/scripts/community_analysis.py +231 -0
- package/skills/ecological-data-foundation/SKILL.md +129 -0
- package/skills/ecological-data-foundation/examples/example-prompts.md +40 -0
- package/skills/ecological-data-foundation/resources/coordinate-cleaning-flags.md +66 -0
- package/skills/ecological-data-foundation/resources/darwin-core-glossary.md +91 -0
- package/skills/ecological-data-foundation/resources/data-citation-guide.md +265 -0
- package/skills/ecological-data-foundation/resources/gbif-data-citation-guide.md +193 -0
- package/skills/ecological-data-foundation/resources/qa-checklist.md +83 -0
- package/skills/ecological-data-foundation/scripts/__pycache__/clean_occurrences.cpython-311.pyc +0 -0
- package/skills/ecological-data-foundation/scripts/__pycache__/download_from_ebird.cpython-311.pyc +0 -0
- package/skills/ecological-data-foundation/scripts/__pycache__/download_from_inat.cpython-311.pyc +0 -0
- package/skills/ecological-data-foundation/scripts/__pycache__/download_from_iucn.cpython-311.pyc +0 -0
- package/skills/ecological-data-foundation/scripts/__pycache__/download_from_obis.cpython-311.pyc +0 -0
- package/skills/ecological-data-foundation/scripts/clean_occurrences.R +230 -0
- package/skills/ecological-data-foundation/scripts/clean_occurrences.py +268 -0
- package/skills/ecological-data-foundation/scripts/download_from_ebird.R +251 -0
- package/skills/ecological-data-foundation/scripts/download_from_ebird.py +364 -0
- package/skills/ecological-data-foundation/scripts/download_from_gbif.R +315 -0
- package/skills/ecological-data-foundation/scripts/download_from_gbif.py +407 -0
- package/skills/ecological-data-foundation/scripts/download_from_inat.R +238 -0
- package/skills/ecological-data-foundation/scripts/download_from_inat.py +304 -0
- package/skills/ecological-data-foundation/scripts/download_from_iucn.R +273 -0
- package/skills/ecological-data-foundation/scripts/download_from_iucn.py +344 -0
- package/skills/ecological-data-foundation/scripts/download_from_obis.R +248 -0
- package/skills/ecological-data-foundation/scripts/download_from_obis.py +318 -0
- package/skills/ecological-impact-assessment/SKILL.md +123 -0
- package/skills/ecological-impact-assessment/examples/example-prompts.md +32 -0
- package/skills/ecological-impact-assessment/resources/baci-design-guide.md +55 -0
- package/skills/ecological-impact-assessment/resources/fragmentation-metrics-reference.md +86 -0
- package/skills/ecological-impact-assessment/resources/pressure-index-template.md +78 -0
- package/skills/ecological-impact-assessment/resources/study-design-guide.md +168 -0
- package/skills/ecological-impact-assessment/scripts/baci_analysis.R +161 -0
- package/skills/ecological-impact-assessment/scripts/fragmentation_analysis.py +141 -0
- package/skills/ecological-impact-assessment/scripts/power_analysis_baci.R +274 -0
- package/skills/ecosystem-services-assessment/SKILL.md +125 -0
- package/skills/ecosystem-services-assessment/examples/example-prompts.md +24 -0
- package/skills/ecosystem-services-assessment/resources/es-indicator-reference.md +45 -0
- package/skills/ecosystem-services-assessment/resources/invest-parameter-guide.md +86 -0
- package/skills/ecosystem-services-assessment/resources/rusle-coefficients.md +88 -0
- package/skills/ecosystem-services-assessment/scripts/__pycache__/compute_es.cpython-311.pyc +0 -0
- package/skills/ecosystem-services-assessment/scripts/compute_es.py +189 -0
- package/skills/ecosystem-services-assessment/scripts/tradeoff_analysis.R +161 -0
- package/skills/environmental-time-series/SKILL.md +125 -0
- package/skills/environmental-time-series/examples/example-prompts.md +33 -0
- package/skills/environmental-time-series/resources/anomaly-indices-reference.md +88 -0
- package/skills/environmental-time-series/resources/bfast-parameter-guide.md +69 -0
- package/skills/environmental-time-series/scripts/__pycache__/recovery_trajectory.cpython-311.pyc +0 -0
- package/skills/environmental-time-series/scripts/__pycache__/trend_analysis.cpython-311.pyc +0 -0
- package/skills/environmental-time-series/scripts/recovery_trajectory.R +305 -0
- package/skills/environmental-time-series/scripts/recovery_trajectory.py +178 -0
- package/skills/environmental-time-series/scripts/trend_analysis.R +192 -0
- package/skills/environmental-time-series/scripts/trend_analysis.py +184 -0
- package/skills/geoprocessing-for-ecology/SKILL.md +123 -0
- package/skills/geoprocessing-for-ecology/examples/example-prompts.md +32 -0
- package/skills/geoprocessing-for-ecology/resources/crs-reference.md +62 -0
- package/skills/geoprocessing-for-ecology/resources/global-predictor-sources.md +331 -0
- package/skills/geoprocessing-for-ecology/resources/resampling-methods.md +57 -0
- package/skills/geoprocessing-for-ecology/scripts/__pycache__/download_predictors.cpython-311.pyc +0 -0
- package/skills/geoprocessing-for-ecology/scripts/download_predictors.R +239 -0
- package/skills/geoprocessing-for-ecology/scripts/download_predictors.py +379 -0
- package/skills/geoprocessing-for-ecology/scripts/stack_and_extract.R +224 -0
- package/skills/geoprocessing-for-ecology/scripts/stack_and_extract.py +172 -0
- package/skills/landscape-connectivity/SKILL.md +170 -0
- package/skills/landscape-connectivity/examples/example-prompts.md +96 -0
- package/skills/landscape-connectivity/examples/jaguar_mesoamerica_corridor_example.md +271 -0
- package/skills/landscape-connectivity/resources/circuitscape-parameter-guide.md +155 -0
- package/skills/landscape-connectivity/resources/graph-theory-for-ecology.md +134 -0
- package/skills/landscape-connectivity/resources/resistance-surface-guide.md +141 -0
- package/skills/landscape-connectivity/scripts/connectivity_analysis.py +387 -0
- package/skills/landscape-connectivity/scripts/connectivity_metrics.R +274 -0
- package/skills/landscape-connectivity/scripts/resistance_surface.R +239 -0
- package/skills/model-validation-and-uncertainty/SKILL.md +131 -0
- package/skills/model-validation-and-uncertainty/examples/example-prompts.md +30 -0
- package/skills/model-validation-and-uncertainty/resources/extrapolation-risk-guide.md +236 -0
- package/skills/model-validation-and-uncertainty/resources/metric-selection-guide.md +52 -0
- package/skills/model-validation-and-uncertainty/resources/threshold-selection-guide.md +64 -0
- package/skills/model-validation-and-uncertainty/scripts/__pycache__/validate_model.cpython-311.pyc +0 -0
- package/skills/model-validation-and-uncertainty/scripts/extrapolation_risk.R +315 -0
- package/skills/model-validation-and-uncertainty/scripts/validate_model.py +226 -0
- package/skills/model-validation-and-uncertainty/scripts/validate_sdm.R +162 -0
- package/skills/occupancy-and-detection/SKILL.md +126 -0
- package/skills/occupancy-and-detection/examples/example-prompts.md +33 -0
- package/skills/occupancy-and-detection/resources/detection-history-format.md +100 -0
- package/skills/occupancy-and-detection/resources/occupancy-study-design.md +47 -0
- package/skills/occupancy-and-detection/scripts/__pycache__/occupancy_analysis.cpython-311.pyc +0 -0
- package/skills/occupancy-and-detection/scripts/occupancy_analysis.R +160 -0
- package/skills/occupancy-and-detection/scripts/occupancy_analysis.py +159 -0
- package/skills/population-viability-analysis/SKILL.md +161 -0
- package/skills/population-viability-analysis/examples/african_elephant_pva_example.md +266 -0
- package/skills/population-viability-analysis/examples/example-prompts.md +95 -0
- package/skills/population-viability-analysis/resources/extinction-risk-thresholds.md +128 -0
- package/skills/population-viability-analysis/resources/matrix-model-guide.md +139 -0
- package/skills/population-viability-analysis/resources/sensitivity-elasticity-reference.md +182 -0
- package/skills/population-viability-analysis/scripts/matrix_pva.R +258 -0
- package/skills/population-viability-analysis/scripts/pva_analysis.py +442 -0
- package/skills/population-viability-analysis/scripts/stochastic_pva.R +353 -0
- package/skills/predictive-modeling-best-practices/SKILL.md +136 -0
- package/skills/predictive-modeling-best-practices/examples/example-prompts.md +58 -0
- package/skills/predictive-modeling-best-practices/resources/collinearity-decision-tree.md +65 -0
- package/skills/predictive-modeling-best-practices/resources/sampling-bias-correction.md +267 -0
- package/skills/predictive-modeling-best-practices/resources/spatial-cv-guide.md +73 -0
- package/skills/predictive-modeling-best-practices/scripts/__pycache__/spatial_cv.cpython-311.pyc +0 -0
- package/skills/predictive-modeling-best-practices/scripts/collinearity_check.R +112 -0
- package/skills/predictive-modeling-best-practices/scripts/spatial_cv.py +182 -0
- package/skills/reproducible-ecology-pipeline/SKILL.md +139 -0
- package/skills/reproducible-ecology-pipeline/examples/example-prompts.md +35 -0
- package/skills/reproducible-ecology-pipeline/resources/directory-structure-template.md +94 -0
- package/skills/reproducible-ecology-pipeline/resources/params-yaml-template.yaml +84 -0
- package/skills/reproducible-ecology-pipeline/resources/reproducibility-checklist-template.md +66 -0
- package/skills/reproducible-ecology-pipeline/scripts/generate_file_manifest.py +110 -0
- package/skills/reproducible-ecology-pipeline/scripts/init_project.sh +53 -0
- package/skills/spatial-prioritization/SKILL.md +162 -0
- package/skills/spatial-prioritization/examples/biodiversity_hotspot_prioritization_example.md +289 -0
- package/skills/spatial-prioritization/examples/example-prompts.md +93 -0
- package/skills/spatial-prioritization/resources/cost-surface-reference.md +130 -0
- package/skills/spatial-prioritization/resources/marxan-vs-prioritizr-comparison.md +125 -0
- package/skills/spatial-prioritization/resources/prioritizr-formulation-guide.md +188 -0
- package/skills/spatial-prioritization/resources/representation-targets-guide.md +186 -0
- package/skills/spatial-prioritization/scripts/prioritization_sensitivity.R +320 -0
- package/skills/spatial-prioritization/scripts/run_prioritization.R +336 -0
- package/skills/species-distribution-modeling/SKILL.md +139 -0
- package/skills/species-distribution-modeling/examples/example-prompts.md +36 -0
- package/skills/species-distribution-modeling/resources/algorithm-comparison.md +25 -0
- package/skills/species-distribution-modeling/resources/calibration-area-guide.md +71 -0
- package/skills/species-distribution-modeling/resources/climate-scenario-preparation.md +170 -0
- package/skills/species-distribution-modeling/resources/maxent-calibration-guide.md +211 -0
- package/skills/species-distribution-modeling/resources/sdm-checklist.md +37 -0
- package/skills/species-distribution-modeling/scripts/predict_distribution.R +236 -0
- package/skills/species-distribution-modeling/scripts/predict_distribution.py +286 -0
- package/skills/species-distribution-modeling/scripts/prepare_future_layers.R +351 -0
- package/skills/species-distribution-modeling/scripts/project_scenarios.R +220 -0
- package/skills/species-distribution-modeling/scripts/run_ensemble_sdm.R +99 -0
- package/skills/species-distribution-modeling/scripts/sdm_pipeline.py +318 -0
- package/skills/species-distribution-modeling/scripts/tune_maxnet.R +344 -0
- package/templates/SKILL_TEMPLATE.md +225 -0
- package/templates/checklists/data-submission-checklist.md +38 -0
- package/templates/checklists/post-analysis-checklist.md +55 -0
- package/templates/checklists/pre-analysis-checklist.md +31 -0
- package/templates/prompts/debug-skill.md +47 -0
- package/templates/prompts/invoke-skill.md +34 -0
- package/templates/prompts/invoke-workflow.md +45 -0
- package/templates/reports/technical-report-template.md +80 -0
- package/templates/scripts/logger_setup.R +79 -0
- package/templates/scripts/logger_setup.py +119 -0
- package/templates/scripts/params_loader.R +28 -0
- package/templates/scripts/params_loader.py +38 -0
- package/workflows/analyze-community-structure/WORKFLOW.md +72 -0
- package/workflows/analyze-environmental-change/WORKFLOW.md +73 -0
- package/workflows/assess-ecological-impact/WORKFLOW.md +75 -0
- package/workflows/assess-ecosystem-services/WORKFLOW.md +68 -0
- package/workflows/assess-landscape-connectivity/WORKFLOW.md +84 -0
- package/workflows/build-fire-risk-map/WORKFLOW.md +79 -0
- package/workflows/produce-technical-report/WORKFLOW.md +113 -0
- package/workflows/run-camera-trap-occupancy/WORKFLOW.md +87 -0
- package/workflows/run-conservation-prioritization/WORKFLOW.md +89 -0
- package/workflows/run-multispecies-screening/WORKFLOW.md +197 -0
- package/workflows/run-occupancy-analysis/WORKFLOW.md +74 -0
- package/workflows/run-population-viability/WORKFLOW.md +90 -0
- package/workflows/run-sdm-study/WORKFLOW.md +99 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
---
|
|
2
|
+
skill_version: 1.0.0
|
|
3
|
+
<!-- [OBRIGATÓRIO] Increment this version (semver) whenever the skill content changes significantly. -->
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: [OBRIGATÓRIO — skill-id in kebab-case, must match directory name and SKILL_INDEX.json]
|
|
7
|
+
|
|
8
|
+
<!-- INSTRUCTIONS FOR SKILL AUTHORS
|
|
9
|
+
Fill in every [OBRIGATÓRIO] field. Delete all HTML comments before submitting.
|
|
10
|
+
Run the validation checklist at the bottom before opening a pull request.
|
|
11
|
+
All content must be in English.
|
|
12
|
+
No location-specific geographic references in global files.
|
|
13
|
+
-->
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Purpose
|
|
18
|
+
|
|
19
|
+
<!-- [OBRIGATÓRIO]
|
|
20
|
+
Write 2–4 sentences describing exactly what this skill does.
|
|
21
|
+
Start with "Guides the agent through..."
|
|
22
|
+
Be specific: name the methods, models, or operations covered.
|
|
23
|
+
Do NOT describe when to use it (that goes in "When to Invoke").
|
|
24
|
+
-->
|
|
25
|
+
|
|
26
|
+
[OBRIGATÓRIO — describe the skill's analytical scope]
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## When to Invoke
|
|
31
|
+
|
|
32
|
+
<!-- [OBRIGATÓRIO]
|
|
33
|
+
List the situations that should trigger this skill as bullet points.
|
|
34
|
+
Each bullet is a concrete scenario, not a keyword.
|
|
35
|
+
These scenarios must be consistent with the trigger_keywords in SKILL_INDEX.json.
|
|
36
|
+
Use plain language that matches how users phrase requests.
|
|
37
|
+
-->
|
|
38
|
+
|
|
39
|
+
Invoke this skill when:
|
|
40
|
+
|
|
41
|
+
- [OBRIGATÓRIO — scenario 1]
|
|
42
|
+
- [OBRIGATÓRIO — scenario 2]
|
|
43
|
+
- [OBRIGATÓRIO — scenario 3]
|
|
44
|
+
- [add more as needed]
|
|
45
|
+
|
|
46
|
+
**trigger_keywords** (must match `skills/SKILL_INDEX.json`):
|
|
47
|
+
`[keyword1]`, `[keyword2]`, `[keyword3]`
|
|
48
|
+
|
|
49
|
+
<!-- List all trigger_keywords from SKILL_INDEX.json here so they stay in sync. -->
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Inputs
|
|
54
|
+
|
|
55
|
+
<!-- [OBRIGATÓRIO]
|
|
56
|
+
List every input the skill needs.
|
|
57
|
+
"Required" = skill cannot run without it.
|
|
58
|
+
"Conditional" = required only under specific conditions (explain in Notes).
|
|
59
|
+
"Recommended" = skill produces lower-quality output without it.
|
|
60
|
+
"Optional" = enhances output but not needed.
|
|
61
|
+
-->
|
|
62
|
+
|
|
63
|
+
| Input | Format | Required |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| [OBRIGATÓRIO — input name] | [format: CSV, GeoTIFF, SHP, GPKG, RData, etc.] | Required / Conditional / Recommended / Optional |
|
|
66
|
+
| [input name] | [format] | Required |
|
|
67
|
+
| [input name] | [format] | Optional |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Outputs
|
|
72
|
+
|
|
73
|
+
<!-- [OBRIGATÓRIO]
|
|
74
|
+
List every file this skill produces.
|
|
75
|
+
Use snake_case filenames with extensions.
|
|
76
|
+
The primary outputs must match primary_outputs in SKILL_INDEX.json.
|
|
77
|
+
-->
|
|
78
|
+
|
|
79
|
+
| Output | Description |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `[OBRIGATÓRIO — filename.ext]` | [what this file contains] |
|
|
82
|
+
| `[filename.ext]` | [description] |
|
|
83
|
+
| `[report_name.md]` | [full narrative report] |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Steps
|
|
88
|
+
|
|
89
|
+
<!-- [OBRIGATÓRIO]
|
|
90
|
+
Numbered, sequential steps the agent must follow.
|
|
91
|
+
Each step should be a complete, unambiguous instruction.
|
|
92
|
+
Reference specific script names where applicable.
|
|
93
|
+
Include the exact command or function call when precision matters.
|
|
94
|
+
Minimum 4 steps.
|
|
95
|
+
-->
|
|
96
|
+
|
|
97
|
+
1. **[OBRIGATÓRIO — step title]**
|
|
98
|
+
[Detailed instruction. Name the script, function, or tool to use. Specify parameters.]
|
|
99
|
+
|
|
100
|
+
2. **[step title]**
|
|
101
|
+
[Instruction]
|
|
102
|
+
|
|
103
|
+
3. **[step title]**
|
|
104
|
+
[Instruction]
|
|
105
|
+
|
|
106
|
+
4. **Validate outputs**
|
|
107
|
+
Confirm that all files listed in the Outputs table were created and are non-empty.
|
|
108
|
+
Check file sizes are above 100 bytes. Record any anomalies in `decision_log.md`.
|
|
109
|
+
|
|
110
|
+
5. **Record decisions**
|
|
111
|
+
Append to `decision_log.md` following the format defined in `AGENT_CONTEXT.md § 7`.
|
|
112
|
+
|
|
113
|
+
<!-- Add more steps as needed. Do not omit the validation and decision-logging steps. -->
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Decision Points
|
|
118
|
+
|
|
119
|
+
<!-- [OBRIGATÓRIO]
|
|
120
|
+
List every condition that requires a non-default decision.
|
|
121
|
+
"Condition" = a measurable or observable state.
|
|
122
|
+
"Diagnosis" = what the condition means.
|
|
123
|
+
"Recommended Action" = what the agent should do.
|
|
124
|
+
Minimum 3 rows.
|
|
125
|
+
Must be consistent with decision_points in SKILL_INDEX.json.
|
|
126
|
+
-->
|
|
127
|
+
|
|
128
|
+
| Condition | Diagnosis | Recommended Action |
|
|
129
|
+
|---|---|---|
|
|
130
|
+
| [OBRIGATÓRIO — e.g., n < 10] | [e.g., insufficient data for reliable modelling] | [e.g., do not fit model; communicate limitation to user] |
|
|
131
|
+
| [condition] | [diagnosis] | [action] |
|
|
132
|
+
| [condition] | [diagnosis] | [action] |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Key Decisions to Document
|
|
137
|
+
|
|
138
|
+
<!-- [OBRIGATÓRIO]
|
|
139
|
+
List the decisions that MUST be recorded in decision_log.md.
|
|
140
|
+
These are choices that affect reproducibility or interpretation.
|
|
141
|
+
Phrase as questions the agent answered during analysis.
|
|
142
|
+
-->
|
|
143
|
+
|
|
144
|
+
Record the following in `decision_log.md` after running this skill:
|
|
145
|
+
|
|
146
|
+
- [OBRIGATÓRIO — e.g., Which predictor variables were retained and why?]
|
|
147
|
+
- [e.g., Which model family was selected and what diagnostic justified it?]
|
|
148
|
+
- [e.g., Were any records excluded? How many and for what reason?]
|
|
149
|
+
- [add more as needed]
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Tools and Libraries
|
|
154
|
+
|
|
155
|
+
<!-- [OBRIGATÓRIO — fill in at least one language block]
|
|
156
|
+
List packages, not functions.
|
|
157
|
+
Separate R and Python. Add CLI tools if applicable.
|
|
158
|
+
Keep version constraints only when a specific version is required.
|
|
159
|
+
-->
|
|
160
|
+
|
|
161
|
+
**R**
|
|
162
|
+
```r
|
|
163
|
+
# [OBRIGATÓRIO — list R packages]
|
|
164
|
+
library(package1) # purpose
|
|
165
|
+
library(package2) # purpose
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Python**
|
|
169
|
+
```python
|
|
170
|
+
# [OBRIGATÓRIO — list Python packages]
|
|
171
|
+
import package1 # purpose
|
|
172
|
+
import package2 # purpose
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**CLI** *(if applicable)*
|
|
176
|
+
```bash
|
|
177
|
+
# [optional — list CLI tools, e.g., GDAL, csvkit]
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Resources
|
|
183
|
+
|
|
184
|
+
<!-- [OBRIGATÓRIO]
|
|
185
|
+
Link to every file in this skill's resources/ directory.
|
|
186
|
+
Minimum 2 resources.
|
|
187
|
+
Use relative paths from the repository root.
|
|
188
|
+
-->
|
|
189
|
+
|
|
190
|
+
- [`skills/[skill-id]/resources/[filename].md`](resources/[filename].md) — [one-line description]
|
|
191
|
+
- [`skills/[skill-id]/resources/[filename].md`](resources/[filename].md) — [one-line description]
|
|
192
|
+
|
|
193
|
+
<!-- Add more resource links as needed. -->
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Notes
|
|
198
|
+
|
|
199
|
+
<!-- [OBRIGATÓRIO]
|
|
200
|
+
List caveats, common pitfalls, and edge cases.
|
|
201
|
+
Be specific. Vague warnings are not useful.
|
|
202
|
+
Minimum 3 bullet points.
|
|
203
|
+
-->
|
|
204
|
+
|
|
205
|
+
- **[OBRIGATÓRIO — pitfall or caveat]**: [specific explanation of the problem and how to avoid it]
|
|
206
|
+
- **[pitfall]**: [explanation]
|
|
207
|
+
- **[pitfall]**: [explanation]
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Validation Checklist
|
|
212
|
+
|
|
213
|
+
Before submitting this skill, verify:
|
|
214
|
+
|
|
215
|
+
- [ ] `trigger_keywords` added to `skills/SKILL_INDEX.json`
|
|
216
|
+
- [ ] At least 2 files in `resources/`
|
|
217
|
+
- [ ] At least 1 script in `scripts/` (R or Python)
|
|
218
|
+
- [ ] At least 3 examples in `examples/example-prompts.md`
|
|
219
|
+
- [ ] Skill added to `CATALOG.md`
|
|
220
|
+
- [ ] Skill added to `README.md`
|
|
221
|
+
- [ ] `skill_version` field present in YAML header
|
|
222
|
+
- [ ] `decision_points` in `SKILL_INDEX.json` match the Decision Points table above
|
|
223
|
+
- [ ] All `[OBRIGATÓRIO]` placeholders replaced
|
|
224
|
+
- [ ] All HTML comments deleted
|
|
225
|
+
- [ ] `bash tests/ci_check.sh` exits with code 0
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Data Submission Checklist (for Zenodo / OSF / figshare)
|
|
2
|
+
|
|
3
|
+
## Before Uploading
|
|
4
|
+
|
|
5
|
+
- [ ] All raw data files in standard open formats (CSV, GeoTIFF, GPKG — not proprietary)
|
|
6
|
+
- [ ] All files named meaningfully (no "data_final_v2_USE_THIS.csv")
|
|
7
|
+
- [ ] README.md describes every file: what it contains, what each column means, units
|
|
8
|
+
- [ ] Taxonomy validated against a standard backbone (version stated)
|
|
9
|
+
- [ ] Darwin Core fields used for biodiversity occurrence data
|
|
10
|
+
- [ ] Sensitive species data: coordinate uncertainty added or location generalised per GBIF policy
|
|
11
|
+
- [ ] Coordinate reference system stated for all spatial files
|
|
12
|
+
- [ ] File checksums computed (MD5 or SHA256) and listed in README
|
|
13
|
+
|
|
14
|
+
## Metadata
|
|
15
|
+
|
|
16
|
+
- [ ] Title: descriptive, includes taxon, region, and type of data
|
|
17
|
+
- [ ] Authors and ORCIDs: complete and correct
|
|
18
|
+
- [ ] DOI of associated publication (if available): linked
|
|
19
|
+
- [ ] License: explicitly stated (CC BY 4.0 recommended for open science)
|
|
20
|
+
- [ ] Keywords: 5–10 relevant terms
|
|
21
|
+
- [ ] Temporal coverage: start date – end date
|
|
22
|
+
- [ ] Spatial coverage: bounding box coordinates
|
|
23
|
+
|
|
24
|
+
## For Occurrence Data Specifically
|
|
25
|
+
|
|
26
|
+
- [ ] All Darwin Core terms documented
|
|
27
|
+
- [ ] basisOfRecord populated
|
|
28
|
+
- [ ] coordinateUncertaintyInMeters populated where known
|
|
29
|
+
- [ ] geodeticDatum = "WGS84" confirmed
|
|
30
|
+
- [ ] License per record populated if records from multiple sources
|
|
31
|
+
|
|
32
|
+
## After Uploading
|
|
33
|
+
|
|
34
|
+
- [ ] DOI resolved and landing page accessible
|
|
35
|
+
- [ ] All files download correctly
|
|
36
|
+
- [ ] README renders correctly on the platform
|
|
37
|
+
- [ ] DOI included in manuscript data availability statement
|
|
38
|
+
- [ ] Zenodo/OSF record linked in the code repository README
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Post-Analysis Checklist
|
|
2
|
+
|
|
3
|
+
Complete before finalising any report or publication.
|
|
4
|
+
|
|
5
|
+
## Statistical Reporting
|
|
6
|
+
|
|
7
|
+
- [ ] All p-values accompanied by effect sizes and CIs
|
|
8
|
+
- [ ] Sample sizes (n) reported for all comparisons
|
|
9
|
+
- [ ] Test statistics reported (F, t, χ², H, Z)
|
|
10
|
+
- [ ] Model performance reported for train, CV, AND test (never only training)
|
|
11
|
+
- [ ] Multiple comparisons: correction applied and method stated (Bonferroni, FDR)
|
|
12
|
+
- [ ] Confidence intervals: method stated (Wald, profile likelihood, bootstrap)
|
|
13
|
+
|
|
14
|
+
## Model Reporting
|
|
15
|
+
|
|
16
|
+
- [ ] Algorithm(s) and version(s) stated
|
|
17
|
+
- [ ] All hyperparameters reported (not just "default settings")
|
|
18
|
+
- [ ] CV strategy reported (k, block size for spatial CV)
|
|
19
|
+
- [ ] Threshold selection method and value reported
|
|
20
|
+
- [ ] Uncertainty quantification described and reported
|
|
21
|
+
- [ ] Variable importance reported for all predictors
|
|
22
|
+
|
|
23
|
+
## Spatial Outputs
|
|
24
|
+
|
|
25
|
+
- [ ] CRS and resolution stated for all rasters
|
|
26
|
+
- [ ] Spatial extent (bounding box or description) stated
|
|
27
|
+
- [ ] Area estimates in appropriate units (ha, km²)
|
|
28
|
+
- [ ] MESS / ExDet applied if predicting outside training range
|
|
29
|
+
- [ ] All maps include scale bar, north arrow, and legend
|
|
30
|
+
|
|
31
|
+
## Figures
|
|
32
|
+
|
|
33
|
+
- [ ] All figures have informative captions (not just "Figure 1")
|
|
34
|
+
- [ ] NMDS plots include stress value
|
|
35
|
+
- [ ] ROC curves include AUC
|
|
36
|
+
- [ ] Calibration plots include calibration slope
|
|
37
|
+
- [ ] Colour palettes are colourblind-friendly (avoid red-green alone)
|
|
38
|
+
- [ ] Figure resolution ≥ 300 dpi for publication
|
|
39
|
+
|
|
40
|
+
## Data and Code Availability
|
|
41
|
+
|
|
42
|
+
- [ ] Raw data archived with DOI (Zenodo, OSF, figshare)
|
|
43
|
+
- [ ] Code archived with DOI and linked to specific commit
|
|
44
|
+
- [ ] Data availability statement written
|
|
45
|
+
- [ ] Code availability statement written
|
|
46
|
+
- [ ] License specified for both data and code
|
|
47
|
+
- [ ] README in data/code archive explains how to reproduce the analysis
|
|
48
|
+
|
|
49
|
+
## Reporting Standards Compliance
|
|
50
|
+
|
|
51
|
+
- [ ] SDM: ODMAP checklist completed (Zurell et al. 2020)
|
|
52
|
+
- [ ] Occupancy: MacKenzie-Bailey GoF reported
|
|
53
|
+
- [ ] Impact assessment: BACI design requirements verified
|
|
54
|
+
- [ ] Community ecology: PERMDISP run before interpreting PERMANOVA
|
|
55
|
+
- [ ] ES assessment: method and data source per service documented
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Pre-Analysis Checklist
|
|
2
|
+
|
|
3
|
+
Complete before starting any quantitative ecology analysis.
|
|
4
|
+
|
|
5
|
+
## Data
|
|
6
|
+
|
|
7
|
+
- [ ] Raw data archived in `data/raw/` and not modified
|
|
8
|
+
- [ ] Data provenance documented (source, version, DOI, access date, license)
|
|
9
|
+
- [ ] `ecological-data-foundation` skill applied; `qa_report.md` reviewed
|
|
10
|
+
- [ ] Final cleaned dataset confirmed and saved
|
|
11
|
+
|
|
12
|
+
## Spatial
|
|
13
|
+
|
|
14
|
+
- [ ] Project CRS defined and documented in `params.yaml`
|
|
15
|
+
- [ ] All layers reprojected to project CRS
|
|
16
|
+
- [ ] Raster stack aligned (same extent, resolution, CRS)
|
|
17
|
+
- [ ] Study area polygon finalised
|
|
18
|
+
|
|
19
|
+
## Modeling
|
|
20
|
+
|
|
21
|
+
- [ ] Collinearity assessed; final predictor set documented
|
|
22
|
+
- [ ] CV strategy defined (spatial or temporal if applicable)
|
|
23
|
+
- [ ] Candidate model set justified (not purely data-driven)
|
|
24
|
+
- [ ] Primary evaluation metric pre-specified
|
|
25
|
+
|
|
26
|
+
## Reproducibility
|
|
27
|
+
|
|
28
|
+
- [ ] `params.yaml` complete (no hard-coded values remain in scripts)
|
|
29
|
+
- [ ] Random seeds set in `params.yaml`
|
|
30
|
+
- [ ] `git init` and initial commit done
|
|
31
|
+
- [ ] `decision_log.md` opened and dated
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Prompt Template: Debug or Review Skill Output
|
|
2
|
+
|
|
3
|
+
Use when the output from a skill step needs to be reviewed, corrected, or improved.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
Review the output of the <skill-name> step.
|
|
7
|
+
|
|
8
|
+
Output file(s):
|
|
9
|
+
- <path to output>
|
|
10
|
+
|
|
11
|
+
Issues observed:
|
|
12
|
+
- <describe what looks wrong or unexpected>
|
|
13
|
+
|
|
14
|
+
Expected behaviour:
|
|
15
|
+
- <describe what the output should look like>
|
|
16
|
+
|
|
17
|
+
Please:
|
|
18
|
+
1. Diagnose the issue
|
|
19
|
+
2. Propose a fix
|
|
20
|
+
3. Apply the fix and regenerate the affected output
|
|
21
|
+
4. Add an entry to decision_log.md explaining what was wrong and how it was fixed
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Review the output of the ecological-data-foundation step.
|
|
28
|
+
|
|
29
|
+
Output file: data/processed/data_clean.csv (n = 1,240)
|
|
30
|
+
Output file: data/processed/flagged_records.csv (n = 2)
|
|
31
|
+
|
|
32
|
+
Issues observed:
|
|
33
|
+
- Only 2 records were flagged, but I can see at least 50 records with
|
|
34
|
+
latitude values that look like they may be DMS format (e.g., "-15766"
|
|
35
|
+
instead of "-15.766").
|
|
36
|
+
- The QA_status column contains only "OK" and "COORD_ZERO".
|
|
37
|
+
|
|
38
|
+
Expected behaviour:
|
|
39
|
+
- DMS-format coordinates should be detected and flagged as COORD_FORMAT_ERROR
|
|
40
|
+
or converted to decimal degrees if the conversion is unambiguous.
|
|
41
|
+
|
|
42
|
+
Please:
|
|
43
|
+
1. Diagnose why these records passed the coordinate range check
|
|
44
|
+
2. Add a DMS detection step
|
|
45
|
+
3. Re-run cleaning and update data_clean.csv and qa_report.md
|
|
46
|
+
4. Add entry to decision_log.md
|
|
47
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Prompt Template: Invoke a Single Skill
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
Load skill: <skill-name>
|
|
5
|
+
Task: <describe the specific task>
|
|
6
|
+
|
|
7
|
+
Inputs:
|
|
8
|
+
- <file or data description>
|
|
9
|
+
- <file or data description>
|
|
10
|
+
|
|
11
|
+
Requirements:
|
|
12
|
+
- <specific requirement or constraint>
|
|
13
|
+
- <specific requirement or constraint>
|
|
14
|
+
|
|
15
|
+
Output: <list expected output files or formats>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
Load skill: ecological-data-foundation
|
|
22
|
+
Task: Clean and validate mammal occurrence data for the Pantanal.
|
|
23
|
+
|
|
24
|
+
Inputs:
|
|
25
|
+
- data/raw/mammals_raw.csv (GBIF download, Darwin Core format)
|
|
26
|
+
- data/spatial/pantanal_boundary.shp (study area)
|
|
27
|
+
|
|
28
|
+
Requirements:
|
|
29
|
+
- Use CoordinateCleaner flags: capitals, centroids, zeros, validity
|
|
30
|
+
- Taxonomy: GBIF Backbone 2023
|
|
31
|
+
- Remove records with coordinate uncertainty > 10 km
|
|
32
|
+
|
|
33
|
+
Output: data/processed/data_clean.csv, data/processed/qa_report.md
|
|
34
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Prompt Template: Invoke a Workflow
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
Run workflow: <workflow-name>
|
|
5
|
+
|
|
6
|
+
Species / System: <target species or ecological system>
|
|
7
|
+
Study area: <geographic scope>
|
|
8
|
+
Temporal scope: <date range or time points>
|
|
9
|
+
|
|
10
|
+
Inputs:
|
|
11
|
+
- <primary data file>
|
|
12
|
+
- <spatial layer>
|
|
13
|
+
- <additional data>
|
|
14
|
+
|
|
15
|
+
Key parameters:
|
|
16
|
+
- <parameter name>: <value>
|
|
17
|
+
- <parameter name>: <value>
|
|
18
|
+
|
|
19
|
+
Output directory: <path>
|
|
20
|
+
Report format: <markdown / PDF / DOCX>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Run workflow: run-sdm-study
|
|
27
|
+
|
|
28
|
+
Species: Giant anteater (Myrmecophaga tridactyla)
|
|
29
|
+
Study area: Cerrado biome + 200 km buffer
|
|
30
|
+
Temporal scope: Current (WorldClim 1970–2000) + SSP2-4.5 2050
|
|
31
|
+
|
|
32
|
+
Inputs:
|
|
33
|
+
- data/processed/data_clean.csv (n = 412 occurrences after cleaning)
|
|
34
|
+
- data/predictors/cerrado_stack.tif (bio1, bio4, bio12, bio15, NDVI, slope)
|
|
35
|
+
- data/spatial/cerrado_buffer.shp
|
|
36
|
+
|
|
37
|
+
Key parameters:
|
|
38
|
+
- Spatial thinning: 10 km
|
|
39
|
+
- CV blocks: 5, size 400 km
|
|
40
|
+
- Algorithms: MaxEnt, BRT, Random Forest
|
|
41
|
+
- Threshold: MaxTSS
|
|
42
|
+
|
|
43
|
+
Output directory: outputs/anteater_sdm/
|
|
44
|
+
Report format: markdown
|
|
45
|
+
```
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Technical Report — [Study Title]
|
|
2
|
+
|
|
3
|
+
**Authors:** [Names]
|
|
4
|
+
**Date:** [YYYY-MM-DD]
|
|
5
|
+
**Version:** [1.0]
|
|
6
|
+
**Repository:** [URL]
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1. Introduction
|
|
11
|
+
|
|
12
|
+
[Context, study objectives, and research questions.]
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 2. Methods
|
|
17
|
+
|
|
18
|
+
### 2.1 Study Area
|
|
19
|
+
[Description of the study area, geographic extent, and key environmental characteristics.]
|
|
20
|
+
|
|
21
|
+
### 2.2 Data Sources
|
|
22
|
+
| Dataset | Source | Resolution / Scale | Date | DOI |
|
|
23
|
+
|---------|--------|-------------------|------|-----|
|
|
24
|
+
| | | | | |
|
|
25
|
+
|
|
26
|
+
### 2.3 Data Preparation
|
|
27
|
+
[Describe cleaning steps, QA procedures, and key decisions. Reference qa_report.md.]
|
|
28
|
+
|
|
29
|
+
### 2.4 [Analysis Approach — e.g., Species Distribution Modeling]
|
|
30
|
+
[Full methods description following relevant reporting standard (ODMAP, etc.).]
|
|
31
|
+
|
|
32
|
+
### 2.5 Model Validation and Uncertainty
|
|
33
|
+
[Describe validation strategy, metrics, and uncertainty quantification.]
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 3. Results
|
|
38
|
+
|
|
39
|
+
### 3.1 Data Summary
|
|
40
|
+
[Number of records after cleaning, spatial extent covered, etc.]
|
|
41
|
+
|
|
42
|
+
### 3.2 Model Performance
|
|
43
|
+
| Metric | Training | CV | Test |
|
|
44
|
+
|--------|---------|-----|------|
|
|
45
|
+
| AUC-ROC | | | |
|
|
46
|
+
| TSS | | | |
|
|
47
|
+
|
|
48
|
+
### 3.3 Main Findings
|
|
49
|
+
[Primary results with full statistical reporting: estimate (95% CI), test statistic, p-value, effect size.]
|
|
50
|
+
|
|
51
|
+
### 3.4 Uncertainty
|
|
52
|
+
[Description of uncertainty sources and their magnitude.]
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 4. Discussion
|
|
57
|
+
|
|
58
|
+
[Interpretation, comparison with literature, limitations, management implications.]
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 5. Conclusions
|
|
63
|
+
|
|
64
|
+
[Concise summary of main findings and recommendations.]
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 6. References
|
|
69
|
+
|
|
70
|
+
[Full citations in standard format.]
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Appendix A: Reproducibility Package
|
|
75
|
+
|
|
76
|
+
- **params.yaml:** [link or path]
|
|
77
|
+
- **Code repository:** [URL with commit hash or tag]
|
|
78
|
+
- **Raw data archive:** [Zenodo DOI or institutional repository URL]
|
|
79
|
+
- **Software environment:** See `logs/software_environment.txt`
|
|
80
|
+
- **Reproducibility checklist:** See `logs/reproducibility_checklist.md`
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# logger_setup.R — Structured logging template for ecological-agent-skills
|
|
2
|
+
# Usage: source("../../templates/scripts/logger_setup.R"); setup_logger("skill-name")
|
|
3
|
+
# Requires: futile.logger (install.packages("futile.logger"))
|
|
4
|
+
|
|
5
|
+
suppressPackageStartupMessages(library(futile.logger))
|
|
6
|
+
|
|
7
|
+
#' Initialise logger for a skill script
|
|
8
|
+
#'
|
|
9
|
+
#' Sets up simultaneous console + file handlers.
|
|
10
|
+
#' Log file: logs/skill_{name}_{timestamp}.log (relative to working directory)
|
|
11
|
+
#'
|
|
12
|
+
#' @param skill_name Short identifier, e.g. "sdm", "occupancy"
|
|
13
|
+
#' @param log_dir Directory for log files (created if absent)
|
|
14
|
+
#' @param level Futile.logger threshold: INFO, WARN, ERROR
|
|
15
|
+
setup_logger <- function(skill_name = "eco-skill",
|
|
16
|
+
log_dir = "logs",
|
|
17
|
+
level = INFO) {
|
|
18
|
+
dir.create(log_dir, recursive = TRUE, showWarnings = FALSE)
|
|
19
|
+
ts <- format(Sys.time(), "%Y%m%d_%H%M%S")
|
|
20
|
+
log_file <- file.path(log_dir, paste0("skill_", skill_name, "_", ts, ".log"))
|
|
21
|
+
|
|
22
|
+
# Console layout: coloured, compact
|
|
23
|
+
flog.layout(layout.format("[~t] [~l] ~m"), name = ROOT)
|
|
24
|
+
|
|
25
|
+
# File appender: full timestamp, same format
|
|
26
|
+
flog.appender(appender.tee(log_file), name = ROOT)
|
|
27
|
+
|
|
28
|
+
flog.threshold(level, name = ROOT)
|
|
29
|
+
|
|
30
|
+
flog.info("Logger initialised | skill=%s | log_file=%s", skill_name, log_file)
|
|
31
|
+
invisible(log_file)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# ── Wrapper functions ────────────────────────────────────────────────────────
|
|
35
|
+
|
|
36
|
+
#' Log an informational message
|
|
37
|
+
log_info <- function(...) flog.info(...)
|
|
38
|
+
|
|
39
|
+
#' Log a warning
|
|
40
|
+
log_warn <- function(...) flog.warn(...)
|
|
41
|
+
|
|
42
|
+
#' Log an error (does NOT stop execution — call stop() afterwards if needed)
|
|
43
|
+
log_error <- function(...) flog.error(...)
|
|
44
|
+
|
|
45
|
+
#' Mark the start of a numbered processing step
|
|
46
|
+
#'
|
|
47
|
+
#' @param step_number Integer step counter
|
|
48
|
+
#' @param description Short description of the step
|
|
49
|
+
log_step <- function(step_number, description) {
|
|
50
|
+
flog.info("── STEP %d: %s", step_number, description)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#' Record an analytical decision with justification
|
|
54
|
+
#'
|
|
55
|
+
#' @param variable Name of the parameter / variable
|
|
56
|
+
#' @param value Value chosen
|
|
57
|
+
#' @param rationale One-sentence justification
|
|
58
|
+
log_decision <- function(variable, value, rationale) {
|
|
59
|
+
flog.info("DECISION | %s = %s | rationale: %s", variable, value, rationale)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#' Standard actionable error message
|
|
63
|
+
#'
|
|
64
|
+
#' @param step Name of the failing step
|
|
65
|
+
#' @param error_msg The error message (from conditionMessage(e))
|
|
66
|
+
#' @param probable_cause One-sentence explanation of likely cause
|
|
67
|
+
#' @param check_this What the user should check
|
|
68
|
+
#' @param prior_skill Which upstream skill should have produced the input
|
|
69
|
+
log_actionable_error <- function(step, error_msg, probable_cause,
|
|
70
|
+
check_this, prior_skill = NULL) {
|
|
71
|
+
prior_line <- if (!is.null(prior_skill))
|
|
72
|
+
paste0("\n Skill anterior que deveria ter produzido este input: ", prior_skill)
|
|
73
|
+
else ""
|
|
74
|
+
|
|
75
|
+
flog.error(
|
|
76
|
+
"[ERROR] Falha em %s: %s\n Causa provável: %s\n Verifique: %s%s",
|
|
77
|
+
step, error_msg, probable_cause, check_this, prior_line
|
|
78
|
+
)
|
|
79
|
+
}
|