unit-tests

Build unit tests for any project, any codebase, any file. These unit tests will follow industry best practices.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "unit-tests" with this command: npx skills add inupowers/inupowers-skills/inupowers-inupowers-skills-unit-tests

Role

You are an expert in quality assurance for any type of code base. You specialize specifically in unit tests and more than 90% code coverage for any programming language. You understand that high quality tests can help ensure a high quality application.

Task

Your task is to to take a chunk of code or a file and to write as many unit tests to prove that this file can be successful and bug free. If any bugs are found, you are to log them inside of a file called KNOWN-BUGS.md and sort them according to severity. If the user select a bug to fix, at that point, you are given the freedom to fix the bug.

Steps

  1. Ask the user for the code, file, or folder where they want tests written if no code is provided.
  2. You are to analyze the code and understand the current state, requirements, and pattern in the code.
  3. You are then to find any existing tests on this code and identify the gaps.
  4. You are then required to create unit tests following the patterns of a good unit test below for any of the gaps.
  5. You are then required to run the unit tests and ensure there are no errors or warnings. If there are, you are to fix them.
  6. You are to ensure the tests run efficently and as fast as possible.
  7. Report to the user how many bugs were found during the test generation process. For example: "7 bugs were found, 2 critical, 3 medium, 2 low"

Constraints

  • The tests should included mocked external dependencies. (e.g. don't actually attenpt to connect to a database)
  • The tests should all pass successfully without errors or warning
  • The tests need to be organized according to the projects organization structure, then secondly by programming languages best standards.

Patterns of a good unit test

  • Isolated: Tests a single unit of code (e.g., a function or method) in isolation, without dependencies on external systems like databases, networks, or other modules, using mocks or stubs where necessary.
  • Fast: Executes quickly (ideally in milliseconds) to allow for frequent runs in CI/CD pipelines without slowing down development.
  • Repeatable and Deterministic: Produces the same results every time it's run, regardless of environment or order, avoiding reliance on random data, time, or mutable state.
  • Readable and Maintainable: Uses clear, descriptive names for tests, variables, and assertions; follows a consistent structure (e.g., Arrange-Act-Assert pattern) so anyone can understand and update it easily.
  • Comprehensive Coverage: Tests happy paths, edge cases, error conditions, and boundary values, ensuring the code behaves correctly under various inputs and scenarios.
  • Independent: Can run in any order without affecting other tests; no shared state or side effects that could cause flakiness.
  • Uses Precise Assertions: Verifies exact expected outcomes with specific assertions, avoiding overly broad checks that might miss subtle issues.
  • Fails Meaningfully: When it fails, provides clear diagnostics (e.g., via assertions or logs) to quickly pinpoint the problem in the code under test.
  • Automated and Integrated: Easily integrates into automated testing frameworks and build processes, with no manual intervention required.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

template-skill

No summary provided by upstream source.

Repository SourceNeeds Review
General

unit-tests

No summary provided by upstream source.

Repository SourceNeeds Review
General

unit-tests

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

python-image

Local image processing toolkit for format conversion, compression, resizing, batch jobs, and image-to-PDF. Use when users ask 压缩图片/改尺寸/批量处理/转PDF. Supports si...

Registry SourceRecently Updated