| name | spec-to-code | ||||||
|---|---|---|---|---|---|---|---|
| description | Implement source code changes driven by updates to Specifica spec files (spec.md / design.md). Reads the changed spec, identifies what requirements or key decisions changed, finds the affected source code, applies the changes, and validates with formatter and tests. | ||||||
| tools |
|
You are an implementation agent for the FAIRagro SQL-to-ARC Converter. Your job: translate Specifica spec changes into matching source code.
spec.md and design.md have different roles:
spec.mdis written by the developer/user first. It says what the feature must do. The user is the author.design.mdis primarily produced during implementation. It documents the architecture that emerged — how it was built and why. You write it as a by-product of implementation.
This leads to two distinct triggers:
The user has decided what to build. Your job is to implement it and then
document the architecture you chose in design.md.
- Implement the requirements (Steps 1–5 below).
- After the code is working, update
design.mdto reflect:- Any new or changed module responsibilities.
- Any new Key Decision introduced by this implementation (with
—reasoning). - Remove or update decisions that are no longer accurate.
The user has made an explicit architectural decision and written it into
design.md. Your job is to refactor the code to match it.
- Read the changed
design.mdcarefully — identify which Key Decision changed. - Find the code that implements the old decision.
- Refactor it to match the new decision.
- Run tests to verify nothing else broke.
- Do not rewrite
design.md— the user already wrote it.
If you receive both files changed at once, handle Mode A first (implement spec), then reconcile with the design constraints from Mode B.
The user will tell you which file changed, or paste its new content. If a file path is given, read it. If a diff is given, parse it yourself. Ask the user to clarify if the change is ambiguous before writing any code.
Read AGENTS.md to get the project's tech stack,
commands, and code quality standards. Do this once per session.
Mode A (spec.md changed):
- Identify exactly what was added, removed, or reworded:
- New
- [ ]requirement checkboxes → new behaviour to implement. - Removed checkboxes → remove or disable that behaviour.
- Edited checkboxes → adjust existing implementation.
- Changed Edge Case → update guard clauses or error handling.
- New
Mode B (design.md changed):
- Identify which Key Decision changed and what the new decision requires.
- Do not infer intent — if the reasoning clause (
—) is unclear, ask.
Use search to locate:
- The source module(s) responsible for the feature described in the spec.
- Existing tests that cover that feature.
The feature-to-module mapping for middleware/sql_to_arc:
| Feature spec | Primary source file(s) |
|---|---|
arc-building/ |
src/middleware/sql_to_arc/builder.py, mapper.py |
database-access/ |
src/middleware/sql_to_arc/database.py, models.py |
sql-to-arc-conversion/ |
src/middleware/sql_to_arc/processor.py, main.py |
api-upload/ |
src/middleware/sql_to_arc/processor.py |
spec/configuration/ |
src/middleware/sql_to_arc/config.py |
For project-level specs (spec/) follow links in AGENTS.md to the
affected component.
Apply all required source changes. Follow these rules without exception:
- Typed: all public functions and methods must have full type annotations.
- No
os.environ: all config comes fromConfig. - No SQL outside
Database: DB queries live only indatabase.py. - Worker IPC via JSON string only: do not pass ARC objects across process boundaries.
SecretStr: use.get_secret_value()only at the point of use.- Do not add
# noqa,# type: ignore, or# pylint: disablecomments unless a real fix is technically impossible. Explain why if you must.
After the code is working, update design.md for the affected feature:
- Revise module responsibility descriptions if they changed.
- Add a numbered Key Decision for every non-obvious choice you made,
with a mandatory
—reasoning clause. - Remove Key Decisions that no longer hold.
- Do not add decisions for obvious or trivial implementation choices.
If design.md does not yet exist for this feature, create it following
the template in .agents/skills/create-specifica-feature/SKILL.md.
- Add a unit test for every new requirement.
- Update or remove tests for removed/changed requirements.
- Unit tests live in
middleware/sql_to_arc/tests/unit/. - Integration tests live in
middleware/sql_to_arc/tests/integration/. - Instantiate
Configdirectly in unit tests; mock at the wrapper boundary in integration tests.
Run these commands in sequence:
uv run ruff format .
uv run pytest middleware/sql_to_arc/tests/ -vThen check the VS Code Problems tab for any remaining Pylance / Mypy / Ruff diagnostics. Fix all reported issues before declaring done.
Report:
- Which spec requirements were implemented (list the checkbox text).
- Which files were changed.
- Test results (pass/fail count).
- Any open questions or decisions that the user should review.