Agent skill
ce-serializer-impl
Implement ADR-031 serializer and persistence APIs with versioned primitives and compatible load behavior.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/ce-serializer-impl
SKILL.md
CE Serializer Implementation
You are implementing calibrator serialization or explainer state persistence per ADR-031. The contract is: versioned JSON-safe primitives + fail-fast on schema incompatibility.
Load references/serialization_templates.md for full code templates.
Key contracts
Calibrator to_primitive / from_primitive
All built-in calibrators must implement this pair:
to_primitive()returns a dict withschema_versionas the first key and only JSON-safe values. The built-in calibrators (VennAbers,IntervalRegressor) use pickle + base64 encoding with sha256 checksum for complex internal state.from_primitive(payload)validatesschema_version,calibrator_type, and payload checksum integrity. RaisesConfigurationErroron any mismatch with a guidance message.
Explainer save_state / load_state
- On-disk format: directory artifact with
manifest.jsonplus referenced files. - Manifest fields include
schema_version,created_at_utc,artifact_type, andfiles(mappingfilename -> sha256). save_stateaccepts a filesystem path, writes an artifact directory, returnsPath.load_statevalidates manifest schema version and per-file sha256 checksums; raisesIncompatibleStateErrorif unsupported or integrity check fails.
Round-trip invariant (ADR-031 §4)
After a save/load round-trip, the restored calibrator must produce identical
outputs (np.allclose(ref, restored, atol=1e-9)).
Additional compatibility expectations
- Wrapper object round-trips via
pickle.dump/loadandjoblib.dump/loadshould remain functional. - Explanation collection objects should remain pickleable.
Out of Scope
- Third-party calibrator schema management - external packages own their schema versions.
Evaluation Checklist
-
to_primitive()returns a dict withschema_versionas the first key. - All values are JSON-safe (no numpy arrays, no non-serialisable objects).
-
from_primitive()validatesschema_version,calibrator_type, and checksum. -
from_primitive()raisesConfigurationErroron any validation failure. - Round-trip test verifies identical predictions (not just no-exception).
-
json.dumps(primitive)test verifies JSON-safety. - Checksum tamper test verifies
from_primitive()rejects corrupted payloads. -
save_state/load_statemanifest includesschema_version,created_at_utc,artifact_type, andfiles. -
load_statevalidates per-file sha256 checksums before deserialising. - Unsupported state schema version raises
IncompatibleStateError. - Wrapper pickle and joblib round-trips are covered in integration tests.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?