Skip to content
Back to skills

Main

ASecurity

Middleware and health endpoints for RepoForge Web application. Trigger: when initializing or extending the FastAPI main application.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 26, 2026
ai-agentspythonbashfastapidockerapidatabasesecurity

Works with

  • api

Security analysis

A100/100

Scanned October 4, 2026

npx -y skills add JNZader/repoforge --skill main --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Main?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Main
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jnzader-main/badge)](https://www.skillsdirectory.com/skills/jnzader-main)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: add-main-endpoints
description: >
  Middleware and health endpoints for RepoForge Web application.
  Trigger: when initializing or extending the FastAPI main application.
license: Apache-2.0
metadata:
  author: repoforge
  version: "1.0"
complexity: low
token_estimate: 450
dependencies: []
related_skills: [add-repo-endpoint, add-user-model]
load_priority: high
---

<!-- L1:START -->
# add-main-endpoints

One sentence: Adds middleware and health check endpoints to the FastAPI app.

**Trigger**: when setting up the RepoForge Web application main entry point.
<!-- L1:END -->

<!-- L2:START -->
## Quick Reference

| Task | Pattern |
|------|---------|
| Add middleware | `add-middleware-pattern` |
| Health check | `health-endpoint-pattern` |
<!-- L2:END -->

<!-- L3:START -->
## Critical Patterns (Detailed)

### Pattern: correlation_id_middleware

Injects a unique correlation ID into each request context for distributed tracing.

```python
@app.middleware("http")
async def correlation_id_middleware(request: Request, call_next):
    import uuid
    request.state.correlation_id = str(uuid.uuid4())
    response = await call_next(request)
    response.headers["X-Correlation-ID"] = request.state.correlation_id
    return response
```

### Pattern: health endpoint

Provides basic and detailed health check endpoints for monitoring and load balancer checks.

```python
async def health() -> dict:
    return {"status": "ok"}

async def health_detailed() -> dict:
    return {"status": "ok", "database": "connected"}
```
## When to Use

- Adding request tracing and monitoring to the RepoForge Web app
- Configuring health checks for Docker container orchestration

## Commands

```bash
docker compose up -d repoforge
```

## Anti-Patterns

### Don't: Skip middleware setup

Omitting `correlation_id_middleware` or `security_headers_middleware` leaves the application vulnerable to request forgery and removes tracing capability.

```python
# BAD: Missing middleware registration
# app.add_middleware(...)  # not called
```
<!-- L3:END -->

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.