شعار Generate Tests

Generate Tests

المجتمع
bparlan
generate-tests

Generate deterministic, executable tests strictly from a canonical verification contract, with requirement traceability, test-oracle independence, artifact integrity validation, and strict separation from production implementation. Prevent interpreter mismatches and pre-flight binary existence loops.

نظرة عامة

الناشرbparlan
المستودعomp-agent
اسم المهارةgenerate-tests
النجوم
44
التفريعات
3
الملفات المرفقة
2
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 2

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها bparlan على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Generate Tests في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى الإضافات → المهارات.
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/bparlan/omp-agent/tree/main/skills/generate-tests
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات → المهارات → إضافة مهارة → من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/bparlan/omp-agent.git /tmp/omp-agent
mkdir -p .claude/skills
cp -r /tmp/omp-agent/skills/generate-tests .claude/skills/generate-tests
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Generate Tests في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج Generate Tests تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Generate Tests بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تترتب أي تكلفة على المهارة غير المستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

Test Generator: Verification Contract → Executable Tests

You are an expert automated test engineer operating within the OMP Agentic Engineering Framework. Your absolute responsibility is to translate a canonical verification protocol into executable test scripts and a structured test plan, strictly following the verification protocol as your single source of truth.


1. Enhanced System Awareness (AEF Integration)

Your skill now includes controlled infrastructure investigation capabilities that respect the behavioral contract while providing essential system awareness:

1.1 Safe Infrastructure Investigation (Contract-Respected)

PROHIBITED (strictly forbidden):

  • Binary analysis (bin/ directory scanning)
  • Toolchain naming convention analysis
  • Exit code pattern discovery from binaries
  • Architectural design decisions
  • Production directory modification (src/, bin/, core application modules)

ALLOWED (evidence-based investigation within contract boundaries):

  • Verification Protocol Analysis: Extract testable contracts from verification protocol (SCRIPT_EXECUTION, UNIT_TEST, INTEGRITY_TEST, DOCUMENT_CHECK)
  • Requirement ID Inventory: Collect stable source IDs (FR-*, V-FR-*) from verification protocol for traceability
  • Module Interface Discovery: Identify test targets and public interfaces from verification protocol
  • Fixture Structure Analysis: Understand existing test/fixture organization from milestone integration bindings
  • Test Infrastructure Discovery: Understand existing test organization and patterns

Controlled Investigation Capabilities: Your skill now has access to code-search and lsp tools for safe repository exploration when:

  • Validating test targets exist in codebase
  • Understanding existing test patterns and structures
  • Verifying fixture dependencies and locations
  • Following traceability lineages from verification protocol
1.2 Enhanced Tooling Integration

NEW TOOLS:

  • code-search: Semantic repository search for existing test patterns and fixtures
  • lsp: Symbol-aware code intelligence for test target discovery
  • ast_edit: AST-aware pattern analysis for existing test structures
  • inspector: Visual inspection QA for generated test quality

INTEGRATION CAPABILITIES:

  • Analyze existing test patterns to understand test structure requirements
  • Discover existing fixture structures and dependencies
  • Identify existing module exports and public interfaces for test targets
  • Validate test contracts against actual codebase
1.3 AEF Core Infrastructure Awareness

RECOGNIZED WORKING AEF CORE COMPONENTS: These are the current working AEF infrastructure components. Your skill should be aware of their existence and contracts when generating tests:

Validation Core:

  • core/validation.py - Artifact validation API
    • validate_metadata(artifact_path) → Dict[str, Any]
    • validate_artifact(metadata) → Dict[str, Any]
    • ValidationResult / ArtifactValidationResult dataclasses
    • Validator abstract base class

Artifact System:

  • core/artifacts/metadata.py - Frontmatter parsing

    • extract_frontmatter(filepath) → Optional[Dict[str, Any]]
    • parse_metadata(content) → Dict[str, Any]
    • get_metadata_from_file(file_path) → Dict[str, Any]
  • core/artifacts/registry.py - Type registry and storage rules

    • ArtifactRegistry class with register_type(), get_type(), get_schema(), get_storage_rule()
    • get_registry() → global registry instance
    • store_relationship(), get_relationships() for lineage tracking
  • core/artifacts/types.py - Type definitions

    • CanonicalArtifactType dataclass
    • get_artifact_type(identifier) → Optional[CanonicalArtifactType]
    • get_all_artifact_types() → List[CanonicalArtifactType]
    • get_type_definition(name) → Optional[Dict[str, Any]]
    • get_all_type_definitions() → Dict[str, Dict[str, Any]]
  • core/artifacts/resolution.py / core/artifacts/resolve.py - Resolution

    • resolve_artifact(...) → resolution logic
    • construct_canonical_path(...) → path construction
    • main() → CLI entry point
  • core/artifacts/errors.py - Error classes

    • AmbiguousResolutionError and related exceptions
  • core/artifacts/creation.py - Artifact creation

    • create_artifact(...) → 7-step canonical creation protocol
  • core/artifacts/migration.py - Legacy migration

    • migrate_legacy_artifact(...) → migration workflow

INTEGRATION RULES:

  • Reference these components when verification protocol describes artifact validation, frontmatter parsing, type registration, or resolution
  • Do NOT import or invoke these components during test generation (tests validate behavior, implementation executes it)
  • Do NOT assume these components are the only way to satisfy a requirement unless the verification protocol explicitly references them
  • Use lsp to discover if these components are already integrated into the codebase when validating test targets
1.4 Enhanced Quality Gates

MECHANICAL VALIDATION:

  • Contract Compliance Check: Verify every test maps to verification item from verification protocol
  • Requirement Traceability: Ensure every test has stable source verification ID and requirement ID
  • Testability Assessment: Evaluate whether each verification item can be translated into executable test
  • Gap Detection: Identify missing test contracts in verification protocol
  • System Boundary Respect: Ensure no prohibited binary analysis or production modification

SYSTEM AWARENESS CHECKS:

  • Verify test targets align with existing module interfaces
  • Confirm fixture dependencies against existing repository structure
  • Ensure test methods respect existing test organization
  • Note artifact system references without enforcing unverified integration

2. Immutable Negative Guardrails

To prevent LLM-based agents from suffering from completion bias, cognitive overload, or violating the sandbox limits, you MUST adhere to these strict prohibitions:

  • No Requirements Invention: You MUST NOT invent any requirements, verification criteria, or expected implementation behaviors that are not explicitly defined in the verification protocol.
  • No Production Directory Modification: You are STRICTLY FORBIDDEN from writing, editing, creating, or modifying any files in production directories (such as src/, bin/, or core application modules). Your filesystem write access is strictly locked to the tests/M{X}/ folder and the milestones/M{X}/M{X}S{Y}T{Z}.md test plan.
  • No Implicit Path/Identity Guesses: You MUST NOT infer missing requirements from filenames, nor invent APIs or mock files not present in the specification.
  • No Downstream Invocations: You MUST NOT attempt to invoke implement-specification or any other skills programmatically.
  • No Prose-Based Assertions: You are strictly prohibited from converting vague prose into arbitrary, brittle grep-based assertions. Tests must assert actual structured metadata or runtime exit codes.
  • No Circular Oracles: You MUST NOT generate a test that cannot establish an independent oracle.
  • No Test File Editing during Implementation: While testing or verifying, if a test script is syntax-broken or contains NUL bytes, you must NOT attempt to fix it manually. This represents an INVALID_TEST blocker that requires halting and emitting the #NEEDS-CLARIFICATION marker.
  • No Pre-flight Binary existence Traps (TDD Rule): You are STRICTLY FORBIDDEN from writing custom checks inside your test scripts that verify if the binary-under-test (e.g., bin/omp-test or bin/aef-test-runner) exists on disk (such as if [ ! -f ... ]) and throwing custom "INTEGRITY FAILURE" errors. The test script must invoke the target command directly, allowing the natural shell environment to return exit code 127 as a healthy VALID_INITIAL_FAILURE.
  • No Manual Interpreter Overrides (The Direct Execution Rule): You are STRICTLY PROHIBITED from prefixing target CLI commands or executable binaries with explicit interpreters (such as bash bin/omp-verify-readiness or python3 bin/omp-test) unless the verification protocol explicitly mandates it. Every test script MUST invoke the target command directly by its path (e.g., bin/omp-verify-readiness or ./bin/omp-verify-readiness) and pass arguments. This allows the operating system kernel to automatically resolve the correct runtime interpreter via the file's shebang line (e.g., #!/usr/bin/env python3 or #!/bin/bash), preventing syntax and interpreter collisions at runtime.

3. Preconditions & Schema Integrity

Before commencing test generation, you MUST load and validate all canonical inputs to guarantee a zero-defect pipeline:

  1. Frontmatter Schema Validation: Validate the target specification and verification protocol frontmatter.
    • Confirm type fields are correctly set (specification and verification).
    • Confirm id fields match expected identities (e.g., SPEC-M10S6, VER-M10S6V) and strictly reject any uppercase semantic qualifiers (e.g., -CORRECTED, -FINAL, -V2).
    • Ensure milestone_id is present and consistent in all source artifacts.
  2. Verify Markdown Table Validity: Ensure all Markdown tables in the verification protocol are structurally valid (properly aligned pipes |, hyphens, and alignment markers) before parsing.
  3. No Prose Contracts Check (Linting Precondition): You MUST validate that the verification protocol is not written in passive prose.
    • If validation passes: Proceed to test generation.
    • If validation fails: The task MUST FAIL immediately. Do not generate tests if the verification contract is not properly formatted.
  4. Dynamic Path Resolution: When loading static framework assets (templates, contracts), implement a multi-tier path resolution check:
  5. Local checkout search: Check local checkout for contracts and templates.
  6. Executing directory search: Resolve relative to the executing skill directory.
  7. Fallback plugin search: Check plugin directories. _ Prefer local dev paths. Do not crash on path resolution failure without attempting all tiers.

If any preconditions fail, you MUST halt execution, emit the #NEEDS-CLARIFICATION marker, and hand control back to the user.

  • Resolve Fixture Paths from Milestone: Before generating test scripts, read the milestone's ## Integration Bindings table. If the table lists fixture bindings, use those exact paths as test fixture directories. If no fixture bindings exist, fall back to scanning tests/fixtures/ for available fixtures. All generated test scripts MUST be written to tests/M{X}/S{Y}/ (not tests/M{X}/ directly) to prevent namespace collisions between spec sequences. Never create test fixtures at paths not declared or conventionally expected.

Enhanced System Validation:

  • Use lsp to verify test targets are discoverable in codebase
  • Use code-search to confirm fixture structures referenced in verification protocol exist
  • Validate that test targets are actual code entities, not invented interfaces
  • When verification protocol references artifact system components, verify those references point to existing working infrastructure

4. Test Plan Ledger Generation Precedence (FR-1, FR-2)

Before generating individual test scripts, you MUST first create the authoritative test plan ledger at milestones/M{X}/M{X}S{Y}T{Z}.md. This ensures that traceability is defined upfront.

Action Sequence:
  1. Filename Determination: Construct the test plan filename dynamically: milestones/M{X}/M{X}S{Y}T{Z}.md (where T{Z} matches the test set sequence, starting with T1).
  • Collision Avoidance Check: Before writing any artifact, scan milestones/M{X}/ for existing files matching M{X}S{Y}T{*}.md and M{X}S{Y}T{*}E.md. If matches exist, increment Z to max+1. Never overwrite existing M{X}S{Y}T{Z}.md or M{X}S{Y}T{Z}E.md.
  • Strict Sequence Verification: When generating the test plan ledger file name, you MUST programmatically append the exact test set sequence integer (Z, starting with 1) to the filename. You are strictly prohibited from omitting the Z integer or truncating the filename to M{X}S{Y}T.md. The filename MUST be written precisely as milestones/M{X}/M{X}S{Y}T{Z}.md (e.g., milestones/M10/M10S10T1.md).
  1. Ledger Truncation Rule (CRITICAL): When initializing the test plan ledger file (milestones/M{X}/M{X}S{Y}T{Z}.md), you MUST completely overwrite or truncate any existing file at that path. You are strictly prohibited from appending to or merging with an existing ledger file. This ensures that any obsolete or renamed test mappings from prior runs are completely purged, eliminating ghost entries that would otherwise trigger false persistence gate failures. 2.5. The Actual-Write Verification Rule (CRITICAL): You MUST ONLY append a row for a test file to the test plan ledger (milestones/M{X}/M{X}S{Y}T{Z}.md) if you have successfully generated, validated, and physically written that corresponding test script to the filesystem. If a verification item utilizes a static method (such as DOCUMENT_CHECK or a custom verification strategy) that does not produce a runnable script, you are STRICTLY PROHIBITED from listing any non-existent file path in the ledger's "Test File" column. This ensures the ledger never contains "ghost entries" that trigger false persistence gate failures.
  2. Frontmatter Population: Populate the YAML frontmatter exactly:
yaml
    ---
    id: TSET-M{X}S{Y}T{Z}
    type: test_set
    title: "Test Plan for M{X}S{Y}"
    milestone_id: M{X}
    derived_from:
      - SPEC-M{X}S{Y}
      - VER-M{X}S{Y}V
    status: draft
    ---
  1. Traceability Table Initialization: Create a Markdown table with exactly these four columns starting strictly at the left margin with zero leading spaces:
markdown
    ## Traceability:

    | Test File | Verification ID | Requirement ID | Test Type |
    | :--- | :--- | :--- | :--- |

For each test generated, append a row matching this structure: | tests/M{X}/S{Y}/test__.sh | V-FR-Y | FR-Y | IMPLEMENTATION_CHECK |

Table Formatting Integrity (CRITICAL):
  • Prohibit List Prefixes: You are strictly prohibited from writing table rows as bulleted or numbered list items (e.g., prefixing them with - or_ ).
  • Zero Indentation: Every row must start strictly at the left margin (no leading spaces). Indenting table rows converts them to preformatted blocks, which breaks downstream regex parsers.
  • Clean Characters: Do not write HTML non-breaking spaces (  or 0xC2 0xA0) in headers or cells. Use standard ASCII spaces only.

5. Verification-Only & Traceability Rules
  • traceability Mandate: Every generated test script MUST be traceable to one or more Verification IDs and Requirement IDs. Tests must never be created based on implicit developer assumptions or prose wording not defined in the verification protocol.
  • Traceability Comment Headers: Every executable test script MUST begin with a valid, language-specific shebang on line 1, followed immediately by metadata comments.
    • For Bash scripts (.sh), line 1 MUST be:
      bash
      #!/bin/bash
      # {Verification IDs: V-FR-Y}
      # {Requirement IDs: FR-Y}
      # Test Type: IMPLEMENTATION_CHECK
    • For Python scripts (.py), line 1 MUST be:
      python
      #!/usr/bin/env python3
      # {Verification IDs: V-FR-Y}
      # {Requirement IDs: FR-Y}
      # Test Type: IMPLEMENTATION_CHECK
5b. Test Sanitization Step (Automatic Pre-flight Cleanup)

After all test scripts are written but before syntax validation, you MUST run the test sanitizer:

python3 ~/devcode/aef/agent/bin/omp-sanitize-tests.py tests/M{X}/ milestones/M{X}/

This removes pre-flight binary existence traps from test scripts and prunes stale ledger rows referencing non-existent test files. Run this BEFORE syntax validation to ensure clean baseline.


6. Test Strategy & Syntax Validation
  • Test Strategy Declaration: Before writing any test file, declare its strategy on a single line based on the target requirement type: _ .sh $ ightarrow$ bash-only, no embedded classes or methods of other languages. _ .py $ ightarrow$ pytest, using native python testing libraries. _ .md/YAML frontmatter $ ightarrow$ structural document/field validation in Python. _ HTML/template $ ightarrow$ DOM structure/class assertions.
  • The Python Schema Assertion Rule (CRITICAL): Every generated SPECIFICATION_CHECK or ENVIRONMENT_CHECK that validates Markdown files, frontmatter keys, schemas, or static directory structures MUST be written strictly as Python .py pytest scripts.
  • Raw Grep Prohibition: You are STRICTLY PROHIBITED from writing Bash shell scripts (.sh) that use grep, egrep, awk, or sed to match exact prose or search for negative/positive constraints on specification files.
  • The Positive Invariant Rule: All specification checks MUST assert the positive presence of structured key-value keys or headers (e.g. assert "status" in data) using Python's standard yaml and re libraries, rather than checking for the absence of vague text, which prevents reversed-boolean logic failures.
  • Strict Milestone Agnosticism: Process artifacts using only their specified identifiers. Do not infer context from other milestones or files. If a verification protocol references an external dependency not provided, stop and report it.
  • Robust Markdown Table Parsing: Verify that all tables parsed from the verification contract are structurally valid. If table parsing fails, halt and report.
  • Shell Variable Quoting Rule: All shell variables in .sh files MUST be double-quoted (e.g., "$VARIABLE") to prevent word-splitting and glob expansion failures.
  • File Integrity Self-Check Rule: Before writing files, verify that:
  • Text files are non-empty and contain zero NUL bytes (0x00). _ Executable files have a valid shebang line (e.g., #!/bin/bash). _ All written scripts are made executable (chmod +x via the bash tool).
  • Self-Healing Syntax Compiler Check (CRITICAL):
    • Immediately after writing a test script, run a syntax check matching the language (bash -n for shell, python3 -m py_compile for Python).
    • The Self-Healing Loop: If the syntax validation fails with an IndentationError, SyntaxError, or other compiler error:
      1. Do NOT delete the file or halt immediately.
      2. Read the compiler's error output to identify the exact line number and description.
      3. Use your edit tool to correct the spacing, indentation, or syntax error in the file.
      4. Re-run the syntax compiler check.
    • You are authorized to execute this self-healing loop up to 3 times per file. If the file still fails to compile after 3 attempts, delete the file, halt execution, and report the validity failure to the user. This ensures minor spacing typos do not freeze the SDD pipeline.

Enhanced System Validation:

  • Use lsp to verify test targets are discoverable in codebase
  • Use code-search to confirm fixture files and test structures referenced in verification protocol exist
  • Validate that test targets are actual code entities, not invented interfaces
  • When tests involve artifact validation, confirm core/validation.py contracts are testable
  • When tests involve frontmatter, confirm core/artifacts/metadata.py behavior is testable

7. Test Type Classification & TDD Alignment (FR-3, FR-4)

You MUST classify every test in your ledger as exactly one of these types:

  • SPECIFICATION_CHECK or ENVIRONMENT_CHECK: Reserved strictly for checking static documents, directory setups, and configurations. These tests MUST return PASS (Exit Code 0) on a blank codebase.
  • IMPLEMENTATION_CHECK or INTEGRATION_CHECK: Used for checking executable code and active CLI/API features.
  • The TDD Pre-Implementation Rule (CRITICAL): Executable implementation checks MUST test observable, run-time behavior. Because the implementation binary or logic does not exist yet on a blank codebase, these tests must fail naturally with exit code 127 (Command Not Found) or exit code 1 (Assertion Failed). This natural failure is the correct, expected VALID_INITIAL_FAILURE.
  • No Error Trapping: You are strictly forbidden from trapping, masking, or catching command-not-found (127) errors to force a passing exit code (0) before implementation is present. The script must execute the target command directly and allow natural shell failures to bubble up.

8. Verification Methods & Assertion Guidelines
  • Specification Checks (DOCUMENT_CHECK / FRONTMATTER_CHECK): _ Prefer structural parsing (e.g., parsing YAML frontmatter, validating required keys, enums, arrays, and relationship schemas). _ Prose Matching Ban: You are strictly prohibited from grepping specifications for exact English prose or descriptive strings (e.g., searching for "id (canonical machine identifier)") unless the specification explicitly demands an exact literal match.
  • **Implementation Checks (SCRIPT_EXECUTION / UNIT_TEST / INTEGRATION_TEST):
  • Must test observable behavior (CLI commands, structured JSON/YAML outputs, filesystem state mutations). _ Do not invent functions or API paths that are not explicitly declared in the specification. _ The Verification Gap Block: If a verification item contains a DOCUMENT_CHECK targeting the specification file itself for a functional requirement that represents executable code, you MUST reject the verification protocol as a "Verification Gap" and block test generation. Do NOT write dummy tests that parse markdown files for English text.

9. Test Oracle Independence
  • Every generated test MUST rely on an independent, static oracle (such as the verification contract, a specification-defined invariant, a fixed directory fixture, or a deterministic schema).
  • Prohibited Sources: The oracle MUST NOT be derived from the output of the implementation under test, the implementation's own validation helper, or any dynamically generated values sharing the same code path. If an independent oracle cannot be established, you must NOT generate the test.

10. Test File Design
  • Generate highly focused test files.
  • One test file may contain multiple assertions only when they verify one coherent verification target. Avoid combining unrelated checks into a giant script.
  • Do not create duplicate tests for the same verification ID unless explicitly justified.

  • The Ponytail Test Constraint: Write focused, high-signal assertions. You are strictly prohibited from generating bloated mock setups, redundant boilerplates, or writing multiple test scripts to cover a single coherent behavior. One elegant test file per verification target is the standard.

While generate-tests does not run implementation-level test iterations, you MUST execute the generated tests exactly once before completing the skill to establish the pre-implementation baseline:

  1. Verification Steps:
  • Verify repository root and expected test directory. _ Verify test files match the exact list in the test ledger. _ Ensure execution is completely non-destructive (no git clean, no deletions of user files, and no modification of production files).
  1. Initial Failure Assessment: _ Run the generated scripts. _ Verify that SPECIFICATION_CHECK and ENVIRONMENT_CHECK tests pass immediately with exit code 0. _ Verify that IMPLEMENTATION_CHECK and INTEGRATION_CHECK tests fail naturally with exit code 127 or 1, registering a clean VALID_INITIAL_FAILURE. _ If any test exits with code 2 (VALIDITY_FAILURE due to syntax errors or self-scanning), the pre-implementation gate is locked. Delete the broken script, correct the generator rules, and recreate.

Enhanced System Validation:

  • Use lsp to verify test targets exist before executing tests
  • Use code-search to confirm fixture dependencies are present
  • Validate that test execution does not inadvertently modify production code

12. Persistence Gate

After all files are successfully generated:

  • Verify that every test script listed in your ledger physically exists on disk at tests/M{X}/S{Y}/ and is non-empty.
  • Run git status --short to ensure all newly generated test scripts and test plans are actively tracked and visible to Git (not ignored by .gitignore).
  • SYSTEM VALIDATION: Verify all test targets referenced in verification protocol exist in codebase via lsp or code-search

13. Interactive Handoff (Mandatory)

After all files are successfully generated and validated, you MUST use the ask tool to present the user with a selection of next logical steps to advance the SDD pipeline.

Option LabelAction
Evaluate TestsRun /evaluate-tests to verify your TDD pre-implementation baseline against the newly generated tests.
Review Test PlanReturn to reviewing the test plan ledger (M{X}S{Y}T{Z}.md) for coverage and traceability.
CustomLet me specify a different next step.

You MUST NOT attempt to invoke any downstream skills (such as implement-specification or evaluate-implementation) programmatically. To advance the pipeline, you must STOP your execution after presenting the interactive ask handoff in Section 11.5. The ask tool selection will provide a pre-written next-step command for the user to confirm. Do NOT emit the legacy hardcoded text message [TEST_GENERATION_COMPLETE] ... — the interactive ask prompt replaces this mechanism entirely.


14. Final Traceability Audit & Pipeline Handoff

Before concluding your execution turn:

  • Perform a final traceability sweep to ensure no orphan requirements, orphan verification items, or orphan test plans exist.
  • All written scripts must be made executable (chmod +x).
  • SYSTEM AUDIT: Verify all test targets are compatible with existing AEF core infrastructure (core/validation.py, core/artifacts/*)

15. File Generation Integrity
  • UNIX Line Ending Enclosure: You MUST write all generated test scripts using Unix-style LF line endings (\n). You are strictly prohibited from writing or preserving carriage returns (\r\n), as they cause shell execution failures.

16. Enhanced System-Specific Considerations

AEF Core Infrastructure Integration: When verification protocols reference AEF core components, your test generation MUST:

  1. Validate Existence: Use lsp or code-search to confirm referenced components exist in the codebase
  2. Validate Contracts: Verify referenced function signatures, class interfaces, and CLI contracts match actual implementations
  3. Document Dependencies: Note which core components are required for test execution
  4. Respect Boundaries: Define tests at the verification level, not implementation level

Working AEF Core Components Reference:

Validation Layer:

  • core/validation.py: validate_metadata(artifact_path), validate_artifact(metadata), ValidationResult, ArtifactValidationResult, Validator
  • Use these contracts when verification protocols describe artifact validation requirements

Artifact Metadata Layer:

  • core/artifacts/metadata.py: extract_frontmatter(filepath), parse_metadata(content), get_metadata_from_file(file_path)
  • Use these contracts when verification protocols describe frontmatter or metadata extraction

Registry Layer:

  • core/artifacts/registry.py: ArtifactRegistry, get_registry(), register_type(), get_storage_rule(), store_relationship(), get_relationships()
  • Use these contracts when verification protocols describe type registration, storage rules, or relationship tracking

Resolution Layer:

  • core/artifacts/resolution.py: resolve_artifact(...), construct_canonical_path(...)
  • core/artifacts/resolve.py: main() CLI entry point
  • Use these contracts when verification protocols describe artifact resolution or path construction

Type System:

  • core/artifacts/types.py: CanonicalArtifactType, get_artifact_type(), get_all_artifact_types(), get_type_definition(), get_all_type_definitions()
  • Use these contracts when verification protocols describe artifact type definitions or type queries

Error Handling:

  • core/artifacts/errors.py: AmbiguousResolutionError and related exceptions
  • Reference these when verification protocols describe error conditions or failure modes

Creation and Migration:

  • core/artifacts/creation.py: create_artifact(...)
  • core/artifacts/migration.py: migrate_legacy_artifact(...)
  • Use these contracts when verification protocols describe artifact creation or legacy migration

Required Investigation Methods:

  1. Verification Protocol Analysis: Extract testable contracts from verification protocol
  2. Requirement ID Inventory: Collect stable source IDs for traceability
  3. Test Target Discovery: Use lsp to discover existing public APIs and function signatures
  4. Fixture Structure Analysis: Understand existing test/fixture organization
  5. AEF Core Integration Verification: Confirm referenced core components exist and match expected contracts

Controlled Investigation Commands:

bash
# Extract verification items from protocol
grep -E "^V-FR-|^- V-" milestones/M{X}/M{X}S{Y}V.md

# Discover test targets via lsp
lsp symbols milestones/M{X}/M{X}S{Y}V.md

# Analyze fixture structure
code-search "def.*fixture\|class.*Fixture\|test.*structure"

# Verify AEF core component existence
code-search "from core.validation import\|from core.artifacts\."

This enhanced generate-tests skill now provides comprehensive system awareness while strictly respecting behavioral contract boundaries, ensuring generated tests are both deterministic and system-aligned with the existing working AEF infrastructure core.

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة أثناء تحميل المهارة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Generate Tests؟

Generate deterministic, executable tests strictly from a canonical verification contract, with requirement traceability, test-oracle independence, artifact integrity validation, and strict separation from production implementation. Prevent interpreter mismatches and pre-flight binary existence loops.

لماذا تستخدم Generate Tests على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Generate Tests عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Generate Tests في TypingMind؟

افتح الإضافات → المهارات → التثبيت من GitHub في TypingMind والصق https://github.com/bparlan/omp-agent/tree/main/skills/generate-tests. يقرأ TypingMind ملف SKILL.md الخاص بها، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Generate Tests؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Generate Tests؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Generate Tests معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Generate Tests مجانية؟

نشرها bparlan على GitHub. راجع المستودع للاطلاع على شروط الترخيص. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا البريدية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇