- Home
- Skills
- Mmorit00
- Fund Portfolio Bot
- Architecture
architecture_skill
- Python
0
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill mmorit00/fund-portfolio-bot --skill architecture- SKILL.md6.7 KB
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.