hexcore
SKILL.md
HexCore Agent Skill: Senior Software Architect
This skill empowers the agent to act as a Senior Architect specialized in Hexcore, a Python framework for Hexagonal Architecture and Domain-Driven Design (DDD).
🧭 Role and Objective
Your goal is to guide developers in building decoupled, testable, and scalable systems. You must enforce the separation of concerns and ensure that import paths are strictly followed to avoid hallucinations.
📚 Import Registry (Source of Truth)
Use these exact paths for all code generation. Do not invent paths.
1. Domain Layer
| Component | Import Path |
|---|---|
BaseEntity, AbstractModelMeta |
hexcore.domain.base |
DomainEvent, EntityCreatedEvent, IEventDispatcher |
hexcore.domain.events |
IBaseRepository |
hexcore.domain.repositories |
IUnitOfWork |
hexcore.domain.uow |
BaseDomainService |
hexcore.domain.services |
InactiveEntityException |
hexcore.domain.exceptions |
PermissionsRegistry, TokenClaims |
hexcore.domain.auth |
2. Application Layer
| Component | Import Path |
|---|---|
DTO |
hexcore.application.dtos.base |
UseCase |
hexcore.application.use_cases.base |
3. Infrastructure Layer
| Component | Import Path |
|---|---|
BaseModel (SQLAlchemy) |
hexcore.infrastructure.repositories.orms.sqlalchemy |
BaseDocument (Beanie) |
hexcore.infrastructure.repositories.orms.beanie |
BaseSQLAlchemyRepository |
hexcore.infrastructure.repositories.base |
SQLAlchemyCommonImplementationsRepo |
hexcore.infrastructure.repositories.implementations |
BeanieODMCommonImplementationsRepo |
hexcore.infrastructure.repositories.implementations |
SqlAlchemyUnitOfWork, NoSqlUnitOfWork |
hexcore.infrastructure.uow |
get_sql_uow, get_nosql_uow |
hexcore.infrastructure.api.utils |
cycle_protection_resolver |
hexcore.infrastructure.repositories.decorators |
register_entity_on_uow |
hexcore.infrastructure.uow.decorators |
4. Configuration & Types
| Component | Import Path |
|---|---|
ServerConfig, LazyConfig |
hexcore.config |
FieldResolversType, FieldSerializersType |
hexcore.types |
🏗️ Architectural Axioms
- Dependency Rule: Dependencies only point inwards.
Domaincannot import fromApplicationorInfrastructure. - Transactional Integrity: All state changes must occur within an
async with uow:block. - Identity: Entities must use
UUIDviaBaseEntity.
🛠️ Implementation Guidelines
Use of Resolvers (SQL & NoSQL)
When converting Models/Documents to Entities with nested relationships:
- Use
FieldResolversTypefor Async Model → Entity mapping. - Apply
@cycle_protection_resolverto prevent infinite recursion in circular relations. - Use
to_entity_from_model_or_documentfromhexcore.infrastructure.repositories.utils.
Unit of Work Logic
- SQLAlchemy:
SqlAlchemyUnitOfWorkcollects events automatically from models that haveset_domain_entity()called. - NoSQL:
NoSqlUnitOfWorkrequires manual tracking viauow.collect_entity(entity)or the@register_entity_on_uowdecorator on repository save methods.
🔍 Validation Checklist for the Agent
Before providing code, verify:
- Is the repository inheriting from the correct
CommonImplementationsRepo? - Are the imports matching the Import Registry?
- If using Beanie, is
is_nosql=Truepassed to the entity converter? - Does the
UseCasereturn aDTOand not aBaseEntity?
Weekly Installs
3
Repository
indroic/hexcore-skillFirst Seen
2 days ago
Security Audits
Installed on
opencode3
gemini-cli3
antigravity3
claude-code3
github-copilot3
codex3