Backend Engineering
Purpose
Build and maintain reliable FastAPI backend functionality using the project's existing architecture.
Project Stack
Python 3.11+, FastAPI, Pydantic 2, SQLAlchemy 2, Alembic, PostgreSQL, Redis, Celery, JWT, bcrypt.
Operating Principles
- Inspect the existing backend architecture before creating new modules.
- Separate routing, schemas, services, persistence, and infrastructure responsibilities.
- Prefer dependency injection through FastAPI dependencies where appropriate.
- Keep route handlers thin.
- Validate all untrusted input.
- Handle database transactions explicitly and predictably.
- Never swallow exceptions without a deliberate reason.
- Use async code only where the surrounding architecture supports it correctly.
- Do not introduce a new architectural pattern when an existing project pattern already solves the problem.
- Keep secrets and credentials out of source code.
- Do not claim backend functionality works without executing relevant verification.
Required Workflow
- Map the affected backend modules.
- Trace the request path from route to persistence.
- Identify data and transaction boundaries.
- Research framework behavior if uncertain.
- Implement using existing project conventions.
- Run lint/type/static checks available in the repository.
- Run relevant unit/integration/API tests.
- Verify failure paths as well as successful paths.
- Review security and transaction behavior.
- Inspect the final diff.
Evidence Rules
Use the strongest available evidence in this order:
- Runtime behavior
- Automated test results
- Type checking, linting, and build results
- Installed package/source behavior
- Official framework or library documentation
- Repository configuration
- Static code inspection
- General model knowledge
Never report an assumption as a verified result.
Tool Selection
- Use Filesystem MCP for repository exploration and file inspection.
- Use Context7 for current, version-specific library/framework documentation.
- Use Fetch when official documentation or public web resources need to be retrieved.
- Use Playwright for browser behavior, frontend interaction, forms, authentication flows, and UI verification.
- Use GitHub CLI for repository, branch, pull request, issue, workflow, and CI operations.
- Prefer the smallest tool set that establishes reliable evidence.
Failure Handling
When something fails:
- Reproduce the failure.
- Capture the exact error.
- Identify the failing layer.
- Check whether the failure is environmental, dependency-related, configuration-related, or caused by application code.
- Research uncertain behavior using authoritative sources.
- Apply the smallest appropriate fix.
- Reproduce the original failure again.
- Run regression checks.
- Inspect the final diff.
Do not hide failures by weakening tests, suppressing errors, deleting evidence, or claiming success without verification.
Security
- Never expose secrets.
- Never commit credentials.
- Treat all external input as untrusted.
- Preserve authentication and authorization boundaries.
- Avoid leaking internal implementation details through errors.
- Review security implications whenever the skill touches users, data, credentials, networking, or deployment.
Completion Criteria
A task using this skill is complete only when:
- The requested behavior is implemented.
- Existing project conventions are preserved.
- Relevant static checks pass.
- Relevant tests pass or their absence is explicitly reported.
- Browser verification is performed when the task affects user-facing behavior.
- Security implications have been considered.
- The final diff has been inspected.
- Verified facts are clearly distinguished from assumptions or remaining uncertainty.
1---2name: backend3description: Backend Engineering4---5# Backend Engineering67## Purpose89Build and maintain reliable FastAPI backend functionality using the project's existing architecture.1011## Project Stack1213Python 3.11+, FastAPI, Pydantic 2, SQLAlchemy 2, Alembic, PostgreSQL, Redis, Celery, JWT, bcrypt.1415## Operating Principles16171. Inspect the existing backend architecture before creating new modules.182. Separate routing, schemas, services, persistence, and infrastructure responsibilities.193. Prefer dependency injection through FastAPI dependencies where appropriate.204. Keep route handlers thin.215. Validate all untrusted input.226. Handle database transactions explicitly and predictably.237. Never swallow exceptions without a deliberate reason.248. Use async code only where the surrounding architecture supports it correctly.259. Do not introduce a new architectural pattern when an existing project pattern already solves the problem.2610. Keep secrets and credentials out of source code.2711. Do not claim backend functionality works without executing relevant verification.2829## Required Workflow30311. Map the affected backend modules.322. Trace the request path from route to persistence.333. Identify data and transaction boundaries.344. Research framework behavior if uncertain.355. Implement using existing project conventions.366. Run lint/type/static checks available in the repository.377. Run relevant unit/integration/API tests.388. Verify failure paths as well as successful paths.399. Review security and transaction behavior.4010. Inspect the final diff.4142## Evidence Rules4344Use the strongest available evidence in this order:45461. Runtime behavior472. Automated test results483. Type checking, linting, and build results494. Installed package/source behavior505. Official framework or library documentation516. Repository configuration527. Static code inspection538. General model knowledge5455Never report an assumption as a verified result.5657## Tool Selection5859- Use Filesystem MCP for repository exploration and file inspection.60- Use Context7 for current, version-specific library/framework documentation.61- Use Fetch when official documentation or public web resources need to be retrieved.62- Use Playwright for browser behavior, frontend interaction, forms, authentication flows, and UI verification.63- Use GitHub CLI for repository, branch, pull request, issue, workflow, and CI operations.64- Prefer the smallest tool set that establishes reliable evidence.6566## Failure Handling6768When something fails:69701. Reproduce the failure.712. Capture the exact error.723. Identify the failing layer.734. Check whether the failure is environmental, dependency-related, configuration-related, or caused by application code.745. Research uncertain behavior using authoritative sources.756. Apply the smallest appropriate fix.767. Reproduce the original failure again.778. Run regression checks.789. Inspect the final diff.7980Do not hide failures by weakening tests, suppressing errors, deleting evidence, or claiming success without verification.8182## Security8384- Never expose secrets.85- Never commit credentials.86- Treat all external input as untrusted.87- Preserve authentication and authorization boundaries.88- Avoid leaking internal implementation details through errors.89- Review security implications whenever the skill touches users, data, credentials, networking, or deployment.9091## Completion Criteria9293A task using this skill is complete only when:9495- The requested behavior is implemented.96- Existing project conventions are preserved.97- Relevant static checks pass.98- Relevant tests pass or their absence is explicitly reported.99- Browser verification is performed when the task affects user-facing behavior.100- Security implications have been considered.101- The final diff has been inspected.102- Verified facts are clearly distinguished from assumptions or remaining uncertainty.