Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
492df2c
Add architecture documentation for composition-based Calculation design
martin-schlipf May 15, 2026
540f9ca
Add skill to port quantities
martin-schlipf May 15, 2026
b792b75
Add DataAccess[T] implementation with TDD, update docs and SKILL
martin-schlipf May 15, 2026
141e765
Add merge() helper to data_access for collecting DataAccess iteration…
martin-schlipf May 18, 2026
971c8a1
Architecture: Dispatcher/Impl split, merge_* dispatch helpers, port-q…
martin-schlipf May 18, 2026
7eaa692
data_access: remove old DataAccess/DataContext/merge API, keep only d…
martin-schlipf May 18, 2026
ae9505d
docs: fix port-quantity skill and architecture guide (merge strategy,…
martin-schlipf May 18, 2026
cd8a3fa
Manual improvement of skills and architecture
martin-schlipf May 19, 2026
9df6372
Replace data_access with dispatch infrastructure
martin-schlipf May 19, 2026
5f8068b
Update architecture docs and port-quantity skill for dispatch infrast…
martin-schlipf May 19, 2026
611cf0e
Pre-implementation snapshot: bandgap ported, docstrings restored
martin-schlipf May 20, 2026
b05b918
to_database: public on Handler only, no dispatcher wrapper
martin-schlipf May 20, 2026
174c9cb
Wire Calculation to _REGISTRY: FileSource, _source, __getattr__, Band…
martin-schlipf May 21, 2026
03566b4
Add __dir__ to Calculation so _REGISTRY quantities appear in tab comp…
martin-schlipf May 21, 2026
6ebd5d8
Merge branch 'master' into architecture-migration
martin-schlipf May 26, 2026
a8da29c
Port 12 quantities to Dispatcher/Handler architecture
martin-schlipf May 26, 2026
0515b78
Update plan: mark 12 ported quantities as done; fix stale test comment
martin-schlipf May 26, 2026
c9bf255
Port Groups 3+4: add StoichiometryHandler, CellHandler, StructureHandler
martin-schlipf May 26, 2026
4bbb611
Apply formatter (ruff/black)
martin-schlipf May 26, 2026
a286c2b
Port internal_strain, born_effective_charge, force_constant to Dispat…
martin-schlipf May 26, 2026
b22cbda
Port force, stress, velocity, local_moment to Dispatcher/Handler arch…
martin-schlipf May 27, 2026
e7100e6
Fix formatting
martin-schlipf May 27, 2026
7a85fb8
Port nics, density, partial_density, potential, current_density, _CON…
martin-schlipf May 27, 2026
51b9f15
Port kpoint, _dispersion, projector, dos, band to Dispatcher/Handler …
martin-schlipf May 27, 2026
fe3063e
Post-port fixes to band, dos, nics, density, partial_density, potenti…
martin-schlipf May 28, 2026
d868cbe
Port phonon.mode, phonon.band, phonon.dos to Dispatcher/Handler archi…
martin-schlipf May 28, 2026
eb4371f
Fix formatting
martin-schlipf May 28, 2026
3c95d1c
Port exciton.eigenvector, exciton.density to Dispatcher/Handler archi…
martin-schlipf May 28, 2026
1faa809
Port electron-phonon group to Dispatcher/Handler architecture
martin-schlipf May 28, 2026
037e677
Fix formatting
martin-schlipf May 28, 2026
0937938
Restore docstrings in Band, simplify Band.read to delegate to BandHan…
martin-schlipf May 28, 2026
b3dce69
Move read/to_dict docstrings: read is primary, to_dict refers to it
martin-schlipf May 28, 2026
1b075dd
Restore elaborate docstrings in BornEffectiveCharge and fix test asse…
martin-schlipf May 28, 2026
cf40728
Port current_density: read=primary docstring, to_dict=alias, Handler …
martin-schlipf May 28, 2026
10ecde4
DielectricFunction: Handler has only to_dict; Dispatcher.read calls it
martin-schlipf May 28, 2026
d157d72
Port dielectric_tensor: read=primary docstring, to_dict=alias, Handle…
martin-schlipf May 28, 2026
7eea281
Restore elaborate docstrings for Density; Handler has only to_dict, r…
martin-schlipf May 28, 2026
34d80bf
Dos: add full docstrings, Handler only has to_dict, read is primary
martin-schlipf May 28, 2026
072778f
Port effective_coulomb: read=primary docstring, to_dict=alias, Handle…
martin-schlipf May 28, 2026
97aa460
ElasticModulus: Handler has only to_dict, read is primary docstring, …
martin-schlipf May 28, 2026
b464fb5
ElectronPhononBandgap: read is primary with docstring, to_dict is alias
martin-schlipf May 28, 2026
193d377
Port electron_phonon_chemical_potential: read=primary docstring, to_d…
martin-schlipf May 28, 2026
3bbb56f
Port electron_phonon_self_energy: read=primary docstring, to_dict=ali…
martin-schlipf May 28, 2026
12ffb31
ElectronPhononTransport: read is primary with docstring, to_dict is a…
martin-schlipf May 28, 2026
110bb08
Port electronic_minimization: read=primary docstring, to_dict=alias, …
martin-schlipf May 28, 2026
0822018
Fix test_doctest: import submodules; fix dispatch to strip source-lev…
martin-schlipf May 28, 2026
e72657b
Port energy: read=primary docstring, to_dict=alias, Handler only has …
martin-schlipf May 28, 2026
b57d032
ExcitonDensity: restore elaborate docstrings, Handler only has to_dic…
martin-schlipf May 28, 2026
203eb59
Port exciton_eigenvector: read=primary docstring, to_dict=alias, Hand…
martin-schlipf May 28, 2026
b995428
Add regression tests for source-selector stripping in _dispatch
martin-schlipf May 28, 2026
f9596f3
Port force: read=primary docstring+examples, to_dict=alias, Handler o…
martin-schlipf May 28, 2026
1328c85
ForceConstant: Handler only has to_dict, read is primary with docstri…
martin-schlipf May 28, 2026
766c6df
InternalStrain: Handler only has to_dict, full docstring on read, fix…
martin-schlipf May 28, 2026
3bf7aa5
LocalMoment: restore all docstrings+decorators, Handler only has to_d…
martin-schlipf May 28, 2026
006d636
Port kpoint: read=primary with full docstring, to_dict=alias, Handler…
martin-schlipf May 28, 2026
d488215
PairCorrelation: Handler only has to_dict, read is primary, to_dict i…
martin-schlipf May 28, 2026
f795204
Nics: Handler only has to_dict, full docstrings on Dispatcher methods
martin-schlipf May 28, 2026
2be8bb5
PhononBand: Handler only has to_dict, restore elaborate docstrings, t…
martin-schlipf May 28, 2026
8cd7534
PhononDos: Handler only has to_dict, full docstrings on Dispatcher me…
martin-schlipf May 28, 2026
96d388f
Port partial_density: read=primary docstring, to_dict=alias, Handler …
martin-schlipf May 28, 2026
a294967
PhononMode: Handler only has to_dict, read is primary with full docst…
martin-schlipf May 28, 2026
8953a8f
PiezoelectricTensor: Handler only has to_dict, read is primary, fix test
martin-schlipf May 28, 2026
ebb7281
Polarization: Handler only has to_dict, read is primary with docstrin…
martin-schlipf May 28, 2026
ca19a18
Port potential: Handler only has to_dict, read=primary with full docs…
martin-schlipf May 28, 2026
5ad0e8d
Projector: Handler only has to_dict, read is primary with docstring, …
martin-schlipf May 28, 2026
c49e23d
Port stress: Handler only has to_dict, read=primary with full docstri…
martin-schlipf May 28, 2026
32c9dd0
RunInfo: Handler only has to_dict, read is primary with docstring, to…
martin-schlipf May 28, 2026
9c4f733
Port system: Handler only has to_dict, read=primary with full docstri…
martin-schlipf May 28, 2026
55c0ef1
Structure: Handler only has to_dict, read is primary with full docstr…
martin-schlipf May 28, 2026
9dfabc3
Velocity: Handler only has to_dict, read is primary with full docstri…
martin-schlipf May 28, 2026
9d81f07
Fix formatting
martin-schlipf May 28, 2026
1c5bd86
Fix StructureHandler.read() -> .to_dict() and update test_class.py fo…
martin-schlipf May 28, 2026
9391f6f
Redesign dispatch selection: auto-forward via introspection, remove s…
martin-schlipf May 29, 2026
83d76f8
Refactor to_view method parameters to fix tests
martin-schlipf May 29, 2026
698bba5
Skip factory method tests for dielectric tensor and elastic modulus d…
martin-schlipf May 29, 2026
126e291
Fix doctests for Kpoint
martin-schlipf May 29, 2026
c6b0f74
Phase 1: inject from_path/from_file via @quantity decorator
martin-schlipf May 29, 2026
464beb8
Simplify _to_database: remove tags/fermi_energy args, flatten to prop…
martin-schlipf Jun 2, 2026
05baab4
Fix @quantity decorator to store full group_name for grouped quantities
martin-schlipf Jun 2, 2026
4a70bbc
Simplify to_database tests: remove dict wrapping from handler results
martin-schlipf Jun 3, 2026
98064f0
Add merge_to_database dispatch function for to_database methods
martin-schlipf Jun 3, 2026
858ff46
Add support for volume datasets / grid_scalars, and fix call to viewe…
MLovetroy Jun 12, 2026
f29ebde
Add to_vasp_viewer_config function to create dictionary suitable for …
MLovetroy Jun 17, 2026
8d05a36
Fix a broken .gitlink related to workshop that prevents uv sync for c…
MLovetroy Jun 17, 2026
0fbe433
Implement Calculation.selections and add tests
MLovetroy Jun 17, 2026
8119aab
Apply black formatting
MLovetroy Jun 17, 2026
e298ca3
Include actual call snippets
MLovetroy Jun 17, 2026
81b8048
Refactor into loadable util script so Calculation class stays tidy
MLovetroy Jun 18, 2026
a323787
Implement additive plotting of View objects
MLovetroy Jun 18, 2026
74cb5f8
Fix comparison issue
MLovetroy Jun 18, 2026
de138db
Refactor View and Graph merge utilities into shared script
MLovetroy Jun 18, 2026
a6e14d7
Fix some possible regressions and align with best practices
MLovetroy Jun 18, 2026
1c6298c
Change return signature of Calculation.selections to `dict[str, [str]…
MLovetroy Jun 22, 2026
f9be321
Change default behavior when method is not None and only_available=Fa…
MLovetroy Jun 22, 2026
5992ba7
Make only_available=False by default to avoid long load; add test for…
MLovetroy Jun 22, 2026
75a2e9d
Handle OOM errors separately
MLovetroy Jun 22, 2026
3765467
Merge branch 'master' into update-for-viewer-monorepo
martin-schlipf Jul 7, 2026
6b94427
Address code-quality bot findings on PR #292
martin-schlipf Jul 7, 2026
c8e0712
Fix selections() only_available doctest for density
martin-schlipf Jul 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
231 changes: 231 additions & 0 deletions .agents/skills/develop-test-driven/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
---
name: develop-test-driven
description: Enforce real red-green-refactor implementation instead of code-first changes. Use this whenever a task will change executable behavior and the repo has a practical automated test seam, whether directly from the user or as a delegated slice inside `execute-plan`.
compatibility: opencode
---

# Develop test driven

Use this skill when implementation should be led by tests instead of by coding first and adding coverage afterward. The goal is to change behavior with evidence, not to write code that merely seems right.

This skill is for active implementation work. It is most useful for features, bug fixes, and refactors where the correct behavior can be expressed in automated tests. It works well as a focused sub-skill inside `execute-plan`: `execute-plan` owns sequencing, delegation, work card creation, and integrated verification handoff; this skill owns the red-green-refactor loop for the implementation slice.

When the slice is mainly about an interface boundary such as web UI, CLI, TUI, API contracts, emails, or notifications, pair this skill with `implement-interface` rather than forcing TDD to also carry all of the interface-fidelity guidance.

If you were invoked from `execute-plan`, treat the feature card and current task as your boundary. Implement only that slice, return evidence, and let `execute-plan` decide broader sequencing and downstream handoffs.

## Owns

- One behavior-changing implementation slice at a time
- The red-green-refactor loop for that slice
- Producing concrete evidence: the failing test or automated check, the minimal code change, and the passing verification

## Does Not Own

- moving feature cards between lanes
- deciding overall task sequencing across a full feature plan
- product discovery, feature design, or implementation planning
- broad final review or documentation closure for the feature

## When To Use

Use this skill when the user or coordinating skill:

- asks for a feature or bug fix and the repo has a test harness
- wants true TDD or says to write tests first
- needs a regression test for a reported failure before changing code
- is working in an area where behavior drift would be expensive
- is executing a task from `execute-plan` that changes executable behavior

Do not use this skill when:

- the change is purely docs, comments, planning artifacts, or static configuration with no meaningful behavior to test
- the repo genuinely has no practical automated test seam for the requested change
- the task is still discovery or planning and implementation should not start yet
- the main work is lane movement or feature-card maintenance rather than behavior change

If there is no good automated seam yet, first find the smallest useful seam. Do not use that as an excuse to skip testing entirely.

## Core Rule

Do not write or keep production code for a new behavior change until a test or other automated check demonstrates the missing behavior first.

That means:

- write the test before the implementation change
- run it and confirm it fails for the expected reason
- make the smallest implementation change that can make it pass
- rerun the focused check and confirm the behavior changed
- refactor only after the tests are green

If code was already written for the requested behavior before the failing test exists, do not quietly continue from there. Either delete the speculative code or ignore it and re-derive the implementation from the test.

Speed is not an exception. When the user wants a quick fix, make the cycle smaller and more targeted, not looser.

## Workflow

### 1. Start From The Intended Behavior And The Current Task Boundary

Before touching code, state what behavior is changing.

Capture:

- the user-visible or externally observable behavior
- the seam where that behavior can be tested
- the smallest first test that would prove the behavior is currently missing
- any task constraints supplied by `execute-plan` or the feature card

Prefer a test that expresses the desired behavior through the real public interface. Default away from mocks when real interactions are practical. A mock-heavy test that only proves the mock was called is weaker than a small real test at the correct boundary.

If a coordinating skill supplied task-specific verification, satisfy that verification without expanding into adjacent plan work.

### 2. Write The Smallest Failing Test

Add one focused test for one behavior.

Good tests usually:

- name the behavior clearly
- assert one meaningful outcome
- use real code paths when practical
- stay small enough that the reason for failure is obvious

Avoid combining multiple behaviors into one broad test unless the repo's existing patterns clearly prefer that shape.

### 3. Verify Red Before Implementing

Run the most targeted command that proves the new test fails.

Confirm all of these:

- the test actually runs
- it fails, not passes
- it fails for the expected reason
- the failure points to missing or incorrect behavior, not a typo or broken test setup

If the test passes immediately, you have not proven the change. Tighten the test or choose a better seam.

If the test fails for the wrong reason, fix the test first. Do not start implementing against a broken signal.

### 4. Make The Smallest Green Change

Only after the failing signal is real, change the implementation.

Aim for the minimum code needed to satisfy the current test. Prefer a direct, boring change over early abstraction. Do not bundle unrelated cleanup, extra options, adjacent feature work, or feature-card edits into the same step.

When fixing a bug, the regression test is the first deliverable. The code change is second.

### 5. Verify Green Immediately

Rerun the focused test or check that failed in the red step.

Then confirm nearby regression safety with whatever additional verification fits the repo and change risk, such as:

- the relevant test file or package
- related integration tests
- lint, typecheck, or build when they are meaningful safeguards

Do not claim success because the code looks correct. Claim success when the targeted failing signal turned green and the surrounding checks still hold.

### 6. Refactor Without Changing Behavior

Once green, improve the code only if the cleanup helps and the tests still guard the behavior.

Good refactors here include:

- removing duplication introduced during the green step
- clarifying names or structure
- extracting a helper that the passing tests now protect

Do not sneak in extra behavior during refactor. If behavior must change again, start another red-green cycle.

### 7. Return Evidence, Then Repeat If Needed

For multi-part work, repeat with the next smallest missing behavior instead of writing a large block of implementation and backfilling tests later.

Each cycle should leave behind:

- one clearer expression of expected behavior
- one passing proof that the behavior now exists
- no ambiguity about what changed

If you are working under `execute-plan`, report back in a way the coordinator can use directly:

- the behavior covered
- the new or updated test
- the command that proved red
- the minimal implementation change for green
- the command that proved green
- any remaining risk or next likely cycle

Do not move the feature card between lanes from this skill unless the coordinating instructions explicitly made that the current task, which is unusual.

## TDD Heuristics

Prefer:

- user-facing or contract-facing tests over implementation-detail tests
- focused commands that validate one new behavior quickly
- minimal implementation before abstraction
- regression tests for every confirmed bug fix
- small repeated cycles over one giant test file rewrite

Flag:

- implementation code appearing before any new failing test
- a new test that passes on the first run without proving anything
- tests that mostly assert mocks, stubs, or internals instead of behavior
- broad code changes justified by one narrow failing test
- claims that manual checking is enough for a behavior that can be automated

## When The Test Seam Is Hard To Reach

Treat a hard-to-test change as design feedback.

First ask:

- is there a smaller public seam to test?
- can the behavior be moved behind a simpler interface?
- can an integration test cover this more honestly than deep mocking?

If the only path forward is limited, be explicit about the compromise and still preserve the red-green order. A weaker but honest automated check is usually better than code-first work with no durable proof at all.

If you are operating under `execute-plan` and no practical automated seam exists, return that constraint clearly so the coordinator can decide whether the task needs replanning, a documented exception, or a different verification approach.

## Resist Common Drift

Push back on these failure patterns:

- "fix it first and add tests after"
- "just patch the function quickly"
- "manual verification is enough for this one"
- "the change is too small to bother testing"

Do not argue abstractly. Translate the pushback into a smaller TDD step: name the narrow failing test, run it, make it pass, then continue.

## Checkpoint Reporting

At meaningful points, report progress in the language of the cycle:

- the behavior under test
- the current feature-task boundary if one was supplied
- the new failing test or check
- the command that proved red
- the implementation change made for green
- the command that proved green
- any remaining behaviors that still need another cycle

Keep these updates short. The point is to show evidence, not to narrate every keystroke.

## Quality Bar

Before finishing, check that:

- every intended behavior change in the current slice is covered by a new or updated automated check
- each important new test was observed failing before the corresponding implementation change
- the final implementation is no broader than the tested scope requires
- bug fixes include a regression test that would have caught the original failure
- the relevant verification commands were actually run and their outcomes are known
- any coordination context from `execute-plan` was honored without drifting into unrelated work

If those are not true, the work is not done yet. Keep cycling until the evidence matches the claim.
Loading
Loading