Skip to content

Developer: Write Your First VocabularyProviderPlugin

This file collects six prompts that step a developer through authoring a new VocabularyProviderPlugin from an empty project file to a discoverable, tested, shippable integration. Each prompt pins the relevant FCC personas, names the R.I.S.C.E.A.R. slot it exercises, and states what good output looks like. The prompts are designed to be run against an FCC-instrumented agent team (mock or live) from a fresh checkout of the developer's project.

Table of Contents

  1. Scope the plugin
  2. Generate the skeleton
  3. Implement the class map
  4. Write pytest cases
  5. Wire the entry point
  6. Validate graceful degradation

1. Scope the plugin

When to use. Day zero, before any code exists.

Personas/subsystems invoked. dal, cw. R.I.S.C.E.A.R. slot: Role + Input.

You are the Data Analyst Lead (dal). Content Writer (cw) reviews.

TASK: Produce a 1-page scoping note for a new
VocabularyProviderPlugin named "myproject_vocabulary" that will
expose the 6 core dataclasses of the developer's project to FCC.

Include:
1. Source namespace (one string, lowercase, ASCII).
2. Intended subset of the 175 packaged YAML files under
   src/fcc/data/objectmodel/ this provider should target.
3. A draft class_map with exactly 6 keys and placeholder Python
   classes named Class1..Class6.
4. A 3-bullet list of non-goals (what this plugin does NOT try
   to do).

CONSTRAINTS:
- The provider must be read-only; no event emission.
- FCC version pin is v1.3.5.3+.

Deliverable: a 4-section Markdown scoping note, 250 to 400 words.

Expected output notes. One namespace, 6 class-map keys, 3 non-goals, FCC pin present.


2. Generate the skeleton

Personas/subsystems invoked. tr, dal. R.I.S.C.E.A.R. slot: Expected Output.

You are the Technical Reviewer (tr). Data Analyst Lead (dal)
reviews.

TASK: Produce the Python skeleton for the plugin at
src/myproject/fcc_plugin.py.

Requirements:
1. Subclass VocabularyProviderPlugin from fcc.plugins.base.
2. Implement plugin_meta(), get_namespace(), and get_class_map().
3. Use dataclasses-only conventions; no Pydantic.
4. Graceful-degradation: get_class_map() must return {} when the
   source package is not importable.

CONSTRAINTS:
- No sys.path hacks.
- No Path(__file__) chains.
- Type hints required on every method signature.

Deliverable: a single .py file body, 40 to 80 lines, with
docstrings and `from __future__ import annotations` at the top.

Expected output notes. Three methods, graceful-degradation branch, future annotations imported.


3. Implement the class map

Personas/subsystems invoked. dal, tr. R.I.S.C.E.A.R. slot: Constraints.

You are the Data Analyst Lead (dal). Technical Reviewer (tr)
reviews.

TASK: Fill in get_class_map() with the 6 real dataclasses from the
developer's project.

CONSTRAINTS:
- Each key follows the pattern "<namespace>:<ClassName>".
- Every value is a Python type (not an instance).
- Import the source dataclasses lazily inside the method.
- Handle ImportError by returning {}.

Deliverable: the get_class_map() implementation plus a 2-bullet
list of the specific YAML file that will be updated on the FCC
side to match this class_map.

Expected output notes. 6 mapping entries, lazy import, FCC-side YAML file named.


4. Write pytest cases

Personas/subsystems invoked. tr. R.I.S.C.E.A.R. slot: Expected Output.

You are the Technical Reviewer (tr).

TASK: Produce pytest test cases for the plugin. File lives at
tests/test_fcc_plugin.py.

Required cases:
1. plugin_meta() returns the right PluginType.
2. get_namespace() returns the namespace in lowercase ASCII.
3. get_class_map() returns at least 6 entries when the source
   package is importable.
4. get_class_map() returns {} when the source package raises
   ImportError (use monkeypatch on builtins.__import__).
5. Every class_map value is a type (isinstance check).

CONSTRAINTS:
- Pure pytest; no unittest.
- No network calls.
- Reach >= 99% line coverage for the plugin module.

Deliverable: a single pytest file body, 60 to 120 lines.

Expected output notes. Five cases, monkeypatch used, coverage target stated.


5. Wire the entry point

Personas/subsystems invoked. dal, tr. R.I.S.C.E.A.R. slot: Role Adoption Checklist.

You are the Data Analyst Lead (dal). Technical Reviewer (tr)
reviews.

TASK: Produce the pyproject.toml entry-point block that registers
the plugin under the fcc.plugins.vocabulary_providers group.

Include:
1. The TOML block itself.
2. A one-line comment above the block explaining the group name.
3. A 3-step verification script that a developer can run after
   `pip install -e .` to confirm discovery:
   - a. Use fcc.admin.readers.PluginReader to list the group.
   - b. Assert the plugin key is present.
   - c. Assert health() reports "ok".

CONSTRAINTS:
- The TOML must be copy-pasteable.
- The script must not require network access.

Deliverable: a Markdown block with the TOML and a Python
verification snippet.

Expected output notes. Correct group name, 3-step script, no network.


6. Validate graceful degradation

Personas/subsystems invoked. sre, tr. R.I.S.C.E.A.R. slot: Role Collaborators.

You are the Site Reliability Engineer (sre). Technical Reviewer
(tr) reviews.

TASK: Produce a 5-step operational check that confirms the plugin
degrades gracefully when the source package is missing in
production.

Steps required:
1. Container image without the source package installed.
2. Readiness probe calls fcc.admin.readers.PluginReader.health().
3. Plugin reports "ok" (empty class_map is still healthy).
4. Downstream consumer sees "no coverage for this namespace" rather
   than a crash.
5. Alerting rule fires only when health() is non-"ok".

CONSTRAINTS:
- Readiness check must be cheap (< 100ms).
- No mutation of FCC internals.

Deliverable: a 5-item numbered checklist with 1-2 sentences per
item, plus a 2-bullet note on which events to record.

Expected output notes. 5-step checklist present, readiness budget honoured, event recording named.