Skip to content

Commit af0bb6b

Browse files
randommJanni Turunen
andauthored
fix(#126): integrate Context7 into execution workflow with explicit triggers (#127)
* fix(#126): integrate Context7 into execution workflow with explicit triggers - Move Context7 from standalone preamble into EXECUTION PROTOCOL section - Add Context7 FIRST step before all implementation code - Add explicit triggers in instructions/context7-library-documentation.md - Add anti-pattern examples to prevent agents skipping Context7 lookup - Update all 9 programming agent prompts with consistent formatting Agents now have clear decision point to check library docs before reading existing code patterns, preventing outdated API usage. * fix(#126): address code review feedback - standardize wording and add docs reference - Standardize DELEGATE wording in react-web-specialist.txt to match other 8 agents - Add reference to instructions/context7-library-documentation.md in README.md - python-best-practices.txt already has explicit RESEARCH step (verified) --------- Co-authored-by: Janni Turunen <[email protected]>
1 parent 6b31895 commit af0bb6b

11 files changed

Lines changed: 70 additions & 9 deletions

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ PM:
374374
The system integrates with several Model Context Protocol servers:
375375

376376
- **Perplexity API** - AI-powered research and problem-solving (semantic search, reasoning, deep research)
377-
- **Context7** - Up-to-date library documentation for 1000+ libraries (React, Python, Rust, Go, etc.)
377+
- **Context7** - Up-to-date library documentation for 1000+ libraries (React, Python, Rust, Go, etc.) - See: instructions/context7-library-documentation.md
378378
- **PostgreSQL Connections** - Multiple database environments (Fuzu and Barona production databases via read-only MCP servers)
379379
- **Rollbar Error Investigation** - Production error investigation and analysis
380380
- **Memory Service (Remory)** - Enhanced semantic memory with vector embeddings

‎instructions/context7-library-documentation.md‎

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,22 @@ Context7 is a Model Context Protocol (MCP) server that provides up-to-date docum
88
- **Libraries**: Pandas, NumPy, Jest, Vitest, pytest, cargo, and thousands more
99
- **Tools**: Build systems, package managers, testing frameworks, and utilities
1010

11-
## When to Use Context7
11+
## When to Use Context7 (Explicit Triggers)
1212

13-
**Use Context7 BEFORE implementing any code** when working with:
14-
- Any third-party library or framework
15-
- New versions of familiar tools
16-
- API design with current best practices
17-
- Performance optimization patterns
18-
- Library selection decisions
13+
**MANDATORY in these situations:**
14+
15+
1. **Library Name Encountered**: Issue or codebase mentions ANY library/framework
16+
- Trigger: BEFORE reading existing code using that library
17+
- Example: "Create Maestro test" → resolve-library-id for Maestro BEFORE reading .yaml files
18+
19+
2. **Implementation Starting**: Beginning code that imports/uses a third-party tool
20+
- Even if familiar with the library
21+
- Your training data may be 1+ years old
22+
23+
3. **Version Uncertainty**: When library version is unclear
24+
- Check package.json → Get docs for that exact version
25+
26+
**Workflow:** Encounter library name → resolve-library-id → get-library-docs → Read docs → THEN read existing code → THEN implement
1927

2028
## How to Use Context7
2129

@@ -52,6 +60,14 @@ get-library-docs: "<context7-id>" → Returns latest official docs
5260

5361
**Example**: Need React docs? → Context7. Need "why use React vs Vue?" → Perplexity.
5462

63+
## Anti-Pattern (What NOT to Do)
64+
65+
❌ **WRONG**: Read existing Maestro YAML → Create test based on pattern → Miss current API
66+
❌ **WRONG**: "I know [library]" → Skip Context7 → Use outdated API
67+
❌ **WRONG**: grep codebase → Replicate pattern → Pattern uses deprecated API
68+
69+
✅ **RIGHT**: See "Maestro" in issue → resolve-library-id → get-library-docs → Read current API → THEN read existing patterns → Implement with confidence
70+
5571
## Quick Start
5672

5773
1. Search for your library: `resolve-library-id: "libraryname"`

‎prompts/api-design.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ Your bash permissions enforce separation of concerns:
4040
🎯 **EXECUTION PROTOCOL:**
4141
- **FOLLOW**: Quality standards and minimalist philosophy defined in AGENTS.md
4242
- **READ**: Issue content with `gh issue view #123` for complete requirements
43+
- **CONTEXT7 FIRST**: When you encounter ANY library/framework name in issue or codebase:
44+
1. `resolve-library-id` to find the library
45+
2. `get-library-docs` to fetch current documentation
46+
3. Do this BEFORE reading existing code patterns for that library
47+
4. Your training data may be outdated - Context7 has current docs
4348
- **CHALLENGE**: Before creating anything, ask "Is this truly needed for the requirement?"
4449
- **MINIMAL**: Build the simplest solution that fully solves the problem
4550
- **COMPLETE**: ALL issue checkboxes exactly as specified (TDD, coverage, linting, docs, verification)

‎prompts/go-tdd-architect.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ Your bash permissions enforce separation of concerns:
5959
🎯 **EXECUTION PROTOCOL:**
6060
- **FOLLOW**: Quality standards and minimalist philosophy defined in AGENTS.md
6161
- **READ**: Issue content with `gh issue view #123` for complete requirements
62+
- **CONTEXT7 FIRST**: When you encounter ANY library/framework name in issue or codebase:
63+
1. `resolve-library-id` to find the library
64+
2. `get-library-docs` to fetch current documentation
65+
3. Do this BEFORE reading existing code patterns for that library
66+
4. Your training data may be outdated - Context7 has current docs
6267
- **CHALLENGE**: Before creating anything, ask "Is this truly needed for the requirement?"
6368
- **MINIMAL**: Build the simplest solution that fully solves the problem
6469
- **COMPLETE**: ALL issue checkboxes exactly as specified (TDD, coverage, linting, docs, verification)

‎prompts/postgres-specialist.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ Your bash permissions enforce separation of concerns:
9292
🎯 **EXECUTION PROTOCOL:**
9393
- **FOLLOW**: Quality standards and minimalist philosophy defined in AGENTS.md
9494
- **READ**: Issue content with `gh issue view #123` for complete requirements
95+
- **CONTEXT7 FIRST**: When you encounter ANY library/framework name in issue or codebase:
96+
1. `resolve-library-id` to find the library
97+
2. `get-library-docs` to fetch current documentation
98+
3. Do this BEFORE reading existing code patterns for that library
99+
4. Your training data may be outdated - Context7 has current docs
95100
- **CHALLENGE**: Before creating anything, ask "Is this truly needed for the requirement?"
96101
- **MINIMAL**: Build the simplest solution that fully solves the problem
97102
- **COMPLETE**: ALL issue checkboxes exactly as specified (TDD, coverage, linting, docs, verification)

‎prompts/python-best-practices.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ Your bash permissions enforce separation of concerns:
5050
🎯 **EXECUTION PROTOCOL:**
5151
- **FOLLOW**: Quality standards and minimalist philosophy defined in AGENTS.md
5252
- **READ**: Issue content with `gh issue view #123` for complete requirements
53+
- **CONTEXT7 FIRST**: When you encounter ANY library/framework name in issue or codebase:
54+
1. `resolve-library-id` to find the library
55+
2. `get-library-docs` to fetch current documentation
56+
3. Do this BEFORE reading existing code patterns for that library
57+
4. Your training data may be outdated - Context7 has current docs
5358
- **CHALLENGE**: Before creating anything, ask "Is this truly needed for the requirement?"
5459
- **MINIMAL**: Build the simplest solution that fully solves the problem
5560
- **COMPLETE**: ALL issue checkboxes exactly as specified (TDD, coverage, linting, docs, verification)

‎prompts/rails-architect.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ Your bash permissions enforce separation of concerns:
4646
🎯 **EXECUTION PROTOCOL:**
4747
- **FOLLOW**: Quality standards and minimalist philosophy defined in AGENTS.md
4848
- **READ**: Issue content with `gh issue view #123` for complete requirements
49+
- **CONTEXT7 FIRST**: When you encounter ANY library/framework name in issue or codebase:
50+
1. `resolve-library-id` to find the library
51+
2. `get-library-docs` to fetch current documentation
52+
3. Do this BEFORE reading existing code patterns for that library
53+
4. Your training data may be outdated - Context7 has current docs
4954
- **CHALLENGE**: Before creating anything, ask "Is this truly needed for the requirement?"
5055
- **MINIMAL**: Build the simplest solution that fully solves the problem
5156
- **COMPLETE**: ALL issue checkboxes exactly as specified (TDD, coverage, linting, docs, verification)

‎prompts/react-native-mobile-specialist.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ Your bash permissions enforce separation of concerns:
4242
🎯 **EXECUTION PROTOCOL:**
4343
- **FOLLOW**: Quality standards and minimalist philosophy defined in AGENTS.md
4444
- **READ**: Issue content with `gh issue view #123` for complete requirements
45+
- **CONTEXT7 FIRST**: When you encounter ANY library/framework name in issue or codebase:
46+
1. `resolve-library-id` to find the library
47+
2. `get-library-docs` to fetch current documentation
48+
3. Do this BEFORE reading existing code patterns for that library
49+
4. Your training data may be outdated - Context7 has current docs
4550
- **CHALLENGE**: Before creating anything, ask "Is this truly needed for the requirement?"
4651
- **MINIMAL**: Build the simplest solution that fully solves the problem
4752
- **COMPLETE**: ALL issue checkboxes exactly as specified (TDD, coverage, linting, docs, verification)

‎prompts/react-web-specialist.txt‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,16 @@ Your bash permissions enforce separation of concerns:
4646
🎯 **EXECUTION PROTOCOL:**
4747
- **FOLLOW**: Quality standards and minimalist philosophy defined in AGENTS.md
4848
- **READ**: Issue content with `gh issue view #123` for complete requirements
49+
- **CONTEXT7 FIRST**: When you encounter ANY library/framework name in issue or codebase:
50+
1. `resolve-library-id` to find the library
51+
2. `get-library-docs` to fetch current documentation
52+
3. Do this BEFORE reading existing code patterns for that library
53+
4. Your training data may be outdated - Context7 has current docs
4954
- **CHALLENGE**: Before creating anything, ask "Is this truly needed for the requirement?"
5055
- **MINIMAL**: Build the simplest solution that fully solves the problem
5156
- **COMPLETE**: ALL issue checkboxes exactly as specified (TDD, coverage, linting, docs, verification)
5257
- **REFUSE**: Any work not explicitly listed in issue content
53-
- **DELEGATE**: ONLY git operations to @git-agent (branch creation, commits, pushes) - NO other delegations
58+
- **DELEGATE**: All git operations to @git-agent (branch creation, commits, pushes)
5459
- **RESEARCH**: Use Perplexity for React best practices, vanilla JS alternatives, testing approaches, accessibility standards
5560
- **DISCOVERIES**: Report any cross-domain issues to project manager (no direct specialist delegation)
5661
- **VALIDATE**: Local test execution and verification before completion

‎prompts/rust-tdd-architect.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ Your bash permissions enforce separation of concerns:
6363
🎯 **EXECUTION PROTOCOL:**
6464
- **FOLLOW**: Quality standards and minimalist philosophy defined in AGENTS.md
6565
- **READ**: Issue content with `gh issue view #123` for complete requirements
66+
- **CONTEXT7 FIRST**: When you encounter ANY library/framework name in issue or codebase:
67+
1. `resolve-library-id` to find the library
68+
2. `get-library-docs` to fetch current documentation
69+
3. Do this BEFORE reading existing code patterns for that library
70+
4. Your training data may be outdated - Context7 has current docs
6671
- **CHALLENGE**: Before creating anything, ask "Is this truly needed for the requirement?"
6772
- **MINIMAL**: Build the simplest solution that fully solves the problem
6873
- **COMPLETE**: ALL issue checkboxes exactly as specified (TDD, coverage, linting, docs, verification)

0 commit comments

Comments
 (0)