test-writer

How to write pytest tests for modules in this workspace. Load whenever you are about to write or extend tests.

npx skills add https://github.com/firebase/genkit --skill test-writer

Test writer

When writing pytest tests in this workspace:

  • One test file per module. foo.py lives next to foo_test.py (suffix, not prefix).
  • Cover the happy path AND at least one edge case. Empty input, duplicates, boundary values — pick what matters for the unit under test.
  • Use pytest.mark.parametrize when the same assertion runs over a small table of inputs. Keep IDs descriptive.
  • Name tests test_<unit>_<scenario>_<expected>. Examples: test_total_empty_cart_returns_zero, test_add_duplicate_item_merges_quantities.
  • Arrange / Act / Assert. Three clear blocks. No setup hidden in fixtures unless it's reused across at least two tests.
  • Assert behavior, not implementation. Don't reach into private attributes or count function calls; check the observable result.
  • Imports at module top. Don't import inside test functions.

More skills from firebase

resolve-docker-vulnerabilities
firebase
Skill to resolve Docker vulnerabilities for the firebase-cli image. Use this skill when you need to check for vulnerabilities in the firebase-cli Docker image…
official
python-expert
firebase
Conventions for clean, idiomatic Python. Load whenever you read, edit, or write Python source files.
official
developing-genkit-dart
firebase
Unified AI SDK for Dart enabling code generation, structured outputs, tools, flows, and agents. Provides core APIs for generation, tool definition, flow orchestration, embeddings, and streaming with a single interface Includes 8+ plugins for LLM providers (Google Gemini, Anthropic Claude, OpenAI GPT), Firebase AI, Model Context Protocol, Chrome browser integration, and HTTP server hosting via Shelf Built-in CLI with local development UI for flow execution, tracing, model experimentation, and...
official
developing-genkit-js
firebase
Build AI-powered Node.js/TypeScript applications with Genkit flows, tools, and multi-model support. Genkit is provider-agnostic; supports Google AI, OpenAI, Anthropic, Ollama, and other LLM providers via plugins Define flows with type-safe schemas using Zod, execute generation requests, and compose multi-step AI workflows in TypeScript Requires Genkit CLI v1.29.0+; recent major API changes mean you must consult genkit docs:read and common-errors.md for current patterns, not prior knowledge...
official
developing-genkit-python
firebase
Develop AI-powered applications using Genkit in Python. Use when the user asks about Genkit, AI agents, flows, or tools in Python, or when encountering Genkit…
official
firebase-ai-logic
firebase
Client-side Gemini integration for web apps with multimodal inference, streaming, and on-device hybrid execution. Supports text-only and multimodal inputs (images, audio, video, PDFs); files over 20 MB route through Cloud Storage Includes chat sessions with automatic history, streaming responses for real-time display, and structured JSON output enforcement Offers hybrid on-device inference via Gemini Nano in Chrome, with automatic fallback to cloud execution Requires App Check for production...
official
firebase-ai-logic-basics
firebase
Official skill for integrating Firebase AI Logic (Gemini API) into web applications. Covers setup, multimodal inference, structured output, and security.
official
firebase-app-hosting-basics
firebase
Deploy and manage full-stack web apps with Firebase App Hosting using Next.js, Angular, and other supported frameworks. Requires Firebase project on Blaze pricing plan; supports Server-Side Rendering (SSR) and Incremental Static Regeneration (ISR) workflows Deploy via firebase.json configuration with optional apphosting.yaml for backend setup, or enable automated "git push to deploy" through GitHub integration Includes secret management via CLI commands for secure access to sensitive keys...
official