propagate
Generate tests from Allium specifications. Use when the user wants to propagate tests, generate test files from a spec, write tests for a specification, create property-based tests, produce state machine tests, check test coverage against spec obligations, or understand what tests a specification requires.
What this skill does
# Propagation This skill generates tests from Allium specifications. Propagation is how plants reproduce from cuttings of the parent: the spec is the parent, the tests are the offspring. Deterministic tools guarantee completeness (every spec construct maps to a test obligation). You handle the implementation bridge: correlating spec constructs with code, generating tests in the project's conventions. ## Prerequisites Before propagating tests, you need: 1. **An Allium spec** — the `.allium` file describing the system's behaviour 2. **A target codebase** — the implementation to test 3. **Test obligations** — from `allium plan <spec>` (JSON listing every required test) 4. **Domain model** — from `allium model <spec>` (JSON describing entity shapes, constraints, state machines) If the CLI tools are not available, derive test obligations manually from the spec using the test-generation taxonomy in [`references/test-generation.md`](../allium/references/test-generation.md). ## Modes ### Surface mode Generates boundary tests from surface declarations. Use when the user wants to test an API, UI contract or integration boundary. For each surface in the spec: 1. **Exposure tests** — verify each item in `exposes` is accessible to the specified actor, including `for` iteration over collections 2. **Provides tests** — verify operations appear when their `when` conditions are true and are hidden otherwise, including when the corresponding rule's `requires` clauses are not met 3. **Actor restriction tests** — verify the surface is not accessible to other actor types 4. **Actor identification tests** — verify only entities matching the actor's `identified_by` predicate can interact; for actors with `within`, verify interaction is scoped to the declared context 5. **Context scoping tests** — verify the surface instance is absent when no entity matches the `context` predicate 6. **Contract obligation tests** — verify `demands` are satisfied by the counterpart, `fulfils` are supplied by this surface, including all typed signatures 7. **Guarantee tests** — verify `@guarantee` annotations hold across the boundary 8. **Timeout tests** — verify referenced temporal rules fire within the surface's context 9. **Related navigation tests** — verify navigation to related surfaces resolves to the correct context entity ### Spec mode Walks the full test obligations document. Use when the user wants comprehensive test coverage for the entire specification. Categories from the test-generation taxonomy: - **Entity and value type tests** — fields, types, optional (`?`) null handling, `when`-clause state-dependent presence, relationships, join lookups, equality - **Enum tests** — comparability across named enums, membership tests, inline enum isolation - **Sum type tests** — variant fields, type guards, exhaustiveness, creation via variant name, base `.created` trigger narrowing - **Derived value and projection tests** — computation, filtering, `-> field` extraction, parameterised derived values, `now` volatility, collection operations - **Default instance tests** — unconditional existence, field values, cross-references between defaults - **Config tests** — defaults, overrides, mandatory parameters, expression-form defaults, qualified references, config chains - **Invariant tests** — post-rule verification, edge cases, implication logic, entity-level invariants - **Rule tests** — success/failure/edge cases, conditionals (ensuring `if` guards read resulting state), entity creation, removal, bulk updates, rule-level `for` iteration, `let` bindings, chained triggers - **State transition tests** — valid/invalid transitions, terminal states, `transitions_to` vs `becomes` semantics - **Temporal tests** — deadline boundaries, re-firing prevention, optional field null behaviour - **Surface tests** — exposure, availability, actor identification with `within` scoping, context scoping, related navigation - **Contract tests** — signature satisfaction, `@invariant` honouring, `demands`/`fulfils` direction - **Cross-module tests** — qualified entity references, external trigger responses, type placeholder substitution - **Cross-rule interaction tests** — duplicate creation guards, provides availability - **Transition graph tests** — every declared edge is reachable via its witnessing rule, undeclared transitions are rejected, terminal states have no outbound rules, non-terminal states have at least one exit, exact correspondence between enum values and graph edges - **State-dependent field tests** — presence when in qualifying state, absence when outside, presence obligations on entering the `when` set, absence obligations on leaving, no obligation when moving within or outside, convergent transitions all set the field, guard required to access `when`-qualified fields, derived value `when` inference via input intersection - **Scenario tests** — happy path, edge cases, order independence - **Data flow chain tests** — exercise full chains from surface capture through rules to downstream rule preconditions. For each chain (surface provides trigger → rule ensures field → downstream rule requires field), generate an integration test that submits data through the surface and verifies it reaches the downstream precondition. - **Reachability tests** — walk from each initial state (via `.created()`) to each terminal state, following a valid path through the transition graph. Each test exercises a complete lifecycle. - **Deadlock scenario tests** — for states where `allium analyse` identifies potential deadlocks, generate tests that put the entity in the stuck state and verify whether it can progress. - **Cross-entity process tests** — for processes spanning multiple entities, generate integration tests that exercise the full process from start to terminal state across all participating entities. If `allium analyse` is available, use its findings to prioritise test generation. A `missing_producer` or `dead_transition` finding indicates a gap worth exercising with a test. A `deadlock` finding should generate a test documenting that the entity cannot escape the stuck state. Consult [actioning findings](../allium/references/actioning-findings.md) for the finding type taxonomy. ## Test output kinds ### 1. Assertion-based tests For deterministic obligations: field presence, enum membership, transition validity, surface exposure, state-dependent field presence and absence. These are standard unit/integration tests. ### 2. Property-based tests For invariants and rule properties. Each expression-bearing invariant becomes a PBT property: - Generate a valid entity state using the generator spec - Apply a sequence of rules (following the transition graph when declared, or deriving valid sequences from rules alone) - Check the invariant holds at every step Use the project's PBT framework: | Language | Framework | Discovery | |----------|-----------|-----------| | TypeScript | fast-check | `package.json` | | Python | Hypothesis | `pyproject.toml` | | Rust | proptest | `Cargo.toml` | | Go | rapid | `go.mod` | | Elixir | StreamData | `mix.exs` | Fall back to assertion-based tests if no PBT framework is present. ### 3. State machine tests For entities with status enums. When a transition graph is declared, walk every path through the graph. When no graph is declared, derive valid transitions from rules. - Verify transitions succeed via witnessing rules - Verify rejected transitions fail - Verify state-dependent fields are present or absent at each state per their `when` clauses - Verify invariants hold at each state State machine tests require an **action map**: a function per transition edge that takes the entity in the source state and produces it in the target state by calling the actual implementation code. Without this map, the test framework can describe valid paths through the graph but cannot execute them. To build the action map: 1. For each edge in the transition graph, find the witne
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.