ai-playbook 1.0.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/README.md +146 -0
- package/agents/README.md +168 -0
- package/agents/SKILL.md +633 -0
- package/agents/architect/AGENT.md +44 -0
- package/agents/architect/README.md +5 -0
- package/agents/coder/AGENT.md +43 -0
- package/agents/coder/README.md +5 -0
- package/agents/debugger/AGENT.md +42 -0
- package/agents/debugger/README.md +6 -0
- package/agents/devops/AGENT.md +43 -0
- package/agents/devops/README.md +5 -0
- package/agents/documentation/AGENT.md +45 -0
- package/agents/documentation/README.md +5 -0
- package/agents/examples.md +550 -0
- package/agents/performance/AGENT.md +45 -0
- package/agents/performance/README.md +6 -0
- package/agents/planner/AGENT.md +44 -0
- package/agents/planner/README.md +6 -0
- package/agents/product-owner/AGENT.md +46 -0
- package/agents/product-owner/README.md +6 -0
- package/agents/refactorer/AGENT.md +44 -0
- package/agents/refactorer/README.md +6 -0
- package/agents/release-manager/AGENT.md +45 -0
- package/agents/release-manager/README.md +6 -0
- package/agents/researcher/AGENT.md +44 -0
- package/agents/researcher/README.md +6 -0
- package/agents/reviewer/AGENT.md +43 -0
- package/agents/reviewer/README.md +6 -0
- package/agents/security/AGENT.md +46 -0
- package/agents/security/README.md +6 -0
- package/agents/support/AGENT.md +45 -0
- package/agents/support/README.md +6 -0
- package/agents/tester/AGENT.md +46 -0
- package/agents/tester/README.md +5 -0
- package/bin/cli.js +186 -0
- package/commands/README.md +266 -0
- package/commands/build.md +135 -0
- package/commands/clean.md +126 -0
- package/commands/deploy-prod.md +171 -0
- package/commands/deploy-staging.md +147 -0
- package/commands/deps.md +169 -0
- package/commands/dev.md +132 -0
- package/commands/format.md +142 -0
- package/commands/lint.md +125 -0
- package/commands/migrate.md +159 -0
- package/commands/release.md +183 -0
- package/commands/rollback.md +152 -0
- package/commands/seed.md +178 -0
- package/commands/setup.md +109 -0
- package/commands/test.md +134 -0
- package/commands/validate.md +147 -0
- package/context/README.md +7 -0
- package/context/aem.md +47 -0
- package/context/architecture.md +51 -0
- package/context/bullminder.md +57 -0
- package/context/coding-style.md +42 -0
- package/context/communication.md +53 -0
- package/context/company.md +46 -0
- package/context/engineering.md +63 -0
- package/context/project-template.md +71 -0
- package/context/trading.md +52 -0
- package/hooks/README.md +326 -0
- package/hooks/code-review/README.md +6 -0
- package/hooks/code-review/check-coverage.md +101 -0
- package/hooks/custom/README.md +6 -0
- package/hooks/custom/project-specific-hooks.md +273 -0
- package/hooks/deployment/README.md +6 -0
- package/hooks/deployment/health-check.md +102 -0
- package/hooks/deployment/pre-deploy-check.md +84 -0
- package/hooks/documentation/README.md +6 -0
- package/hooks/documentation/update-changelog.md +146 -0
- package/hooks/post-task/README.md +5 -0
- package/hooks/post-task/run-tests.md +61 -0
- package/hooks/pre-commit/README.md +6 -0
- package/hooks/pre-commit/format.md +63 -0
- package/hooks/pre-commit/lint.md +62 -0
- package/hooks/pre-commit/type-check.md +78 -0
- package/hooks/pre-task/README.md +6 -0
- package/hooks/pre-task/check-branch.md +48 -0
- package/hooks/pre-task/validate-environment.md +48 -0
- package/hooks/security-check/README.md +6 -0
- package/hooks/security-check/dependency-audit.md +85 -0
- package/hooks/security-check/secrets-scan.md +77 -0
- package/hooks/test-before-finish/README.md +6 -0
- package/hooks/test-before-finish/run-all-tests.md +128 -0
- package/index.js +69 -0
- package/knowledge/README.md +33 -0
- package/knowledge/ai-agents.md +74 -0
- package/knowledge/decision-making.md +73 -0
- package/knowledge/documentation.md +67 -0
- package/knowledge/engineering-principles.md +65 -0
- package/knowledge/product-discovery.md +68 -0
- package/knowledge/security-privacy.md +54 -0
- package/knowledge/testing-quality.md +63 -0
- package/package.json +63 -0
- package/patterns/README.md +7 -0
- package/prompts/README.md +208 -0
- package/prompts/architect/README.md +96 -0
- package/prompts/architect/design-system.md +140 -0
- package/prompts/debugger/README.md +96 -0
- package/prompts/debugger/diagnose-issue.md +141 -0
- package/prompts/developer/README.md +129 -0
- package/prompts/developer/fix-bug.md +136 -0
- package/prompts/developer/implement-feature.md +133 -0
- package/prompts/product-owner/README.md +116 -0
- package/prompts/product-owner/define-feature.md +145 -0
- package/prompts/reviewer/README.md +91 -0
- package/prompts/reviewer/code-review.md +129 -0
- package/prompts/support/README.md +154 -0
- package/prompts/support/resolve-issue.md +124 -0
- package/roles/README.md +6 -0
- package/roles/design-architect/README.md +98 -0
- package/roles/design-architect/accessibility/README.md +33 -0
- package/roles/design-architect/accessibility/checklists.md +29 -0
- package/roles/design-architect/accessibility/examples.md +35 -0
- package/roles/design-architect/checklists.md +76 -0
- package/roles/design-architect/component-library/README.md +35 -0
- package/roles/design-architect/component-library/checklists.md +29 -0
- package/roles/design-architect/component-library/examples.md +35 -0
- package/roles/design-architect/design-system/README.md +35 -0
- package/roles/design-architect/design-system/checklists.md +27 -0
- package/roles/design-architect/design-system/examples.md +41 -0
- package/roles/design-architect/examples/README.md +31 -0
- package/roles/design-architect/examples/checklists.md +26 -0
- package/roles/design-architect/examples/examples.md +46 -0
- package/roles/design-architect/examples.md +90 -0
- package/roles/design-architect/figma/README.md +33 -0
- package/roles/design-architect/figma/checklists.md +27 -0
- package/roles/design-architect/figma/examples.md +38 -0
- package/roles/design-architect/responsibilities.md +73 -0
- package/roles/design-architect/responsive/README.md +34 -0
- package/roles/design-architect/responsive/checklists.md +26 -0
- package/roles/design-architect/responsive/examples.md +39 -0
- package/roles/design-architect/role.md +129 -0
- package/roles/design-architect/skill-map.md +42 -0
- package/roles/design-architect/triggers.md +110 -0
- package/roles/design-architect/ui/README.md +36 -0
- package/roles/design-architect/ui/checklists.md +29 -0
- package/roles/design-architect/ui/examples.md +28 -0
- package/roles/design-architect/usability/README.md +34 -0
- package/roles/design-architect/usability/checklists.md +28 -0
- package/roles/design-architect/usability/examples.md +31 -0
- package/roles/design-architect/ux/README.md +36 -0
- package/roles/design-architect/ux/checklists.md +28 -0
- package/roles/design-architect/ux/examples.md +37 -0
- package/roles/design-architect/wireframes/README.md +34 -0
- package/roles/design-architect/wireframes/checklists.md +25 -0
- package/roles/design-architect/wireframes/examples.md +32 -0
- package/roles/design-architect/workflow.md +80 -0
- package/roles/devops/README.md +101 -0
- package/roles/devops/ansible/README.md +6 -0
- package/roles/devops/checklists.md +413 -0
- package/roles/devops/ci-cd/README.md +169 -0
- package/roles/devops/ci-cd/checklists.md +289 -0
- package/roles/devops/ci-cd/examples.md +429 -0
- package/roles/devops/cloud-platforms/README.md +109 -0
- package/roles/devops/cost-optimization/README.md +131 -0
- package/roles/devops/disaster-recovery/README.md +118 -0
- package/roles/devops/docker/README.md +6 -0
- package/roles/devops/examples/README.md +6 -0
- package/roles/devops/examples.md +775 -0
- package/roles/devops/github-actions/README.md +6 -0
- package/roles/devops/helm/README.md +6 -0
- package/roles/devops/infrastructure-as-code/README.md +160 -0
- package/roles/devops/infrastructure-as-code/checklists.md +124 -0
- package/roles/devops/jenkins/README.md +6 -0
- package/roles/devops/kubernetes/README.md +150 -0
- package/roles/devops/kubernetes/checklists.md +192 -0
- package/roles/devops/kubernetes/examples.md +189 -0
- package/roles/devops/monitoring/README.md +93 -0
- package/roles/devops/networking/README.md +83 -0
- package/roles/devops/performance/README.md +104 -0
- package/roles/devops/responsibilities.md +95 -0
- package/roles/devops/role.md +130 -0
- package/roles/devops/security/README.md +126 -0
- package/roles/devops/skill-map.md +162 -0
- package/roles/devops/terraform/README.md +6 -0
- package/roles/devops/triggers.md +241 -0
- package/roles/devops/workflow.md +197 -0
- package/roles/qa/README.md +16 -0
- package/roles/qa/api-testing/README.md +6 -0
- package/roles/qa/automation/README.md +6 -0
- package/roles/qa/checklists.md +24 -0
- package/roles/qa/examples/README.md +6 -0
- package/roles/qa/examples.md +27 -0
- package/roles/qa/performance/README.md +6 -0
- package/roles/qa/playwright/README.md +6 -0
- package/roles/qa/responsibilities.md +16 -0
- package/roles/qa/role.md +47 -0
- package/roles/qa/selenium/README.md +6 -0
- package/roles/qa/skill-map.md +14 -0
- package/roles/qa/triggers.md +10 -0
- package/roles/qa/workflow.md +9 -0
- package/roles/software-architect/README.md +16 -0
- package/roles/software-architect/agents/README.md +6 -0
- package/roles/software-architect/ai-architecture/README.md +6 -0
- package/roles/software-architect/aws/README.md +6 -0
- package/roles/software-architect/azure/README.md +6 -0
- package/roles/software-architect/caching/README.md +6 -0
- package/roles/software-architect/checklists.md +25 -0
- package/roles/software-architect/cloud/README.md +6 -0
- package/roles/software-architect/database-design/README.md +6 -0
- package/roles/software-architect/diagrams/README.md +6 -0
- package/roles/software-architect/distributed-systems/README.md +7 -0
- package/roles/software-architect/docker/README.md +6 -0
- package/roles/software-architect/event-driven/README.md +7 -0
- package/roles/software-architect/examples/README.md +6 -0
- package/roles/software-architect/examples.md +22 -0
- package/roles/software-architect/gcp/README.md +6 -0
- package/roles/software-architect/kubernetes/README.md +6 -0
- package/roles/software-architect/messaging/README.md +6 -0
- package/roles/software-architect/rag/README.md +7 -0
- package/roles/software-architect/responsibilities.md +17 -0
- package/roles/software-architect/role.md +46 -0
- package/roles/software-architect/scalability/README.md +6 -0
- package/roles/software-architect/security/README.md +6 -0
- package/roles/software-architect/skill-map.md +15 -0
- package/roles/software-architect/system-design/README.md +6 -0
- package/roles/software-architect/triggers.md +10 -0
- package/roles/software-architect/vector-db/README.md +6 -0
- package/roles/software-architect/workflow.md +9 -0
- package/roles/software-developer/README.md +116 -0
- package/roles/software-developer/api/README.md +365 -0
- package/roles/software-developer/api/checklist.md +131 -0
- package/roles/software-developer/api/examples.md +459 -0
- package/roles/software-developer/authentication/README.md +26 -0
- package/roles/software-developer/authentication/checklists.md +22 -0
- package/roles/software-developer/authentication/examples.md +32 -0
- package/roles/software-developer/authorization/README.md +26 -0
- package/roles/software-developer/authorization/checklists.md +21 -0
- package/roles/software-developer/authorization/examples.md +27 -0
- package/roles/software-developer/backend/README.md +26 -0
- package/roles/software-developer/backend/checklists.md +21 -0
- package/roles/software-developer/backend/examples.md +21 -0
- package/roles/software-developer/cache/README.md +25 -0
- package/roles/software-developer/cache/checklists.md +21 -0
- package/roles/software-developer/cache/examples.md +22 -0
- package/roles/software-developer/checklists.md +122 -0
- package/roles/software-developer/code-review/README.md +23 -0
- package/roles/software-developer/code-review/checklists.md +22 -0
- package/roles/software-developer/code-review/examples.md +20 -0
- package/roles/software-developer/database/README.md +27 -0
- package/roles/software-developer/database/checklists.md +21 -0
- package/roles/software-developer/database/examples.md +27 -0
- package/roles/software-developer/debugging/README.md +24 -0
- package/roles/software-developer/debugging/checklists.md +20 -0
- package/roles/software-developer/debugging/examples.md +28 -0
- package/roles/software-developer/examples/README.md +22 -0
- package/roles/software-developer/examples/checklists.md +8 -0
- package/roles/software-developer/examples/examples.md +25 -0
- package/roles/software-developer/examples.md +378 -0
- package/roles/software-developer/frontend/README.md +76 -0
- package/roles/software-developer/frontend/accessibility/README.md +136 -0
- package/roles/software-developer/frontend/accessibility/best-practices.md +368 -0
- package/roles/software-developer/frontend/code-quality/README.md +136 -0
- package/roles/software-developer/frontend/code-quality/best-practices.md +309 -0
- package/roles/software-developer/frontend/components/README.md +65 -0
- package/roles/software-developer/frontend/components/best-practices.md +273 -0
- package/roles/software-developer/frontend/debugging/README.md +149 -0
- package/roles/software-developer/frontend/debugging/best-practices.md +329 -0
- package/roles/software-developer/frontend/examples/README.md +19 -0
- package/roles/software-developer/frontend/examples/checklists.md +8 -0
- package/roles/software-developer/frontend/examples/examples.md +17 -0
- package/roles/software-developer/frontend/logging-observability/README.md +196 -0
- package/roles/software-developer/frontend/logging-observability/best-practices.md +430 -0
- package/roles/software-developer/frontend/performance/README.md +99 -0
- package/roles/software-developer/frontend/performance/best-practices.md +350 -0
- package/roles/software-developer/frontend/state-management/README.md +85 -0
- package/roles/software-developer/frontend/state-management/best-practices.md +344 -0
- package/roles/software-developer/frontend/testing/README.md +114 -0
- package/roles/software-developer/frontend/testing/best-practices.md +272 -0
- package/roles/software-developer/fullstack/README.md +25 -0
- package/roles/software-developer/fullstack/checklists.md +19 -0
- package/roles/software-developer/fullstack/examples.md +14 -0
- package/roles/software-developer/graphql/README.md +24 -0
- package/roles/software-developer/graphql/checklists.md +20 -0
- package/roles/software-developer/graphql/examples.md +24 -0
- package/roles/software-developer/integration-tests/README.md +25 -0
- package/roles/software-developer/integration-tests/checklists.md +20 -0
- package/roles/software-developer/integration-tests/examples.md +18 -0
- package/roles/software-developer/java/README.md +24 -0
- package/roles/software-developer/java/checklists.md +16 -0
- package/roles/software-developer/java/examples.md +22 -0
- package/roles/software-developer/javascript/README.md +24 -0
- package/roles/software-developer/javascript/checklists.md +15 -0
- package/roles/software-developer/javascript/examples.md +18 -0
- package/roles/software-developer/logging/README.md +105 -0
- package/roles/software-developer/logging/checklists.md +48 -0
- package/roles/software-developer/logging/examples.md +135 -0
- package/roles/software-developer/messaging/README.md +24 -0
- package/roles/software-developer/messaging/checklists.md +21 -0
- package/roles/software-developer/messaging/examples.md +26 -0
- package/roles/software-developer/microservices/README.md +25 -0
- package/roles/software-developer/microservices/checklists.md +21 -0
- package/roles/software-developer/microservices/examples.md +21 -0
- package/roles/software-developer/node/README.md +25 -0
- package/roles/software-developer/node/checklists.md +15 -0
- package/roles/software-developer/node/examples.md +15 -0
- package/roles/software-developer/nosql/README.md +24 -0
- package/roles/software-developer/nosql/checklists.md +21 -0
- package/roles/software-developer/nosql/examples.md +20 -0
- package/roles/software-developer/observability/README.md +25 -0
- package/roles/software-developer/observability/checklists.md +21 -0
- package/roles/software-developer/observability/examples.md +22 -0
- package/roles/software-developer/performance/README.md +26 -0
- package/roles/software-developer/performance/checklists.md +20 -0
- package/roles/software-developer/performance/examples.md +20 -0
- package/roles/software-developer/python/README.md +25 -0
- package/roles/software-developer/python/checklists.md +15 -0
- package/roles/software-developer/python/examples.md +17 -0
- package/roles/software-developer/react/README.md +24 -0
- package/roles/software-developer/react/checklists.md +15 -0
- package/roles/software-developer/react/examples.md +22 -0
- package/roles/software-developer/refactoring/README.md +23 -0
- package/roles/software-developer/refactoring/checklists.md +21 -0
- package/roles/software-developer/refactoring/examples.md +11 -0
- package/roles/software-developer/responsibilities.md +58 -0
- package/roles/software-developer/role.md +127 -0
- package/roles/software-developer/skill-map.md +88 -0
- package/roles/software-developer/springboot/README.md +25 -0
- package/roles/software-developer/springboot/checklists.md +15 -0
- package/roles/software-developer/springboot/examples.md +21 -0
- package/roles/software-developer/sql/README.md +24 -0
- package/roles/software-developer/sql/checklists.md +22 -0
- package/roles/software-developer/sql/examples.md +20 -0
- package/roles/software-developer/testing/README.md +25 -0
- package/roles/software-developer/testing/checklists.md +21 -0
- package/roles/software-developer/testing/examples.md +19 -0
- package/roles/software-developer/triggers.md +550 -0
- package/roles/software-developer/typescript/README.md +25 -0
- package/roles/software-developer/typescript/checklists.md +15 -0
- package/roles/software-developer/typescript/examples.md +18 -0
- package/roles/software-developer/unit-tests/README.md +24 -0
- package/roles/software-developer/unit-tests/checklists.md +19 -0
- package/roles/software-developer/unit-tests/examples.md +22 -0
- package/roles/software-developer/workflow.md +196 -0
- package/roles/sre/README.md +16 -0
- package/roles/sre/alerts/README.md +6 -0
- package/roles/sre/availability/README.md +6 -0
- package/roles/sre/chaos/README.md +6 -0
- package/roles/sre/checklists.md +24 -0
- package/roles/sre/examples/README.md +6 -0
- package/roles/sre/examples.md +19 -0
- package/roles/sre/observability/README.md +6 -0
- package/roles/sre/reliability/README.md +6 -0
- package/roles/sre/responsibilities.md +16 -0
- package/roles/sre/role.md +46 -0
- package/roles/sre/skill-map.md +14 -0
- package/roles/sre/slos/README.md +6 -0
- package/roles/sre/triggers.md +10 -0
- package/roles/sre/workflow.md +9 -0
- package/roles/support-engineer/README.md +16 -0
- package/roles/support-engineer/checklists.md +24 -0
- package/roles/support-engineer/datadog/README.md +6 -0
- package/roles/support-engineer/examples/README.md +6 -0
- package/roles/support-engineer/examples.md +17 -0
- package/roles/support-engineer/incident-response/README.md +6 -0
- package/roles/support-engineer/kubernetes/README.md +6 -0
- package/roles/support-engineer/linux/README.md +6 -0
- package/roles/support-engineer/logs/README.md +6 -0
- package/roles/support-engineer/monitoring/README.md +6 -0
- package/roles/support-engineer/networking/README.md +6 -0
- package/roles/support-engineer/newrelic/README.md +6 -0
- package/roles/support-engineer/postmortem/README.md +6 -0
- package/roles/support-engineer/production/README.md +6 -0
- package/roles/support-engineer/responsibilities.md +16 -0
- package/roles/support-engineer/role.md +47 -0
- package/roles/support-engineer/root-cause-analysis/README.md +6 -0
- package/roles/support-engineer/runbooks/README.md +6 -0
- package/roles/support-engineer/skill-map.md +14 -0
- package/roles/support-engineer/splunk/README.md +6 -0
- package/roles/support-engineer/triggers.md +10 -0
- package/roles/support-engineer/troubleshooting/README.md +6 -0
- package/roles/support-engineer/workflow.md +9 -0
- package/setup.sh +204 -0
- package/skills/.claude/README.md +7 -0
- package/skills/README.md +21 -0
- package/skills/ai-agents/README.md +207 -0
- package/skills/ai-agents/examples.md +335 -0
- package/skills/ai-agents/skill.md +392 -0
- package/skills/architecture/README.md +198 -0
- package/skills/architecture/examples.md +316 -0
- package/skills/architecture/skill.md +189 -0
- package/skills/design-architecture/README.md +107 -0
- package/skills/design-architecture/examples.md +84 -0
- package/skills/design-architecture/skill.md +192 -0
- package/skills/devops/README.md +177 -0
- package/skills/devops/examples.md +376 -0
- package/skills/devops/skill.md +210 -0
- package/skills/documentation/README.md +182 -0
- package/skills/documentation/examples.md +364 -0
- package/skills/documentation/skill.md +200 -0
- package/skills/performance/README.md +177 -0
- package/skills/performance/examples.md +376 -0
- package/skills/performance/skill.md +199 -0
- package/skills/qa/README.md +106 -0
- package/skills/qa/examples.md +84 -0
- package/skills/qa/skill.md +384 -0
- package/skills/security/README.md +108 -0
- package/skills/security/examples.md +85 -0
- package/skills/security/skill.md +223 -0
- package/skills/software-development/README.md +239 -0
- package/skills/software-development/assessment.md +0 -0
- package/skills/software-development/checklists.md +0 -0
- package/skills/software-development/examples.md +375 -0
- package/skills/software-development/prompts.md +0 -0
- package/skills/software-development/skill.md +390 -0
- package/skills/software-development/templates/README.md +7 -0
- package/skills/software-development/templates/api-development.md +0 -0
- package/skills/software-development/templates/bug-fix.md +0 -0
- package/skills/software-development/templates/code-review.md +0 -0
- package/skills/software-development/templates/feature-implementation.md +0 -0
- package/skills/software-development/templates/llm-integration.md +0 -0
- package/skills/software-development/templates/performance-review.md +0 -0
- package/skills/software-development/templates/security-review.md +0 -0
- package/skills/software-development/templates/test-generation.md +0 -0
- package/skills/software-development/tools.md +0 -0
- package/skills/software-development/workflows.md +0 -0
- package/skills/sre/README.md +107 -0
- package/skills/sre/examples.md +379 -0
- package/skills/sre/skill.md +256 -0
- package/skills/support-engineering/README.md +107 -0
- package/skills/support-engineering/examples.md +85 -0
- package/skills/support-engineering/skill.md +103 -0
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
# Accessibility: Best Practices
|
|
2
|
+
|
|
3
|
+
Accessible applications work for everyone. This includes users with disabilities, users on slow networks, and users in challenging environments. Accessibility is not optional—it's a core part of quality.
|
|
4
|
+
|
|
5
|
+
## Semantic HTML
|
|
6
|
+
|
|
7
|
+
Use the right HTML elements. Semantic elements communicate meaning to assistive technologies.
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
// BAD: Non-semantic
|
|
11
|
+
function Navigation() {
|
|
12
|
+
return (
|
|
13
|
+
<div class="nav">
|
|
14
|
+
<div class="nav-item" onClick={goHome}>Home</div>
|
|
15
|
+
<div class="nav-item" onClick={goAbout}>About</div>
|
|
16
|
+
<div class="nav-item" onClick={goContact}>Contact</div>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Screen readers don't understand that these are navigation links
|
|
22
|
+
// Keyboard navigation doesn't work
|
|
23
|
+
|
|
24
|
+
// GOOD: Semantic elements
|
|
25
|
+
function Navigation() {
|
|
26
|
+
return (
|
|
27
|
+
<nav>
|
|
28
|
+
<a href="/">Home</a>
|
|
29
|
+
<a href="/about">About</a>
|
|
30
|
+
<a href="/contact">Contact</a>
|
|
31
|
+
</nav>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Key semantic elements:
|
|
36
|
+
// <header>, <nav>, <main>, <article>, <section>, <aside>, <footer>
|
|
37
|
+
// <h1>, <h2>, <h3> for headings (not divs)
|
|
38
|
+
// <button> for actions (not div onclick)
|
|
39
|
+
// <a> for navigation (not div with click handler)
|
|
40
|
+
// <form>, <label>, <input> for forms
|
|
41
|
+
// <table>, <thead>, <tbody>, <th>, <td> for data tables
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Keyboard Navigation
|
|
45
|
+
|
|
46
|
+
All functionality must work with keyboard alone.
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
// BAD: Mouse-only (keyboard users are stuck)
|
|
50
|
+
function Modal({ onClose }) {
|
|
51
|
+
return (
|
|
52
|
+
<div className="modal-overlay" onClick={onClose}>
|
|
53
|
+
<div className="modal-content">
|
|
54
|
+
<h2>Delete Item?</h2>
|
|
55
|
+
<p>This action cannot be undone.</p>
|
|
56
|
+
<div className="modal-actions">
|
|
57
|
+
<button onClick={onClose}>Cancel</button>
|
|
58
|
+
<button onClick={handleDelete}>Delete</button>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Clicking outside closes modal
|
|
66
|
+
// But no way to know you can click outside without mouse
|
|
67
|
+
// Tab focus might go to elements outside modal
|
|
68
|
+
|
|
69
|
+
// GOOD: Keyboard support
|
|
70
|
+
function Modal({ onClose }) {
|
|
71
|
+
const modalRef = useRef();
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
function handleEscape(e) {
|
|
75
|
+
if (e.key === 'Escape') onClose();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
window.addEventListener('keydown', handleEscape);
|
|
79
|
+
return () => window.removeEventListener('keydown', handleEscape);
|
|
80
|
+
}, [onClose]);
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<div
|
|
84
|
+
className="modal-overlay"
|
|
85
|
+
onClick={onClose}
|
|
86
|
+
role="presentation"
|
|
87
|
+
>
|
|
88
|
+
<div
|
|
89
|
+
className="modal-content"
|
|
90
|
+
role="alertdialog"
|
|
91
|
+
ref={modalRef}
|
|
92
|
+
>
|
|
93
|
+
<h2>Delete Item?</h2>
|
|
94
|
+
<p>This action cannot be undone.</p>
|
|
95
|
+
<p className="accessibility-hint">Press Escape to cancel</p>
|
|
96
|
+
<div className="modal-actions">
|
|
97
|
+
<button onClick={onClose}>Cancel</button>
|
|
98
|
+
<button onClick={handleDelete} autoFocus>Delete</button>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Test with keyboard alone:
|
|
106
|
+
// - Tab through all interactive elements in logical order
|
|
107
|
+
// - Ensure focus is visible
|
|
108
|
+
// - All actions available via keyboard
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Color Contrast
|
|
112
|
+
|
|
113
|
+
Text must have sufficient contrast against its background. Minimum 4.5:1 for normal text.
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
// BAD: Low contrast (light gray on white)
|
|
117
|
+
<p style={{ color: '#cccccc', background: '#ffffff' }}>
|
|
118
|
+
Hard to read
|
|
119
|
+
</p>
|
|
120
|
+
|
|
121
|
+
// BAD: Failing WCAG AA
|
|
122
|
+
<p style={{ color: '#999999', background: '#ffffff' }}>
|
|
123
|
+
Text fails contrast check
|
|
124
|
+
</p>
|
|
125
|
+
|
|
126
|
+
// GOOD: 4.5:1 contrast ratio
|
|
127
|
+
<p style={{ color: '#333333', background: '#ffffff' }}>
|
|
128
|
+
Clear and readable
|
|
129
|
+
</p>
|
|
130
|
+
|
|
131
|
+
// GOOD: Sufficient contrast for larger text (3:1 minimum)
|
|
132
|
+
<h2 style={{ color: '#555555', background: '#ffffff' }}>
|
|
133
|
+
Heading with 3:1 contrast
|
|
134
|
+
</h2>
|
|
135
|
+
|
|
136
|
+
// Use WebAIM Contrast Checker to verify
|
|
137
|
+
// Chrome DevTools has built-in contrast check
|
|
138
|
+
// Many color picker tools show contrast ratio
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Alt Text for Images
|
|
142
|
+
|
|
143
|
+
Every image needs descriptive alt text (except decorative images).
|
|
144
|
+
|
|
145
|
+
```javascript
|
|
146
|
+
// BAD: No alt text
|
|
147
|
+
<img src="/user-avatar.jpg" />
|
|
148
|
+
|
|
149
|
+
// BAD: Unhelpful alt text
|
|
150
|
+
<img src="/user-avatar.jpg" alt="image" />
|
|
151
|
+
<img src="/chart.png" alt="chart.png" />
|
|
152
|
+
|
|
153
|
+
// GOOD: Descriptive alt text
|
|
154
|
+
<img
|
|
155
|
+
src="/user-avatar.jpg"
|
|
156
|
+
alt="Sarah Johnson, Product Designer"
|
|
157
|
+
/>
|
|
158
|
+
|
|
159
|
+
// GOOD: Alt text describes content, not the image itself
|
|
160
|
+
<img
|
|
161
|
+
src="/sales-chart.png"
|
|
162
|
+
alt="Sales increased 25% year-over-year, from $2M to $2.5M"
|
|
163
|
+
/>
|
|
164
|
+
|
|
165
|
+
// GOOD: Decorative images marked explicitly
|
|
166
|
+
<img
|
|
167
|
+
src="/decorative-line.png"
|
|
168
|
+
alt=""
|
|
169
|
+
aria-hidden="true"
|
|
170
|
+
/>
|
|
171
|
+
|
|
172
|
+
// Alt text guidelines:
|
|
173
|
+
// - Be specific and descriptive
|
|
174
|
+
// - Describe content, not "image of" or "picture of"
|
|
175
|
+
// - Keep it concise (< 125 characters)
|
|
176
|
+
// - Include important text that appears in image
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Form Accessibility
|
|
180
|
+
|
|
181
|
+
Forms must be usable by everyone.
|
|
182
|
+
|
|
183
|
+
```javascript
|
|
184
|
+
// BAD: Not accessible
|
|
185
|
+
<div>
|
|
186
|
+
<input type="email" placeholder="Email" />
|
|
187
|
+
<input type="password" placeholder="Password" />
|
|
188
|
+
<button>Sign In</button>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
// Screen readers can't associate labels with inputs
|
|
192
|
+
// No semantic structure
|
|
193
|
+
// Placeholder disappears when typing
|
|
194
|
+
|
|
195
|
+
// GOOD: Accessible form
|
|
196
|
+
<form>
|
|
197
|
+
<div className="form-group">
|
|
198
|
+
<label htmlFor="email">Email Address</label>
|
|
199
|
+
<input
|
|
200
|
+
id="email"
|
|
201
|
+
type="email"
|
|
202
|
+
required
|
|
203
|
+
aria-describedby="email-hint"
|
|
204
|
+
/>
|
|
205
|
+
<small id="email-hint">We'll never share your email</small>
|
|
206
|
+
</div>
|
|
207
|
+
|
|
208
|
+
<div className="form-group">
|
|
209
|
+
<label htmlFor="password">Password</label>
|
|
210
|
+
<input
|
|
211
|
+
id="password"
|
|
212
|
+
type="password"
|
|
213
|
+
required
|
|
214
|
+
/>
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
<button type="submit">Sign In</button>
|
|
218
|
+
</form>
|
|
219
|
+
|
|
220
|
+
// For validation errors:
|
|
221
|
+
<div
|
|
222
|
+
className="form-group"
|
|
223
|
+
role="alert"
|
|
224
|
+
aria-live="polite"
|
|
225
|
+
>
|
|
226
|
+
<label htmlFor="email">Email Address</label>
|
|
227
|
+
<input
|
|
228
|
+
id="email"
|
|
229
|
+
type="email"
|
|
230
|
+
aria-invalid="true"
|
|
231
|
+
aria-describedby="email-error"
|
|
232
|
+
/>
|
|
233
|
+
<span id="email-error" className="error">
|
|
234
|
+
Please enter a valid email
|
|
235
|
+
</span>
|
|
236
|
+
</div>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## ARIA Usage
|
|
240
|
+
|
|
241
|
+
ARIA (Accessible Rich Internet Applications) enhances semantic HTML, but should not replace it.
|
|
242
|
+
|
|
243
|
+
```javascript
|
|
244
|
+
// BAD: ARIA doesn't help if HTML is wrong
|
|
245
|
+
<div role="button" onClick={handleClick}>
|
|
246
|
+
Click me
|
|
247
|
+
</div>
|
|
248
|
+
|
|
249
|
+
// Doesn't work with keyboard, confuses screen readers
|
|
250
|
+
|
|
251
|
+
// GOOD: Use semantic HTML first
|
|
252
|
+
<button onClick={handleClick}>
|
|
253
|
+
Click me
|
|
254
|
+
</button>
|
|
255
|
+
|
|
256
|
+
// ARIA only when semantic HTML insufficient
|
|
257
|
+
function Tabs({ activeTab, onTabChange, children }) {
|
|
258
|
+
return (
|
|
259
|
+
<div role="tablist">
|
|
260
|
+
{children.map((child, i) => (
|
|
261
|
+
<button
|
|
262
|
+
key={i}
|
|
263
|
+
role="tab"
|
|
264
|
+
aria-selected={activeTab === i}
|
|
265
|
+
aria-controls={`panel-${i}`}
|
|
266
|
+
onClick={() => onTabChange(i)}
|
|
267
|
+
>
|
|
268
|
+
{child.props.label}
|
|
269
|
+
</button>
|
|
270
|
+
))}
|
|
271
|
+
{children.map((child, i) => (
|
|
272
|
+
<div
|
|
273
|
+
key={i}
|
|
274
|
+
id={`panel-${i}`}
|
|
275
|
+
role="tabpanel"
|
|
276
|
+
aria-labelledby={`tab-${i}`}
|
|
277
|
+
hidden={activeTab !== i}
|
|
278
|
+
>
|
|
279
|
+
{child}
|
|
280
|
+
</div>
|
|
281
|
+
))}
|
|
282
|
+
</div>
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Focus Management
|
|
288
|
+
|
|
289
|
+
Focus should move logically and be visible.
|
|
290
|
+
|
|
291
|
+
```javascript
|
|
292
|
+
// GOOD: Focus management
|
|
293
|
+
function Dialog({ onClose }) {
|
|
294
|
+
const firstButtonRef = useRef();
|
|
295
|
+
|
|
296
|
+
useEffect(() => {
|
|
297
|
+
// Move focus to first button when dialog opens
|
|
298
|
+
firstButtonRef.current?.focus();
|
|
299
|
+
|
|
300
|
+
// Trap focus within dialog (optional but good practice)
|
|
301
|
+
function handleTab(e) {
|
|
302
|
+
if (e.key === 'Tab') {
|
|
303
|
+
// Keep focus within dialog
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
window.addEventListener('keydown', handleTab);
|
|
308
|
+
return () => window.removeEventListener('keydown', handleTab);
|
|
309
|
+
}, []);
|
|
310
|
+
|
|
311
|
+
return (
|
|
312
|
+
<div role="dialog" aria-modal="true">
|
|
313
|
+
<h2>Confirm Delete</h2>
|
|
314
|
+
<button ref={firstButtonRef} onClick={onClose}>
|
|
315
|
+
Cancel
|
|
316
|
+
</button>
|
|
317
|
+
<button onClick={handleDelete}>Delete</button>
|
|
318
|
+
</div>
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Focus styles must be visible
|
|
323
|
+
button:focus {
|
|
324
|
+
outline: 2px solid blue;
|
|
325
|
+
outline-offset: 2px;
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## Testing Accessibility
|
|
330
|
+
|
|
331
|
+
Test with real tools and assistive technologies.
|
|
332
|
+
|
|
333
|
+
```javascript
|
|
334
|
+
// Automated testing (catches ~30% of issues)
|
|
335
|
+
import { axe, toHaveNoViolations } from 'jest-axe';
|
|
336
|
+
|
|
337
|
+
test('Modal is accessible', async () => {
|
|
338
|
+
const { container } = render(<Modal />);
|
|
339
|
+
const results = await axe(container);
|
|
340
|
+
expect(results).toHaveNoViolations();
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
// Manual testing (catches remaining 70%)
|
|
344
|
+
// - Use keyboard only (no mouse)
|
|
345
|
+
// - Use screen reader (NVDA, JAWS, VoiceOver)
|
|
346
|
+
// - Test with real users with disabilities
|
|
347
|
+
// - Zoom to 200% and check responsive design
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
## Accessibility Best Practices Checklist
|
|
351
|
+
|
|
352
|
+
- [ ] Semantic HTML elements used (nav, main, article, button, label)
|
|
353
|
+
- [ ] All interactive elements keyboard accessible
|
|
354
|
+
- [ ] Focus order logical (typically top to bottom, left to right)
|
|
355
|
+
- [ ] Focus visible (not removed with CSS)
|
|
356
|
+
- [ ] Text has 4.5:1 contrast ratio (normal) or 3:1 (large)
|
|
357
|
+
- [ ] All images have appropriate alt text
|
|
358
|
+
- [ ] Form labels associated with inputs
|
|
359
|
+
- [ ] Form errors announced to screen readers
|
|
360
|
+
- [ ] ARIA used only to enhance semantic HTML
|
|
361
|
+
- [ ] Tested with actual assistive technologies
|
|
362
|
+
|
|
363
|
+
## Related Guidance
|
|
364
|
+
|
|
365
|
+
- `/components` — semantic component design
|
|
366
|
+
- `/testing` — accessibility testing approaches
|
|
367
|
+
- `/tools-setup` — accessibility testing tools
|
|
368
|
+
- `/code-quality` — semantic HTML standards
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Code Quality
|
|
2
|
+
|
|
3
|
+
Senior frontend developers write clean, formatted, linted code. Automated tools catch issues.
|
|
4
|
+
|
|
5
|
+
## Code Formatting
|
|
6
|
+
|
|
7
|
+
### Tools
|
|
8
|
+
- **Prettier** — automatic code formatting
|
|
9
|
+
- **ESLint** — code quality and style rules
|
|
10
|
+
|
|
11
|
+
### Setup
|
|
12
|
+
```json
|
|
13
|
+
// .prettierrc
|
|
14
|
+
{
|
|
15
|
+
"semi": true,
|
|
16
|
+
"singleQuote": true,
|
|
17
|
+
"trailingComma": "es5",
|
|
18
|
+
"printWidth": 100,
|
|
19
|
+
"tabWidth": 2
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Pre-commit Hooks
|
|
24
|
+
- Run linter before commit
|
|
25
|
+
- Run formatter on staged files
|
|
26
|
+
- Use Husky + lint-staged
|
|
27
|
+
|
|
28
|
+
### Why Automate
|
|
29
|
+
- Removes style debates
|
|
30
|
+
- Consistent codebase
|
|
31
|
+
- CI catches violations early
|
|
32
|
+
- No manual formatting required
|
|
33
|
+
|
|
34
|
+
## Code Standards
|
|
35
|
+
|
|
36
|
+
### Naming Conventions
|
|
37
|
+
- Components: PascalCase (`MyButton.jsx`)
|
|
38
|
+
- Functions/variables: camelCase (`handleClick`, `userData`)
|
|
39
|
+
- Constants: UPPER_SNAKE_CASE (`MAX_RETRIES`)
|
|
40
|
+
- Private/internal: `_leadingUnderscore`
|
|
41
|
+
- Boolean functions: `is*`, `has*`, `should*` (`isLoading`, `hasError`)
|
|
42
|
+
|
|
43
|
+
### File Organization
|
|
44
|
+
- One component per file (unless tightly coupled)
|
|
45
|
+
- Group by feature, not file type
|
|
46
|
+
- Colocate tests with implementation
|
|
47
|
+
|
|
48
|
+
### Import Organization
|
|
49
|
+
- External packages first
|
|
50
|
+
- Internal imports second
|
|
51
|
+
- Relative imports last
|
|
52
|
+
- Sort alphabetically within groups
|
|
53
|
+
|
|
54
|
+
### Function Length
|
|
55
|
+
- Keep functions small (<30 lines)
|
|
56
|
+
- Longer functions suggest decomposition
|
|
57
|
+
- One purpose per function
|
|
58
|
+
|
|
59
|
+
### Complexity
|
|
60
|
+
- Avoid deep nesting (3+ levels)
|
|
61
|
+
- Early returns reduce nesting
|
|
62
|
+
- Extract complex logic to helpers
|
|
63
|
+
- Use guards to fail fast
|
|
64
|
+
|
|
65
|
+
## Comments & Documentation
|
|
66
|
+
|
|
67
|
+
### When to Comment
|
|
68
|
+
- Why, not what (code shows what)
|
|
69
|
+
- Non-obvious decisions
|
|
70
|
+
- Complex algorithms
|
|
71
|
+
- Edge cases and gotchas
|
|
72
|
+
|
|
73
|
+
### When NOT to Comment
|
|
74
|
+
- Self-explanatory code
|
|
75
|
+
- Redundant explanations
|
|
76
|
+
- Outdated comments (worse than none)
|
|
77
|
+
|
|
78
|
+
### JSDoc for Public APIs
|
|
79
|
+
```javascript
|
|
80
|
+
/**
|
|
81
|
+
* Format date for display
|
|
82
|
+
* @param {Date} date - the date to format
|
|
83
|
+
* @returns {string} formatted date (YYYY-MM-DD)
|
|
84
|
+
*/
|
|
85
|
+
export function formatDate(date) { ... }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## TypeScript Standards
|
|
89
|
+
|
|
90
|
+
- Use strict mode (`"strict": true`)
|
|
91
|
+
- No `any` types (use `unknown` if needed)
|
|
92
|
+
- Export types explicitly
|
|
93
|
+
- Type function arguments and returns
|
|
94
|
+
- Use interfaces for objects, types for unions
|
|
95
|
+
|
|
96
|
+
## Linting Rules to Enable
|
|
97
|
+
|
|
98
|
+
```javascript
|
|
99
|
+
// ESLint config
|
|
100
|
+
{
|
|
101
|
+
"extends": ["eslint:recommended"],
|
|
102
|
+
"rules": {
|
|
103
|
+
"no-unused-vars": "error",
|
|
104
|
+
"no-console": "warn",
|
|
105
|
+
"prefer-const": "error",
|
|
106
|
+
"no-var": "error",
|
|
107
|
+
"eqeqeq": "error"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Pre-commit Checklist
|
|
113
|
+
|
|
114
|
+
Before pushing:
|
|
115
|
+
- [ ] Code formatted (Prettier)
|
|
116
|
+
- [ ] Linter passes (ESLint)
|
|
117
|
+
- [ ] Tests pass
|
|
118
|
+
- [ ] No console.log or debugging code
|
|
119
|
+
- [ ] No dead/commented code
|
|
120
|
+
- [ ] No secrets in code
|
|
121
|
+
|
|
122
|
+
## Anti-Patterns
|
|
123
|
+
|
|
124
|
+
- Mixing concerns in one component
|
|
125
|
+
- No type safety (missing types)
|
|
126
|
+
- Ignoring linter warnings
|
|
127
|
+
- Inconsistent naming
|
|
128
|
+
- Functions doing too much
|
|
129
|
+
- Dead code left commented out
|
|
130
|
+
- Magic strings/numbers (use constants)
|
|
131
|
+
|
|
132
|
+
## Related Guidance
|
|
133
|
+
|
|
134
|
+
- `/testing` — testing code quality
|
|
135
|
+
- `/debugging` — debugging code issues
|
|
136
|
+
- `/logging-observability` — logging standards
|