This is a Meta-Prompt. When the user mentions this document, please assume the above role. Your goal is to establish the project's 'laws and regulations' to ensure code style consistency and maintainability.
Your Task
Based on the determined tech stack (specs/2_技术栈.md), establish specific development standards.Must dynamically adapt to the selected technology(do not generate Python standards for a Go project).
Boundary Guards (Guardrails) - CRITICAL
Please strictly follow the general boundary guard rules:specs/GUARDRAILS.md Current Phase: Architecture & Design Phase
Workflow
- Read Context:
- Read
specs/2_技术栈.md, confirm the core language and framework. - Read
specs/1_产品概述.md, understand the business domain (e.g., financial projects have different precision requirements). * Full Rule Scan: Must scan all documents underspecs/orspecs/rulesto ensure no constraints are missed.
- Read
- Establish Standards (Dynamic Generation):
- Code Style: Choose the most mainstream standards in that language's community (e.g., Python -> PEP8/Black, JS -> ESLint/Prettier).
- Naming Conventions: Specify naming rules for files, classes, and variables.
- Git Commit: Mandatory use of Conventional Commits。
- Define AI Interaction Protocol (AI Protocol):
- Core Rules: What must the AI read before writing code? What must it do after writing code? (e.g.,
写代码前必读 AI错题本)。
- Core Rules: What must the AI read before writing code? What must it do after writing code? (e.g.,
- Generate Document: Generate the final Markdown document.
Output Template (Template)
Development Standards
1. Code Style
- Core Principles: [e.g., Explicit is better than implicit]
- Formatting Tools: [e.g., Prettier / Black / Gofmt]
- Naming Conventions:
- Files: [e.g., snake_case / kebab-case]
- Classes: [e.g., PascalCase]
- Variables/Functions: [e.g., camelCase]
2. Git Commit Convention
We follow the Conventional Commits convention:
- Format:
<type>(<scope>): <subject> - Examples:
feat(auth): add login page - Common Types:
feat: new featurefix: bug fixdocs: documentation changesrefactor: refactoring (i.e., code changes that neither add features nor fix bugs)chore: changes to the build process or auxiliary tools
3. AI Interaction Protocol
To ensure code quality, AI assistants must follow the protocol below:
- Reading First: Before writing new code, must first read the context of the relevant files, as well as all global rule documents under
specs/. - Mistake Notebook Mechanism: Before each task starts, you must check
specs/7_AI错题本.mdto avoid repeating mistakes. - Atomic commits and verification:
- Step: Write code -> Run tests/preview -> confirm it is correct -> commit.
- Prohibited: It is prohibited to directly commit code without user verification (or when tests fail).
- Self-review: After code generation, a Self-Review must be performed to check whether it complies with the above code style.
Interaction guidelines
- Rigor: Specifications must be specific and executable, and must not be ambiguous.
- Final delivery: After the document content is confirmed by the user, please save it to
specs/4_开发规范.md。