Task Objective
- This Skill is used to: through a virtual four-role team (autonomous learning → PM → architect → senior programmer) working collaboratively, transform the user's natural language requirements into complete Python project deliverables
- Capabilities include: autonomous learning and knowledge integration, requirements analysis and clarification, architecture design (adaptive project scale), code implementation, feature verification, version control,feature expansion, project refactoring, skill recognition and invocation, database design and implementation, data layer abstraction
- Trigger conditions: the user proposes a clear software development requirement (such as "make a weather query tool", "implement a to-do system", "add a data export feature", "optimize code performance", "design a user management system", etc.)
Preliminary Preparation
- Dependency description: web_search tool (already integrated)
- Package management tool:UV(modern Python package manager, fast, reliable, lockfile-based dependency management)
- Installation:
pip install uv - Project initialization:
uv init - Dependency management:
uv add package
- Installation:
- File preparation: no prerequisite files required
- Version Control Mechanism: all documents and code must include version information, use Semantic Versioning (such as v1.0.0), and record version history and reasons for changes
Operation Steps
Phase 0: Autonomous Learning and Knowledge Integration
Objective: obtain relevant domain knowledge through web search, generate project background documents, and provide knowledge support for subsequent phases
Execution Steps:
-
Identify keywords: extract core technology, domain, and tool keywords from the user's requirements
- Technology keywords: such as "REST API", "WebSocket", "CSV processing", "database", "ORM"
- Domain keywords: such as "weather query", "to-do", "data analysis", "user management"
- Tool keywords: such as "Flask", "pandas", "UV", "SQLAlchemy", "MongoDB"
-
Execute web search(3-6 rounds):
- Round 1: search "<domain> best practices" to obtain general design principles
- Round 2: search "<technology> framework comparison", such as "Flask vs FastAPI comparison"
- Round 3: search "<feature> implementation solutions", such as "Python weather API call example"
- Round 4 (optional): search "<problem> common pitfalls", such as "REST API common errors"
- Round 5: search "Python 3.11+ new features", "framework version compatibility", "UV package manager best practices", "loguru logging library best practices"
- Round 6 (newly added): search "database selection", "SQLAlchemy vs MongoDB", "vector database comparison", "graph database comparison", "Repository pattern best practices", "database performance optimization"
-
Filter and integrate information:
- Evaluate the credibility and timeliness of search results
- Extract key information: technology selection rationale, design patterns, best practices, common issues, version features, UV usage, database selection
- Integrate conflicting information and annotate the pros and cons of different solutions
- Key focus: version compatibility, long-term maintainability, learning resources, UV package management advantages, database features
- Generate a structured knowledge summary
-
Generate
docs/background.md:- Reference references/background-template.md structure
- Include: project background overview, technical domain knowledge, best practices, tool comparison (including version information), common issues, UV package management,database-related knowledge
- Enhance: add version compatibility, long-term maintainability, and learning resources to the tool comparison dimensions
- Enhance: database selection guide (SQLite, PostgreSQL, MongoDB, vector databases, graph databases)
- Enhance: database design and implementation best practices (ORM/ODM, indexing strategies, performance optimization)
- Ensure the information is accurate, practical, and easy to understand
Phase 1: Project Manager (PM) - Requirements Analysis and Documentation
Goal: Understand user requirements in combination with background knowledge, generate a clear requirements document, and assess project scale
Execution Steps:
-
Analyze requirements in combination with background knowledge:
- Read
docs/background.mdto understand domain best practices and common pitfalls - Identify key points that may be missing from user requirements (based on domain knowledge)
- Assess the reasonableness and feasibility of the requirements
- Read
-
Identify ambiguities or incompleteness in the requirements
-
Conduct at most 2 rounds of clarification interaction(if the requirements are unclear):
- Start with "[Question]" to confirm details with the user
- Typical questions: functional boundaries, input/output formats, non-functional requirements, technology stack preferences, version requirements, expected project scale, etc.
- Example: "Build a weather query tool" → clarify "Which cities are supported? Data source? Is caching needed?"
-
Assess project scale:
- Small project: < 5 feature points, < 500 lines of code expected
- Medium project: 5-10 feature points, 500-2000 lines of code expected
- Large project: > 10 feature points, > 2000 lines of code expected
- In
requirements.md, clearly indicate the project scale
-
Database requirements clarification(new):
- Confirm whether data persistence storage is needed
- Confirm the data type (relational, document, vector, graph)
- Confirm the data scale and concurrency requirements
- Confirm whether multi-database support is needed
- Confirm whether database switching capability is needed
-
Based on user feedback, background knowledge, and project scale assessment, generate
docs/requirements.md:- Reference references/requirements-template.md structure
- Include: feature list, input/output description, non-functional requirements, assumptions and constraints, version requirements, project scale,database requirements
- Key: Refine the non-functional requirements by referring to the best practices in background.md
- Added: Specify the Python 3.11+ version requirement, version control strategy, UV package management requirement, project scale, loguru logging library requirement (mandatory use), and database selection requirement (refer to database-selection-guide.md)
- Ensure every functional point is clear and executable
- Record version: v1.0.0 (initial version)
Phase 2: System Architect (Architect) - Architecture Design
Goal: Based on the requirements document, background knowledge, and project scale, design the system architecture, and generate the design document and task list
Execution Steps:
- Read
docs/requirements.mdandbackground.mdto understand the complete requirements, domain knowledge, project scale, and database needs - Choose the architecture organization approach based on project scale:
- Small project: Use a single file or a simple folder structure
project/ ├── main.py ├── README.md # 项目根目录 ├── pyproject.toml ├── uv.lock └── docs/ # 文档文件夹 ├── background.md ├── requirements.md └── architecture.md - Large project: Use standard Python project folder organization
project/ ├── README.md # 项目根目录 ├── pyproject.toml ├── uv.lock ├── src/ │ ├── __init__.py │ ├── main.py │ ├── api/ # API 模块 │ ├── models/ # 数据模型 │ ├── services/ # 业务逻辑 │ ├── repositories/ # 数据访问层(Repository) │ └── utils/ # 工具函数 ├── tests/ │ └── test_main.py └── docs/ # 文档文件夹 ├── background.md ├── requirements.md └── architecture.md
- Small project: Use a single file or a simple folder structure
- Design the system architecture:
- Refer to the tool comparison in background.mdto make technology selections
- Module division and responsibility assignment (based on project scale)
- Data flow design
- Technology selection (reasons must be stated, citing the comparative analysis in background.md):
- Must compare at least 2 options in detail
- Explain the trade-off rationale (performance vs ease of use, functionality vs complexity)
- Cite the comparison data in background.md (performance, ecosystem, learning curve, version compatibility)
- Clearly state the advantages and disadvantages of the selected option
- Interface definition (function signatures, parameter descriptions,type annotations must be included)
- Refer to the best practices in background.md, and apply design patterns and architectural patterns
- UV package management strategy: Use pyproject.toml to manage dependencies, and uv.lock to lock versions
- Skill identification: Identify potentially reusable skill modules in the project, and define skill interfaces in architecture.md
- Design the database architecture(Added):
- Refer to the database selection guide to choose an appropriate database (SQLite, PostgreSQL, MongoDB, ChromaDB, Neo4j, etc.)
- Design the data model (table structure, indexing strategy)
- Design the data access layer (Repository pattern)
- Implement the database abstraction layer (support switching between multiple databases)
- Generate the database design document and the data layer abstraction document
- Generate the following files:
docs/architecture.md: Refer to references/architecture-template.md- Added: Database design section (refer to database-design-template.md)
- Added: Data access layer section (refer to data-abstraction-template.md)
- Added: Select the corresponding architecture template based on project scale
- Added: Version control section (version strategy, dependency version locking)
- Added:UV package management section (pyproject.toml configuration, uv.lock strategy)
- New:Database design section (database selection, data models, indexing strategy)
- New:Data access layer section (Repository pattern, BaseRepository interface, concrete implementations)
- New:Skill identification and management section (skill list, interface definitions, reuse guide)
- Clarify Python 3.11+ version requirement
- Add technical selection trade-off explanation
docs/database-design.md:Refer to references/database-design-template.md- Database selection and configuration
- Data model design
- Indexing strategy
- Data access interface definitions
docs/data-abstraction.md:Refer to references/data-abstraction-template.md- BaseRepository interface definition
- SQLAlchemy / MongoDB implementation
- Repository factory
- Database switching strategy
README.md:Refer to references/readme-template.md, including basic usage, dependency installation (using UV), how to runtodo.md:Refer to references/todo-template.md, initial state marks all tasks as[ ](incomplete)- New:Type annotation related tasks
- New:UV package management tasks
- New:Database design and implementation tasks
- New:Skill identification and management tasks
- New:Adjust task list according to project scale
Phase 3: Senior Dev - Code implementation
Objective:Based on architecture design, task list, and background knowledge, write high-quality executable code
Execution steps:
- Read
docs/architecture.md、docs/database-design.md、docs/data-abstraction.md、todo.mdandbackground.md, understand the system design, project scale, database design, data access layer architecture, domain best practices, and skill definitions - Organize code files according to project scale:
- Small project:All code in
main.pyin - Large project:
src/__init__.py:Package initializationsrc/main.py:Main entrysrc/api/:API modulesrc/models/:Data modelssrc/services/:Business logicsrc/repositories/:Data access layer (Repository)src/utils/:Utility functionstests/:Test files
- Small project:All code in
- Write code:
- Must use Python 3.11+ features:
- Type annotations (Type Hints): all function parameters and return values must use type annotations
- Use PEP 585 (built-in generic types): such as
list[int]instead ofList[int] - Use PEP 646 (type parameters): such as
def func[T](items: list[T]) -> T: - Use match-case statements (Python 3.10+) for pattern matching
- Use improved features of dataclasses
- Clear code structure with necessary comments
- Apply the best practices in background.md: such as error handling,Use loguru for logging, code standards
- Refer to the common issues in background.md, avoid typical pitfalls
- Call existing skills: when implementing new features, prioritize calling the skill modules defined in architecture.md to avoid duplicate development
- Implement the data access layer:
- Implement the BaseRepository interface
- Implement SQLAlchemyBaseRepository / MongoDBBaseRepository
- Implement the Repository for specific entities (UserRepository, etc.)
- Implement the RepositoryFactory factory
- Implement all feature points
- Include
if __name__ == "__main__"entry - Ensure the code can run directly without additional configuration
- Type annotation example:
def process_data(data: list[dict[str, Any]]) -> dict[str, int]: """处理数据并返回统计结果""" counts: dict[str, int] = {} for item in data: key = item.get("key") if key: counts[key] = counts.get(key, 0) + 1 return counts - Skill invocation example:
from src.utils.helpers import existing_skill def new_feature(data: list[Any]) -> dict[str, Any]: """新功能实现,调用已有技能""" # 直接调用技能 result = existing_skill(data) return result - Repository usage example:
from src.repositories import UserRepository def get_user(user_id: int) -> User | None: """获取用户""" repo = UserRepository(session) return repo.get_by_id(user_id)
- Must use Python 3.11+ features:
- Generate the UV dependency file:
pyproject.toml: use the standard format, including project metadata and dependencies- Add database dependencies: sqlalchemy, pymongo, chromadb, psycopg2-binary, etc.
- Add migration tools: alembic (relational databases), mongomock (MongoDB testing)
uv.lock: automatically generated, locks dependency versions- Reference template:references/uv-lock-template.md
- Synchronously update
todo.md:- Mark completed tasks as
[x] - Ensure each task corresponds to
requirements.mdone entry in
- Mark completed tasks as
Phase 4: Quality Verification - Functional Testing
Objective: verify whether the code meets the original requirements and generate a test report
Execution steps:
- Design test cases:
- Cover
requirements.mdall feature points in - Refer to the common issues in background.md, design targeted test scenarios
- Include normal scenarios and edge cases
- Add database tests:
- Test CRUD operations
- Test transaction handling
- Test concurrent operations
- Use in-memory databases for testing (SQLite / mongomock)
- Record the input and expected output of each test case
- Cover
- Execute tests (simulated run):
- Analyze the code logic and verify whether the functionality is implemented correctly
- Check whether it conforms to the architecture design
- Verify the UV dependency file: ensure pyproject.toml and uv.lock are correct
- Verify the completeness of type annotations: ensure all key functions have type annotations
- Verify skill invocation: confirm that new features correctly call existing skills
- Verify the loguru logging configuration: ensure logs are output correctly
- Verify the data access layer: confirm that the Repository interface is implemented correctly
- Verify database operations: confirm that CRUD operations and query optimization are correct
- Refer to the security considerations in background.md,验证安全措施
- Generate
test_report.md:- Reference references/test-report-template.md
- List: verified features, whether they pass, potential risks or uncovered scenarios
- Give a clear pass/fail judgment for each feature
- Cite knowledge from background.md,explain common issues covered by testing
- Add:Verify usage of Python 3.11+ features, UV dependency management, skill invocation, loguru logging configuration, and database operation verification
Phase 5: Feature Extension (Add Features)
Goal:Add new features on top of the existing project, identify and reuse existing skills
Trigger Conditions:The user requests "add feature", "extend functionality", etc.
Execution Steps:
-
Read the existing project:
- Read
docs/requirements.md、docs/architecture.md、docs/database-design.md、docs/data-abstraction.md、docs/background.md - Read existing code files (main.py or the src/ directory)
- Read
pyproject.tomlto understand existing dependencies
- Read
-
Analyze the existing architecture:
- Understand existing functional modules and data flow
- Identify callable skills defined in architecture.md
- Assess database extension requirements:Whether new data tables/collections are needed, and whether indexes need updating
- Assess the impact of new features on the existing system
-
Design the feature extension plan:
- Clarify the requirements and interfaces of the new features
- Prioritize using existing skills to implement new features
- Design the code adaptation plan for the new features
- Design database changes:Add tables/collections, update Repository
- Assess whether new dependencies are needed
-
Adapt the code:
- Call existing skill modules
- Write new feature code
- Update the data access layer:Add or modify Repository
- Write database migration scripts(if needed)
- Ensure consistency with the existing code style
- Add type annotations and loguru logging
-
Update documentation:
- Update
requirements.md:Add new feature requirements, update the version number (v1.0.0 → v1.1.0) - Update
architecture.md:Update the architecture design and skill list - Update
docs/database-design.md:Update the database design - Update
docs/data-abstraction.md:Update the data access layer - Update
todo.md:Add new feature development tasks and database extension tasks - Update
README.md:Update the feature list and usage instructions
- Update
-
Test and verify:
- Test the new features
- Regression test the existing features
- Test database changes:Verify new tables/collections, indexes, and migrations
- Update
test_report.md - Use UV to update dependencies (if needed):
uv add package
-
Generate the extension plan document:
- Reference references/feature-extension-template.md
- Record the extension process, code changes, documentation updates, and database changes
Phase 6: Project Refactoring
Goal:Analyze code quality and performance, perform refactoring, and improve maintainability
Trigger conditions:The user requests "refactoring", "optimization", "code improvement", etc.
Execution steps:
-
Read the existing project:
- Read all code files
- Read all documentation files
- Read
pyproject.tomlanduv.lock
-
Analyze code quality and performance:
- Analyze code complexity, duplicate code, and naming conventions
- Identify performance bottlenecks
- Identify architectural issues (high coupling, low cohesion)
- Analyze database performance:Query optimization, index optimization, connection pooling
- Identify modules that can be extracted as skills
-
Design the refactoring plan:
- Determine refactoring goals (performance, readability, maintainability)
- Design the code refactoring plan (extract functions/classes, simplify logic)
- Design the performance optimization plan (algorithms, caching, concurrency)
- Design the architecture optimization plan (decoupling, interface optimization)
- Design the database optimization plan:Query optimization, index optimization, connection pool optimization
- Identify and define new skill modules
-
Execute refactoring:
- Execute code refactoring
- Execute performance optimization
- Execute architecture optimization
- Execute database optimization:Optimize queries, update indexes, adjust connection pools
- Optimize the data access layer:Improve the Repository implementation
- Update the skill identification section in architecture.md
- Use UV to update dependencies (if needed):
uv lock --upgrade
-
Verify the refactoring results:
- Regression testing
- Performance testing
- Database performance testing
- Functional verification
- Update
test_report.md
-
Generate the refactoring report:
- Reference references/refactoring-plan-template.md
- Record the before-and-after comparison of refactoring (code quality, performance, architecture, database performance)
- Record skill identification and management
Final delivery
New project delivery format
Output all file contents in the following format (each file starts with --- FILE: filename --- ):
Small project(single file):
--- FILE: README.md ---
<README.md 完整内容>
--- FILE: pyproject.toml ---
<pyproject.toml 完整内容>
--- FILE: uv.lock ---
<uv.lock 完整内容>
--- FILE: main.py ---
<main.py 完整内容>
--- FILE: docs/background.md ---
<docs/background.md 完整内容>
--- FILE: docs/requirements.md ---
<docs/requirements.md 完整内容>
--- FILE: docs/architecture.md ---
<docs/architecture.md 完整内容>
--- FILE: docs/database-design.md ---
<docs/database-design.md 完整内容>
--- FILE: docs/data-abstraction.md ---
<docs/data-abstraction.md 完整内容>
--- FILE: test_report.md ---
<test_report.md 完整内容>
Large project(folder organization):
--- FILE: README.md ---
<README.md 完整内容>
--- FILE: pyproject.toml ---
<pyproject.toml 完整内容>
--- FILE: uv.lock ---
<uv.lock 完整内容>
--- FILE: src/__init__.py ---
<src/__init__.py 完整内容>
--- FILE: src/main.py ---
<src/main.py 完整内容>
--- FILE: src/repositories/__init__.py ---
<src/repositories/__init__.py 完整内容>
--- FILE: src/repositories/base.py ---
<BaseRepository 接口>
--- FILE: src/repositories/user_repo.py ---
<UserRepository 实现>
--- FILE: tests/__init__.py ---
<tests/__init__.py 完整内容>
--- FILE: tests/test_repositories.py ---
<Repository 测试>
--- FILE: docs/background.md ---
<docs/background.md 完整内容>
--- FILE: docs/requirements.md ---
<docs/requirements.md 完整内容>
--- FILE: docs/architecture.md ---
<docs/architecture.md 完整内容>
--- FILE: docs/database-design.md ---
<docs/database-design.md 完整内容>
--- FILE: docs/data-abstraction.md ---
<docs/data-abstraction.md 完整内容>
--- FILE: test_report.md ---
<test_report.md 完整内容>
Feature extension delivery format
--- FILE: docs/requirements.md ---
<更新后的 requirements.md>
--- FILE: docs/architecture.md ---
<更新后的 architecture.md>
--- FILE: docs/database-design.md ---
<更新后的 database-design.md>
--- FILE: docs/data-abstraction.md ---
<更新后的 data-abstraction.md>
--- FILE: main.py 或 src/... ---
<修改后的代码文件>
--- FILE: pyproject.toml ---
<更新后的 pyproject.toml(如有)>
--- FILE: README.md ---
<更新后的 README.md>
--- FILE: feature_extension_plan.md ---
<功能扩展计划文档>
Refactoring delivery format
--- FILE: main.py 或 src/... ---
<重构后的代码文件>
--- FILE: docs/architecture.md ---
<更新后的 architecture.md(包含技能识别)>
--- FILE: docs/database-design.md ---
<更新后的 database-design.md>
--- FILE: docs/data-abstraction.md ---
<更新后的 data-abstraction.md>
--- FILE: refactoring_report.md ---
<重构报告>
--- FILE: test_report.md ---
<更新后的测试报告>
Resource index
- Background knowledge template: see references/background-template.md
- Requirements document template: see references/requirements-template.md
- Architecture document template: see references/architecture-template.md
- UV lock file template: see references/uv-lock-template.md
- Task list template: see references/todo-template.md
- Test report template: see references/test-report-template.md
- Project description template: see references/readme-template.md
- Feature extension template: see references/feature-extension-template.md
- Refactoring plan template: see references/refactoring-plan-template.md
- Database selection guide:see references/database-selection-guide.md
- Database design template:see references/database-design-template.md
- Data layer abstraction template:see references/data-abstraction-template.md
Notes
Core requirements (mandatory)
- UV package management: Must use UV as the package management tool, use
pyproject.tomlto manage dependencies,uv.lockto lock versions - loguru logging: Must use loguru for logging
- Python 3.11+ features: Must use type annotations, PEP 585 built-in generic types
- Project scale adaptation: Assess scale during the PM phase, choose the organizational approach during the architect phase
- Version control mechanism: Use semantic versioning (vX.Y.Z), record version history
- Skill identification and management: Identify skills during the architecture phase, reuse skills during the implementation phase
- Database design and implementation: Select an appropriate database based on requirements (SQLite, PostgreSQL, MongoDB, vector database, graph database)
- Data layer abstraction: Must implement the Repository pattern, provide a unified CRUD interface
- Database switching capability: Support switching between different database implementations via configuration
Process requirements
- Autonomous learning phase: Must perform web searches, must not skip
- Requirement clarification limits: The PM phase allows at most 2 rounds of interaction; beyond that, proceed based on existing information
- No over-engineering: Implement strictly according to user requirements, must not add unmentioned features
- Background knowledge application: Each phase must reference and apply the knowledge in background.md
- Code quality: Ensure the generated code can run directly and includes complete error handling
Technology selection (mandatory)
- Must compare at least 2 options in detail
- Must explain the trade-off rationale (performance vs ease of use, functionality vs complexity)
- Must cite the comparison data in background.md
- Must explain the advantages and disadvantages of the chosen option
Database requirements (mandatory)
- Database selection: Select an appropriate database based on project requirements, refer to database-selection-guide.md
- Data model design: Design a reasonable data table/collection structure, define the indexing strategy
- Data access layer: Implement the Repository pattern, provide a unified CRUD interface
- Type safety: All data access functions must include type annotations
- Performance optimization: Reasonable indexing strategy, connection pool configuration, query optimization
Status synchronization
- todo.md must correspond one-to-one with the feature points in requirements.md
- The test report must cover all feature points and clearly indicate pass status
Feature extension
- Prioritize calling existing skills to avoid duplicate development
- Ensure new features are consistent with the existing code style
- Update all related documentation (including database design documentation)
- Execute regression testing
- Database extension: Assess whether new tables/collections need to be added, update the Repository, write migration scripts
Refactoring
- Analyze before executing, avoid blind refactoring
- Keep functionality unchanged, only optimize the internal implementation
- Database Optimization: Optimize queries, indexes, connection pooling
- Record comparison data before and after refactoring
- Identify and extract skill modules
Usage Examples
Example 1: User Management System with Database (Large Project)
- User Requirements: "Implement a user management system that supports user registration, login, and information query"
- Phase 0: Search "database selection", "SQLAlchemy vs MongoDB", "user authentication best practices", "password encryption", "Python 3.11+ type annotations", "UV package management", "Repository pattern"
- PM Phase:
- Clarify data scale, concurrency requirements, authentication method, password storage
- Clarify database requirements: relational data (user information), expected 100k users
- Assess project scale: 5 feature points → Medium-sized project → Choose PostgreSQL(supports high concurrency)
- Architect Phase:
- Database selection: PostgreSQL (relational, supports high concurrency)
- Design data model: User table (id, username, email, password_hash, created_at)
- Design data access layer: BaseRepository interface, SQLAlchemyBaseRepository, UserRepository
- Design RepositoryFactory: supports switching between PostgreSQL / SQLite
- Index strategy: username (UNIQUE), email (UNIQUE), created_at (INDEX)
- Choose large project architecture: src/repositories/ data access layer
- Identify skill modules: password encryption, token generation
- Senior Dev Phase:
- Implement BaseRepository interface (CRUD operations)
- Implement SQLAlchemyBaseRepository
- Implement UserRepository (get_by_email, get_by_username)
- Implement RepositoryFactory
- Use Python 3.11+ features, type annotations
- Use loguru for logging
- Generate
pyproject.toml(sqlalchemy、psycopg2-binary、alembic)
- Verification Phase: Test CRUD operations, concurrent operations, database performance, type annotations, data access layer abstraction
Example 2: Document Management System (MongoDB)
- User Requirements: "Implement a document management system that supports document CRUD and full-text search"
- PM Phase:
- Clarify document format, storage method, search requirements
- Clarify database requirements: document data, requires flexible schema and full-text search
- Assess project scale: 4 feature points → Small project → Choose MongoDB(document-oriented, flexible schema)
- Architect Phase:
- Database selection: MongoDB (document-oriented, supports full-text search)
- Design data model: Document collection (title, content, tags, metadata, created_at)
- Design data access layer: MongoDBBaseRepository, DocumentRepository
- Index strategy: title (TEXT), content (TEXT), tags (MULTIKEY)
- Senior Dev Phase:
- Implement MongoDBBaseRepository
- Implement DocumentRepository (search_by_keyword)
- Use pymongo, type annotations
- Verification phase: test CRUD operations, full-text search, performance
Example 3: Vector search system (ChromaDB)
- User requirements: "Implement a vector search system that supports semantic search of documents"
- PM phase:
- Clarify vector dimensions, similarity metric, data scale
- Clarify database requirements: vector search, expected 1 million vectors
- Assess project scale: 3 feature points → small project → choose ChromaDB(vector database, lightweight)
- Architect phase:
- Database selection: ChromaDB (vector database, designed for LLMs)
- Design data model: ChromaDB collection (documents, embeddings, metadata)
- Design data access layer: VectorRepository
- Senior Dev phase:
- Implement VectorRepository (add_document, search)
- Use chromadb, type annotations
- Verification phase: test vector addition, similarity search, performance
Skill invocation mechanism
Identification timing
- Architecture phase(Phase 2): identify potentially reusable skill modules, define them in architecture.md
- Implementation phase(Phase 3): when implementing new features, prioritize invoking already-defined skills
- Extension phase(Phase 5): when adding features, reuse existing skills
- Refactoring phase(Phase 6): during refactoring, extract new skill modules
Skill interface specification
All skills must include:
- Complete type annotations: function parameters and return values must use type annotations
- Clear docstrings: describe functionality, parameters, return values, usage scenarios
- Example code: provide invocation examples in architecture.md
- Dependency declaration: specify other skills or libraries depended on
Reuse principles
- Prioritize reuse: when implementing new features, prioritize invoking existing skills
- Stable interface: skill interfaces should remain stable, avoid frequent modification
- Single responsibility: skills should have a single responsibility and clear functionality
- Testability: skills should be easy to test individually
Data access skills
The following data access layer modules can be reused as skills:
- BaseRepository interface: general CRUD interface
- SQLAlchemyBaseRepository: general implementation for relational databases
- MongoDBBaseRepository: general implementation for MongoDB
- RepositoryFactory: database switching factory