Loading Hanami Application Context
Load the minimum context needed to work safely in a Hanami codebase. Discover structure before proposing changes.
Quick Reference
- Discover: Slices, providers, settings, routes, relations, existing patterns.
- Verify: Test framework, DI conventions, ROM setup.
- Rule: Never propose code without first running
load-context.
Core Process
[!IMPORTANT] Security Gate: Always redact all passwords, credentials, tokens, and API keys. Replace them with
[REDACTED]or*****in any notes or summaries.
Pattern reference: For details on sampling, see PATTERNS.md.
Slice inventory — list every slice in
slices/:find slices/ -mindepth 1 -maxdepth 1 -type d find slices/ -name '*.rb' | head -40Checkpoint: If
slices/is missing, verify this is a Hanami 2.x application by checkingGemfileorconfig/app.rb.Provider inventory — read
config/providers/to identify registered integrations:cat config/providers/*.rbSettings — inspect
config/settings.rbfor environment variables and type constraints:cat config/settings.rb 2>/dev/null || cat config/settings/*.rbRoutes — read
config/routes.rbto map URL endpoints:cat config/routes.rbROM setup — identify database adapters, relation paths, and migration setup:
cat config/providers/rom.rb 2>/dev/null || grep -r 'rom' config/providers/ -lTest setup — detect testing frameworks and transactional helpers:
cat spec/spec_helper.rb 2>/dev/null find spec/ -name '*_helper.rb' | head -10Dependency injection — analyze auto_inject usages and mixin styles:
grep -r 'include Deps' slices/ --include='*.rb' | head -10 grep -r 'auto_inject' slices/ config/ --include='*.rb' | head -10Existing patterns — sample actions, operations, and repos:
find slices/ -path '*/actions/*.rb' | head -3 | xargs cat find slices/ -path '*/operations/*.rb' | head -3 | xargs cat find slices/ -path '*/repositories/*.rb' | head -3 | xargs cat
Completion Gate
Before proceeding to any implementation, populate the 7 sections of the context map. For details on the output format and examples, refer to CONTEXT-OUTPUT-FORMAT.md.
- Slice map populated
- Provider map populated
- Settings summary recorded
- Route summary recorded
- Test infrastructure identified
- DI conventions noted
- Pattern notes captured
Integration
| Skill | When to chain |
|---|---|
| configure-providers | After context, to set up or verify provider configuration |
| implement-di | After context, to implement or verify DI patterns |
| hanami-setup | First step in the project onboarding agent |