一键导入
discover-standards
Extract tribal knowledge and recurring patterns from the codebase into concise, documented standards files in agent-os/standards/.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Extract tribal knowledge and recurring patterns from the codebase into concise, documented standards files in agent-os/standards/.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | discover-standards |
| description | Extract tribal knowledge and recurring patterns from the codebase into concise, documented standards files in agent-os/standards/. |
Extract tribal knowledge from your codebase into concise, documented standards.
Check if the user specified an area when running this command. If they did, skip to Step 2.
If no area was specified:
I've identified these areas in your codebase:
1. **API Routes** (src/api/) — Request handling, response formats
2. **Database** (src/models/, src/db/) — Models, queries, migrations
3. **React Components** (src/components/) — UI patterns, props, state
4. **Authentication** (src/auth/) — Login, sessions, permissions
Which area should we focus on for discovering standards? (Pick one, or suggest a different area)
Wait for user response before proceeding.
Once an area is determined:
Read key files in that area (5-10 representative files)
Look for patterns that are:
Use AskUserQuestion to present findings and let user select:
I analyzed [area] and found these potential standards worth documenting:
1. **API Response Envelope** — All responses use { success, data, error } structure
2. **Error Codes** — Custom error codes like AUTH_001, DB_002 with specific meanings
3. **Pagination Pattern** — Cursor-based pagination with consistent param names
Which would you like to document?
Options:
- "Yes, all of them"
- "Just 1 and 3"
- "Add: [your suggestion]"
- "Skip this area"
Wait for user selection before proceeding.
IMPORTANT: For each selected standard, you MUST complete this full loop before moving to the next standard:
Example questions to ask (adapt based on the specific standard):
Do NOT batch all questions upfront. Process one standard at a time through the full loop.
For each standard (after completing Step 3's Q&A):
Determine the appropriate folder (create if needed):
api/, database/, javascript/, css/, backend/, testing/, global/Check if a related standard file already exists — append to it if so
Draft the content and use AskUserQuestion to confirm:
Here's the draft for api/response-format.md:
---
# API Response Format
All API responses use this envelope:
\`\`\`json
{ "success": true, "data": { ... } }
{ "success": false, "error": { "code": "...", "message": "..." } }
\`\`\`
- Never return raw data without the envelope
- Error responses must include both code and message
- Success responses omit the error field entirely
---
Create this file? (yes / edit: [your changes] / skip)
agent-os/standards/[folder]/After all standards are created:
agent-os/standards/ for all .md filesNew standard needs an index entry:
File: api/response-format.md
Suggested description: "API response envelope structure and error format"
Accept this description? (yes / or type a better one)
agent-os/standards/index.yml:api:
response-format:
description: API response envelope structure and error format
Alphabetize by folder, then by filename.
Use AskUserQuestion:
Standards created for [area]:
- api/response-format.md
- api/error-codes.md
Would you like to discover standards in another area, or are we done?
All standards: agent-os/standards/[folder]/[standard].md
Index file: agent-os/standards/index.yml
Standards will be injected into AI context windows. Every word costs tokens. Follow these rules:
Good:
# Error Responses
Use error codes: `AUTH_001`, `DB_001`, `VAL_001`
\`\`\`json
{ "success": false, "error": { "code": "AUTH_001", "message": "..." } }
\`\`\`
- Always include both code and message
- Log full error server-side, return safe message to client
Bad:
# Error Handling Guidelines
When an error occurs in our application, we have established a consistent pattern...
[continues for 3 more paragraphs]
Use this skill when the user wants to save, update, or reference visual design assets for the project. Triggers on "save design", "update designs", "sync designs", "add visual", "design assets", "claude design export", "design folder", "/design". Also fires proactively when the agent is about to write UI code (React components, CSS, Tailwind classes, layout) — in that case, read the active design first so code matches the visual spec. The design folder is always at `.pi/design/` and the agent should always check it before writing any UI-facing code.
Pointer to the jsdoc-conventions standards file. Read this before writing or editing any JSDoc in a project.
Pointer to the spec-structure standards file. Read this before writing or editing any implementation spec.
Port new paradigms from the global base harness (~/.pi/agent/) into the current project's .pi/ harness, adapting them to match the project's stack, workflow tier, and conventions. Run in any project to pull in improvements made to another project's harness.
Break down a spec.md or requirements.md into an actionable tasks.md with strategic grouping and ordering. Used after spec creation and before implementation.
Detect the project type from code signals and reorganize standards folders to match — web app, backend API, CLI, library, dotfiles, mobile, or monorepo.