This document guides AI coding agents when performing complex tasks in the Pair framework repository.
It complements:
- AGENTS.md (entrypoint and workflow)
- SKILL.md (quick-start and document map)
- GEMINI.md (coding standards and conventions)
- CODEX.md (Codex behavior)
- PAIR_ARCHITECTURE.md (framework architecture)
- PAIR_PATTERNS.md (idiomatic coding patterns)
Agents should consult this document when implementing:
- new features
- bug fixes
- refactoring
- performance improvements
- migrations
- framework extensions
Open this document only when the task is not obviously local and low-risk.
For routine work, follow AGENTS.md, SKILL.md, and GEMINI.md first.
This file adds task-shaping guidance for work that crosses layers, carries rollout risk, or needs broader verification.
Before implementing a larger task:
- Define the affected layers and public surfaces.
- Identify compatibility, rollout, and documentation risk.
- Split the work into the smallest reviewable slices.
- Decide the verification path before editing.
- Update wiki or contract docs in the same change when public behavior moves.
When fixing a bug:
- Identify the root cause.
- Reproduce the problem if possible.
- Check adjacent behavior and likely regression surface.
- Prefer a root-cause fix over defensive patching around symptoms.
- Verify that existing behavior remains unchanged.
When adding a feature:
-
Identify the appropriate framework layer:
- controller
- model
- utility
- frontend helper
-
Check whether a similar feature already exists.
-
Reuse existing utilities where possible.
-
Prefer additive hooks, optional behavior, or narrow extensions over contract changes.
-
Keep new config keys, docs, and public examples in the same diff.
When refactoring code:
- Confirm that the refactor does not change external behavior.
- Prefer small localized refactors.
- Avoid refactoring unrelated files.
- Remove duplication only where it improves the owner component instead of creating a new abstraction by reflex.
When optimizing performance:
-
Identify the actual bottleneck.
-
Avoid speculative optimizations.
-
Focus on:
- database queries
- loops
- repeated allocations
- unnecessary ORM calls.
-
Prefer improving existing logic instead of rewriting components.
When implementing migrations or framework upgrades:
- Separate schema risk, data risk, and rollout risk in your reasoning.
- Check downstream models, forms, APIs, jobs, and exports before finalizing the change.
- Prefer additive changes or deprecation paths over immediate removal.
- Document rollback and deployment-order constraints clearly.
When updating documentation:
- Ensure examples match the current framework behavior.
- Update only the file that owns the topic.
- Remove duplication instead of copying rules into multiple files.
- Prefer practical examples only where they clarify the owning document.
Agents should verify:
- affected layers were all checked explicitly
- compatibility and rollout risk were documented
- verification matched the real risk of the task
- related docs were updated when public behavior changed