mmorit00/fund-portfolio-bot
Overview
This skill enforces the project's 3-layer architecture and layering rules (v0.3.1) for a Discord bot. It codifies allowed dependency directions: cli → flows → core ← data, with core owning DI registration. Use it to validate design choices, imports, and dependency injection usage when adding or refactoring code.
How this skill works
The skill inspects file paths, import statements, and function signatures to determine layer membership and dependency direction. It checks that core modules do not import outer layers, flows use @dependency for data access, and container.py is the only place that instantiates data-layer classes. It also validates naming conventions and type-annotation patterns to avoid circular imports.
When to use it
- Designing a new module or feature for the bot
- Changing or adding import statements
- During code review to verify layer boundaries
- When resolving or preventing circular import issues
- When adding or updating dependency registrations in the container
Best practices
- Identify the layer (cli / flows / core / data) before coding and keep responsibilities narrow
- Let container.py create concrete data instances; flows receive them via @dependency
- Core modules must only import other core modules; container.py may import data
- Use concrete Repo/Service classes for types; use TYPE_CHECKING and string annotations to avoid cycles
- Name flow functions in snake_case and repo/service classes in PascalCase
Example use cases
- A developer asks where to place a new trade-confirmation function—place orchestration in flows/trade.py and rules/models in core
- Refactoring: replace direct data imports in flows with @dependency-injected parameters and register factories in core/container.py
- Code review: flag a PR where core/ imports src.data.db.TradeRepo (allowed only in container.py)
- Testing: override dependencies by passing mock repos into a flow function call
- Adding a new database client: register it in core/container.py and avoid importing it from core models
FAQ
No—core must not import data. For annotations use TYPE_CHECKING or forward string annotations like "TradeRepo".
Where should I instantiate a Repo used by flows?
Create a factory in core/container.py registered with @register, then let flows receive it via @dependency by matching the parameter name.
5 skills
This skill helps you design and review proper layer boundaries and dependency flow in the fund-portfolio-bot, enforcing cli → flows → data.
This skill helps you enforce concise, context-aware naming for classes, functions, and variables to reduce ambiguity.
This skill orchestrates multiple models to analyze codebase, guiding deep analysis, architecture discovery, and multi-perspective decision making.
This skill helps AI establish self-positioning in projects using Root/Folder/File metadata, triggering automatic _dir.md templates and I/O/Pos annotations.
This skill helps you manage roadmap.md updates by enforcing concise structure, version entries, and decision rationale for clear, consistent docs.