writing-tests-pg-data
Instructions for writing tests for PG Data services, likely involving database fixtures and integration tests.
Skill by agent-ix
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/agent-ix-writing-tests-pg-data
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, data, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/writing-tests-pg-data
What's inside
- Skill name
writing-tests-pg-data- Description
- Instructions for writing tests for PG Data services, likely involving database fixtures and integration tests.
- License
- MIT
- Instructions
- 88 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Writing PG Data Tests
If this plugin is not initialized or an Agent IX command fails, read [the dev-tools setup guide](https://github.com/agent-ix/dev-tools/blob/main/setup.md) for its prerequisites and local diagnosis.
This skill provides guidelines for writing tests for services using `SQLModel` and `postgres`, aligned with the Agent-IX Golden Path.
**Source Spec**: Derived from `pg-data-service` (SQLModel, Alembic).
## Core Rules
1. **Framework**: Use `pytest-sqlmodel`. This plugin provides all necessary fixtures and database management.
2. **Real Database**: Tests must ALWAYS run against a real Postgres database managed by the `postgres` fixture. Do not use SQLite/in-memory databases.
3. **Isolation**: The `db_session` fixture provided by `pytest-sqlmodel` handles transaction isolation (rollbacks) automatically.
4. **Factories**: Use helper functions (factories) to create test data rather than raw SQL inserts.
## Fixtures
Standard fixtures used in `conftest.py` (provided by `pytest-sqlmodel`):
- `db_session`: A `Session` object isolated by a transaction. Use this for DB interactions in tests.
- `postgres`: The underlying `testcontainers` or service-managed postgres instance URL.
- `client`: A `TestClient` with the session dependency overridden to use `db_session`.
## Testing Models
Test that models can be created and retrieved.
```python
class TestHeroModel:
"""Tests for the Hero model."""
def test_create_hero(self, session: Session):
"""
Description:
Test that a Hero can be created and persisted.
Assumptions:
- Database is available
- Session is active
Criteria:
- Hero is saved with a generated ID
- Fields match input values
Trace: FR-001-AC-1
"""
hero = Hero(name="Deadpond", secret_name="Dive Wilson")
session.add(hero)
session.commit()
session.refresh(hero)
assert hero.id is not None
assert hero.age is None
```
## Testing API Endpoints
Test that endpoints interact correctly with the DB.
```python
class TestHeroAPI:
"""Tests for the Hero API endpoints."""
def test_create_hero_api(self, client: TestClient):
"""
Description:
Test the create hero POST endpoint.
Assumptions:
- API is running
- Database connection is valid
Criteria:
- Returns 200 OK
- Response contains created hero with ID
"""
response = client.post(
"/heroes/",
json={"name": "Spider-Boy", "secret_name": "Pedro Parqueador"}
)
data = response.json()
assert response.status_code == 200
assert data["name"] == "Spider-Boy"
assert data["id"] is not None
```From agent-ix/dev-tools, MIT.
More from agent-ix/dev-tools
- 0.570score
security-deepsec
agent-ix
Run a generic DeepSec-backed security review and remediation burndown for one or more target repositories.
SkillAFreshness: AClaude Code +9 - 0.570score
docs-figures
agent-ix
Draw diagrams, charts and CSS animations for GitHub READMEs and documentation as transparent light and dark SVG pairs, with text drawn as glyph outlines so…
SkillAFreshness: AClaude Code +9 - 0.570score
rust-review
agent-ix
Review Rust changes against Agent IX Rust style, repository conventions, behavior, test evidence, safety and concurrency, wire contracts, resource bounds, and…
SkillAFreshness: AClaude Code +9 - 0.567score
rust-style
agent-ix
Agent IX Rust conventions for every Rust coding and review task.
SkillAFreshness: AClaude Code +9 - 0.567score
new-project
agent-ix
Scaffold a new repository from an Agent IX template, verify it locally, establish AGPL and content-rights controls, and create its GitHub repository privately.
SkillAFreshness: AClaude Code +9 - 0.560score
writing-tests-react
agent-ix
Index to React component testing guides.
SkillAFreshness: AClaude Code +9 - 0.558score
backport-code
agent-ix
A skill for systematically backporting bug fixes and features across specs, templates, and downstream repositories.
SkillAFreshness: AClaude Code +9 - 0.558score
review-react
agent-ix
Review React components for test coverage, including unit tests and Storybook stories with requirement traceability.
SkillAFreshness: AClaude Code +9 - 0.558score
writing-tests-python
agent-ix
Instructions for writing Python tests (pytest), including mocking, fixtures, and golden path standards.
SkillAFreshness: AClaude Code +9 - 0.558score
writing-tests-typescript
agent-ix
Instructions for writing TypeScript tests (Jest), including typed mocks and testing patterns.
SkillAFreshness: AClaude Code +9 - 0.553score
code-review
agent-ix
Review code for Agent-IX Golden Path compliance, focusing on test style, mock boundaries, implementation gaps, and code-test alignment.
SkillAFreshness: AClaude Code +9 - 0.550score
assurance-onboarding
agent-ix
Capture a generic handoff in the fixture host.
SkillAFreshness: AClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 4, 2026 (24 days ago)
- Last release
- Oct 22, 2026 (6 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/agent-ix/dev-tools
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from agent-ix
- 0.570score
security-deepsec
agent-ix
Run a generic DeepSec-backed security review and remediation burndown for one or more target repositories.
SkillAFreshness: AClaude Code +9 - 0.570score
docs-figures
agent-ix
Draw diagrams, charts and CSS animations for GitHub READMEs and documentation as transparent light and dark SVG pairs, with text drawn as glyph outlines so…
SkillAFreshness: AClaude Code +9 - 0.570score
rust-review
agent-ix
Review Rust changes against Agent IX Rust style, repository conventions, behavior, test evidence, safety and concurrency, wire contracts, resource bounds, and…
SkillAFreshness: AClaude Code +9 - 0.567score
rust-style
agent-ix
Agent IX Rust conventions for every Rust coding and review task.
SkillAFreshness: AClaude Code +9 - 0.567score
new-project
agent-ix
Scaffold a new repository from an Agent IX template, verify it locally, establish AGPL and content-rights controls, and create its GitHub repository privately.
SkillAFreshness: AClaude Code +9 - 0.560score
writing-tests-react
agent-ix
Index to React component testing guides.
SkillAFreshness: AClaude Code +9
Cite this page
writing-tests-pg-data skill. Agent Mart. https://agentmart.dev/skills/agent-ix-writing-tests-pg-data (last updated 2026-10-24)