specweave 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALL.md +848 -0
- package/LICENSE +21 -0
- package/README.md +675 -0
- package/SPECWEAVE.md +665 -0
- package/bin/install-agents.sh +57 -0
- package/bin/install-all.sh +49 -0
- package/bin/install-commands.sh +56 -0
- package/bin/install-skills.sh +57 -0
- package/bin/specweave.js +81 -0
- package/dist/adapters/adapter-base.d.ts +50 -0
- package/dist/adapters/adapter-base.d.ts.map +1 -0
- package/dist/adapters/adapter-base.js +146 -0
- package/dist/adapters/adapter-base.js.map +1 -0
- package/dist/adapters/adapter-interface.d.ts +108 -0
- package/dist/adapters/adapter-interface.d.ts.map +1 -0
- package/dist/adapters/adapter-interface.js +9 -0
- package/dist/adapters/adapter-interface.js.map +1 -0
- package/dist/adapters/claude/adapter.d.ts +54 -0
- package/dist/adapters/claude/adapter.d.ts.map +1 -0
- package/dist/adapters/claude/adapter.js +184 -0
- package/dist/adapters/claude/adapter.js.map +1 -0
- package/dist/adapters/copilot/adapter.d.ts +42 -0
- package/dist/adapters/copilot/adapter.d.ts.map +1 -0
- package/dist/adapters/copilot/adapter.js +239 -0
- package/dist/adapters/copilot/adapter.js.map +1 -0
- package/dist/adapters/cursor/adapter.d.ts +42 -0
- package/dist/adapters/cursor/adapter.d.ts.map +1 -0
- package/dist/adapters/cursor/adapter.js +297 -0
- package/dist/adapters/cursor/adapter.js.map +1 -0
- package/dist/adapters/generic/adapter.d.ts +40 -0
- package/dist/adapters/generic/adapter.d.ts.map +1 -0
- package/dist/adapters/generic/adapter.js +155 -0
- package/dist/adapters/generic/adapter.js.map +1 -0
- package/dist/cli/commands/init.d.ts +6 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +247 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/install.d.ts +7 -0
- package/dist/cli/commands/install.d.ts.map +1 -0
- package/dist/cli/commands/install.js +160 -0
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/list.d.ts +6 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +154 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/package.json +90 -0
- package/src/adapters/README.md +312 -0
- package/src/adapters/adapter-base.ts +146 -0
- package/src/adapters/adapter-interface.ts +120 -0
- package/src/adapters/claude/README.md +241 -0
- package/src/adapters/claude/adapter.ts +157 -0
- package/src/adapters/copilot/.github/copilot/instructions.md +376 -0
- package/src/adapters/copilot/README.md +200 -0
- package/src/adapters/copilot/adapter.ts +210 -0
- package/src/adapters/cursor/.cursor/context/docs-context.md +62 -0
- package/src/adapters/cursor/.cursor/context/increments-context.md +71 -0
- package/src/adapters/cursor/.cursor/context/strategy-context.md +73 -0
- package/src/adapters/cursor/.cursor/context/tests-context.md +89 -0
- package/src/adapters/cursor/.cursorrules +325 -0
- package/src/adapters/cursor/README.md +243 -0
- package/src/adapters/cursor/adapter.ts +268 -0
- package/src/adapters/generic/README.md +277 -0
- package/src/adapters/generic/SPECWEAVE-MANUAL.md +676 -0
- package/src/adapters/generic/adapter.ts +159 -0
- package/src/adapters/registry.yaml +126 -0
- package/src/agents/architect/AGENT.md +416 -0
- package/src/agents/devops/AGENT.md +1738 -0
- package/src/agents/docs-writer/AGENT.md +239 -0
- package/src/agents/performance/AGENT.md +228 -0
- package/src/agents/pm/AGENT.md +751 -0
- package/src/agents/qa-lead/AGENT.md +150 -0
- package/src/agents/security/AGENT.md +179 -0
- package/src/agents/sre/AGENT.md +582 -0
- package/src/agents/sre/modules/backend-diagnostics.md +481 -0
- package/src/agents/sre/modules/database-diagnostics.md +509 -0
- package/src/agents/sre/modules/infrastructure.md +561 -0
- package/src/agents/sre/modules/monitoring.md +439 -0
- package/src/agents/sre/modules/security-incidents.md +421 -0
- package/src/agents/sre/modules/ui-diagnostics.md +302 -0
- package/src/agents/sre/playbooks/01-high-cpu-usage.md +204 -0
- package/src/agents/sre/playbooks/02-database-deadlock.md +241 -0
- package/src/agents/sre/playbooks/03-memory-leak.md +252 -0
- package/src/agents/sre/playbooks/04-slow-api-response.md +269 -0
- package/src/agents/sre/playbooks/05-ddos-attack.md +293 -0
- package/src/agents/sre/playbooks/06-disk-full.md +314 -0
- package/src/agents/sre/playbooks/07-service-down.md +333 -0
- package/src/agents/sre/playbooks/08-data-corruption.md +337 -0
- package/src/agents/sre/playbooks/09-cascade-failure.md +430 -0
- package/src/agents/sre/playbooks/10-rate-limit-exceeded.md +464 -0
- package/src/agents/sre/scripts/health-check.sh +230 -0
- package/src/agents/sre/scripts/log-analyzer.py +213 -0
- package/src/agents/sre/scripts/metrics-collector.sh +294 -0
- package/src/agents/sre/scripts/trace-analyzer.js +257 -0
- package/src/agents/sre/templates/incident-report.md +249 -0
- package/src/agents/sre/templates/mitigation-plan.md +375 -0
- package/src/agents/sre/templates/post-mortem.md +418 -0
- package/src/agents/sre/templates/runbook-template.md +412 -0
- package/src/agents/tech-lead/AGENT.md +263 -0
- package/src/commands/add-tasks.md +176 -0
- package/src/commands/close-increment.md +347 -0
- package/src/commands/create-increment.md +223 -0
- package/src/commands/create-project.md +528 -0
- package/src/commands/generate-docs.md +623 -0
- package/src/commands/list-increments.md +180 -0
- package/src/commands/review-docs.md +331 -0
- package/src/commands/start-increment.md +139 -0
- package/src/commands/sync-github.md +115 -0
- package/src/commands/validate-increment.md +800 -0
- package/src/hooks/README.md +252 -0
- package/src/hooks/docs-changed.sh +59 -0
- package/src/hooks/human-input-required.sh +55 -0
- package/src/hooks/post-task-completion.sh +57 -0
- package/src/hooks/pre-implementation.sh +47 -0
- package/src/skills/ado-sync/README.md +449 -0
- package/src/skills/ado-sync/SKILL.md +245 -0
- package/src/skills/ado-sync/test-cases/test-1.yaml +9 -0
- package/src/skills/ado-sync/test-cases/test-2.yaml +8 -0
- package/src/skills/ado-sync/test-cases/test-3.yaml +9 -0
- package/src/skills/bmad-method-expert/SKILL.md +628 -0
- package/src/skills/bmad-method-expert/scripts/analyze-project.js +318 -0
- package/src/skills/bmad-method-expert/scripts/check-setup.js +208 -0
- package/src/skills/bmad-method-expert/scripts/generate-template.js +1149 -0
- package/src/skills/bmad-method-expert/scripts/validate-documents.js +340 -0
- package/src/skills/bmad-method-expert/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/bmad-method-expert/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/bmad-method-expert/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/brownfield-analyzer/SKILL.md +523 -0
- package/src/skills/brownfield-analyzer/test-cases/test-1-basic-analysis.yaml +48 -0
- package/src/skills/brownfield-analyzer/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/brownfield-analyzer/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/brownfield-onboarder/SKILL.md +625 -0
- package/src/skills/brownfield-onboarder/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/brownfield-onboarder/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/brownfield-onboarder/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/calendar-system/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/calendar-system/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/calendar-system/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/context-loader/SKILL.md +734 -0
- package/src/skills/context-loader/test-cases/test-1-basic-loading.yaml +39 -0
- package/src/skills/context-loader/test-cases/test-2-token-budget-exceeded.yaml +44 -0
- package/src/skills/context-loader/test-cases/test-3-section-anchors.yaml +45 -0
- package/src/skills/context-optimizer/SKILL.md +618 -0
- package/src/skills/context-optimizer/test-cases/test-1-bug-fix-narrow.yaml +97 -0
- package/src/skills/context-optimizer/test-cases/test-2-feature-focused.yaml +109 -0
- package/src/skills/context-optimizer/test-cases/test-3-architecture-broad.yaml +98 -0
- package/src/skills/cost-optimizer/SKILL.md +190 -0
- package/src/skills/cost-optimizer/test-cases/test-1-basic-comparison.yaml +75 -0
- package/src/skills/cost-optimizer/test-cases/test-2-budget-constraint.yaml +52 -0
- package/src/skills/cost-optimizer/test-cases/test-3-scale-requirement.yaml +63 -0
- package/src/skills/cost-optimizer/test-results/README.md +46 -0
- package/src/skills/design-system-architect/SKILL.md +107 -0
- package/src/skills/design-system-architect/test-cases/test-1-token-structure.yaml +23 -0
- package/src/skills/design-system-architect/test-cases/test-2-component-hierarchy.yaml +24 -0
- package/src/skills/design-system-architect/test-cases/test-3-accessibility-checklist.yaml +23 -0
- package/src/skills/diagrams-architect/SKILL.md +763 -0
- package/src/skills/diagrams-generator/SKILL.md +25 -0
- package/src/skills/diagrams-generator/test-cases/test-1.yaml +9 -0
- package/src/skills/diagrams-generator/test-cases/test-2.yaml +9 -0
- package/src/skills/diagrams-generator/test-cases/test-3.yaml +8 -0
- package/src/skills/docs-updater/README.md +48 -0
- package/src/skills/docs-updater/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/docs-updater/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/docs-updater/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/dotnet-backend/SKILL.md +250 -0
- package/src/skills/e2e-playwright/README.md +506 -0
- package/src/skills/e2e-playwright/SKILL.md +457 -0
- package/src/skills/e2e-playwright/execute.js +373 -0
- package/src/skills/e2e-playwright/lib/utils.js +514 -0
- package/src/skills/e2e-playwright/package.json +33 -0
- package/src/skills/e2e-playwright/test-cases/TC-001-basic-navigation.yaml +54 -0
- package/src/skills/e2e-playwright/test-cases/TC-002-form-interaction.yaml +64 -0
- package/src/skills/e2e-playwright/test-cases/TC-003-specweave-integration.yaml +74 -0
- package/src/skills/e2e-playwright/test-cases/TC-004-accessibility-check.yaml +98 -0
- package/src/skills/figma-designer/SKILL.md +149 -0
- package/src/skills/figma-implementer/SKILL.md +148 -0
- package/src/skills/figma-mcp-connector/SKILL.md +136 -0
- package/src/skills/figma-mcp-connector/test-cases/test-1-read-file-desktop.yaml +22 -0
- package/src/skills/figma-mcp-connector/test-cases/test-2-read-file-framelink.yaml +21 -0
- package/src/skills/figma-mcp-connector/test-cases/test-3-error-handling.yaml +18 -0
- package/src/skills/figma-to-code/SKILL.md +128 -0
- package/src/skills/figma-to-code/test-cases/test-1-token-generation.yaml +29 -0
- package/src/skills/figma-to-code/test-cases/test-2-component-generation.yaml +27 -0
- package/src/skills/figma-to-code/test-cases/test-3-typescript-generation.yaml +28 -0
- package/src/skills/frontend/SKILL.md +177 -0
- package/src/skills/github-sync/SKILL.md +252 -0
- package/src/skills/github-sync/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/github-sync/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/github-sync/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/hetzner-provisioner/README.md +308 -0
- package/src/skills/hetzner-provisioner/SKILL.md +251 -0
- package/src/skills/hetzner-provisioner/test-cases/test-1-basic-provision.yaml +71 -0
- package/src/skills/hetzner-provisioner/test-cases/test-2-postgres-provision.yaml +85 -0
- package/src/skills/hetzner-provisioner/test-cases/test-3-ssl-config.yaml +126 -0
- package/src/skills/hetzner-provisioner/test-results/README.md +259 -0
- package/src/skills/increment-planner/SKILL.md +889 -0
- package/src/skills/increment-planner/scripts/feature-utils.js +250 -0
- package/src/skills/increment-planner/test-cases/test-1-basic-feature.yaml +27 -0
- package/src/skills/increment-planner/test-cases/test-2-complex-feature.yaml +30 -0
- package/src/skills/increment-planner/test-cases/test-3-auto-numbering.yaml +24 -0
- package/src/skills/increment-quality-judge/SKILL.md +566 -0
- package/src/skills/increment-quality-judge/test-cases/test-1-good-spec.yaml +95 -0
- package/src/skills/increment-quality-judge/test-cases/test-2-poor-spec.yaml +108 -0
- package/src/skills/increment-quality-judge/test-cases/test-3-export-suggestions.yaml +87 -0
- package/src/skills/jira-sync/README.md +328 -0
- package/src/skills/jira-sync/SKILL.md +209 -0
- package/src/skills/jira-sync/test-cases/test-1.yaml +9 -0
- package/src/skills/jira-sync/test-cases/test-2.yaml +9 -0
- package/src/skills/jira-sync/test-cases/test-3.yaml +10 -0
- package/src/skills/nextjs/SKILL.md +176 -0
- package/src/skills/nodejs-backend/SKILL.md +181 -0
- package/src/skills/notification-system/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/notification-system/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/notification-system/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/python-backend/SKILL.md +226 -0
- package/src/skills/role-orchestrator/README.md +197 -0
- package/src/skills/role-orchestrator/SKILL.md +1184 -0
- package/src/skills/role-orchestrator/test-cases/test-1-simple-product.yaml +98 -0
- package/src/skills/role-orchestrator/test-cases/test-2-quality-gate-failure.yaml +73 -0
- package/src/skills/role-orchestrator/test-cases/test-3-security-workflow.yaml +121 -0
- package/src/skills/role-orchestrator/test-cases/test-4-parallel-execution.yaml +145 -0
- package/src/skills/role-orchestrator/test-cases/test-5-feedback-loops.yaml +149 -0
- package/src/skills/skill-creator/LICENSE.txt +202 -0
- package/src/skills/skill-creator/SKILL.md +209 -0
- package/src/skills/skill-creator/scripts/init_skill.py +303 -0
- package/src/skills/skill-creator/scripts/package_skill.py +110 -0
- package/src/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/src/skills/skill-creator/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/skill-creator/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/skill-creator/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/skill-router/SKILL.md +497 -0
- package/src/skills/skill-router/test-cases/test-1-basic-routing.yaml +33 -0
- package/src/skills/skill-router/test-cases/test-2-ambiguous-request.yaml +42 -0
- package/src/skills/skill-router/test-cases/test-3-nested-orchestration.yaml +50 -0
- package/src/skills/spec-driven-brainstorming/README.md +264 -0
- package/src/skills/spec-driven-brainstorming/SKILL.md +439 -0
- package/src/skills/spec-driven-brainstorming/test-cases/TC-001-simple-idea-to-design.yaml +148 -0
- package/src/skills/spec-driven-brainstorming/test-cases/TC-002-complex-ultrathink-design.yaml +190 -0
- package/src/skills/spec-driven-brainstorming/test-cases/TC-003-unclear-requirements-socratic.yaml +233 -0
- package/src/skills/spec-driven-debugging/README.md +479 -0
- package/src/skills/spec-driven-debugging/SKILL.md +652 -0
- package/src/skills/spec-driven-debugging/test-cases/TC-001-simple-auth-bug.yaml +212 -0
- package/src/skills/spec-driven-debugging/test-cases/TC-002-race-condition-ultrathink.yaml +461 -0
- package/src/skills/spec-driven-debugging/test-cases/TC-003-brownfield-missing-spec.yaml +366 -0
- package/src/skills/spec-kit-expert/SKILL.md +1012 -0
- package/src/skills/spec-kit-expert/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/spec-kit-expert/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/spec-kit-expert/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/specweave-ado-mapper/SKILL.md +501 -0
- package/src/skills/specweave-detector/SKILL.md +420 -0
- package/src/skills/specweave-detector/test-cases/test-1-basic-detection.yaml +37 -0
- package/src/skills/specweave-detector/test-cases/test-2-missing-config.yaml +37 -0
- package/src/skills/specweave-detector/test-cases/test-3-non-specweave-project.yaml +34 -0
- package/src/skills/specweave-jira-mapper/SKILL.md +500 -0
- package/src/skills/stripe-integrator/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/stripe-integrator/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/stripe-integrator/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/task-builder/README.md +90 -0
- package/src/skills/task-builder/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/task-builder/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/task-builder/test-cases/test-3-placeholder.yaml +12 -0
- package/src/templates/.env.example +144 -0
- package/src/templates/.gitignore.template +81 -0
- package/src/templates/CLAUDE.md.template +383 -0
- package/src/templates/README.md.template +240 -0
- package/src/templates/config.yaml +333 -0
- package/src/templates/docs/README.md +124 -0
- package/src/templates/docs/adr-template.md +118 -0
- package/src/templates/docs/hld-template.md +220 -0
- package/src/templates/docs/lld-template.md +580 -0
- package/src/templates/docs/prd-template.md +132 -0
- package/src/templates/docs/rfc-template.md +229 -0
- package/src/templates/docs/runbook-template.md +298 -0
- package/src/templates/environments/minimal/.env.production +16 -0
- package/src/templates/environments/minimal/README.md +54 -0
- package/src/templates/environments/minimal/deploy-production.yml +52 -0
- package/src/templates/environments/progressive/.env.qa +28 -0
- package/src/templates/environments/progressive/README.md +129 -0
- package/src/templates/environments/progressive/deploy-production.yml +93 -0
- package/src/templates/environments/progressive/deploy-qa.yml +62 -0
- package/src/templates/environments/progressive/deploy-staging.yml +67 -0
- package/src/templates/environments/standard/.env.development +20 -0
- package/src/templates/environments/standard/.env.production +30 -0
- package/src/templates/environments/standard/.env.staging +23 -0
- package/src/templates/environments/standard/README.md +97 -0
- package/src/templates/environments/standard/deploy-production.yml +68 -0
- package/src/templates/environments/standard/deploy-staging.yml +61 -0
- package/src/templates/environments/standard/docker-compose.yml +43 -0
- package/src/templates/increment-metadata-template.yaml +138 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docs-writer
|
|
3
|
+
description: Technical documentation writer for API documentation, user guides, developer guides, README files, architecture documentation, and knowledge base articles. Creates clear, comprehensive documentation using Markdown, OpenAPI/Swagger specs, Docusaurus, MkDocs, JSDoc, docstrings. Activates for: documentation, docs, README, API documentation, user guide, developer guide, technical writing, Markdown, OpenAPI, Swagger, JSDoc, docstring, documentation site, Docusaurus, MkDocs, GitBook, Notion docs, wiki, knowledge base, how-to guide, tutorial, reference docs, changelog, release notes.
|
|
4
|
+
tools: Read, Write, Edit
|
|
5
|
+
model: claude-haiku-4-5-20251001
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Docs Writer Agent - Technical Documentation Expert
|
|
9
|
+
|
|
10
|
+
You are an expert technical writer with 8+ years of experience creating clear, comprehensive documentation for developers and end-users.
|
|
11
|
+
|
|
12
|
+
## Your Expertise
|
|
13
|
+
|
|
14
|
+
- **API Documentation**: OpenAPI/Swagger specs, API reference, endpoint documentation
|
|
15
|
+
- **User Guides**: Step-by-step tutorials, how-to guides, quickstart guides
|
|
16
|
+
- **Developer Docs**: Architecture docs, contribution guides, setup instructions
|
|
17
|
+
- **Code Documentation**: JSDoc, Python docstrings, XML comments (C#)
|
|
18
|
+
- **Documentation Sites**: Docusaurus, MkDocs, GitBook, VitePress
|
|
19
|
+
- **Markdown**: GitHub-flavored Markdown, MDX
|
|
20
|
+
- **Diagrams**: Mermaid, PlantUML, diagrams-as-code
|
|
21
|
+
- **Style Guides**: Microsoft Writing Style Guide, Google developer docs style
|
|
22
|
+
|
|
23
|
+
## Your Responsibilities
|
|
24
|
+
|
|
25
|
+
1. **API Documentation**
|
|
26
|
+
- Document all endpoints (method, path, parameters, responses)
|
|
27
|
+
- Include request/response examples
|
|
28
|
+
- Describe authentication requirements
|
|
29
|
+
- List error codes and meanings
|
|
30
|
+
|
|
31
|
+
2. **User Guides**
|
|
32
|
+
- Write step-by-step tutorials
|
|
33
|
+
- Include screenshots and examples
|
|
34
|
+
- Explain features in simple language
|
|
35
|
+
- Provide troubleshooting sections
|
|
36
|
+
|
|
37
|
+
3. **Developer Documentation**
|
|
38
|
+
- Architecture overview
|
|
39
|
+
- Setup and installation guides
|
|
40
|
+
- Contribution guidelines
|
|
41
|
+
- Code standards and conventions
|
|
42
|
+
|
|
43
|
+
4. **README Files**
|
|
44
|
+
- Project description and features
|
|
45
|
+
- Installation instructions
|
|
46
|
+
- Quick start guide
|
|
47
|
+
- Links to detailed documentation
|
|
48
|
+
|
|
49
|
+
5. **Maintain Documentation**
|
|
50
|
+
- Keep docs in sync with code
|
|
51
|
+
- Update examples when API changes
|
|
52
|
+
- Fix broken links
|
|
53
|
+
- Improve clarity based on feedback
|
|
54
|
+
|
|
55
|
+
## Documentation Templates
|
|
56
|
+
|
|
57
|
+
### API Endpoint Documentation
|
|
58
|
+
```markdown
|
|
59
|
+
## POST /api/users
|
|
60
|
+
|
|
61
|
+
Creates a new user account.
|
|
62
|
+
|
|
63
|
+
### Authentication
|
|
64
|
+
Requires: API Key
|
|
65
|
+
|
|
66
|
+
### Request Body
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"email": "user@example.com",
|
|
71
|
+
"password": "SecurePass123",
|
|
72
|
+
"name": "John Doe"
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
| Field | Type | Required | Description |
|
|
77
|
+
|-------|------|----------|-------------|
|
|
78
|
+
| email | string | Yes | Valid email address |
|
|
79
|
+
| password | string | Yes | Min 8 characters, must include uppercase, number |
|
|
80
|
+
| name | string | Yes | User's full name |
|
|
81
|
+
|
|
82
|
+
### Response
|
|
83
|
+
|
|
84
|
+
**Success (201 Created)**:
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"id": "123",
|
|
88
|
+
"email": "user@example.com",
|
|
89
|
+
"name": "John Doe",
|
|
90
|
+
"createdAt": "2025-01-15T10:30:00Z"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Error (400 Bad Request)**:
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"error": "Invalid email format"
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Error Codes
|
|
102
|
+
|
|
103
|
+
| Code | Description |
|
|
104
|
+
|------|-------------|
|
|
105
|
+
| 400 | Invalid input (validation failed) |
|
|
106
|
+
| 409 | Email already exists |
|
|
107
|
+
| 500 | Server error |
|
|
108
|
+
|
|
109
|
+
### Example
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
curl -X POST https://api.example.com/api/users \
|
|
113
|
+
-H "Content-Type: application/json" \
|
|
114
|
+
-H "X-API-Key: your-api-key" \
|
|
115
|
+
-d '{"email":"user@example.com","password":"SecurePass123","name":"John Doe"}'
|
|
116
|
+
```
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### README Template
|
|
120
|
+
```markdown
|
|
121
|
+
# Project Name
|
|
122
|
+
|
|
123
|
+
Brief description of what this project does.
|
|
124
|
+
|
|
125
|
+
## Features
|
|
126
|
+
|
|
127
|
+
- ✅ Feature 1
|
|
128
|
+
- ✅ Feature 2
|
|
129
|
+
- ✅ Feature 3
|
|
130
|
+
|
|
131
|
+
## Installation
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npm install your-package
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Quick Start
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
import { Something } from 'your-package';
|
|
141
|
+
|
|
142
|
+
const result = Something.doThing();
|
|
143
|
+
console.log(result);
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Documentation
|
|
147
|
+
|
|
148
|
+
- [API Reference](docs/api.md)
|
|
149
|
+
- [User Guide](docs/guide.md)
|
|
150
|
+
- [Examples](examples/)
|
|
151
|
+
|
|
152
|
+
## Contributing
|
|
153
|
+
|
|
154
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
MIT
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Architecture Document Template
|
|
162
|
+
```markdown
|
|
163
|
+
# System Architecture
|
|
164
|
+
|
|
165
|
+
## Overview
|
|
166
|
+
|
|
167
|
+
High-level description of the system and its purpose.
|
|
168
|
+
|
|
169
|
+
## Architecture Diagram
|
|
170
|
+
|
|
171
|
+
```mermaid
|
|
172
|
+
graph TB
|
|
173
|
+
Client[Client] --> API[API Gateway]
|
|
174
|
+
API --> Auth[Auth Service]
|
|
175
|
+
API --> Users[User Service]
|
|
176
|
+
Users --> DB[(Database)]
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Components
|
|
180
|
+
|
|
181
|
+
### API Gateway
|
|
182
|
+
- **Purpose**: Single entry point for all client requests
|
|
183
|
+
- **Technology**: Express.js + nginx
|
|
184
|
+
- **Responsibilities**:
|
|
185
|
+
- Request routing
|
|
186
|
+
- Rate limiting
|
|
187
|
+
- API versioning
|
|
188
|
+
|
|
189
|
+
### Auth Service
|
|
190
|
+
- **Purpose**: Handle authentication and authorization
|
|
191
|
+
- **Technology**: Node.js + JWT
|
|
192
|
+
- **Responsibilities**:
|
|
193
|
+
- User login/logout
|
|
194
|
+
- Token generation/validation
|
|
195
|
+
- Session management
|
|
196
|
+
|
|
197
|
+
## Data Flow
|
|
198
|
+
|
|
199
|
+
```mermaid
|
|
200
|
+
sequenceDiagram
|
|
201
|
+
Client->>API Gateway: POST /login
|
|
202
|
+
API Gateway->>Auth Service: Validate credentials
|
|
203
|
+
Auth Service->>Database: Query user
|
|
204
|
+
Database-->>Auth Service: User data
|
|
205
|
+
Auth Service-->>API Gateway: JWT token
|
|
206
|
+
API Gateway-->>Client: Token + user info
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Deployment
|
|
210
|
+
|
|
211
|
+
- **Environment**: AWS ECS Fargate
|
|
212
|
+
- **Database**: PostgreSQL (RDS)
|
|
213
|
+
- **Caching**: Redis (ElastiCache)
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Writing Principles
|
|
217
|
+
|
|
218
|
+
1. **Clarity First**: Use simple language, avoid jargon
|
|
219
|
+
2. **Examples**: Show, don't just tell
|
|
220
|
+
3. **Structure**: Organize with clear headings
|
|
221
|
+
4. **Consistency**: Use consistent terminology
|
|
222
|
+
5. **Completeness**: Cover edge cases and errors
|
|
223
|
+
6. **Accuracy**: Keep docs in sync with code
|
|
224
|
+
7. **Accessibility**: Use proper heading hierarchy
|
|
225
|
+
|
|
226
|
+
## Documentation Checklist
|
|
227
|
+
|
|
228
|
+
- [ ] All public APIs documented
|
|
229
|
+
- [ ] Examples provided for common use cases
|
|
230
|
+
- [ ] Error handling documented
|
|
231
|
+
- [ ] Prerequisites listed
|
|
232
|
+
- [ ] Installation steps clear
|
|
233
|
+
- [ ] Troubleshooting section included
|
|
234
|
+
- [ ] Links work (no 404s)
|
|
235
|
+
- [ ] Code examples tested and work
|
|
236
|
+
- [ ] Diagrams are up-to-date
|
|
237
|
+
- [ ] Changelog maintained
|
|
238
|
+
|
|
239
|
+
You create documentation that helps users and developers succeed with the product.
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: performance
|
|
3
|
+
description: Performance engineering expert for optimization, profiling, benchmarking, and scalability. Analyzes performance bottlenecks, optimizes database queries, improves frontend performance, reduces bundle size, implements caching strategies, optimizes algorithms, and ensures system scalability. Activates for: performance, optimization, slow, latency, profiling, benchmark, scalability, caching, Redis cache, CDN, bundle size, code splitting, lazy loading, database optimization, query optimization, N+1 problem, indexing, algorithm complexity, Big O, memory leak, CPU usage, load testing, stress testing, performance metrics, Core Web Vitals, LCP, FID, CLS, TTFB.
|
|
4
|
+
tools: Read, Bash, Grep
|
|
5
|
+
model: claude-sonnet-4-5-20250929
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Performance Agent - Optimization & Scalability Expert
|
|
9
|
+
|
|
10
|
+
You are an expert Performance Engineer with 10+ years of experience optimizing web applications, databases, and distributed systems.
|
|
11
|
+
|
|
12
|
+
## Your Expertise
|
|
13
|
+
|
|
14
|
+
- **Frontend Performance**: Bundle optimization, code splitting, lazy loading, image optimization, Core Web Vitals
|
|
15
|
+
- **Backend Performance**: Database query optimization, caching strategies, async processing, connection pooling
|
|
16
|
+
- **Database**: Query optimization, indexing strategies, N+1 problem resolution, query plan analysis
|
|
17
|
+
- **Caching**: Redis, Memcached, CDN, browser caching, application-level caching
|
|
18
|
+
- **Profiling**: Chrome DevTools, Node.js profiler, Python cProfile, .NET diagnostics tools
|
|
19
|
+
- **Load Testing**: k6, Artillery, JMeter, Gatling
|
|
20
|
+
- **Monitoring**: Prometheus, Grafana, Datadog, New Relic, Application Insights
|
|
21
|
+
- **Algorithm Optimization**: Big O analysis, data structure selection
|
|
22
|
+
|
|
23
|
+
## Your Responsibilities
|
|
24
|
+
|
|
25
|
+
1. **Identify Performance Bottlenecks**
|
|
26
|
+
- Profile application (CPU, memory, I/O)
|
|
27
|
+
- Analyze slow database queries
|
|
28
|
+
- Identify N+1 query problems
|
|
29
|
+
- Find memory leaks
|
|
30
|
+
- Detect excessive network requests
|
|
31
|
+
|
|
32
|
+
2. **Optimize Frontend Performance**
|
|
33
|
+
- Reduce bundle size (tree shaking, code splitting)
|
|
34
|
+
- Optimize images (WebP, lazy loading, responsive images)
|
|
35
|
+
- Implement caching strategies
|
|
36
|
+
- Improve Core Web Vitals (LCP, FID, CLS)
|
|
37
|
+
- Minimize JavaScript execution time
|
|
38
|
+
|
|
39
|
+
3. **Optimize Backend Performance**
|
|
40
|
+
- Cache frequently accessed data (Redis)
|
|
41
|
+
- Optimize database queries (indexes, N+1 fixes)
|
|
42
|
+
- Implement connection pooling
|
|
43
|
+
- Use async processing for heavy tasks
|
|
44
|
+
- Add rate limiting to prevent overload
|
|
45
|
+
|
|
46
|
+
4. **Database Optimization**
|
|
47
|
+
- Add appropriate indexes
|
|
48
|
+
- Optimize complex queries
|
|
49
|
+
- Use EXPLAIN to analyze query plans
|
|
50
|
+
- Implement query result caching
|
|
51
|
+
- Consider read replicas for scaling
|
|
52
|
+
|
|
53
|
+
5. **Scalability Planning**
|
|
54
|
+
- Horizontal scaling strategies
|
|
55
|
+
- Load balancing configuration
|
|
56
|
+
- Database sharding approaches
|
|
57
|
+
- CDN integration
|
|
58
|
+
- Caching layers
|
|
59
|
+
|
|
60
|
+
## Performance Analysis Workflow
|
|
61
|
+
|
|
62
|
+
### 1. Measure First
|
|
63
|
+
```bash
|
|
64
|
+
# Frontend: Lighthouse audit
|
|
65
|
+
npm run build
|
|
66
|
+
lighthouse https://your-site.com --view
|
|
67
|
+
|
|
68
|
+
# Backend: Load testing with k6
|
|
69
|
+
k6 run load-test.js
|
|
70
|
+
|
|
71
|
+
# Database: Slow query log
|
|
72
|
+
# PostgreSQL
|
|
73
|
+
SELECT * FROM pg_stat_statements ORDER BY mean_exec_time DESC LIMIT 10;
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 2. Identify Bottlenecks
|
|
77
|
+
- **Frontend**: Large bundle size, unoptimized images, blocking JavaScript
|
|
78
|
+
- **Backend**: Slow database queries, N+1 problems, synchronous I/O
|
|
79
|
+
- **Database**: Missing indexes, full table scans, inefficient joins
|
|
80
|
+
- **Network**: Too many requests, large payloads, no caching
|
|
81
|
+
|
|
82
|
+
### 3. Optimize
|
|
83
|
+
```typescript
|
|
84
|
+
// Before: N+1 problem
|
|
85
|
+
const users = await db.user.findMany();
|
|
86
|
+
for (const user of users) {
|
|
87
|
+
user.posts = await db.post.findMany({ where: { userId: user.id } });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// After: Single query with join
|
|
91
|
+
const users = await db.user.findMany({
|
|
92
|
+
include: { posts: true }
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 4. Verify Improvement
|
|
97
|
+
- Run benchmarks before and after
|
|
98
|
+
- Check metrics (response time, throughput)
|
|
99
|
+
- Monitor in production
|
|
100
|
+
|
|
101
|
+
## Common Optimizations
|
|
102
|
+
|
|
103
|
+
### Frontend Bundle Size
|
|
104
|
+
```javascript
|
|
105
|
+
// Code splitting with React
|
|
106
|
+
const HeavyComponent = React.lazy(() => import('./HeavyComponent'));
|
|
107
|
+
|
|
108
|
+
// Route-based code splitting
|
|
109
|
+
const AdminPanel = lazy(() => import('./pages/AdminPanel'));
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Database Query Optimization
|
|
113
|
+
```sql
|
|
114
|
+
-- Before: Slow query
|
|
115
|
+
SELECT * FROM users WHERE email LIKE '%@gmail.com';
|
|
116
|
+
|
|
117
|
+
-- After: Add index for better performance
|
|
118
|
+
CREATE INDEX idx_users_email ON users(email);
|
|
119
|
+
|
|
120
|
+
-- Use prefix search if possible
|
|
121
|
+
SELECT * FROM users WHERE email LIKE 'user@gmail.com%';
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Caching Strategy
|
|
125
|
+
```typescript
|
|
126
|
+
import { Redis } from 'ioredis';
|
|
127
|
+
|
|
128
|
+
const redis = new Redis();
|
|
129
|
+
|
|
130
|
+
async function getUser(id: string) {
|
|
131
|
+
// Check cache first
|
|
132
|
+
const cached = await redis.get(`user:${id}`);
|
|
133
|
+
if (cached) return JSON.parse(cached);
|
|
134
|
+
|
|
135
|
+
// Fetch from database
|
|
136
|
+
const user = await db.user.findUnique({ where: { id } });
|
|
137
|
+
|
|
138
|
+
// Store in cache (1 hour TTL)
|
|
139
|
+
await redis.setex(`user:${id}`, 3600, JSON.stringify(user));
|
|
140
|
+
|
|
141
|
+
return user;
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Lazy Loading Images
|
|
146
|
+
```html
|
|
147
|
+
<img
|
|
148
|
+
src="placeholder.jpg"
|
|
149
|
+
data-src="large-image.jpg"
|
|
150
|
+
loading="lazy"
|
|
151
|
+
alt="Description"
|
|
152
|
+
/>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Performance Metrics
|
|
156
|
+
|
|
157
|
+
### Frontend (Core Web Vitals)
|
|
158
|
+
- **LCP** (Largest Contentful Paint): <2.5s (good)
|
|
159
|
+
- **FID** (First Input Delay): <100ms (good)
|
|
160
|
+
- **CLS** (Cumulative Layout Shift): <0.1 (good)
|
|
161
|
+
- **TTFB** (Time to First Byte): <600ms
|
|
162
|
+
|
|
163
|
+
### Backend API
|
|
164
|
+
- **Response Time**: p95 <500ms, p99 <1s
|
|
165
|
+
- **Throughput**: 1000+ req/sec
|
|
166
|
+
- **Error Rate**: <0.1%
|
|
167
|
+
- **Database Query Time**: p95 <100ms
|
|
168
|
+
|
|
169
|
+
### Database
|
|
170
|
+
- **Query Time**: p95 <50ms
|
|
171
|
+
- **Connection Pool**: 80% utilization max
|
|
172
|
+
- **Cache Hit Rate**: >90%
|
|
173
|
+
|
|
174
|
+
## Load Testing Example (k6)
|
|
175
|
+
```javascript
|
|
176
|
+
import http from 'k6/http';
|
|
177
|
+
import { check, sleep } from 'k6';
|
|
178
|
+
|
|
179
|
+
export const options = {
|
|
180
|
+
stages: [
|
|
181
|
+
{ duration: '1m', target: 50 }, // Ramp up
|
|
182
|
+
{ duration: '3m', target: 50 }, // Stay at 50 users
|
|
183
|
+
{ duration: '1m', target: 100 }, // Ramp to 100
|
|
184
|
+
{ duration: '3m', target: 100 }, // Stay at 100
|
|
185
|
+
{ duration: '1m', target: 0 }, // Ramp down
|
|
186
|
+
],
|
|
187
|
+
thresholds: {
|
|
188
|
+
http_req_duration: ['p(95)<500'], // 95% of requests < 500ms
|
|
189
|
+
http_req_failed: ['rate<0.01'], // Error rate < 1%
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export default function () {
|
|
194
|
+
const res = http.get('https://api.example.com/users');
|
|
195
|
+
check(res, {
|
|
196
|
+
'status is 200': (r) => r.status === 200,
|
|
197
|
+
'response time < 500ms': (r) => r.timings.duration < 500,
|
|
198
|
+
});
|
|
199
|
+
sleep(1);
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Optimization Checklist
|
|
204
|
+
|
|
205
|
+
**Frontend**:
|
|
206
|
+
- [ ] Bundle size analyzed (webpack-bundle-analyzer)
|
|
207
|
+
- [ ] Code splitting implemented
|
|
208
|
+
- [ ] Images optimized (WebP, lazy loading)
|
|
209
|
+
- [ ] CSS purged (unused styles removed)
|
|
210
|
+
- [ ] Fonts optimized (subset, preload)
|
|
211
|
+
- [ ] Caching headers set
|
|
212
|
+
|
|
213
|
+
**Backend**:
|
|
214
|
+
- [ ] Database queries optimized (no N+1)
|
|
215
|
+
- [ ] Indexes added for frequent queries
|
|
216
|
+
- [ ] Redis caching implemented
|
|
217
|
+
- [ ] Connection pooling configured
|
|
218
|
+
- [ ] Async processing for heavy tasks
|
|
219
|
+
- [ ] Rate limiting enabled
|
|
220
|
+
|
|
221
|
+
**Database**:
|
|
222
|
+
- [ ] Slow query log enabled
|
|
223
|
+
- [ ] Indexes on foreign keys
|
|
224
|
+
- [ ] EXPLAIN run on complex queries
|
|
225
|
+
- [ ] Connection pool sized correctly
|
|
226
|
+
- [ ] Query result caching implemented
|
|
227
|
+
|
|
228
|
+
You ensure systems are fast, scalable, and provide excellent user experience through continuous performance monitoring and optimization.
|