What it is for
Writes tests for validation, calculation, state-transition and authorization behavior, each tied to a rule the agent confirmed in source. It records which rules are already covered by existing tests. Use it when- You want tests for a module, endpoint or business rule.
- You want to find coverage gaps against the rules in the code.
- You need browser or full user-journey tests (use End-to-End Test Generation).
Prerequisites
- A repository that CoreStory v3 has indexed. The skill checks this first with
statusandcorpus_info, and stops if the snapshot is missing or the last ingest failed. Setup is on the CoreStory v3 playbooks overview. - The
corestory-localplugin or the MCP connection, so the agent can reach the CoreStory v3 tools. - An existing test framework. The skill matches the repo’s conventions and does not set up new infrastructure without asking.
How to invoke it
- Automatic. With the Claude Code plugin, a session hook points the agent to the matching skill before it edits or answers. The agent picks
generate-testswhen the request fits. - By name. Ask for it directly (
/generate-testsin Claude Code; the plugin may show it ascorestory-local:generate-tests), or say “use the generate-tests skill” in other agents. - From a rules file. Without the plugin hook, add the one-line fallback from the overview to
CLAUDE.mdorAGENTS.md.
What it produces
- New test files in the repo’s test location.
TEST-NOTES.mdin the repository root: scope, a rule inventory with each row marked covered, partly covered or uncovered (with testpath:start-end), tests added, commands and results, andNot verified.
How it works
- Preflight with
statusandcorpus_info; state the scope in one line. - Build an inventory:
searchwithkind:"sao:Rule"per category,entitywith evidence, andread_fileon the evidence lines. Keep only rules whose quote or condition was seen, including rules enforced in other layers. - Read existing tests with
list_filesandread_filefor framework, layout and run command, and mark each inventory row’s coverage. - Write tests that assert observable outcomes, cite the rule id, and use the evidence values with a boundary on each side.
- Run each new test and the relevant suite, and record the results.
Limits
- A failing test is a finding. The skill reports whether the rule or the code looks wrong, with both locations, and does not bend the assertion to match.
- Coverage labels come from reading tests, not from a coverage tool.
- CoreStory reads and indexes code. It does not run or test it. Any test results in the output are the agent’s own, from commands it ran.
- Results describe the ingested snapshot, which may differ from your working tree if files changed since.
- Hits from
searchare leads, not proof. The skill reads the cited lines before it relies on a rule, and lists what it could not check underNot verified. - Compared with the hosted playbook: the hosted playbook is Behavioral Test Coverage.
Skill source
The full recipe is the skill file itself:generate-tests/SKILL.md on GitHub.