From majestic-engineer
Reads nearest AGENTS.md for context before researching code domains, then appends patterns, gotchas, conventions, and testing insights after.
npx claudepluginhub majesticlabs-dev/majestic-marketplace --plugin majestic-engineerThis skill is limited to using the following tools:
Compound learnings into folder-specific AGENTS.md files during research work.
Researches external documentation, best practices, and industry standards via web search and codebase analysis. Useful for library docs, implementation comparisons, and recommended structures.
Documents codebases as-is by spawning parallel sub-agents to research files and synthesize findings into reports. Activates on /research or codebase understanding requests.
Spawns parallel sub-agents to conduct comprehensive codebase research, analyzing files, patterns, and architecture while synthesizing findings into a research document. Use for deep codebase understanding or technical questions.
Share bugs, ideas, or general feedback.
Compound learnings into folder-specific AGENTS.md files during research work.
Activate this behavior when:
Before diving into code, find and read the nearest AGENTS.md:
# From target folder, traverse up to find nearest AGENTS.md
# Example: researching app/jobs/cash_app/
# Check: app/jobs/cash_app/AGENTS.md
# app/jobs/AGENTS.md
# app/AGENTS.md
# AGENTS.md (root)
From existing AGENTS.md, note:
Briefly acknowledge:
Found existing context in app/jobs/AGENTS.md:
- Jobs use Sidekiq with retry configuration
- Naming: *Job suffix required
- Testing: Use perform_inline in specs
After research, evaluate each discovery:
| Criteria | Example |
|---|---|
| Applies to multiple files in domain | "All jobs inherit from ApplicationJob" |
| Non-obvious convention | "Jobs must call super before custom logic" |
| Gotcha that caused confusion | "CashApp jobs require merchant_id, not user_id" |
| Integration pattern | "Jobs trigger webhooks via WebhookService" |
| Testing insight | "Use freeze_time for scheduled job specs" |
| Criteria | Example |
|---|---|
| One-off implementation detail | "ProcessPaymentJob has 3 retries" |
| Already documented | Pattern exists in AGENTS.md |
| Too specific to single file | "Line 42 has a TODO" |
| Obvious from code | "Job processes payments" |
Use nearest-wins hierarchy:
{domain}/AGENTS.md exists → update it# Find existing AGENTS.md files
find . -name "AGENTS.md" -type f | head -20
Map learning type to section:
| Learning Type | Target Section |
|---|---|
| Pattern/Convention | ## Patterns or ## Conventions |
| Gotcha/Warning | ## Gotchas or ## Common Issues |
| File organization | ## Structure |
| Testing approach | ## Testing |
| Integration point | ## Integration or ## Dependencies |
If section doesn't exist, create it.
- **[Short title]**: [Concrete description]
- Example: `path/to/example.rb:42`
Keep entries:
Use Edit tool to append to appropriate section:
## Gotchas
- **Existing gotcha**: Description
- **NEW: Merchant ID required**: CashApp jobs use `merchant_id`, not `user_id`
- Example: `app/jobs/cash_app/process_payment_job.rb:15`
If no AGENTS.md exists in the domain hierarchy, create one:
# {Domain Name}
## Purpose
{One-line description of this domain}
## Patterns
- **Pattern name**: Description
- Example: `path/to/file.rb`
## Gotchas
- **Gotcha name**: Description
## Testing
- **Testing approach**: Description
| Domain Depth | Create At |
|---|---|
app/jobs/ | app/jobs/AGENTS.md |
app/jobs/cash_app/ | app/jobs/cash_app/AGENTS.md (if 3+ files) |
app/services/payments/ | app/services/payments/AGENTS.md |
Only create subfolder AGENTS.md if:
User: "Investigate how background jobs work in this app"
Claude:
1. Target domain: app/jobs/
2. Check for AGENTS.md...
- Found: app/jobs/AGENTS.md
3. Read existing context:
"Jobs use Sidekiq, ApplicationJob base class, *Job suffix"
4. Proceed with research, avoiding re-discovery of known patterns
After researching app/jobs/cash_app/:
Discovered:
- CashApp jobs require merchant_id (not user_id) ← WORTH RECORDING
- ProcessPaymentJob has 3 retries ← SKIP (too specific)
- All CashApp jobs log to separate channel ← WORTH RECORDING
Update app/jobs/cash_app/AGENTS.md:
## Gotchas
+ - **Merchant ID required**: Use `merchant_id`, not `user_id` for CashApp jobs
+ - Example: `app/jobs/cash_app/process_payment_job.rb:15`
## Patterns
+ - **Separate logging**: CashApp jobs use `CashAppLogger` channel
+ - Example: `app/jobs/cash_app/base_job.rb:8`
Researching app/services/webhooks/ (no existing AGENTS.md)
After research, create app/services/webhooks/AGENTS.md:
# Webhooks
## Purpose
Outbound webhook delivery and retry management.
## Patterns
- **Delivery service**: All webhooks go through `WebhookDeliveryService`
- Example: `app/services/webhooks/delivery_service.rb`
- **Payload builders**: Each event type has a `*PayloadBuilder`
- Example: `app/services/webhooks/payment_payload_builder.rb`
## Gotchas
- **Idempotency required**: Webhooks may retry; receivers must handle duplicates
- **Timeout**: 30-second timeout on delivery attempts
Before updating AGENTS.md, verify:
When research requires external best practices (not just codebase analysis), use this methodology.
mcp__perplexity-ask__perplexity_ask) to search for:
## [Topic] Best Practices
### Must Have
- **[Practice name]**: [Description]
> "[Direct quote from source]"
-- Source: [Link or reference]
### Recommended
- **[Practice name]**: [Description]
### Anti-patterns to Avoid
- **[Anti-pattern]**: [Why it's problematic]
### Sources
- [All referenced sources with links]
| Don't | Do Instead |
|---|---|
| Dump all findings into AGENTS.md | Filter for generalizable patterns only |
| Create AGENTS.md for every folder | Only domains with distinct patterns |
| Write paragraphs | Single bullet points with examples |
| Duplicate root-level guidance | Only domain-specific additions |
| Update on every file read | Batch updates at research completion |