Sf app architect tdd
Skill msrivastav13/sf-app-architect/skills/sf-app-architect-tdd
Drive test-first implementation on Salesforce-platform projects, one red → green behavior slice at a time at pre-agreed Apex, Flow, LWC, data-transformation, or integration seams; use validation rather than fake unit tests when metadata has no deterministic test seam. Use when invoked by sf-app-architect-implement, or when the user wants red-green-refactor / test-first development on Salesforce metadata.From its SKILL.md
npx -y skills add msrivastav13/sf-app-architect --skill sf-app-architect-tddAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.1 KB, as published. Nobody here has run it
SF App Architect TDD
TDD is the red → green engine used by sf-app-architect-implement.
Test behavior through stable platform interfaces, not XML shape or private implementation. Read TEST-SEAMS.md before choosing or changing a seam.
Preconditions
Before the first test:
- read the ticket, parent spec, glossary, and ADRs;
- write down the pre-agreed seams;
- identify the independent expected result;
- identify the smallest command that will prove red and green;
- classify metadata-only or environment work that requires validation rather than strict TDD.
Do not invent a new seam without stopping for approval when the spec made seam choice material.
Loop
1. Red
Write one test for one missing behavior.
Run the narrowest command and confirm:
- it fails;
- it fails for the intended missing behavior;
- it is not failing only because of syntax, metadata dependency, environment drift, or unrelated test breakage.
A test that passes before implementation is not red. A compile failure unrelated to the behavior is not useful red.
2. Green
Make the smallest coherent source change that passes the test.
- Do not anticipate later slices.
- Do not add unrelated metadata.
- Keep package and manifest boundaries intact.
- Run the narrow test frequently.
- Run project-native static checks frequently.
- Use only the ticket's permitted org operations.
3. Repeat
Take the next behavior slice only after the current test is green.
Do not perform broad refactoring inside the loop. Structural cleanup belongs to sf-app-architect-code-review, where the complete diff and spec are visible.
Completion criterion: every agreed automated behavior is represented by an independent, passing test and no cycle skipped observed red.
Test quality rules
- Assert business outcomes and public contracts, not coverage.
- Expected values come from the spec, a worked example, or another independent source.
- Keep tests deterministic and isolated from mutable org data by default.
- Exercise single-record and bulk behavior where the transaction can receive bulk input.
- Cover relevant success, failure, permission, sharing, retry, and async outcomes.
- Use callout mocks for external behavior.
- Flush asynchronous Apex deliberately when the behavior depends on it.
- Test LWC behavior through public properties/methods, events, user interaction, and rendered output.
- Test automation through supported invocation or record outcomes, not Flow XML.
- Do not make tests depend on execution order.
- Do not use
SeeAllData=trueas a convenience. - Do not assert exact governor consumption unless the limit is itself a specified contract.
- Do not weaken assertions merely to make a test green.
When strict TDD does not fit
Examples include permission assignment, page assignment, folder access, credential provisioning, package installation, metadata deletion, and Flow activation.
For these, define a deterministic validation scenario:
- precondition;
- operation;
- observable expected result;
- named environment;
- cleanup;
- evidence retained.
Do not write a tautological Apex test that merely describes metadata you cannot exercise.
Completion criterion: every non-TDD acceptance item has an explicit validation seam and is handed back to implementation for execution.
License and lineage
Original modifications and additions in this file are licensed under Apache License 2.0. Portions are adapted from Matt Pocock's MIT-licensed Skills for Real Engineers project and have been substantially modified for Salesforce app development. See the repository root LICENSE, NOTICE, LICENSES/MIT-Matt-Pocock.txt, and THIRD_PARTY_NOTICES.md.