# Manage Database Session

> >

- **Type:** Skill
- **Install:** `agentstack add skill-jnzader-repoforge-database`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [JNZader](https://agentstack.voostack.com/s/jnzader)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [JNZader](https://github.com/JNZader)
- **Source:** https://github.com/JNZader/repoforge/tree/main/.claude/skills/backend/database
- **Website:** https://repoforge.javierzader.com

## Install

```sh
agentstack add skill-jnzader-repoforge-database
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# manage-database-session

This skill covers patterns for managing database sessions and models.

**Trigger**: Load when working with database interactions.

## Quick Reference

| Task | Pattern |
|------|---------|
| Create a database session | `get_db()` |
| Define a database model | `Base` |

## Critical Patterns (Summary)
- **Create a database session**: Use `get_db()` to create a session for database operations.
- **Define a database model**: Utilize `Base` to define your database models.

## Critical Patterns (Detailed)

### Create a database session

Use `get_db()` to create a session for database operations, ensuring proper management of database connections.

```python
from apps.server.app.models.database import get_db

async def some_database_operation():
    async with get_db() as session:
        # Perform database operations
        pass
```

### Define a database model

Utilize `Base` to define your database models, which will serve as the foundation for your ORM mappings.

```python
from apps.server.app.models.database import Base
from sqlalchemy import Column, Integer, String

class User(Base):
    __tablename__ = 'users'
    
    id = Column(Integer, primary_key=True, index=True)
    name = Column(String, index=True)
```

## When to Use

- When creating a new database session for CRUD operations.
- When defining new models for your database schema.

## Commands

```bash
python -m alembic upgrade head
```

## Anti-Patterns

### Don't: Use raw SQL queries directly

Using raw SQL queries bypasses the ORM and can lead to security vulnerabilities and maintenance issues.

```python
# BAD
async def raw_query():
    await db.execute("SELECT * FROM users")
```

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [JNZader](https://github.com/JNZader)
- **Source:** [JNZader/repoforge](https://github.com/JNZader/repoforge)
- **License:** MIT
- **Homepage:** https://repoforge.javierzader.com

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-jnzader-repoforge-database
- Seller: https://agentstack.voostack.com/s/jnzader
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
