# Sparc Refine > Ejecuta las fases de Refinamiento y Finalización de SPARC: revisa el código, mejora la cobertura de tests, valida contra la especificación y genera documentación. Fuente: https://skillsagentes.com/skills/ruvnet/ruflo/sparc-refine Markdown: https://skillsagentes.com/skills/ruvnet/ruflo/sparc-refine.md Repositorio: https://github.com/ruvnet/ruflo Autor: ruvnet Licencia: MIT Actualizado: el mes pasado Coste de contexto: 36 tok instalada, 1.5k tok al activarse, 1.5k tok con todos los archivos del bundle Bundle: 1 archivo, 6 KB Permisos que pide: mcp__plugin_ruflo-core_ruflo__memory_store mcp__plugin_ruflo-core_ruflo__memory_search mcp__plugin_ruflo-core_ruflo__memory_retrieve mcp__plugin_ruflo-core_ruflo__task_create mcp__plugin_ruflo-core_ruflo__task_update mcp__plugin_ruflo-core_ruflo__task_complete mcp__plugin_ruflo-core_ruflo__hooks_intelligence_trajectory-step mcp__plugin_ruflo-core_ruflo__hooks_intelligence_trajectory-end mcp__plugin_ruflo-core_ruflo__neural_train mcp__plugin_ruflo-core_ruflo__neural_predict bash read write edit ## Instalación Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina. ```bash # Claude Code npx -y skills add ruvnet/ruflo --skill sparc-refine --agent claude-code # Cursor npx -y skills add ruvnet/ruflo --skill sparc-refine --agent cursor # Codex npx -y skills add ruvnet/ruflo --skill sparc-refine --agent codex # Gemini CLI npx -y skills add ruvnet/ruflo --skill sparc-refine --agent gemini # Windsurf npx -y skills add ruvnet/ruflo --skill sparc-refine --agent windsurf # Cline npx -y skills add ruvnet/ruflo --skill sparc-refine --agent cline ``` ## Qué hace - Revisa la implementación frente a la especificación, la arquitectura y el pseudocódigo - Escribe tests unitarios, de integración y de casos límite hasta cubrir al menos el 80% del código nuevo - Valida el rendimiento contra los umbrales definidos en la especificación - Construye una matriz de trazabilidad y un checklist de preparación para despliegue - Genera documentación de API y ejemplos de uso a partir del código ## Cuándo usarla - La fase de Arquitectura de SPARC ya pasó su gate - Se necesita llevar una función de 'implementada' a 'lista para producción' ## Qué la activa - "Ejecuta la fase de refinamiento SPARC para esta función" - "Completa el ciclo SPARC y genera el checklist de despliegue" - "Revisa la cobertura de tests de esta feature contra sus criterios de aceptación" ## Antes de instalar - Requiere las herramientas MCP de ruflo (memory_store, task_create, neural_train, etc.) y que las fases previas de SPARC ya estén completas. ## Archivos - SKILL.md — 6 KB ## SKILL.md Reproducido tal cual desde ruvnet/ruflo bajo MIT. Esta sección es el documento original y está en inglés. # SPARC Refinement + Completion Run Phases 4 and 5 of the SPARC methodology: iteratively improve through code review and testing, then finalize with validation, documentation, and deployment readiness. ## When to use After the Architecture phase is complete and its gate has been passed. This skill covers the final two phases that bring a feature from implemented to production-ready. ## Steps ### Phase 4 — Refinement 1. **Retrieve all prior artifacts** — call `mcp__plugin_ruflo-core_ruflo__memory_search` with namespace `sparc-phases` and query for the feature slug. Load spec (acceptance criteria), pseudocode, and architecture. 2. **Retrieve phase state** — call `mcp__plugin_ruflo-core_ruflo__memory_search` with namespace `sparc-state` to confirm we are in Phase 4. 3. **Code review** — review the implementation against: a. **Specification compliance**: does every acceptance criterion have a corresponding code path? b. **Architecture adherence**: do modules follow the defined boundaries and dependency rules? c. **Pseudocode fidelity**: does the implementation match the designed algorithms? d. **Code quality**: naming conventions, single responsibility, error handling, no dead code e. Document findings as review comments 4. **Test coverage analysis**: a. Run existing tests and measure coverage b. Identify uncovered acceptance criteria c. Write missing tests: - Unit tests for each public function - Integration tests for cross-module interactions - Edge case tests for each identified edge case from the spec d. Target coverage >= 80% on new code 5. **Performance validation** — if the spec includes performance constraints: a. Profile critical paths identified in the pseudocode b. Compare measured performance against constraint thresholds c. Optimize if thresholds are not met 6. **Iterate** — repeat steps 3-5 until: - All acceptance criteria have passing tests - Code review has no critical or high-severity issues - Coverage meets the threshold - Performance constraints are satisfied 7. **Store refinement artifact** — call `mcp__plugin_ruflo-core_ruflo__memory_store` with namespace `sparc-phases`, key `refine-{feature-slug}`, value: `{ status: "complete", reviewFindings: [...], coveragePercent: N, performanceResults: {...}, iterations: N }` 8. **Record trajectory step** — call `mcp__plugin_ruflo-core_ruflo__hooks_intelligence_trajectory-step` with refinement summary ### Phase 5 — Completion 9. **Full regression** — run the complete test suite to verify no regressions from refinement changes 10. **Traceability matrix** — build a matrix mapping every acceptance criterion to: - The test(s) that verify it - The code file(s) that implement it - The current pass/fail status 11. **Documentation**: a. Generate API documentation from code comments and type definitions b. Write usage examples for key public interfaces c. Update any existing documentation affected by the changes 12. **Deployment readiness checklist**: - [ ] All tests passing - [ ] Documentation complete - [ ] Database migrations prepared (if applicable) - [ ] Configuration changes documented - [ ] Feature flags configured (if applicable) - [ ] Rollback plan defined - [ ] Security review complete (no secrets, inputs validated) 13. **Store completion artifact** — call `mcp__plugin_ruflo-core_ruflo__memory_store` with namespace `sparc-phases`, key `complete-{feature-slug}`, value: `{ status: "complete", traceabilityMatrix: [...], documentationFiles: [...], deploymentChecklist: {...}, regressionResult: "pass" }` 14. **End trajectory** — call `mcp__plugin_ruflo-core_ruflo__hooks_intelligence_trajectory-end` with the full SPARC cycle summary 15. **Train neural patterns** — call `mcp__plugin_ruflo-core_ruflo__neural_train` with the successful SPARC cycle data to improve future predictions 16. **Store learned pattern** — call `mcp__plugin_ruflo-core_ruflo__memory_store` with namespace `patterns`, key `sparc-{feature-slug}`, value summarizing what worked, phase durations, and common blockers encountered 17. **Present completion report** — display the traceability matrix, deployment checklist, and final status. Suggest running `/sparc advance` to pass the final gate, or `/sparc report` for the full methodology report. ## Output format ``` # Refinement: {Feature Name} ## Code Review Summary - Critical issues: {N} (must be 0 to pass gate) - High issues: {N} - Medium issues: {N} - Resolved: {N}/{total} ## Test Coverage - Overall: {N}% - New code: {N}% - Acceptance criteria covered: {N}/{total} ## Performance | Constraint | Target | Measured | Status | |-----------|--------|----------|--------| | Response time | <200ms | 145ms | Pass | --- # Completion: {Feature Name} ## Traceability Matrix | AC | Test | Code | Status | |----|------|------|--------| | AC-1 | test_xxx | service.ts:42 | Pass | | AC-2 | test_yyy | controller.ts:18 | Pass | | AC-3 | test_zzz | repository.ts:31 | Pass | ## Deployment Checklist - [x] All tests passing - [x] Documentation complete - [x] Migrations prepared - [x] Config documented - [x] Rollback plan defined - [x] Security reviewed --- SPARC workflow complete. Run `/sparc report` for the full methodology report. ``` ## Dónde encaja - Categoría: [Herramientas para desarrolladores](https://skillsagentes.com/categorias/herramientas-desarrollo.md) — Skills que cambian cómo tu agente escribe, revisa y despliega código. - Creador: [ruvnet](https://skillsagentes.com/creators/ruvnet.md) — 275 skills en el directorio - [Todas las skills](https://skillsagentes.com/skills.md) - [Ranking de instalaciones](https://skillsagentes.com/ranking.md) ## Otras skills del mismo repositorio - [Harness Gepa](https://skillsagentes.com/skills/ruvnet/ruflo/harness-gepa.md): Inspecciona y audita genomas GEPA: carga y valida un genoma, renderiza el system prompt que compila, o clasifica los modos de fallo de una transcripción de ejecución. - [Deepseek Reason](https://skillsagentes.com/skills/ruvnet/ruflo/deepseek-reason.md): Completion en modo razonamiento contra deepseek-reasoner (R1) de DeepSeek. Devuelve el chain-of-thought por separado de la respuesta final. Lee DEEPSEEK_API_KEY y degrada si falta o la API no responde. - [Deepseek Chat](https://skillsagentes.com/skills/ruvnet/ruflo/deepseek-chat.md): Completion de un solo turno contra el modelo deepseek-chat de DeepSeek vía /v1/chat/completions. Lee DEEPSEEK_API_KEY y degrada con status:degraded si falta o la API no responde. Para tareas sin razonamiento. - [Adr Index](https://skillsagentes.com/skills/ruvnet/ruflo/adr-index.md): Construye o reconstruye el índice de ADRs y su grafo de dependencias ejecutando scripts/import.mjs, en vez de cientos de llamadas MCP. - [Agntcy Status](https://skillsagentes.com/skills/ruvnet/ruflo/agntcy-status.md): Muestra el estado de la integración AGNTCY/SLIM/CASA: si los paquetes están instalados, qué transporte está activo y si el enforcement de CASA está habilitado. --- Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)