Skip to content

feat: add FastAPI patterns skill and reviewer agent#1508

Open
DiwanshuG wants to merge 16 commits intoaffaan-m:mainfrom
DiwanshuG:feat/contributor-onboarding
Open

feat: add FastAPI patterns skill and reviewer agent#1508
DiwanshuG wants to merge 16 commits intoaffaan-m:mainfrom
DiwanshuG:feat/contributor-onboarding

Conversation

@DiwanshuG
Copy link
Copy Markdown

@DiwanshuG DiwanshuG commented Apr 20, 2026

New contributions:

  • skills/fastapi-patterns/ - Comprehensive FastAPI best practices
  • agents/fastapi-reviewer.md - FastAPI code review specialist
  • commands/fastapi-review.md - Slash command for reviews
  • rules/python/fastapi.md - Project-specific FastAPI rules
  • Cross-harness: Codex and Cursor skill copies

Coverage includes:

  • Project structure and application factory pattern
  • Pydantic schemas (request/response separation)
  • Dependency injection patterns
  • Async database operations with SQLAlchemy
  • Custom error handling and exceptions
  • JWT authentication and OAuth2 flow
  • Testing with pytest and TestClient
  • OpenAPI documentation customization
  • Production deployment (Docker, Gunicorn, config)
  • Performance optimization (caching, compression)

What Changed

Why This Change

Testing Done

  • Manual testing completed
  • Automated tests pass locally (node tests/run-all.js)
  • Edge cases considered and tested

Type of Change

  • fix: Bug fix
  • feat: New feature
  • refactor: Code refactoring
  • docs: Documentation
  • test: Tests
  • chore: Maintenance/tooling
  • ci: CI/CD changes

Security & Quality Checklist

  • No secrets or API keys committed (ghp_, sk-, AKIA, xoxb, xoxp patterns checked)
  • JSON files validate cleanly
  • Shell scripts pass shellcheck (if applicable)
  • Pre-commit hooks pass locally (if configured)
  • No sensitive data exposed in logs or output
  • Follows conventional commits format

Documentation

  • Updated relevant documentation
  • Added comments for complex logic
  • README updated (if needed)

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive FastAPI production patterns guide covering app factory with async lifespan, middleware, schemas, dependency patterns, async DB/CRUD, async external client, auth (JWT/OAuth2), custom error handlers, testing patterns, OpenAPI customization, deployment examples, and performance tips.
    • Added FastAPI rules and best-practice checklist for security, async usage, schemas, and testing.
    • Added a FastAPI reviewer specification and a review-command workflow to standardize architecture, quality, security, and performance reviews.

New contributions:
- skills/fastapi-patterns/ - Comprehensive FastAPI best practices
- agents/fastapi-reviewer.md - FastAPI code review specialist
- commands/fastapi-review.md - Slash command for reviews
- rules/python/fastapi.md - Project-specific FastAPI rules
- Cross-harness: Codex and Cursor skill copies

Coverage includes:
- Project structure and application factory pattern
- Pydantic schemas (request/response separation)
- Dependency injection patterns
- Async database operations with SQLAlchemy
- Custom error handling and exceptions
- JWT authentication and OAuth2 flow
- Testing with pytest and TestClient
- OpenAPI documentation customization
- Production deployment (Docker, Gunicorn, config)
- Performance optimization (caching, compression)
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds multiple FastAPI documentation artifacts: production-oriented patterns guides, a FastAPI reviewer agent spec and command, and a FastAPI ruleset. All changes are documentation-only; no runtime code or public API declarations were modified.

Changes

Cohort / File(s) Summary
FastAPI Patterns Skills Documentation
./.agents/skills/fastapi-patterns/SKILL.md, ./.cursor/skills/fastapi-patterns/SKILL.md, ./skills/fastapi-patterns/SKILL.md
Adds a comprehensive FastAPI patterns guide: app-factory with async lifespan, middleware, Pydantic schema patterns, dependency injection (DB, auth, role-based, pagination), async SQLAlchemy & CRUD patterns, external HTTP client lifecycle, custom exception handlers, JWT/OAuth examples, OpenAPI customization, pytest patterns, performance tips (GZip, Redis), and deployment examples (Pydantic settings, Gunicorn, Docker).
FastAPI Review Agent & Command
./agents/fastapi-reviewer.md, ./commands/fastapi-review.md
Adds a FastAPI reviewer agent spec (senior architect persona, PASS/FAIL criteria, structured review workflow and report template) and a command doc describing /fastapi-review invocation and multi-stage review steps.
FastAPI Development Rules
./rules/python/fastapi.md
Adds rules prescribing project layout (application factory), separation of request/response Pydantic schemas, async usage for I/O-bound ops, centralized custom exception handling, DI practices for DB/auth, security checklist (hashing, JWT/OAuth, CORS, rate limiting), and testing guidance with dependency overrides.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • affaan-m

Poem

🐇 I nibble notes on routes so neat,

async hops and schemas sweet.
Tokens snug and tests on fleet,
Docker dreams and caches fleet.
Hop—release, the endpoints greet!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add FastAPI patterns skill and reviewer agent' accurately reflects the primary changes: addition of FastAPI documentation resources (skills), an agent specification (fastapi-reviewer.md), and related commands/rules files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 20, 2026

Greptile Summary

This PR adds a FastAPI patterns skill, a reviewer agent, a slash command, and project rules — a solid reference contribution. However, the three SKILL.md copies (skills/, .agents/, .cursor/) contain numerous copy-paste bugs across their code snippets that would produce broken code for any developer who follows them verbatim; the prior review rounds catalogued most of them, but several fixes applied to the main skills/ copy were never propagated to the .agents/ and .cursor/ mirrors.

Confidence Score: 3/5

Not safe to merge until the remaining propagation gaps in the .agents/ and .cursor/ copies are resolved — developers copying those snippets will get ImportError, AttributeError, or silently broken behaviour.

The main skills/ file is largely corrected from prior rounds, but the .agents/ and .cursor/ mirror copies still carry multiple P1 bugs (wrong AsyncSession import, un-wired custom_openapi, unguarded update(), CORS credentials mismatch). These are documentation files whose entire value is copy-pasteable correctness, so correctness bugs in the copies block merge.

.agents/skills/fastapi-patterns/SKILL.md and .cursor/skills/fastapi-patterns/SKILL.md need all fixes from the main skills/ copy applied before merge.

Important Files Changed

Filename Overview
skills/fastapi-patterns/SKILL.md Comprehensive FastAPI patterns guide with numerous code-correctness bugs across testing, auth, caching, and error-handling snippets (many flagged in prior review rounds).
.agents/skills/fastapi-patterns/SKILL.md Near-identical copy of the main SKILL.md; multiple fixes applied to the main file were not propagated here (CORS credentials, AsyncSession import, update() guard, custom_openapi wiring).
.cursor/skills/fastapi-patterns/SKILL.md Cursor-harness copy with the same propagation gaps as the .agents/ copy; custom_openapi still called directly and AsyncSession still imported from wrong module.
agents/fastapi-reviewer.md Well-structured reviewer agent spec with clear workflow steps and example output; no logic errors.
commands/fastapi-review.md Simple slash command definition that delegates to the fastapi-reviewer agent; no issues.
rules/python/fastapi.md Concise project rules file with correct patterns for schemas, DI, async, and security; clean.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    PR[PR: FastAPI Patterns Skill]
    PR --> MAIN[skills/fastapi-patterns/SKILL.md - Most fixes applied]
    PR --> AGENTS[.agents/skills/fastapi-patterns/SKILL.md - Fixes missing]
    PR --> CURSOR[.cursor/skills/fastapi-patterns/SKILL.md - Fixes missing]
    PR --> REVIEWER[agents/fastapi-reviewer.md - Clean]
    PR --> CMD[commands/fastapi-review.md - Clean]
    PR --> RULES[rules/python/fastapi.md - Clean]

    MAIN -->|Not propagated to| AGENTS
    MAIN -->|Not propagated to| CURSOR

    AGENTS --> A1[CORS credentials=True + allow_origins=*]
    AGENTS --> A2[AsyncSession from wrong module]
    AGENTS --> A3[update missing exclude_unset=True]
    AGENTS --> A4[custom_openapi called directly]

    CURSOR --> C1[AsyncSession from wrong module]
    CURSOR --> C2[custom_openapi called directly]
Loading

Reviews (12): Last reviewed commit: "fix(fastapi-patterns): register custom O..." | Re-trigger Greptile

Comment thread skills/fastapi-patterns/SKILL.md
Comment thread skills/fastapi-patterns/SKILL.md
Comment thread skills/fastapi-patterns/SKILL.md Outdated
Comment thread skills/fastapi-patterns/SKILL.md Outdated
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 issues found across 6 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".cursor/skills/fastapi-patterns/SKILL.md">

<violation number="1" location=".cursor/skills/fastapi-patterns/SKILL.md:103">
P2: The example CORS config combines allow_origins=['*'] with allow_credentials=True, which Starlette/FastAPI disallow and browsers reject. This is an invalid configuration and can lead to runtime errors or failed credentialed requests.</violation>
</file>

<file name="rules/python/fastapi.md">

<violation number="1" location="rules/python/fastapi.md:53">
P2: FastAPI path parameters must match the function argument name; the example uses `/users/{id}` but `user_id` in the signature, which would cause a 422 if copied.</violation>

<violation number="2" location="rules/python/fastapi.md:120">
P3: Async pytest fixture uses synchronous TestClient, which is misleading; async tests should use AsyncClient or the fixture should be sync.</violation>
</file>

<file name="skills/fastapi-patterns/SKILL.md">

<violation number="1" location="skills/fastapi-patterns/SKILL.md:381">
P2: Test dependency override yields an `AsyncConnection` (`engine.begin`) instead of an `AsyncSession`, conflicting with the documented ORM session usage and risking runtime breakage in CRUD code.</violation>

<violation number="2" location="skills/fastapi-patterns/SKILL.md:384">
P2: Test override targets the wrong dependency: `get_db_session` is overridden, but routes inject `get_db`, which calls `get_db_session` directly, so the override likely won’t apply.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread .cursor/skills/fastapi-patterns/SKILL.md
Comment thread rules/python/fastapi.md Outdated
Comment thread skills/fastapi-patterns/SKILL.md Outdated
Comment thread skills/fastapi-patterns/SKILL.md
Comment thread rules/python/fastapi.md
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
commands/fastapi-review.md (1)

36-36: Minor wording polish: hyphenate compound modifier.

At Line 36, consider rate-limiting configuration for cleaner grammar in the checklist item.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@commands/fastapi-review.md` at line 36, Update the checklist item string
"CORS and rate limiting configuration" to hyphenate the compound modifier by
changing it to "CORS and rate-limiting configuration" so the phrase at Line 36
reads grammatically correct; locate and replace the exact checklist entry "CORS
and rate limiting configuration" in commands/fastapi-review.md.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@skills/fastapi-patterns/SKILL.md`:
- Around line 383-385: The test fixture currently sets
app.dependency_overrides[get_db_session] but routes call get_db (which
internally calls get_db_session() as a context manager), so the override is
never used; change the override target to app.dependency_overrides[get_db] =
override_get_db (ensure override_get_db has the same call signature as get_db),
remove or stop relying on get_db_session override, and keep using create_app()
to build the app so all endpoints pick up the get_db override.
- Around line 1135-1155: Update the Redis cache typings and the cached wrapper
signature: import Any from typing and change the signatures in RedisCache.get
and RedisCache.set to use Optional[Any] and value: Any (replace lowercase any),
and remove the default None from the cached wrapper's request parameter so it is
declared as request: Request (not request: Request = None) to avoid an unguarded
null dereference when computing cache_key; keep references to the methods get,
set, delete and the decorator function cached/wrapper when making the edits.

---

Nitpick comments:
In `@commands/fastapi-review.md`:
- Line 36: Update the checklist item string "CORS and rate limiting
configuration" to hyphenate the compound modifier by changing it to "CORS and
rate-limiting configuration" so the phrase at Line 36 reads grammatically
correct; locate and replace the exact checklist entry "CORS and rate limiting
configuration" in commands/fastapi-review.md.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e18c9a39-8b67-4f94-9599-23bbfbfdd0b5

📥 Commits

Reviewing files that changed from the base of the PR and between 8bdf88e and 4f200ce.

📒 Files selected for processing (6)
  • .agents/skills/fastapi-patterns/SKILL.md
  • .cursor/skills/fastapi-patterns/SKILL.md
  • agents/fastapi-reviewer.md
  • commands/fastapi-review.md
  • rules/python/fastapi.md
  • skills/fastapi-patterns/SKILL.md

Comment thread skills/fastapi-patterns/SKILL.md
Comment thread skills/fastapi-patterns/SKILL.md Outdated
@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

Comment thread skills/fastapi-patterns/SKILL.md
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

Comment thread skills/fastapi-patterns/SKILL.md Outdated
Comment thread skills/fastapi-patterns/SKILL.md
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="skills/fastapi-patterns/SKILL.md">

<violation number="1" location="skills/fastapi-patterns/SKILL.md:738">
P2: JWT example references `timezone.utc` without importing `timezone`, causing a runtime NameError in the documented pattern.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

subject: str,
expires_delta: Optional[timedelta] = None,
) -> str:
expire = datetime.now(timezone.utc) + (expires_delta or timedelta(minutes=30))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: JWT example references timezone.utc without importing timezone, causing a runtime NameError in the documented pattern.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At skills/fastapi-patterns/SKILL.md, line 738:

<comment>JWT example references `timezone.utc` without importing `timezone`, causing a runtime NameError in the documented pattern.</comment>

<file context>
@@ -735,7 +735,7 @@ def create_access_token(
     expires_delta: Optional[timedelta] = None,
 ) -> str:
-    expire = datetime.utcnow() + (expires_delta or timedelta(minutes=30))
+    expire = datetime.now(timezone.utc) + (expires_delta or timedelta(minutes=30))
     to_encode = {"exp": expire, "sub": str(subject)}
     return jwt.encode(
</file context>

@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

Comment thread skills/fastapi-patterns/SKILL.md
Comment thread skills/fastapi-patterns/SKILL.md
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

Comment thread skills/fastapi-patterns/SKILL.md
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (2)
skills/fastapi-patterns/SKILL.md (2)

366-384: ⚠️ Potential issue | 🟠 Major

Override the dependency actually used by Depends.

At Line 383, app.dependency_overrides[get_db_session] = override_get_db won’t affect handlers that depend on get_db (Line 249 / Line 302). Override get_db instead so tests consistently inject the test session.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/fastapi-patterns/SKILL.md` around lines 366 - 384, The test fixture
currently sets app.dependency_overrides[get_db_session] but the routes use
get_db, so update the override to target the actual dependency: set
app.dependency_overrides[get_db] = override_get_db (keep the override_get_db
async generator and AsyncSession logic as-is) so handlers that declare
Depends(get_db) receive the in-memory AsyncSession during tests.

1134-1154: ⚠️ Potential issue | 🟠 Major

Fix invalid any typing and nullable request dereference in cache example.

Line 1134/1138 should use Any (not lowercase any), and Line 1152’s request: Request = None is unsafe because Line 1153 dereferences request.url.path unguarded.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/fastapi-patterns/SKILL.md` around lines 1134 - 1154, The Redis cache
methods and decorator use incorrect typing and unsafe request usage: change
parameter/type hints from lowercase any to typing.Any (import Any) on
RedisCache.get/set/delete and cached signature, and fix the wrapper to avoid
dereferencing a nullable request by either requiring request: Request (no
default None) or keeping request: Optional[Request] and adding a guard that
computes cache_key only when request is present (fall back to func name +
serialized args/kwargs when request is None); update references in get/set/setex
methods and the cached wrapper accordingly (functions: RedisCache.get,
RedisCache.set, RedisCache.delete, cached, wrapper).
🧹 Nitpick comments (1)
skills/fastapi-patterns/SKILL.md (1)

22-1179: Add explicit How It Works and Examples section headers.

The guide is comprehensive, but it should include clear top-level sections named How It Works and Examples to match the skill format requirement. As per coding guidelines: “skills/**/*.md: Skill format must be Markdown with clear sections for When to Use, How It Works, and Examples”.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/fastapi-patterns/SKILL.md` around lines 22 - 1179, Add two top-level
Markdown sections "How It Works" and "Examples" to the SKILL.md document to
satisfy the required skill format; insert them as H2 (## How It Works) and H2
(## Examples) headings in the logical spots (for example place "How It Works"
after the "Project Structure" / before "Pydantic Schemas", and "Examples" before
the "Dependency Injection" or near concrete code blocks) and populate each with
a brief paragraph explaining the concept and one short code/example snippet or
pointer to existing examples in the doc so the file includes clear "When to
Use", "How It Works", and "Examples" top-level sections.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@skills/fastapi-patterns/SKILL.md`:
- Around line 714-738: The create_access_token function uses timezone.utc but
timezone isn't imported, causing a NameError; fix it by adding timezone to the
datetime imports (ensure the top import line includes "from datetime import
datetime, timedelta, timezone") so create_access_token (and any other uses of
timezone) can reference timezone.utc correctly.
- Line 765: The import for AsyncSession is wrong: replace the line that imports
AsyncSession from app.db.session with an import from sqlalchemy.ext.asyncio;
update the import statement that references AsyncSession so it reads "from
sqlalchemy.ext.asyncio import AsyncSession" to match the rest of the skill and
the app/db/session.py usage, ensuring any references to AsyncSession in
functions or examples (e.g., dependency providers or route handlers) continue to
use the corrected import.
- Around line 913-946: The custom_openapi function is being executed but not
registered as FastAPI's openapi hook; instead of simply calling
custom_openapi(app), assign the callable to app.openapi so FastAPI will call
your custom_openapi when serving /docs and /redoc. Locate the custom_openapi
function and the app = create_app() instantiation and set app.openapi = lambda:
custom_openapi(app) (or app.openapi = functools.partial(custom_openapi, app)) so
the framework uses your custom schema at runtime.

---

Duplicate comments:
In `@skills/fastapi-patterns/SKILL.md`:
- Around line 366-384: The test fixture currently sets
app.dependency_overrides[get_db_session] but the routes use get_db, so update
the override to target the actual dependency: set
app.dependency_overrides[get_db] = override_get_db (keep the override_get_db
async generator and AsyncSession logic as-is) so handlers that declare
Depends(get_db) receive the in-memory AsyncSession during tests.
- Around line 1134-1154: The Redis cache methods and decorator use incorrect
typing and unsafe request usage: change parameter/type hints from lowercase any
to typing.Any (import Any) on RedisCache.get/set/delete and cached signature,
and fix the wrapper to avoid dereferencing a nullable request by either
requiring request: Request (no default None) or keeping request:
Optional[Request] and adding a guard that computes cache_key only when request
is present (fall back to func name + serialized args/kwargs when request is
None); update references in get/set/setex methods and the cached wrapper
accordingly (functions: RedisCache.get, RedisCache.set, RedisCache.delete,
cached, wrapper).

---

Nitpick comments:
In `@skills/fastapi-patterns/SKILL.md`:
- Around line 22-1179: Add two top-level Markdown sections "How It Works" and
"Examples" to the SKILL.md document to satisfy the required skill format; insert
them as H2 (## How It Works) and H2 (## Examples) headings in the logical spots
(for example place "How It Works" after the "Project Structure" / before
"Pydantic Schemas", and "Examples" before the "Dependency Injection" or near
concrete code blocks) and populate each with a brief paragraph explaining the
concept and one short code/example snippet or pointer to existing examples in
the doc so the file includes clear "When to Use", "How It Works", and "Examples"
top-level sections.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c2b9e79b-a12b-43ed-a67c-b5c6ac91e3cc

📥 Commits

Reviewing files that changed from the base of the PR and between dcca60b and 395f3a5.

📒 Files selected for processing (2)
  • rules/python/fastapi.md
  • skills/fastapi-patterns/SKILL.md
✅ Files skipped from review due to trivial changes (1)
  • rules/python/fastapi.md

Comment thread skills/fastapi-patterns/SKILL.md
Comment thread skills/fastapi-patterns/SKILL.md Outdated
Comment thread skills/fastapi-patterns/SKILL.md
@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

Comment thread .agents/skills/fastapi-patterns/SKILL.md Outdated
@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

Comment thread skills/fastapi-patterns/SKILL.md
Comment thread skills/fastapi-patterns/SKILL.md
Comment thread skills/fastapi-patterns/SKILL.md
@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

Comment thread skills/fastapi-patterns/SKILL.md
@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

Comment thread .agents/skills/fastapi-patterns/SKILL.md Outdated
Comment thread .agents/skills/fastapi-patterns/SKILL.md Outdated
@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="skills/fastapi-patterns/SKILL.md">

<violation number="1" location="skills/fastapi-patterns/SKILL.md:1152">
P1: Caching decorator example requires `request` but does not reliably receive or forward it, making the documented pattern prone to runtime failure.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

"""Decorator for caching endpoint responses."""
def decorator(func):
@wraps(func)
async def wrapper(*args, request: Request, **kwargs):
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Caching decorator example requires request but does not reliably receive or forward it, making the documented pattern prone to runtime failure.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At skills/fastapi-patterns/SKILL.md, line 1152:

<comment>Caching decorator example requires `request` but does not reliably receive or forward it, making the documented pattern prone to runtime failure.</comment>

<file context>
@@ -1148,7 +1149,7 @@ def cached(expire: int = 300):
     def decorator(func):
         @wraps(func)
-        async def wrapper(*args, request: Request = None, **kwargs):
+        async def wrapper(*args, request: Request, **kwargs):
             cache_key = f"{func.__name__}:{request.url.path}:{request.query_params}"
             
</file context>
Fix with Cubic

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

Comment thread skills/fastapi-patterns/SKILL.md
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".agents/skills/fastapi-patterns/SKILL.md">

<violation number="1" location=".agents/skills/fastapi-patterns/SKILL.md:380">
P2: Test DB override drops commit/rollback handling, so tests no longer mirror production transaction behavior and may not persist writes that production commits after dependency yield.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread .agents/skills/fastapi-patterns/SKILL.md Outdated
@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Apr 20, 2026

You're iterating quickly on this pull request. To help protect your rate limits, cubic has paused automatic reviews on new pushes for now—when you're ready for another review, comment @cubic-dev-ai review.

@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 20, 2026

Want your agent to iterate on Greptile's feedback? Try greploops.

from app.dependencies import get_db
from app.schemas.token import Token
from app.core.security import verify_password, create_access_token
from app.db.session import AsyncSession
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Wrong module for AsyncSession import — ImportError on module load

AsyncSession is exported from sqlalchemy.ext.asyncio, not app.db.session. Any developer who copies this auth router snippet will immediately get ImportError: cannot import name 'AsyncSession' from 'app.db.session' when the module is loaded. The main skills/fastapi-patterns/SKILL.md already has the correct import (from sqlalchemy.ext.asyncio import AsyncSession), but it wasn't carried over to this copy or the .cursor/ copy (line 767 there).

Suggested change
from app.db.session import AsyncSession
from sqlalchemy.ext.asyncio import AsyncSession

@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools Bot commented Apr 20, 2026

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.



app = create_app()
custom_openapi(app)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 custom_openapi not wired to app.openapi in .cursor/ copy

custom_openapi(app) is called once eagerly to populate app.openapi_schema, but it is never assigned as app.openapi. The main skills/fastapi-patterns/SKILL.md was already corrected to use app.openapi = lambda: custom_openapi(app), making the schema lazily regenerated on each call to /openapi.json. This .cursor/ copy (and the .agents/ copy at line 952) still has the old one-shot call, so if app.openapi_schema is ever cleared the custom schema will not regenerate.

Suggested change
custom_openapi(app)
app.openapi = lambda: custom_openapi(app)

The identical fix is also needed at .agents/skills/fastapi-patterns/SKILL.md line 952.

@DiwanshuG
Copy link
Copy Markdown
Author

Addressed all bot suggestions:

  • Fixed CORS configuration issues
  • Corrected dependency overrides
  • Improved update logic for partial updates
  • Ensured consistency across .agents examples

Happy to make any further changes if needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant