Files
leo-claude-mktplace/plugins/saas-api-platform/skills/framework-detection.md
lmiranda 2d51df7a42 feat(marketplace): command consolidation + 8 new plugins (v8.1.0 → v9.0.0) [BREAKING]
Phase 1b: Rename all ~94 commands across 12 plugins to /<noun> <action>
sub-command pattern. Git-flow consolidated from 8→5 commands (commit
variants absorbed into --push/--merge/--sync flags). Dispatch files,
name: frontmatter, and cross-reference updates for all plugins.

Phase 2: Design documents for 8 new plugins in docs/designs/.

Phase 3: Scaffold 8 new plugins — saas-api-platform, saas-db-migrate,
saas-react-platform, saas-test-pilot, data-seed, ops-release-manager,
ops-deploy-pipeline, debug-mcp. Each with plugin.json, commands, agents,
skills, README, and claude-md-integration. Marketplace grows from 12→20.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 14:52:11 -05:00

82 lines
3.0 KiB
Markdown

---
name: framework-detection
description: Detect FastAPI vs Express, identify project structure, locate route files and models
---
# Framework Detection
## Purpose
Identify the API framework in use and map the project structure. This skill is loaded by the `api-architect` agent during setup and code generation to ensure framework-appropriate output.
---
## Detection Rules
### FastAPI Detection
| Indicator | Location | Confidence |
|-----------|----------|------------|
| `from fastapi import` in Python files | `*.py` | High |
| `fastapi` in `requirements.txt` | Project root | Medium |
| `fastapi` in `pyproject.toml` dependencies | Project root | Medium |
| `uvicorn` in requirements alongside fastapi | Project root | High |
| `@app.get`, `@router.post` decorators | `*.py` | High |
**FastAPI Project Structure (typical):**
```
app/
__init__.py
main.py # FastAPI app instance, middleware, router includes
routes/ # Route modules (one per resource)
models/ # Pydantic models (request/response schemas)
dependencies/ # Dependency injection functions
middleware/ # Custom middleware
core/ # Config, security, database setup
```
### Express Detection
| Indicator | Location | Confidence |
|-----------|----------|------------|
| `express` in `package.json` dependencies | Project root | High |
| `require('express')` or `import express` | `*.js`, `*.ts` | High |
| `express.Router()` usage | `*.js`, `*.ts` | High |
| `tsconfig.json` present alongside Express | Project root | Express+TS variant |
**Express Project Structure (typical):**
```
src/
app.js or app.ts # Express app instance, middleware, router mounts
routes/ # Route modules (one per resource)
models/ # Database models (Sequelize, Mongoose, etc.)
schemas/ # Validation schemas (Zod, Joi)
middleware/ # Custom middleware
config/ # Environment config, database setup
```
---
## Project Mapping Procedure
1. **Check package files first**: `requirements.txt`, `pyproject.toml`, `package.json`
2. **Scan entry points**: `main.py`, `app.py`, `app.js`, `app.ts`, `index.js`, `index.ts`
3. **Locate route directory**: Search for `routes/`, `routers/`, `controllers/`, `api/`
4. **Locate model directory**: Search for `models/`, `schemas/`, `entities/`
5. **Locate test directory**: Search for `tests/`, `test/`, `__tests__/`, `spec/`
6. **Check for existing OpenAPI spec**: `openapi.yaml`, `openapi.json`, `swagger.*`
---
## Framework Version Detection
**FastAPI**: Parse version from `requirements.txt` pin or `pyproject.toml` constraint. Important for feature availability (e.g., `lifespan` parameter in 0.93+).
**Express**: Parse version from `package.json` dependencies. Important for middleware compatibility (Express 4 vs 5).
---
## Ambiguous Projects
If both FastAPI and Express indicators are found (monorepo), ask the user which service to target. Store the selection in `.api-platform.json` with a `service_root` field pointing to the specific service directory.