cs-rag-architecture-guideline
Original:🇨🇳 Chinese
Translated
General Architecture Specification for CS-RAG Project, unifies global architecture cognition and architecture design constraints, provides entry points for layered inspection, impact analysis, interface contracts, dependency injection and pluggable governance.
1installs
Sourceqiao-925/qiao-skills
Added on
NPX Install
npx skill4agent add qiao-925/qiao-skills cs-rag-architecture-guidelineTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →CS-RAG Architecture General Specification
General Architecture Specification for CS-RAG Project. The rules fromandarchitecture-cognitionhave been merged losslessly, and it can be used independently after deleting the original skills.architecture-design
⚠️ Core Mandatory Requirements
Unified Three-Layer Architecture Constraints
- Frontend Layer → Business Layer → Infrastructure Layer (one-way dependency)
- Prohibit reverse dependencies: Infrastructure Layer cannot depend on Business Layer or Frontend Layer
- Prohibit cross-layer access: Frontend Layer cannot directly access Infrastructure Layer
- Infrastructure Layer must not contain business logic
Combined Governance Sequence of Cognition and Design
- First perform architecture cognition inspection: layer position, component relationships, data flow impact
- Then perform architecture design inspection: interface contracts, dependency injection, pluggable design
- Finally perform compliance review: cross-layer, reverse dependencies, circular dependencies, compatibility
Scenarios Requiring User Decision for Upgrade
- Involving cross-layer dependency modifications
- Involving core component interface changes (especially breaking changes)
- Involving data flow/main path changes
- Involving global strategy, performance, resource consumption or data consistency risks
AI Agent Behavior Requirements
Phase A: Architecture Cognition (full migration from original architecture-cognition
)
architecture-cognitionBefore modifying code, you must answer:
- Position Identification: Which layer does it belong to? Which components are affected? Is there a cross-layer dependency risk?
- Impact Scope: Which data flows are affected? Do any components depend on this interface? Do tests need to be updated?
- Architecture Constraints: Does it violate the three-layer architecture? Does it introduce circular dependencies?
When creating new components, you must clarify:
- Responsibility Positioning: Which layer does it belong to? What is the single responsibility? What is the relationship with existing components?
- Interface Design: Is an abstract base class/Protocol required? Is the factory pattern required?
- Dependency Management: Which components does it depend on? Can dependency injection be used? Does it violate the dependency direction?
Quick Reference (Project Context):
| Layer | Core Components | Responsibilities |
|---|---|---|
| Frontend Layer | | User interaction, UI display |
| Business Layer | | Business logic, process orchestration |
| Infrastructure Layer | | Technical implementation, no business logic |
Phase B: Architecture Design (full migration from original architecture-design
)
architecture-designCheck items during design changes:
- Mark the affected layers and upstream/downstream modules
- Confirm no circular dependencies
- Confirm no cross-layer access
Interface Design Requirements:
- Define contracts with abstract base classes or Protocol
- New interfaces are backward compatible by default
- Use constructor-based dependency injection, prohibit static singletons
Pluggable Design Requirements:
- Use factory or registry pattern to register new implementations
- All switchable components are enabled via configuration items
When planning new modules:
- Each module/class is responsible for only a single domain
- Naming follows the structure
src/<layer>/<role>/module.py
Phase C: Compliance Review
- Review whether cross-layer access or reverse dependencies are introduced
- Review whether interface changes have compatibility strategies
- Review whether circular dependencies occur
Judgment Criteria
- Whether the three-stage inspection of "cognition + design + review" is completed
- Whether the three-layer dependency direction is correct and no circular dependencies exist
- Whether interface compatibility and implementation replaceability are retained
Lossless Merge Declaration
- This skill has carried out content-level migration of two sets of original rules, not just link jumps.
- The original text has been copied to:
SKILL.mdreferences/architecture-cognition-skill.mdreferences/architecture-design-skill.md
- The original reference texts have been fully copied to the directory of this skill.
references/ - For detailed mapping, see .
references/lossless-merge-routing.md
Readiness Instructions for Deleting Source Skills
- After deleting and
architecture-cognition, this skill can still run independently.architecture-design - Only the path changes before and after deletion, and no rule content will be lost.
Reference Materials
- - Lossless merge routing and original text mapping
references/lossless-merge-routing.md - - Full text of original
references/architecture-cognition-skill.mdarchitecture-cognition - - Original cognition reference: system positioning
references/architecture-cognition-system-overview.md - - Original cognition reference: three-layer architecture
references/architecture-cognition-three-layer-architecture.md - - Original cognition reference: component map
references/architecture-cognition-component-map.md - - Original cognition reference: data flow
references/architecture-cognition-data-flow.md - - Full text of original
references/architecture-design-skill.mdarchitecture-design - - Original design reference: layered guidelines
references/architecture-design-layer-guidelines.md - - Original design reference: module planning
references/architecture-design-module-planning.md - - Original design reference: interface design
references/architecture-design-interface-design.md