Implémentation TDD pour ETNA_TRADER

VérifiéSûr

Exécute une implémentation TDD structurée à partir de documents de tâches ou de corrections de bugs dans ETNA_TRADER. Utiliser pour démarrer, continuer ou reprendre une implémentation.

Spar Skills Guide Bot
DeveloppementIntermédiaire
22/07/2026
Claude Code
#tdd#dotnet#csharp#task-workflow#code-review-feedback

Recommandé pour

Synthèse automatique

Pilote l'implémentation TDD (Red-Green-Refactor) de tâches ou de correctifs dans le projet ETNA_TRADER, à partir des documents du dossier tasks/ et sur une branche de fonctionnalité.

Points forts

  • Détecte automatiquement le mode approprié : démarrage, reprise d'un travail en cours ou traitement des retours de revue de code.
  • Impose une boucle TDD explicite avec les commandes dotnet build / dotnet test à exécuter à chaque cycle.
  • Rappelle les règles d'architecture du projet (Contracts → Services → DAL → API, ConfigureAwait, CancellationToken, exports nommés).
  • Verrouille les écritures Git derrière une autorisation explicite de l'utilisateur (commit, push, PR, merge).

Limites

  • Fortement couplé à ETNA_TRADER : conventions .NET/TypeScript, chemins tasks/ et .claude/rules/ propres à ce dépôt.
  • Suppose qu'un document de tâche complet existe déjà (critères d'acceptation, plan de test, fichiers impactés) ; il ne le rédige pas.
  • Le texte fourni est tronqué au milieu de la section TDD, l'étape de refactorisation et les phases suivantes ne sont donc pas entièrement documentées.
Quand l'utiliser

À utiliser lorsqu'une tâche ou un correctif dispose déjà d'un document structuré dans tasks/ et doit être implémenté ou repris en suivant le TDD sur une branche dédiée.

Quand l'éviter

À éviter pour une exploration libre, du prototypage rapide ou des projets hors ETNA_TRADER, où les contraintes d'architecture et le dossier tasks/ n'ont pas de sens.

Analyse de sécurité

Sûr
Score qualité90/100

The skill instructs standard development workflows (TDD, builds, tests, linting) and explicitly requires user permission before any git writes. No destructive, exfiltration, or obfuscated commands are present.

Aucun point d'attention détecté

Comment cette analyse est faite

Exemples

Start a new task
Implement tasks/ETNA-142-order-cancellation/ using TDD. Start from scratch and follow the task document exactly.
Resume in-progress work
Continue the implementation of the task in tasks/ETNA-98-position-reconciliation — check git history and the task status to see where we stopped.
Apply code review feedback
Address the code review comments on the branch for tasks/ETNA-77-risk-limits and re-run the unit tests afterwards.

name: si description: Execute structured TDD implementation following task documents or bug fixing in ETNA_TRADER. Use when starting, continuing, or resuming implementation of a task or fixing a bug from tasks/ directory. Also handles addressing code review feedback. argument-hint: "[task-directory]" user-invocable: true

Start Implementation — ETNA_TRADER

PRIMARY OBJECTIVE

Implement features systematically with TDD approach on feature branches.

Three modes of operation:

  1. Start — Begin implementation from scratch
  2. Continue — Resume in-progress implementation
  3. Address CR — Apply code review feedback

Before any work, determine which mode applies by reviewing the task document status and git history.

CONSTRAINTS

  • Follow the existing task document in tasks/ directory
  • Git writes require explicit user permission: Do NOT create commits, push branches, open PRs, or merge unless the user explicitly approves
  • STRICT DESCRIPTION ADHERENCE: Only implement what is explicitly described in the task document
  • Follow ETNA_TRADER architecture layer rules (Contracts → Services → DAL → API)
  • No hardcoded connection strings — always use IConfiguration or app settings
  • ConfigureAwait(false) on all service and repository await calls
  • CancellationToken must be propagated through the entire call chain
  • Named exports only — no default exports from TypeScript components (frontend tasks)
  • No async void — use async Task (except event handlers)
  • Use ArgumentNullException.ThrowIfNull / guard clauses at service entry points

WORKFLOW STEPS

STEP 1: Task Validation

  1. Ask user: "Which task to implement? Provide task name or path." If not provided:

    • List tasks in tasks/ if unclear
  2. Validate document:

    • Confirm the task exists
    • Confirm scope is unambiguous: clear acceptance criteria, clear "done" definition
    • Confirm task status is appropriate ("Ready for Implementation" or "Draft")
    • Confirm there is an implementation plan: impacted files, layer notes, test plan
  3. Pre-implementation check:

    • Review relevant rules: .claude/rules/trading-csharp-conventions.md, .claude/rules/trading-testing-architecture.md
    • Review frontend rules if UI work: .claude/rules/trading-component-patterns.md
    • Explore affected codebase areas
    • Verify .NET build and tests pass: dotnet build + dotnet test qa/ --filter "Category!=Integration" — tail output

STEP 2: Setup

Note: Skip this step when continuing implementation or addressing Code Review results.

  1. Update task status to "In Progress" with timestamp
  2. Create feature branch (follow repo convention): feat/<ticket-id>-[slug] or fix/<ticket-id>-[slug]
  3. Update task document with branch name
  4. Permission gate: Ask for explicit approval before any git operation

STEP 3: Implementation

Parallelization (optional)

If part of the work can be done safely in parallel (e.g., separate .NET service + separate frontend component with no shared state), use the parallelization skill:

  • .claude/skills/parallelization/skill.md

Sequential Mode

Before Each Step:

  1. Announce: "Starting Step [N]: [Description]"
  2. Review requirements: Acceptance criteria, tests, artifacts

During Implementation (TDD + Docs):

  1. Follow agreed Test Plan: Implement tests based on the Test Plan in the task document

  2. TDD Red-Green-Refactor Cycle — .NET (NUnit/xUnit):

    • RED: Write failing test first
      dotnet test qa/<Project>.Tests/ --filter "FullyQualifiedName~<TestClass>" --no-build 2>&1 | tail -20
      # Expected: FAIL
      
    • GREEN: Write minimal code to make test pass
      dotnet build src/<Project>/ 2>&1 | tail -10
      dotnet test qa/<Project>.Tests/ --filter "FullyQualifiedName~<TestClass>" 2>&1 | tail -20
      # Expected: PASS
      
    • REFACTOR: Clean up while keeping tests green
  3. TDD Red-Green-Refactor Cycle — TypeScript (Vitest/Jest, frontend):

    • RED: Write failing test
      cd frontend/ACAT && npx vitest run --reporter=verbose 2>&1 | tail -20
      
    • GREEN: Implement component/hook to pass test
    • REFACTOR: Clean up
  4. Update relevant documentation DURING code writing (not after):

    • New service/repository → update docs/architecture.md if new pattern established
    • Architecture change → create or update ADR in docs/adr/
    • New DB object → document in db/README.md or inline comments in SSDT .sql
    • Provider/DI change → update Unity registration module and document in task
  5. Test file locations:

    • Unit (C#): qa/<Project>.Tests/<mirrors-src-path>/<Type>Tests.cs
    • Integration (C#): qa/<Project>.IntegrationTests/<mirrors-src-path>/<Type>IntegrationTests.cs
    • Frontend: frontend/ACAT/src/features/<feature>/<Component>.test.tsx (co-located)
  6. Build and type-check commands:

    # .NET
    dotnet build src/<Project>/ 2>&1 | tail -20
    dotnet test qa/<Project>.Tests/ 2>&1 | tail -30
    
    # TypeScript frontend
    cd frontend/ACAT && npx tsc --noEmit 2>&1 | head -20
    cd frontend/ACAT && npm run lint 2>&1 | head -20
    

After Each Step:

  1. Update the task document (REQUIRED — not just chat output):

    • Mark step checkbox as complete: - [ ] → - [x]
    • Add Changelog entry describing what was done
    • Update Tests field with command run + result

    Example:

    - [x] Sub-step 3.1: Add OrderService.PlaceOrderAsync
      - **Tests**: `dotnet test qa/Etna.Trader.FrontOffice.Tests/ --filter "OrderServiceTests"` — 8 PASS
      - **Changelog**: Created `OrderService.PlaceOrderAsync`, added `OrderServiceTests.cs`
    
  2. Commit changes (permission gate):

    • If the user has not explicitly approved git writes: ask for permission before any git command
    • If approved: use conventional commits
      • Code + tests: git commit -m "feat(orders): add PlaceOrderAsync with validation"
      • DB change: git commit -m "db(orders): add ClientOrderId column to Orders table"
      • Docs update: git commit -m "docs(orders): document order placement architecture"

Error Recovery

  • Tests fail: Fix the failing code, re-run tests. Do NOT skip or delete failing tests.
  • Build errors: Fix the errors. Do NOT suppress with #pragma warning disable without documented reason.
  • Type errors (TypeScript): Fix the type errors. Do NOT use any as a shortcut.
  • Lint errors: Fix the lint errors. Do NOT use // eslint-disable without justification.
  • Task document incomplete: Ask user to clarify missing criteria before proceeding.

STEP 4: Completion

Final Verification

Run quality gates via agent:

  • Use Task tool with subagent_type: "automated-quality-gate"
  • Provide task_path (absolute path to task directory)
  • Agent runs build/lint/tests and writes a Quality Gate Report in the task directory
# .NET quality gate
dotnet build 2>&1 | tail -10
dotnet test qa/Etna.Tests.sln --filter "Category!=Integration" 2>&1 | tail -30

# Frontend quality gate (if applicable)
cd frontend/ACAT && npx tsc --noEmit && npm run lint && npx vitest run 2>&1 | tail -20

Finalize Task Document

  1. Update status to "Ready for Review" with timestamp
  2. Verify all checkboxes are accurate
  3. Add implementation summary:
    ## Completion Summary
    
    **Implementation Complete**: [Brief technical description]
    **Files Changed**: [count] files modified, [count] files created
    **Tests**: [count] total (unit: [n], integration: [n])
    **Quality Gate**: PASSED — build clean, lint clean, all tests pass
    **Technical Debt/Follow-ups**: [Any deferred work]
    

STEP 5: Prepare for Code Review

  1. Permission gate (required):

    • Creating a PR and pushing requires explicit user approval for git writes
  2. Quick task-doc self-check:

    • All implementation checkboxes are accurate
    • Test evidence and quality-gate result are documented
    • Branch name is consistent
    • Completion summary is present and readable for reviewers
  3. Prepare PR context in task document:

    • Ensure branch name and test evidence are up to date
    • Add a short reviewer-oriented implementation summary
    • Create/open PR manually or via gh pr create

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/tdd-implementation-for-etna-trader-mrwak8z2/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/tdd-implementation-for-etna-trader-mrwak8z2' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/tdd-implementation-for-etna-trader-mrwak8z2/download' --output '.skill-downloads/tdd-implementation-for-etna-trader-mrwak8z2/SKILL.md.part' && mv '.skill-downloads/tdd-implementation-for-etna-trader-mrwak8z2/SKILL.md.part' '.skill-downloads/tdd-implementation-for-etna-trader-mrwak8z2/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/tdd-implementation-for-etna-trader-mrwak8z2/SKILL.md' && test -s '.skill-downloads/tdd-implementation-for-etna-trader-mrwak8z2/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/si' && cp -R '.skill-downloads/tdd-implementation-for-etna-trader-mrwak8z2' '.claude/skills/si'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/tdd-implementation-for-etna-trader-mrwak8z2'

openskills read 'tdd-implementation-for-etna-trader-mrwak8z2'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/tdd-implementation-for-etna-trader-mrwak8z2/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires