refactor: research workflow as Claude Code context injection

Research is now optimized for Claude Code implementation quality:
- PROJECT.md-driven (features, constraints, questions, decisions)
- High-confidence only (no low-quality padding)
- 3 focused files: stack.md, implementation.md, risks.md
- Code examples with current vs deprecated patterns

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson
2025-12-15 23:23:15 -06:00
parent 5bbff091c6
commit 77ea129fd5
4 changed files with 738 additions and 705 deletions

View File

@@ -1,181 +1,243 @@
# Project Research Template
Template for `.planning/research/{category}.md` - project-level domain research written by subagents.
Template for `.planning/research/{category}.md` - implementation context for Claude Code.
---
## File Template
<philosophy>
## What This Research Is
**Context injection for Claude Code implementation quality.**
This is NOT research for humans to make decisions.
This is context that Claude Code reads during implementation to generate correct, modern code.
**Quality bar:** Will this make Claude generate better code?
**Include:** High-confidence, directly actionable, current patterns with code examples
**Exclude:** Low-confidence, generic advice, "might be useful" padding, outdated patterns
</philosophy>
---
## stack.md Template
```markdown
# {Category}: {Domain}
# Stack: [Project Name]
**Category:** {ecosystem | architecture | pitfalls | standards}
**Domain:** {domain from PROJECT.md}
**Researched:** {date}
**Confidence:** {high | medium | low}
**Purpose:** Libraries and tools for Claude Code to use during implementation
**Researched:** [date]
## Research Summary
## [Feature 1 from PROJECT.md Scope]
{2-3 sentence overview of what was found and why it matters for this project}
**Use:** [Library Name] v[X.Y.Z]
**Why:** [One sentence - why this library for this feature]
## Findings
```[language]
// Setup / import
import { Thing } from 'library'
### {Finding 1 Title}
// Basic usage
const result = Thing.doThing()
```
{What was discovered}
**Docs:** [URL to current documentation]
**Source:** {URL or documentation reference}
**Confidence:** {high | medium | low}
**Relevance:** {Why this matters for the project}
## [Feature 2 from PROJECT.md Scope]
### {Finding 2 Title}
**Use:** [Library Name] v[X.Y.Z]
**Why:** [One sentence]
{What was discovered}
```[language]
// Setup / import
[actual code]
```
**Source:** {URL or documentation reference}
**Confidence:** {high | medium | low}
**Relevance:** {Why this matters for the project}
**Docs:** [URL]
{... additional findings ...}
## [Continue for each feature in Scope...]
## Recommendations
## Constraint Compatibility
### Use
| Constraint | Status | Notes |
|------------|--------|-------|
| [constraint from PROJECT.md] | ✓ Compatible | [brief note] |
| [constraint from PROJECT.md] | ✓ Compatible | [brief note] |
- **{Library/Pattern/Tool}** - {One line why}
- **{Library/Pattern/Tool}** - {One line why}
## Unanswered
### Avoid
- **{Thing to avoid}** - {One line why}
- **{Thing to avoid}** - {One line why}
### Defer Decision
- **{Topic}** - {Why more info needed}
## Sources
| Source | Type | Confidence | Last Verified |
|--------|------|------------|---------------|
| {URL or reference} | {official docs / blog / github / forum} | {high/medium/low} | {date} |
| {URL or reference} | {type} | {confidence} | {date} |
## Open Questions
- {Question that couldn't be resolved}
- {Question that needs more context}
- {Question for roadmap planning to consider}
---
*Generated by research-project subagent*
*Category: {category}*
- [Any features where no clear library choice exists - be honest]
```
---
<category_guides>
## implementation.md Template
## Category-Specific Guidance
```markdown
# Implementation: [Project Name]
### ecosystem.md
**Purpose:** Current API patterns for Claude Code to use
**Researched:** [date]
**Purpose:** Map the library/framework landscape for this domain
## [Feature 1] Implementation
**Key questions to answer:**
- What are the go-to libraries for this problem?
- Which frameworks are actively maintained?
- What's the "standard stack" experts use?
- What NOT to hand-roll (existing solutions exist)?
### Current Pattern (2025)
**Structure emphasis:**
- Compare 2-4 main options
- Clear "use X when..." guidance
- Version currency (is it maintained?)
- Integration considerations
```[language]
// Correct way to implement [feature]
[actual working code - not pseudocode]
```
### architecture.md
### NOT This (Deprecated)
**Purpose:** Document standard project structure and patterns
```[language]
// Claude may generate this - it's outdated
[old pattern]
// Why wrong: [deprecated in vX, removed in vY, causes Z problem]
```
**Key questions to answer:**
- How do experts organize code for this domain?
- What patterns prevent common problems?
- What component boundaries make sense?
- How does data flow in typical implementations?
### Key APIs
**Structure emphasis:**
- Directory structure recommendations
- Component organization patterns
- State management approaches
- Integration patterns with related systems
- `methodName(params)` - [what it does, when to use]
- `otherMethod(params)` - [what it does, when to use]
### pitfalls.md
## [Feature 2] Implementation
**Purpose:** Catalog what NOT to do and why
[Same structure]
**Key questions to answer:**
- What mistakes do beginners commonly make?
- What causes performance problems?
- What architectural choices cause regret?
- What seems like a good idea but isn't?
## Open Questions Answered
**Structure emphasis:**
- Clear problem → consequence → solution
- Real examples of failures
- Detection (how to know if you're doing this)
- Prevention (how to avoid)
### [Question from PROJECT.md Open Questions]
### standards.md
**Answer:** [Direct answer]
**Source:** [URL or documentation reference]
**Purpose:** Document best practices and quality expectations
### [Question 2]
**Key questions to answer:**
- What does "production quality" mean for this domain?
- What testing approaches work?
- What performance benchmarks matter?
- What accessibility/security considerations apply?
**Answer:** [Direct answer or "Could not determine - [reason]"]
**Structure emphasis:**
- Measurable quality criteria
- Testing strategies that work
- Performance targets
- Common standards/conventions
## Decisions Validated
</category_guides>
### [Decision from PROJECT.md Decisions Made]
<difference_from_phase_research>
## How This Differs from Phase-Level Research
**Validation:** ✓ Good choice / ⚠️ Has gotchas
**Notes:** [Implementation considerations Claude should know]
**project-research.md (this template):**
- Written BEFORE roadmap exists
- Informs phase structure and scope
- Ecosystem-level landscape view
- Answers "what tools/patterns should we use?"
## Quick Reference
**research.md (phase-level):**
- Written AFTER roadmap exists
- Informs specific phase implementation
- Implementation-level detail
- Answers "how do we implement this phase?"
| Task | Current Pattern | Deprecated Pattern |
|------|-----------------|-------------------|
| [common task 1] | `newWay()` | `oldWay()` |
| [common task 2] | `async/await` | `.then()` chains |
```
Project research is strategic (shapes the roadmap).
Phase research is tactical (shapes the implementation).
</difference_from_phase_research>
---
<quality_bar>
## Quality Expectations
## risks.md Template
A well-written research file:
- Has specific, actionable recommendations (not "it depends")
- Cites sources with confidence levels
- Distinguishes verified facts from educated guesses
- Surfaces open questions honestly
- Can be read in 2-3 minutes and inform a decision
```markdown
# Risks: [Project Name]
**Purpose:** What Claude Code might get wrong
**Researched:** [date]
## Deprecated Patterns to Avoid
### [Deprecated Thing 1]
**Claude might generate:**
```[language]
// This is outdated - from old tutorials/training data
[deprecated code pattern]
```
**Instead use:**
```[language]
// Current approach (2025)
[correct code pattern]
```
**Why:** Deprecated in v[X], removed in v[Y]. [Brief explanation]
### [Deprecated Thing 2]
[Same structure]
## Common Mistakes
### [Mistake 1: Descriptive Name]
**What happens:** [The incorrect approach Claude might take]
**Why it's wrong:** [Specific consequence - performance, bugs, etc.]
**Correct approach:**
```[language]
// Wrong
[bad code]
// Right
[good code]
```
## Stack-Specific Gotchas
### [Gotcha for this project's chosen stack]
**Issue:** [What goes wrong]
**When:** [Trigger conditions]
**Fix:** [How to avoid or handle]
## Decision Risks
### [Decision from PROJECT.md]
**Risk level:** Low / Medium / High
**Concern:** [What could go wrong with this choice]
**Mitigation:** [How to avoid the problem]
## Critical Warnings
1. **[Most important thing Claude must not mess up]**
2. **[Second most important]**
3. **[Third most important]**
```
---
<quality_rules>
## Quality Rules
### INCLUDE:
- High-confidence information only
- Actual code examples (runnable, not pseudocode)
- Current syntax (2024-2025)
- Direct answers to PROJECT.md questions
- Specific recommendations tied to manifest features
### EXCLUDE:
- Low or medium confidence items
- "Might be useful" padding
- Generic advice not specific to this project
- Options without clear recommendation
- Old repos/articles acknowledged as outdated
- Anything that doesn't directly improve Claude's implementation
### Format for Claude Consumption:
Every recommendation should include:
1. What to use (specific, versioned)
2. Why (one sentence)
3. How (actual code)
4. What NOT to do (if relevant)
### No Padding Rule:
If you can't find high-confidence information for something, say so:
- "Could not determine - no authoritative source found"
- "Unanswered - requires experimentation"
This is better than padding with low-quality guesses.
</quality_rules>
**Avoid:**
- Generic advice that applies to anything
- Recommendations without reasoning
- Outdated information (pre-2024 unless fundamental)
- Confidence without verification
</quality_bar>