mirror of
https://github.com/davila7/claude-code-templates.git
synced 2026-09-19 01:30:23 +08:00
41cbbea00c
- Split components.json: índice sin content (1.9 MB / 249 KB br vs 15.6 MB / 4.15 MB br).
Generador produce component-content/{type}/{slug}.json por componente y auto-copia
a dashboard/public/. Página de detalle carga contenido on-demand via fetchComponentContent().
- Restaurar cabeceras de caché y seguridad perdidas en la migración Vercel→Cloudflare:
_headers con Cache-Control max-age=86400 para JSONs, immutable para _astro/*,
y HSTS, X-Frame-Options, Referrer-Policy, Permissions-Policy en todas las rutas.
- Eliminar dashboard/vercel.json (config muerta desde migración a Cloudflare Pages).
- Diferir hidratación: ClerkIsland y AuthButton client:load → client:idle;
SaveToCollectionButton → client:visible.
- Eliminar gpt-tokenizer del bundle del navegador: reemplazado por estimación chars/4.
- Actualizar .claude/rules/dashboard.md para reflejar hosting en Cloudflare Pages.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 line
2.7 KiB
JSON
1 line
2.7 KiB
JSON
{"content": "---\nallowed-tools: Read, Write, Edit, Bash\nargument-hint: [file-path] | [component-name]\ndescription: Generate a complete test file for a specified source file or component. Use when the user explicitly asks to write, create, or generate tests for a specific file.\n---\n\n# Generate Tests\n\nGenerate comprehensive test suite for: $ARGUMENTS\n\n## Current Testing Setup\n\n- Test framework: !`cat package.json 2>/dev/null | grep -E '\"jest\"|\"vitest\"|\"mocha\"|\"jasmine\"' | head -3 || cat jest.config.* vitest.config.* 2>/dev/null | head -5 || echo \"Framework not detected\"`\n- Existing tests: !`find . -name \"*.test.*\" -o -name \"*.spec.*\" | head -5`\n- Test coverage: !`npm run test:coverage 2>/dev/null || echo \"No coverage script\"`\n- Target: if $ARGUMENTS is a file path, read it with @$ARGUMENTS; if it is a component name, search for it with Grep before writing tests\n\n## Test Generation Framework\n\n1. **Analyze** the target file/component structure — identify all exported functions, classes, methods, and their signatures\n2. **Strategy** — examine existing test patterns in the project; choose unit vs integration scope; identify critical paths and error scenarios\n3. **Mock Design** — map all external dependencies (I/O, APIs, timers, dates); create factories for test data; plan cleanup for async operations\n4. **Unit Tests** — write isolated tests per function/method covering happy path, edge cases, and error conditions; follow AAA pattern (Arrange, Act, Assert)\n5. **Integration Tests** — test component interactions, API layers with mocked responses, and end-to-end user workflows where applicable\n6. **Quality Check** — verify naming describes behavior not implementation; confirm 80%+ coverage on critical business logic; ensure test isolation\n\n## Framework-Specific Guidance\n\n- **React**: Component testing with React Testing Library; test user interactions and rendering\n- **Vue**: Component testing with Vue Test Utils; test props, events, and slots\n- **Angular**: Component and service testing with TestBed; test dependency injection\n- **Node.js**: API endpoint and middleware testing; test request/response cycles\n- **Python**: `pytest` with fixtures, `unittest.mock` for patching, `pytest-cov` for coverage\n- **Go**: Table-driven tests in `_test.go` files, `testify/assert` for assertions, subtests via `t.Run()`\n- **Rust**: `#[cfg(test)]` modules, `#[test]` attributes, `mockall` for mocking\n\n## Best Practices\n\n- Follow AAA pattern (Arrange, Act, Assert)\n- 80%+ coverage; prioritize critical business logic and error paths\n- Mock external I/O; use factories for test data\n- Naming: describe what the function does, not implementation details\n"} |