writing-tests
Skill76 starsChanged 6 days agoApache-2.0View on GitHub
Use when writing or fixing realtimekit-ui Stencil/Jest specs, e2e tests, and fixtures after the developer confirms the code works and allows tests. Check visible component behavior and exported helpers without mocking the code under test.
52 other projects use a version of this.
Adopted by
Most recently taken up by
- DataDog/browser-sdktheir own version, first seen Nov 30, 2026
- basaltbytes/skillstheir own version, first seen Nov 29, 2026
- mattwynne/skillstheir own version, first seen Nov 29, 2026
- dayfinggg/openai-codex-agent-skillstheir own version, first seen Nov 29, 2026
- borkweb/skillstheir own version, first seen Nov 29, 2026
- 851-labs/codevisortheir own version, first seen Nov 29, 2026
Used with
Projects with it also use reviewing-code, running-tests and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
ZayZay1nonlySkillreviewing-code
Provides structured code review with prioritized feedback. Use when reviewing PRs, analyzing code quality, checking for bugs, or auditing changes. Triggers on "review this", "check this code", PR reviews, or code quality questions.
Also in 5 projects that use this
OpenAISkillrunning-tests
Guide for running tests in the openai-dotnet repository. Use this when asked to run, debug, or validate tests, or when writing new tests. Explains test modes (Playback, Record, Live), how to identify recorded vs non-recorded tests, environment variable configuration, and what to do when recordings are missing or stale.
Also in 4 projects that use this
JetBrainsSkillcommits
Read before each commit, amend or reword: the subject SafePush accepts and the body.
Also in 3 projects that use this
BlockSkilldebugging
Debugging guidelines and best practices
Also in 5 projects that use this
sahinSkillexecute
Also in 3 projects that use this
MicrosoftSkillcouncil
Convene the persona panel — six orthogonal review lenses — on a target. Cold independent fan-out, debate-to-consensus, synthesized verdict with recorded dissent and a roster manifest.
Also in 4 projects that use this
Other versions52 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 52
- remotion-dev/remotion★ 76ksame name
- PostHog/posthog★ 41ksame name
- JetBrains/intellij-community★ 21ksame name
- quarkusio/quarkus★ 16ksame name
- mcp-use/mcp-use★ 11ksame name
- DetachHead/rebased★ 6.6ksame name
- chattocorp/chatto★ 3ksame name
- starkware-libs/cairo★ 1.9ksame name
- bholmesdev/hubble.md★ 1.5ksame name
- amplifthq/openmeld★ 1.4ksame name
42 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository14 other files it gives its agents.
- AGENTS.mdAGENTS.md
- packages/core/AGENTS.mdAGENTS.md
- packages/core/src/components/AGENTS.mdAGENTS.md
- packages/core/src/lib/AGENTS.mdAGENTS.md
- packages/core/src/utils/AGENTS.mdAGENTS.md
- breaking-changesSkill
- code-first-workflowSkill
- minimal-changesSkill
- no-guessingSkill
- plain-markdownSkill
- realtimekit-jsdocSkill
- realtimekit-sdk-mapSkill
- realtimekit-test-setupSkill
- strict-namingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. 0 are common, 11 are distinctive, and 8 are very specific to this project.
0
Common
Most of the 52 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Write tests only after the developer confirms the code works (see code-first-workflow).
- Distinctive: line 12
If the repo has its own test setup skill or notes (commands, mock folders), read them first.
- Very specific: line 14
Use Stencil's Jest runner and @stencil/core/testing for component specs.
- Very specific: line 19
Check what an app can see: shadow DOM, props, emitted event detail, or a returned UIConfig.
- Distinctive: line 21
Keep UI Kit render logic, state updates, and shared helpers real when those are the code under test.
- Distinctive: line 31
Search nearby specs for usable setup before you create a new fixture.
- Distinctive: line 32
Use an existing shared helper if it fits.
- Very specific: line 33
Use jest.fn() for an SDK method the component calls.
- Distinctive: line 34
If the same setup repeats across several specs, extract it to a shared helper and check its existing users.
- Distinctive: line 48
Write one test for each behaviour on that list.
- Very specific: line 49
Run the relevant specs once.
- Distinctive: line 69
Test data has the same shape as real data.
- Very specific: line 70
Follow strict-naming in test code as well.
- Distinctive: line 71
If mock setup is more than half of a test, you are mocking at the wrong level.
- Distinctive: line 75
Run the tests in single-run mode, not watch mode.
- Distinctive: line 76
Check that the assertion would catch the behavior it describes.
- Distinctive: line 77
Run the other tests of the area you touched.
- Very specific: line 84
When you must ask the developer, follow "Asking questions" in code-first-workflow: all questions in one message, each with your suggestion.
- Very specific: line 96
Use the "Final report" of code-first-workflow.
“Common” is measured: kept by at least 6 in 10 of the 52 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Writing tests
Write tests only after the developer confirms the code works (see code-first-workflow). Do not add tests for a docs-only edit.
Goal: every new or changed line and branch runs inside a test, and the test checks what that line does.
If the repo has its own test setup skill or notes (commands, mock folders), read them first.
Use Stencil's Jest runner and @stencil/core/testing for component specs. Read realtimekit-test-setup for commands.
1. Test the real code
- Render the real component with
newSpecPage, or call the real exported helper. - Check what an app can see: shadow DOM, props, emitted event detail, or a returned
UIConfig. - Mock boundaries outside the UI Kit when needed: the
meetingSDK object, browser/device APIs, timers, and network calls. - Keep UI Kit render logic, state updates, and shared helpers real when those are the code under test.
Reason: a mocked function is a function the test never runs. Its lines stay unverified even when the coverage number looks good.
When you add tests to an existing spec, keep the mock level that spec already uses, as long as the lines you are testing still run for real. Do not rewrite existing tests to move the mock level. If the existing level stops your lines from running, say so and ask.
2. Reuse setup where it helps
A small fixture local to one spec is fine. Share a mock or builder when several specs need it.
- Search nearby specs for usable setup before you create a new fixture.
- Use an existing shared helper if it fits. Do not change unrelated tests just to move mocks.
- Use
jest.fn()for an SDK method the component calls. Keep the rest of the fake meeting as small as the component needs. - If the same setup repeats across several specs, extract it to a shared helper and check its existing users.
Inside a spec file:
| Allowed | Belongs in the shared location |
jest.fn() for a meeting method called by the component | Replacing the component or helper being tested with a mock |
jest.spyOn() on an edge such as a browser API | Mocking the UI Kit behavior whose result you need to check |
A local createMeeting() fixture in one spec | Repeating the same large setup across many specs |
jest.useFakeTimers() when timing matters | Advancing timers without asserting the visible effect |
3. Cover every new line, honestly
- List the changed behaviors and branches from the diff: each visible state, prop default, event, or helper result. Include failure paths when they apply.
- Write one test for each behaviour on that list. Include the failure paths.
- Run the relevant specs once. Use the core
test:coveragescript when coverage is needed; do not use the watch-modetest:specscript for this. - For each uncovered new line, add a test. If no real input can reach the line, do not force it. Tell the developer the line may be dead code.
These tricks are not allowed:
- Coverage-ignore comments such as
/* istanbul ignore next */. test.skip,test.only,test.todo, or commented-out tests left in the file.- A test with no assertion, or one that only checks "does not throw", written to run lines.
- Checking only that a mock was called when the real effect can be checked.
- Assertions about what the mock itself does.
- Copying the production logic into the test to compute the expected value. Write the expected value by hand.
- Inputs that can never occur in the real flow.
- Reaching private state with
as anywhen a public path exists. - Making a failing test pass by weakening its assertion or deleting it.
- Changing production code only to make a test easier (test-only methods, exporting private things). Ask first.
4. Write clear tests
- The test name is the UI scenario in plain words:
shows the setup screen when showSetupScreen is true. - One behaviour per test.
- Test data has the same shape as real data. Use complete payloads.
- Follow
strict-namingin test code as well. - If mock setup is more than half of a test, you are mocking at the wrong level. Move the mock closer to the edge.
5. Prove the tests work
- Run the tests in single-run mode, not watch mode. Read the full output.
- Check that the assertion would catch the behavior it describes. Prefer a clear DOM, event, or config assertion over changing production code just to force a failure.
- Run the other tests of the area you touched. Report failures you did not cause. Do not hide them.
- Fix type and lint errors in the test files.
A test that does not check a visible result needs a stronger assertion. Rewrite it.
6. When something is wrong
When you must ask the developer, follow "Asking questions" in code-first-workflow: all questions in one message, each with your suggestion.
| Situation | What to do |
| A new test fails | Find which side is wrong, the code or the test. If the test is wrong, fix the test. |
| The code you wrote for this task is wrong, or misses a case | Fix the code, then the test. Tell the developer what you changed, why, and what to check again. Follow "When tests show that the code is wrong" in code-first-workflow. Never change the code only to make a test pass. |
| Code that is not part of this task looks like a bug | Do not fix it. Do not write a test that expects the suspected bug. Flag it with file and line, the ways to fix it, and your suggestion. |
| A line can be reached, but only with a side effect that breaks the test run | Do not force it. Report it. |
| One part of the task is blocked | Finish the part that is not blocked. Then stop and ask about the blocked part. |
Report
Use the "Final report" of code-first-workflow. Add this line to it:
Shared mocks added or changed: <list, or "none">Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

