skill
saline-intrusion-coastal-farming-agent-skill
πΎπ Coastal Saline-Intrusion Forecasting | Production-grade agro-hydrology & soil-washing planning engine. Models Maas-Hoffman yield loss, leaching needs, and crop calendar shifts via crawl4ai knowle
Set up
Skills are installed by placing their folder where your agent loads skills.
The download comes from github.com/dungnotnull/saline-intrusion-coastal-farming-agent-skill itself, not from our server, so what you get is exactly what its author published.
Install instructions come from the README
README
synced Oct 22, 2026saline-intrusion-coastal-farming
Coastal Saline-Intrusion Risk Forecasting & Soil-Washing Planning for Farms
A professional-grade, open-source Claude Code harness for Coastal Agro-Hydrology & Salinity Management. It gathers real-time authoritative data, applies recognized domain methods (Maas-Hoffman crop salt-tolerance model, leaching requirement formula, soil salinity classification), integrates academic research via a self-updating knowledge base, and delivers evidence-backed, risk-disclosed outputs in Vietnamese or English.
v2.0.0 adds a modular skill-registry architecture (
saline_skill/): a typed tool framework, lifecycle hooks, a chain-of-thought router, type-safe configuration, and modular directories (scripts/,references/,assets/,config/). SeeSKILL.mdfor the registry specification.
Features
- π Saline-Intrusion Risk Forecasting β 5-factor intrusion risk model (tidal amplitude, rainfall deficit, groundwater salinity, coastal distance, sea-level rise)
- πΎ Crop Salt-Tolerance Modeling β Maas-Hoffman threshold-slope model for 18 crops with weighted root-zone ECe
- π§ Soil Classification β Saline / Sodic / Saline-Sodic using ECe (4 dS/m), ESP (15%), and pH thresholds
- π§ Leaching Requirement β LR = EC_iw / (5 Γ EC_e β EC_iw) with full reclamation plan (water volume, gypsum, drainage)
- π Sowing Calendar Optimization β shift sowing off the peak-salinity window with cultivar substitution
- π Self-Improving Knowledge Base β weekly crawl (ArXiv + Semantic Scholar + RSS) with SHA256 dedup + composite scoring
- π§© Modular Skill Registry β register / resolve / execute / validate skills with JSON I/O schemas
- πͺ Lifecycle Hooks β
pre_run,pre/post_skill,on_error,on_degradation,on_gate_fail,post_run(a failing hook never crashes the run) - π§ Chain-of-Thought Router β adapts execution order to state (reuse, skip, level-4 short-circuit)
- βοΈ Type-safe Config β env-first, YAML defaults, system-wide feature flags
- πͺ 10 Quality Gates β U1βU6 (universal) + G1βG4 (domain) with auto-fix and 2-retry max
- πΆ 5-Level Graceful Degradation β Tier AβE fallback with explicit LIMITATION notices; tools never raise
- π Bilingual β automatic Vietnamese/English detection (gate U4)
- β Production Testing β 5 E2E scenarios + 4 validators (315 checks) + 24 package unit tests
Repository layout
saline-intrusion-coastal-farming/
βββ saline_skill/ # Modular agent harness (registry, schemas, hooks, router, tools, agents, harness)
β βββ tools/ # Typed tools: web_search, maas_hoffman, leaching_requirement, intrusion_score, ...
β βββ agents/ # 5 domain sub-agents mirroring skills/sub-*.md
βββ config/ # Type-safe config: settings.py, default.yaml, feature flags
βββ scripts/ # Automation: run_harness.py, seed_knowledge_base.py, setup.py, validate_architecture.py
βββ references/ # Domain knowledge + prompt base-templates (RAG grounding)
βββ assets/ # JSON I/O schemas, tool registry schema, system diagram
βββ skills/ # Markdown skill specs: main.md + 5 sub-skills
βββ tools/ # Knowledge crawl pipeline + validators
βββ tests/ # E2E scenarios + package unit tests
βββ SKILL.md # Skill-registry specification (registration/resolution/execution/validation)
βββ SECOND-KNOWLEDGE-BRAIN.md # Living knowledge base
βββ PROJECT-detail.md # Full technical specification
Installation
git clone <repo-url>
cd 162-saline-intrusion-coastal-farming
python -m venv .venv
source .venv/bin/activate # .venv\Scripts\activate on Windows
pip install -r requirements.txt
pip install pytest pytest-cov # dev
The harness is dependency-light: requests, feedparser, and python-dateutil are only used by the
live-data tools and the knowledge pipeline; all tools degrade gracefully when those (or network) are
unavailable. PyYAML is optional (enables config/default.yaml).
Usage
As a Claude Code Skill
/saline-intrusion-coastal-farming Analyze saline intrusion risk for rice paddy at Thanh Phu, Ben Tre, Vietnam
The harness executes 6 steps: requirements β evidence β core-analysis β knowledge β advisor β quality gate.
As a CLI / library
python scripts/run_harness.py \
--query "Analyze saline intrusion risk for rice farm at An Vinh, Soc Trang" \
--location "An Vinh, Soc Trang" --distance-km 2.5 --crop rice \
--soil-ece 5.2 --soil-esp 8 --soil-ph 7.8 --irrigation-ec 1.2 \
--tidal-amplitude 2.0 --gw-ec 3.0 --et0 4.5 --season-days 90 \
--sowing-date 2026-05-01 --peak-start 2026-03-01 --peak-end 2026-04-30 \
--json report.json
Programmatic:
from saline_skill.harness import Harness
out = Harness().run("Analyze saline intrusion for rice farm at Soc Trang", {
"object": "Farm A", "location": "Soc Trang", "distance_to_coast_km": 2.5,
"crops": [{"name": "rice"}],
"data": {"soil": {"ece_dS_m": 5.2, "esp_pct": 8.0, "ph": 7.8},
"geohydro": {"irrigation_ec_dS_m": 1.2, "tidal_amplitude_m": 2.0, "gw_ec_dS_m": 3.0},
"climate": {"et0_mm_per_day": 4.5, "season_days": 90,
"current_sowing_date": "2026-05-01",
"peak_salinity_start": "2026-03-01", "peak_salinity_end": "2026-04-30"}},
})
print(out["verdict"]["category"], out["gate_results"])
print(out["report_markdown"])
Knowledge pipeline
python tools/knowledge_updater.py --dry-run # fetch + score, no write
python tools/knowledge_updater.py --news-only # RSS only
python tools/knowledge_updater.py --keywords "soil salinity" "rice salt tolerance"
python scripts/seed_knowledge_base.py # (re)seed the brain
Setup
python scripts/setup.py --no-install # checks Python β₯3.11, seeds brain, offline smoke test
Architecture
User query ββΊ Harness (saline_skill/harness.py)
βββΊ Config (config/settings.py β env + YAML, type-safe)
βββΊ Chain-of-thought Router (saline_skill/router.py)
βββΊ Skill Registry (saline_skill/registry.py) β 5 SkillSpecs
βββΊ Tools (saline_skill/tools/* β JSON schemas + handlers, graceful fallback)
βββΊ Hooks (saline_skill/hooks.py β lifecycle, never crash)
βββΊ Quality Gates (U1βU6 + G1βG4, auto-fix + 2 retries)
See SKILL.md for the full registry specification and assets/system-diagram.md for the Mermaid diagram.
Domain methods
| Method | Formula | Reference |
|---|---|---|
| Maas-Hoffman yield | RY(%) = 100 β slope Γ (ECe β threshold) | Maas & Hoffman (1977) |
| Leaching requirement | LR = EC_iw / (5 Γ EC_e β EC_iw) | FAO Irrigation & Drainage Paper 29 |
| Gypsum requirement | GR = 8.6 Γ (ESP_i β ESP_t) Γ Οb Γ d / 100 | USDA NRCS |
| Soil classification | Saline: ECe > 4, ESP < 15, pH < 8.5 | FAO / USDA NRCS |
| Intrusion risk score | 5-factor weighted model (0β100) | This skill |
Data sources
| Source | Tier | URL |
|---|---|---|
| NOAA Tides & Currents | A | tidesandcurrents.noaa.gov |
| Copernicus CDS | A | cds.climate.copernicus.eu |
| USGS Water Data | A | water.usgs.gov |
| FAO Land & Water | B | fao.org/land-water |
| USDA NRCS | B | nrcs.usda.gov |
| IRRI | B | irri.org |
| ICBA | B | biosaline.org |
| Vietnam MARD/SIWPR | A/B | Mekong Delta salinity monitoring |
| Semantic Scholar | C | semanticscholar.org |
| ArXiv | C | arxiv.org |
Quality gates
| Gate | Check |
|---|---|
| U1 | β₯3 sources, β₯1 academic/authoritative (Tier 1β3) |
| U2 | Disclosure/limitations before recommendation |
| U3 | Evidence hierarchy (Tier 1β4) per source |
| U4 | Language matches user preference (vi/en) |
| U5 | Output uses full template (all mandatory sections) |
| U6 | Every claim traceable to source or flagged [analyst judgment] |
| G1 | Crop salt tolerance cites β₯1 authoritative source per cultivar |
| G2 | Soil classified saline/sodic/saline-sodic with quantitative thresholds |
| G3 | Leaching requirement computed with LR formula and stated units |
| G4 | Sowing calendar & washing plan tied to intrusion scenario timeline |
Testing
python -m pytest tests/test_saline_skill.py -q # 24 package unit tests
python scripts/validate_architecture.py # modular architecture validator
python tools/test_knowledge_updater.py # 8 knowledge-updater unit tests
python tools/run_test_scenarios.py # structural & content validator
python tools/validate_project.py # 191-check 8-File Contract + architecture validator
CI runs all of the above on Python 3.11 and 3.12 across ubuntu/windows/macos.
Roadmap
- Phase 0: Research & Architecture
- Phase 1: Core Sub-Skills (5)
- Phase 2: Main Harness + 10 Quality Gates + Graceful Degradation
- Phase 3: Knowledge Pipeline (crawl + dedup + scoring + brain)
- Phase 4: Testing & Validation
- Phase 5: Integration & Polish (open-source ready)
- Phase 6: Modular Skill-Registry Architecture (v2.0.0)
Status: PRODUCTION READY v2.0.0
Contributing
See CONTRIBUTING.md for development setup, code style, and pull request checklist.
License
MIT β see LICENSE.
Citation
@software{saline-intrusion-coastal-farming,
title = {saline-intrusion-coastal-farming: Coastal Saline-Intrusion Risk Forecasting & Soil-Washing Planning for Farms},
author = {saline-intrusion-coastal-farming Contributors},
year = {2026},
version= {2.0.0},
url = {https://github.com/saline-intrusion-coastal-farming}
}