faostat-skills 0.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.
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "faostat-skills",
3
+ "description": "Analysis skills for UN FAOSTAT food and agriculture data. Country profiles, commodity briefings, trade analysis, climate assessments, and data visualizations. Works with any AI assistant that supports the SKILL.md format.",
4
+ "version": "0.1.0",
5
+ "author": {
6
+ "name": "Griffiths Obli-Laryea"
7
+ },
8
+ "homepage": "https://github.com/berba-q/faostat-skills",
9
+ "repository": "https://github.com/berba-q/faostat-skills",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "faostat",
13
+ "agriculture",
14
+ "food-security",
15
+ "trade",
16
+ "emissions",
17
+ "climate",
18
+ "commodities",
19
+ "analysis",
20
+ "visualization"
21
+ ]
22
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Griffiths Obli-Laryea
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,184 @@
1
+ # FAOSTAT Skills
2
+
3
+ [![npm version](https://img.shields.io/npm/v/faostat-skills)](https://www.npmjs.com/package/faostat-skills)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Claude Code](https://img.shields.io/badge/Claude_Code-plugin-blueviolet)](https://claude.com/claude-code)
6
+ [![Codex](https://img.shields.io/badge/Codex-compatible-green)](https://openai.com)
7
+
8
+ AI-powered analysis skills for the [UN FAOSTAT](https://www.fao.org/faostat/en/#data) database — the world's most comprehensive source of food and agriculture statistics. These platform-agnostic skills guide your AI assistant through multi-step analytical workflows: country food security profiles, trade dependency analysis, commodity deep dives, agrifood climate assessments, and data-driven storytelling.
9
+
10
+ **Works with:** Claude Code, OpenAI Codex, and any AI assistant that supports the `SKILL.md` format.
11
+
12
+ ### Quick Start
13
+
14
+ ```bash
15
+ # Claude Code
16
+ claude plugin install faostat-skills
17
+
18
+ # Then ask:
19
+ # "Give me a food security profile for Kenya"
20
+ # "Compare wheat yields in France, USA, and India"
21
+ # "How dependent is Egypt on wheat imports?"
22
+ ```
23
+
24
+ ## Prerequisites
25
+
26
+ The [FAOSTAT MCP Server](https://github.com/berba-q/faostat-mcp) must be installed and configured before using these skills.
27
+
28
+ ```bash
29
+ pip install faostat-mcp
30
+ ```
31
+
32
+ Then configure your credentials (one-time setup) by asking your AI assistant:
33
+ > "Set up FAOSTAT with my credentials"
34
+
35
+ ## Installation
36
+
37
+ ### Claude Code
38
+
39
+ ```bash
40
+ claude plugin install faostat-skills
41
+ ```
42
+
43
+ Or install directly from GitHub:
44
+
45
+ ```bash
46
+ claude plugin install berba-q/faostat-skills
47
+ ```
48
+
49
+ ### OpenAI Codex
50
+
51
+ Clone this repo into your Codex skills directory:
52
+
53
+ ```bash
54
+ git clone https://github.com/berba-q/faostat-skills.git ~/.agents/skills/faostat-skills
55
+ ```
56
+
57
+ Or symlink the skills directory:
58
+
59
+ ```bash
60
+ ln -s /path/to/faostat-skills/skills ~/.agents/skills/faostat
61
+ ```
62
+
63
+ ### Other AI Assistants
64
+
65
+ Copy the `skills/` directory to wherever your AI tool discovers skill files. Each skill is a self-contained `SKILL.md` with YAML frontmatter and markdown instructions.
66
+
67
+ ## Available Skills
68
+
69
+ ### Tier 1: Core Analysis
70
+
71
+ | Skill | Command | Description |
72
+ |-------|---------|-------------|
73
+ | **Country Food Security Profile** | `/faostat-country-profile` | Comprehensive food security assessment — production, trade, nutrition, and risk indicators for any country |
74
+ | **Comparative Agricultural Analysis** | `/faostat-compare` | Side-by-side comparison of agricultural metrics across countries, commodities, or regions |
75
+ | **Commodity Deep Dive** | `/faostat-commodity` | Complete global briefing for any commodity — production rankings, yield trends, trade flows |
76
+
77
+ ### Tier 2: Specialized
78
+
79
+ | Skill | Command | Description |
80
+ |-------|---------|-------------|
81
+ | **Agrifood Climate Analyzer** | `/faostat-climate` | Climate-agriculture nexus analysis — emissions profiles, temperature trends, land use, inputs-emissions links |
82
+ | **Trade Dependency Analyzer** | `/faostat-trade` | Import dependence assessment with self-sufficiency ratios and supply chain risk indicators |
83
+ | **Data Visualizer** | `/faostat-viz` | Generate interactive Chart.js HTML charts from FAOSTAT data |
84
+
85
+ ### Tier 3: Creative
86
+
87
+ | Skill | Command | Description |
88
+ |-------|---------|-------------|
89
+ | **Agricultural Trend Monitor** | `/faostat-trends` | Identify biggest changes and anomalies in agricultural data over a time window |
90
+ | **Data Storyteller** | `/faostat-story` | Build data-driven narratives with embedded charts for journalism and research |
91
+ | **FAOSTAT Explorer** | `/faostat-explore` | Guided discovery of FAOSTAT's data catalog with sample data and explanations |
92
+
93
+ ## Examples
94
+
95
+ ```
96
+ > Give me a food security profile for Kenya
97
+
98
+ > Compare wheat yields in France, USA, and India over the last 10 years
99
+
100
+ > Tell me everything about global rice production and trade
101
+
102
+ > What are the agrifood emissions for Brazil? How do they compare per capita?
103
+
104
+ > How dependent is Egypt on wheat imports?
105
+
106
+ > Chart the top 10 maize producers over the last 20 years
107
+
108
+ > What's changed most in African agriculture over the last 5 years?
109
+
110
+ > Help me write a data story about the global avocado boom
111
+
112
+ > What data does FAOSTAT have about fertilizers?
113
+ ```
114
+
115
+ ## FAOSTAT Domain Reference
116
+
117
+ Key domains used by these skills:
118
+
119
+ | Domain | Content |
120
+ |--------|---------|
121
+ | **QCL** | Crops and Livestock Products (production, area, yield) |
122
+ | **TM** | Trade Matrix (import/export by partner) |
123
+ | **FBS** | Food Balance Sheets (supply/demand for 360+ foods) |
124
+ | **FS** | Food Security indicators |
125
+ | **GT** | Emissions Totals — agrifood systems (broadest scope) |
126
+ | **GCE** | Emissions from crops only |
127
+ | **GF** | Forest emissions/removals — sinks, net conversion |
128
+ | **EI** | Emissions Intensities |
129
+ | **EM** | Emissions Indicators (shares, per capita, per value) |
130
+ | **ET** | Temperature Change |
131
+ | **RL** | Land Use |
132
+ | **RFN/RFM/RFB** | Fertilizers |
133
+ | **RP/RT** | Pesticides use and trade |
134
+
135
+ ## Architecture
136
+
137
+ ```
138
+ FAOSTAT Skills (this repo) FAOSTAT MCP Server (separate)
139
+ ┌────────────────────────┐ ┌────────────────────────┐
140
+ │ 9 platform-agnostic │ uses │ 21 MCP tools │
141
+ │ SKILL.md workflows │────────→ │ Published on PyPI │
142
+ │ │ │ v1.2.2 · stable │
143
+ └────────────────────────┘ └────────────────────────┘
144
+ ```
145
+
146
+ Skills orchestrate the MCP server's tools into multi-step analysis workflows. They encode FAOSTAT domain expertise so users can easily interact with the FAOSTAT data.
147
+
148
+ ## Project Structure
149
+
150
+ ```
151
+ faostat-skills/
152
+ ├── skills/ ← Core: platform-agnostic SKILL.md files
153
+ │ ├── country-profile/
154
+ │ ├── compare/
155
+ │ ├── commodity/
156
+ │ ├── trade/
157
+ │ ├── trends/
158
+ │ ├── climate/
159
+ │ ├── viz/
160
+ │ ├── story/
161
+ │ └── explore/
162
+ ├── .claude-plugin/ ← Claude Code packaging
163
+ ├── .agents/skills/ ← OpenAI Codex packaging (symlink)
164
+ ├── commands/ ← Claude Code slash commands
165
+ ├── README.md
166
+ └── LICENSE
167
+ ```
168
+
169
+ ## Contributing
170
+
171
+ 1. Fork the repository
172
+ 2. Create a feature branch (`git checkout -b feature/new-skill`)
173
+ 3. Follow the existing SKILL.md format (YAML frontmatter + markdown instructions)
174
+ 4. Test the skill with a real FAOSTAT MCP server connection
175
+ 5. Submit a pull request
176
+
177
+ ## License
178
+
179
+ MIT License - see [LICENSE](LICENSE) for details.
180
+
181
+ ## Related
182
+
183
+ - [FAOSTAT MCP Server](https://github.com/berba-q/faostat-mcp) — The MCP server these skills are built on
184
+ - [FAOSTAT](https://www.fao.org/faostat/en/#data) — The UN FAO FAOSTAT database
@@ -0,0 +1,6 @@
1
+ ---
2
+ description: Analyze agrifood emissions, climate impact, deforestation, land use, and the agriculture-climate nexus using FAOSTAT data
3
+ argument-hint: <country or topic, e.g. "Brazil emissions profile" or "deforestation in Indonesia">
4
+ ---
5
+
6
+ Invoke the `faostat-climate` skill to handle this request. The skill supports five sub-workflows: country emissions profiles, emissions comparisons, crop emissions analysis, forest & land use, and inputs-emissions links. Detect the appropriate sub-workflow from the user's input, or present the options.
@@ -0,0 +1,6 @@
1
+ ---
2
+ description: Generate a global briefing for an agricultural commodity
3
+ argument-hint: <commodity name>
4
+ ---
5
+
6
+ Invoke the `commodity` skill to produce a comprehensive global briefing for the specified commodity. If no commodity is provided in the argument, ask the user which commodity they would like analyzed.
@@ -0,0 +1,6 @@
1
+ ---
2
+ description: Compare countries or commodities on agricultural metrics
3
+ argument-hint: <entity1> vs <entity2> [metric]
4
+ ---
5
+
6
+ Invoke the `compare` skill to produce a structured side-by-side comparison. If no entities or metric are provided in the argument, ask the user what they would like to compare and on which metric.
@@ -0,0 +1,6 @@
1
+ ---
2
+ description: Generate a food security and agricultural profile for a country
3
+ argument-hint: <country name>
4
+ ---
5
+
6
+ Invoke the `country-profile` skill to generate a comprehensive food security profile for the specified country. If no country is provided in the argument, ask the user which country they would like profiled.
@@ -0,0 +1,6 @@
1
+ ---
2
+ description: Guided discovery of FAOSTAT data catalog — browse domains, see samples, understand what's available
3
+ argument-hint: [topic of interest]
4
+ ---
5
+
6
+ Invoke the `faostat-explore` skill to run the FAOSTAT Explorer. Pass along any topic of interest or question the user specified.
@@ -0,0 +1,6 @@
1
+ ---
2
+ description: Build a data-driven narrative with embedded charts from FAOSTAT data
3
+ argument-hint: <research question or story angle>
4
+ ---
5
+
6
+ Invoke the `faostat-story` skill to run the Data Storyteller. Pass along any research question, story angle, or topic the user specified.
@@ -0,0 +1,6 @@
1
+ ---
2
+ description: Assess food import dependence, self-sufficiency ratios, and supply chain risk for a country and commodity
3
+ argument-hint: <country and commodity, e.g. "Egypt wheat" or "Japan rice">
4
+ ---
5
+
6
+ Invoke the `faostat-trade` skill to handle this request. The skill calculates self-sufficiency ratios, identifies top trading partners and concentration risk, and tracks dependency trends over time.
@@ -0,0 +1,6 @@
1
+ ---
2
+ description: Identify biggest changes, fastest growers/decliners, and anomalies in agricultural data
3
+ argument-hint: <region or countries> [time window]
4
+ ---
5
+
6
+ Invoke the `faostat-trends` skill to run the Agricultural Trend Monitor. Pass along any region, countries, time window, or commodity focus the user specified.
@@ -0,0 +1,6 @@
1
+ ---
2
+ description: Generate interactive HTML charts from FAOSTAT data (line, bar, scatter, stacked bar)
3
+ argument-hint: <what to visualize, e.g. "wheat production trends for top 5 producers">
4
+ ---
5
+
6
+ Invoke the `faostat-viz` skill to handle this request. The skill queries FAOSTAT data (or uses data already in conversation context), selects the appropriate chart type, and generates a standalone interactive HTML chart with Chart.js.
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "faostat-skills",
3
+ "version": "0.1.0",
4
+ "description": "Analysis skills for UN FAOSTAT food and agriculture data. Country profiles, commodity briefings, trade analysis, climate assessments, and data visualizations.",
5
+ "author": "Griffiths Obli-Laryea",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/berba-q/faostat-skills.git"
10
+ },
11
+ "homepage": "https://github.com/berba-q/faostat-skills",
12
+ "keywords": [
13
+ "claude-code",
14
+ "claude-code-plugin",
15
+ "codex",
16
+ "faostat",
17
+ "agriculture",
18
+ "food-security",
19
+ "trade",
20
+ "emissions",
21
+ "climate",
22
+ "commodities",
23
+ "analysis",
24
+ "mcp",
25
+ "ai-skills"
26
+ ],
27
+ "files": [
28
+ "skills/",
29
+ "commands/",
30
+ ".claude-plugin/",
31
+ "README.md",
32
+ "LICENSE"
33
+ ]
34
+ }
@@ -0,0 +1,152 @@
1
+ ---
2
+ name: faostat-climate
3
+ description: Use when the user asks about agricultural emissions, climate impact of farming, agrifood carbon footprint, greenhouse gases from agriculture, deforestation, forest carbon sinks, temperature change, fertilizer emissions, N2O, land use change, emissions intensity, or the climate-agriculture nexus. Keywords: emissions, climate, carbon, greenhouse gas, GHG, deforestation, forest, temperature, warming, N2O, fertilizer emissions, land use, agrifood, emissions intensity, carbon sink
4
+ ---
5
+
6
+ # Agrifood Climate Analyzer
7
+
8
+ Analyze the climate-agriculture nexus using FAOSTAT emissions, temperature, land use, and agricultural inputs data. This skill has five sub-workflows. Detect the appropriate one from the user's question, or present the options and ask.
9
+
10
+ ## Prerequisites
11
+
12
+ Before starting, verify that the FAOSTAT MCP tools are available: `faostat_search_codes`, `faostat_get_data`, `faostat_get_rankings`. If they are not available, inform the user they need the FAOSTAT MCP server configured and stop.
13
+
14
+ ## Domain Reference (CRITICAL -- use exactly these codes)
15
+
16
+ | Domain | Code | Content |
17
+ |--------|------|---------|
18
+ | Emissions Totals | **GT** | Agrifood systems emissions -- broadest scope, full agrifood chain |
19
+ | Crop Emissions | **GCE** | Emissions from crops only (narrower than GT) |
20
+ | Forest Emissions/Removals | **GF** | Forest sinks, net forest conversion (deforestation proxy) |
21
+ | Emissions Intensities | **EI** | Emissions per unit of output |
22
+ | Emissions Indicators | **EM** | Shares, per capita, per value of agricultural production |
23
+ | Temperature Change | **ET** | Country-level warming trends |
24
+ | Land Use | **RL** | Agricultural and forest land use |
25
+ | Fertilizers (use & trade) | **RFN**, **RFM**, **RFB** | Nitrogen, manufactured, bulk fertilizers |
26
+ | Pesticides Use | **RP** | Pesticide application data |
27
+ | Pesticides Trade | **RT** | Pesticide import/export data |
28
+
29
+ ## Sub-workflow Detection
30
+
31
+ Read the user's question and select the most appropriate sub-workflow:
32
+
33
+ - **Country emissions profile** -- questions about a single country's agrifood emissions footprint, climate impact, or warming trend. Use Sub-workflow A.
34
+ - **Emissions comparison** -- questions comparing emissions across countries or regions, "who emits the most," rankings. Use Sub-workflow B.
35
+ - **Crop emissions / efficiency** -- questions about emissions from specific crops, which countries produce most efficiently, emissions intensity. Use Sub-workflow C.
36
+ - **Deforestation / forest / land use** -- questions about forest loss, carbon sinks, agricultural expansion, land use change. Use Sub-workflow D.
37
+ - **Fertilizer-emissions link** -- questions about fertilizer use and emissions, N2O, pesticide trends, input intensity. Use Sub-workflow E.
38
+
39
+ If the question does not clearly match one sub-workflow, present the five options with a one-line description of each and ask the user to choose.
40
+
41
+ ## Sub-workflow A: Country Emissions Profile
42
+
43
+ 1. Ask for the country if not already specified.
44
+ 2. Resolve the country name to an area code using `faostat_search_codes(domain_code='GT', dimension_id='area', query='<country>')`.
45
+ - If `requires_confirmation` is true in the response, present the matching options and ask the user to choose. Do NOT proceed until the user confirms.
46
+ 3. Pull agrifood systems emissions totals from the **GT** domain:
47
+ `faostat_get_data(domain_code='GT', area='<area_code>', response_format='compact')`
48
+ Focus on the most recent 10 years. Identify total agrifood emissions and breakdown by source category (farm gate, land use, pre/post production).
49
+ 4. Pull emissions indicators from the **EM** domain:
50
+ `faostat_get_data(domain_code='EM', area='<area_code>', response_format='compact')`
51
+ Extract per capita emissions, share of national total, emissions per value of agricultural production.
52
+ 5. Pull temperature change data from the **ET** domain:
53
+ `faostat_get_data(domain_code='ET', area='<area_code>', response_format='compact')`
54
+ Identify the warming trend over the available period.
55
+ 6. Synthesize into a structured profile:
56
+ - **Agrifood Emissions Overview** -- total emissions, trend (rising/falling/stable), breakdown by source
57
+ - **Normalized Metrics** -- per capita, share of national emissions, per dollar of agricultural output
58
+ - **Temperature Trend** -- warming trajectory for this country
59
+ - **Key Findings** -- 2-3 headline insights connecting the data
60
+ 7. Attribute: "Source: FAOSTAT (FAO), accessed [current date]"
61
+
62
+ ## Sub-workflow B: Emissions Comparison
63
+
64
+ 1. Ask for the countries or region to compare (minimum 2, maximum 10). Accept country names, region names, or a mix.
65
+ 2. Resolve each entity to area codes using `faostat_search_codes(domain_code='GT', dimension_id='area', query='<name>')`.
66
+ - Handle `requires_confirmation` for each entity separately. Do NOT proceed until all codes are confirmed.
67
+ 3. Pull emissions totals from the **GT** domain for all entities:
68
+ `faostat_get_data(domain_code='GT', area='<code1>,<code2>,...', response_format='compact')`
69
+ 4. Pull emissions indicators from the **EM** domain for all entities:
70
+ `faostat_get_data(domain_code='EM', area='<code1>,<code2>,...', response_format='compact')`
71
+ Extract per capita and share metrics for normalization.
72
+ 5. Present comparison:
73
+ - **Absolute emissions** -- rank by total agrifood emissions (latest year)
74
+ - **Per capita emissions** -- re-rank by per capita to show a different picture
75
+ - **Per value of output** -- emissions efficiency ranking
76
+ - **Trend comparison** -- who is reducing, who is increasing?
77
+ - **Key insights** -- highlight surprising reversals or contrasts between absolute and normalized rankings
78
+ 6. Attribute: "Source: FAOSTAT (FAO), accessed [current date]"
79
+
80
+ ## Sub-workflow C: Crop Emissions Analysis
81
+
82
+ 1. Ask for the crop and optionally a set of countries. If no countries specified, use global top producers.
83
+ 2. Resolve the crop to an item code using `faostat_search_codes(domain_code='GCE', dimension_id='item', query='<crop>')`.
84
+ - Handle `requires_confirmation` as always.
85
+ 3. If countries were specified, resolve their area codes. If not, use `faostat_get_rankings` to identify top 10 producers for context.
86
+ 4. Pull crop-specific emissions from the **GCE** domain:
87
+ `faostat_get_data(domain_code='GCE', item='<item_code>', area='<codes>', response_format='compact')`
88
+ 5. Pull emissions intensities from the **EI** domain:
89
+ `faostat_get_data(domain_code='EI', item='<item_code>', area='<codes>', response_format='compact')`
90
+ 6. Rank countries by emissions intensity (lowest = most efficient).
91
+ 7. Present analysis:
92
+ - **Total crop emissions** -- who emits the most growing this crop?
93
+ - **Emissions intensity ranking** -- who produces most efficiently per unit of output?
94
+ - **Efficiency trends** -- is intensity improving or worsening over time?
95
+ - **Key insight** -- highlight the gap between the most and least efficient producers
96
+ 8. Attribute: "Source: FAOSTAT (FAO), accessed [current date]"
97
+
98
+ ## Sub-workflow D: Forest & Land Use
99
+
100
+ 1. Ask for the country or region if not specified.
101
+ 2. Resolve area codes using `faostat_search_codes(domain_code='GF', dimension_id='area', query='<name>')`.
102
+ - Handle `requires_confirmation`.
103
+ 3. Pull forest emissions and removals from the **GF** domain:
104
+ `faostat_get_data(domain_code='GF', area='<area_code>', response_format='compact')`
105
+ Look for: net forest conversion (deforestation proxy), forest land emissions, forest land removals (carbon sinks).
106
+ 4. Pull land use data from the **RL** domain:
107
+ `faostat_get_data(domain_code='RL', area='<area_code>', response_format='compact')`
108
+ Look for: agricultural land area, forest area, changes over time.
109
+ 5. Analyze the relationship:
110
+ - **Forest carbon balance** -- are removals (sinks) offsetting emissions? What is the net?
111
+ - **Net forest conversion** -- proxy for deforestation rate and trend
112
+ - **Land use shift** -- is agricultural land expanding at the expense of forest?
113
+ - **Timeline** -- when did the biggest changes occur?
114
+ 6. Present findings:
115
+ - **Forest Emissions & Sinks** -- net balance, trend
116
+ - **Deforestation Proxy** -- net forest conversion figures and direction
117
+ - **Land Use Dynamics** -- agricultural vs. forest area over time
118
+ - **Key Finding** -- is agriculture driving deforestation here? How do sinks compare to emissions?
119
+ 7. Attribute: "Source: FAOSTAT (FAO), accessed [current date]"
120
+
121
+ ## Sub-workflow E: Inputs-Emissions Link
122
+
123
+ 1. Ask for the country or set of countries if not specified.
124
+ 2. Resolve area codes using `faostat_search_codes(domain_code='GT', dimension_id='area', query='<name>')`.
125
+ - Handle `requires_confirmation`.
126
+ 3. Pull fertilizer use data from the **RFN** domain (nitrogen fertilizers are the primary N2O driver):
127
+ `faostat_get_data(domain_code='RFN', area='<area_code>', response_format='compact')`
128
+ 4. Optionally pull from **RFM** (manufactured) and **RFB** (bulk) for a fuller picture.
129
+ 5. Pull pesticide use from the **RP** domain:
130
+ `faostat_get_data(domain_code='RP', area='<area_code>', response_format='compact')`
131
+ 6. Pull agrifood emissions from the **GT** domain:
132
+ `faostat_get_data(domain_code='GT', area='<area_code>', response_format='compact')`
133
+ Focus on N2O emissions components if available.
134
+ 7. Analyze the correlation:
135
+ - **Fertilizer use trend** -- is nitrogen fertilizer use increasing or decreasing?
136
+ - **Emissions trend** -- do N2O / total agrifood emissions track fertilizer use?
137
+ - **Pesticide trend** -- increasing or decreasing? Any policy-driven shifts?
138
+ - **Correlation assessment** -- does higher fertilizer use correspond to higher emissions in this country/set?
139
+ 8. Present findings:
140
+ - **Fertilizer Use** -- volumes, trends, nitrogen share
141
+ - **Pesticide Use** -- volumes, trends
142
+ - **Emissions Correlation** -- how closely do inputs track emissions?
143
+ - **Policy Implications** -- what does this suggest for emissions reduction strategies?
144
+ 9. Attribute: "Source: FAOSTAT (FAO), accessed [current date]"
145
+
146
+ ## Important Rules
147
+
148
+ - Always use `faostat_search_codes` before `faostat_get_data` to resolve codes. Never guess domain-specific codes.
149
+ - When `requires_confirmation` is true in a search result, always present options to the user and wait for their choice.
150
+ - Use `response_format='compact'` when querying multiple entities or large time ranges.
151
+ - For rankings, use DISPLAY element codes (e.g., '5510' for production). For data filtering, use FILTER codes (e.g., '2510' for production).
152
+ - Always include the source attribution line at the end of any output.
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: faostat-commodity
3
+ description: Use when the user asks about a specific crop or commodity — global production, top producers, yield trends, trade flows, or a commodity briefing. Keywords: commodity, crop, wheat, rice, maize, coffee, cocoa, soybean, production rankings, top producers, yield, trade, global supply
4
+ ---
5
+
6
+ # Commodity Deep Dive
7
+
8
+ Generate a comprehensive global briefing for a specific agricultural commodity using FAOSTAT data.
9
+
10
+ ## Prerequisites
11
+
12
+ Verify that the following FAOSTAT MCP tools are available before proceeding:
13
+ - `faostat_search_codes`
14
+ - `faostat_get_data`
15
+ - `faostat_get_rankings`
16
+
17
+ If any tool is missing, inform the user: "This skill requires the FAOSTAT MCP server to be connected. Please ensure it is running and try again."
18
+
19
+ ## Workflow
20
+
21
+ ### Step 1: Identify the Commodity
22
+
23
+ Extract the commodity name from the user's message, or ask if not specified. Accept common names (e.g., "wheat", "coffee", "palm oil").
24
+
25
+ ### Step 2: Resolve Commodity Code
26
+
27
+ Call `faostat_search_codes(domain_code='QCL', dimension_id='item', query='<commodity_name>')`.
28
+
29
+ **CRITICAL:** If the response contains `requires_confirmation: true`, present ALL matching options to the user and ask them to select the correct one. This is common for items like "rice" (paddy vs. milled), "oil" (multiple types), or "beans" (multiple varieties). Do NOT proceed until the user confirms.
30
+
31
+ Store the confirmed `item` code.
32
+
33
+ ### Step 3: Pull Global Production Rankings
34
+
35
+ Call `faostat_get_rankings` with:
36
+ - `domain_code='QCL'`
37
+ - `element_code='5510'` (Production — NOTE: this is the DISPLAY code, which `faostat_get_rankings` requires, NOT the filter code '2510')
38
+ - `item_code='<resolved_item_code>'`
39
+ - `year='<most_recent_year>'` (try current year minus 2; if no data, try minus 3)
40
+ - `limit=10`
41
+ - `response_format='objects'`
42
+
43
+ Record the top 10 producers and their production volumes.
44
+
45
+ ### Step 4: Pull Yield and Area Trends for Top Producers
46
+
47
+ For the **top 5 producers** from Step 3, pull multi-year data.
48
+
49
+ Call `faostat_get_data` for each metric:
50
+
51
+ **Production trends:**
52
+ - `domain_code='QCL'`
53
+ - `area='<top5_area_codes>'` (comma-separated)
54
+ - `item='<item_code>'`
55
+ - `element='2510'` (Production — FILTER code for `faostat_get_data`)
56
+ - `year='<10_year_range>'` (e.g., `'2014:2023'`)
57
+ - `response_format='compact'`
58
+ - `limit=100`
59
+ - `show_unit=True`
60
+
61
+ **Area harvested trends:**
62
+ - Same parameters but `element='2312'` (Area harvested — FILTER code)
63
+
64
+ **Yield trends:**
65
+ - Same parameters but `element='2413'` (Yield — FILTER code)
66
+
67
+ **IMPORTANT DISTINCTION:** `faostat_get_rankings` uses DISPLAY element codes (e.g., `'5510'`). `faostat_get_data` uses FILTER element codes (e.g., `'2510'`). These are different code systems — do not mix them.
68
+
69
+ ### Step 5: Pull Global Trade Data
70
+
71
+ Call `faostat_get_data` with:
72
+ - `domain_code='TM'`
73
+ - `item='<item_code>'` (search for the item in the TM domain first if the QCL item code does not work)
74
+ - `response_format='compact'`
75
+ - `limit=50`
76
+
77
+ Extract:
78
+ - Top exporters and importers by value or quantity
79
+ - Total global trade volume if available
80
+ - Trade flow direction (which regions export, which import)
81
+
82
+ If the QCL item code does not return trade data, call `faostat_search_codes(domain_code='TM', dimension_id='item', query='<commodity_name>')` to find the correct TM item code.
83
+
84
+ ### Step 6: Compose the Briefing
85
+
86
+ Structure the output as follows:
87
+
88
+ **Title:** Commodity Briefing: [Commodity Name]
89
+
90
+ 1. **Global Production Overview**
91
+ - Total global production (if available) and the year of data
92
+ - Top 10 producers ranked by volume, with percentage share of global total
93
+ - Concentration: how much the top 3 and top 5 producers control
94
+
95
+ 2. **Yield Trajectories**
96
+ - Yield trends for top 5 producers over the past decade
97
+ - Which countries are improving yields fastest
98
+ - Current yield levels and gaps between leaders and laggards
99
+ - Area harvested trends — is growth coming from expansion or intensification?
100
+
101
+ 3. **Trade Flows**
102
+ - Major exporters and importers
103
+ - Net trade position of top producers (do they consume domestically or export?)
104
+ - Any notable trade dependencies
105
+
106
+ 4. **Historical Context & Outlook**
107
+ - How has production shifted over the past decade?
108
+ - Emerging producers (countries with fastest growth)
109
+ - Key risks: concentration risk, climate vulnerability, trade dependency
110
+ - Brief note on the commodity's global significance (food staple, cash crop, animal feed, biofuel feedstock, etc.)
111
+
112
+ End with:
113
+
114
+ > Source: FAOSTAT (FAO), accessed [current date]. Production rankings and trade data may reflect reporting lags of 1-3 years.
115
+
116
+ ## Error Handling
117
+
118
+ - If trade data is unavailable for the commodity, note this and complete the briefing with production data only.
119
+ - If yield data is missing for some countries, compute trends only for countries with sufficient data.
120
+ - If the most recent year returns no data, step back one year at a time (up to 3 attempts).
121
+
122
+ ## Output Format
123
+
124
+ Lead with the production rankings table for immediate impact. Follow with narrative sections. Use tables for ranked data and inline numbers for trend descriptions. Keep the analysis concise but substantive — aim for a briefing that gives the reader a complete picture in under 2 minutes of reading.