Files
rag-technical-docs-assistant/docs/agent-guidance/RAG-Phase1-Skills-Creation-Prompt.md
amirhosein mazaheri ca8833dd2f docs: restructure documentation hierarchy and update agent reference map
- Organize architecture, specifications, plans, and guides into dedicated subdirectories under docs/
- Remove legacy and duplicate documents from data/documents/
- Update AGENTS.md, README.md, and agent skills to target canonical docs paths
2026-10-07 16:19:24 +03:30

14 KiB
Raw Permalink Blame History

Prompt: Create Repository Skills for the Phase 1 RAG Assistant

Paste the following prompt into the coding agent with the project repository open. Make the six current project documents available in the repository first; their exact directory is discovered by the agent. This prompt creates development skills, not application features.


You are working inside my Organization Knowledge Assistant repository. Create three practical, repository-scoped development skills:

  1. implement-feature
  2. write-tests
  3. review-change

Integrate relevant real-provider RAG evaluation into write-tests; do not create a separate verify-rag-flow skill.

Implement the skill files and necessary references now. Do not stop at a proposal or print hypothetical file contents. Do not implement product features while creating these skills.

1. Inspect the repository and agent environment

Before writing:

  • Locate the repository root and inspect Git status. Preserve unrelated modifications.
  • Read applicable root and nested AGENTS.md files and any existing skill-authoring instructions.
  • Inspect the agent's actual supported repository skill location and existing skill conventions. Use that supported location; do not assume a directory merely because it appears in an example. If no project skill discovery mechanism is available, create reusable skill documents in a clearly identified repository directory and report that automatic discovery is unverified. Do not claim installation without evidence.
  • Inspect existing skills by frontmatter name. Update equivalent project-owned skills rather than creating duplicate names. Do not modify system, plugin or globally installed skills.
  • Inspect the application tree, dependency manifests, test configuration, CI and existing commands. Do not prescribe a new framework or test runner when suitable conventions already exist.
  • Prefer rg and rg --files for discovery.

Do not hardcode paths from another machine, ChatGPT scratch directories, Library IDs or inaccessible sandbox links.

2. Resolve the actual project references

Find these exact filenames, wherever they are located in the repository:

Document Purpose
RAG-AI-Phase1-Delivery-Plan.md Phase 1 scope, delivery sequence and acceptance criteria
RAG-Phase1-Implementation-Guide.md Modules, responsibilities, workflows and implementation boundaries
RAG-Phase1-API-Catalog.md Routes, DTOs, permissions, errors, retry and idempotency contracts
RAG-Phase1-Database-Design.md Current schema, constraints, transactions and migration approach
RAG-Phase1-Scenario-Report-FA.md Business scenarios and Persian explanations
RAG-AI-Architecture.md Wider architecture and future direction

Read enough of each to verify it is the current simplified design. The current design has independent uploaded documents and no document-content versioning. Do not select an obsolete document just because its filename matches. Resolve duplicates using content, repository context and document status; ask a focused question only when competing authoritative copies cannot be distinguished.

Create or update one small shared reference index in the repository's existing documentation area. If there is no convention, use docs/development/agent-reference-map.md. Record:

  • The actual relative path to each document and what it governs.
  • Which sections each skill should consult, preferably with verified heading anchors or heading names.
  • Actual relevant source/test directories and verified development commands.
  • Any missing references or unresolved contradictions, explicitly labelled.

Do not copy whole documents into the skills. Do not fabricate missing contents, executable commands, schema fields or approval decisions. If a required document is missing, continue building the available skill structure; label the relevant workflow blocked on that reference and report exactly what is missing. Do not leave a broken link disguised as an existing reference.

Every skill must link directly to this reference index using a valid relative link from its own SKILL.md. Within the index, resolve links relative to the index file. Verify every path and any heading anchor you create. Avoid machine-specific absolute paths and symlinks outside the repository.

Reference authority:

  • Follow governing instructions and the user's explicit current task.
  • Use the Phase 1 plan for scope; API and database documents for their contracts; implementation guide for workflows.
  • Treat the broader architecture as context, not permission to implement deferred features.
  • Treat existing code as implementation evidence, not automatic proof that conflicting behavior is correct.
  • Surface material contradictions; do not silently rewrite policy or expand scope. Continue unrelated work when a decision blocks only one part.

3. Keep shared project rules in AGENTS.md

Preserve existing instructions. Add a concise section only where the rules belong; avoid duplicating nested instructions. Include these current invariants:

  • Deliver within Phase 1 scope using the existing modular backend and separate ingestion worker.
  • Each upload creates an independent document; content is not overwritten in place.
  • Do not introduce document_versions, version_id or version_no for document content.
  • Chunks and ingestion jobs reference document_id; answer sources reference document_id and chunk_id.
  • Retry processes the same eligible failed document; it does not create a new document identity.
  • Only authorized, ready, active and undeleted documents are searchable.
  • The backend derives trusted identity and search scope. Model arguments cannot override them.
  • Text and Live use the same backend search implementation.
  • Keep persistent provider secrets server-side.
  • Follow documented request deduplication, worker claim/lease rules and context invalidation behavior where relevant.
  • Keep API/schema documentation aligned with intentional contract changes. Never alter contracts just to excuse a bug.
  • Avoid unnecessary dependencies, services, abstractions and unrelated refactoring.

Configuration revisions and embedding profile metadata are not document-content versioning and must not be removed accidentally.

Link to the shared reference map instead of embedding all requirements into AGENTS.md. Add verified project commands only; label commands not yet runnable rather than guessing that they work.

4. Skill structure and authoring requirements

For each skill create a SKILL.md with valid YAML frontmatter:

  • name: exactly the requested skill name.
  • description: concise purpose and specific triggering situations, including when not to use it if needed to prevent over-triggering.

Follow the actual agent's supported metadata schema. Add UI metadata only if supported and useful; validate it using the available authoring guidance. Never invent metadata keys.

Keep each skill procedural, specific and concise; aim for approximately 100–200 lines or less. Include relevant references, the workflow, verification requirements, stopping conditions and an output format. Do not add filler README files, duplicate manuals, unused resources or scripts that only wrap a single ordinary command.

Skills must not recursively invoke one another in a loop. Implementation includes its necessary validation; test-writing develops tests; review is read-only unless fixing is explicitly requested.

Skill A: implement-feature

Trigger: implement or modify a scoped application capability in this repository.

Workflow:

  1. Identify requested behavior, acceptance criteria and relevant references.
  2. Inspect the existing implementation, test patterns and affected integration boundaries.
  3. State a short implementation plan proportional to the task. Continue without routine permission requests.
  4. Implement the smallest complete change across the necessary API, application, persistence/provider and UI boundaries. Do not force edits into layers the task does not affect.
  5. Handle relevant permissions, state transitions, errors and concurrency/idempotency requirements.
  6. Preserve provider-neutral application boundaries and shared retrieval.
  7. Add meaningful tests for changed behavior and regressions. Reuse existing fixtures.
  8. Run relevant checks using repository commands; update affected docs for intentional contract changes.
  9. Report changed behavior, files, actual checks and remaining limitations.

If the task explicitly changes a contract, update its documentation and consumers coherently. If a product decision is genuinely missing, isolate it and request that decision without inventing it. Do not ask for permission for ordinary reversible implementation choices.

Skill B: write-tests

Trigger: create, extend or improve tests for an identified behavior, regression or release risk.

Workflow:

  1. Read the intended behavior and existing tests before choosing assertions.
  2. Select the smallest useful test level: unit, integration, contract or end-to-end.
  3. Cover relevant success, failure and boundary cases; avoid mechanically enumerating irrelevant combinations.
  4. Use the repository's runner, fixtures and naming conventions.
  5. Mock external providers at the adapter/transport boundary where appropriate. Do not mock the behavior under test or treat a fake database as proof of PostgreSQL constraints.
  6. Use an isolated PostgreSQL/pgvector test environment when testing database-specific transactions, vector queries or constraints; never run destructive fixtures against production.
  7. Keep ordinary automated tests deterministic and network-free by default. Control clocks and retries through injected dependencies where the code supports them.
  8. Run the targeted tests and explain failures. Do not weaken assertions, skip regressions or change expected behavior merely to make the suite pass.
  9. Distinguish a product bug, a test defect and an unavailable environment. Report an exposed product bug without silently expanding a tests-only task into a production fix.

Choose relevant cases from:

  • Authorized upload, invalid files, failed extraction and no publication of partial chunks.
  • Duplicate upload/chat request replay and changed-payload conflicts.
  • Active/ready/deleted filtering and forged scope arguments.
  • Worker lease expiry, stale claim rejection and duplicate-free publication.
  • Turn state, conversation ownership, interruption and source mapping.
  • Document deactivation and stale context handling.
  • Live tool dispatch using shared retrieval, duplicate tool events and close/failure state.

Add a clearly separate optional section: Real-provider RAG evaluation.

Use it when real-output quality is requested or release readiness requires it and the environment/data access is authorized. Prepare a small corpus and questions with expected evidence, including paraphrases, missing knowledge and follow-ups. Check extraction, retrieved evidence, answer support and source identity separately. Test text and voice separately. Prefer factual assertions over exact full-answer wording. Label any model-based judging and human checks; do not present them as deterministic proof.

Use bounded requests, protect sensitive data and honor existing cost/network authorization. If credentials, corpus, a runnable service or required voice interaction are unavailable, report the evaluation as not run. Never fabricate metrics or claim mock results establish real-model quality. Keep this optional evaluation out of the default unit-test run.

Skill C: review-change

Trigger: review a diff, implementation or proposed merge for defects and contract violations.

Workflow:

  1. Resolve the requested review scope and base. Inspect the diff and relevant surrounding code/tests/docs.
  2. Check correctness, authorization, contract alignment, data integrity, failure behavior and relevant concurrency/retry issues.
  3. Pay particular attention to inactive-document leaks, stale context, duplicate provider work, invalid citations and application/provider boundary mistakes where those areas changed.
  4. Use targeted read-only inspection or checks to validate suspected findings. Do not execute production writes.
  5. Prioritize actionable defects over stylistic preferences; avoid speculative findings without a concrete failure path.
  6. Report each finding with severity, actual file and location, trigger, impact and recommended correction direction.
  7. If no defects are found, say so with the review scope and untested risks. Do not invent findings to populate the report.

Default to review-only. Do not modify code unless the user asks for fixes. Do not report unimplemented roadmap features as bugs when the Phase 1 plan defers them.

5. Validate the created skills

Validate in the repository where the skills will be used:

  • Frontmatter parses; names match; descriptions distinguish the three workflows.
  • All referenced files and heading anchors resolve from their actual locations.
  • No scratch paths, fabricated commands, stale document-version requirements or placeholder links remain.
  • Existing instructions and unrelated modifications are preserved.
  • The three skills route these representative requests correctly:
    • “Implement document upload and processing status.” → implement-feature.
    • “Add regression tests for repeated chat submissions.” → write-tests.
    • “Review this change for inactive-document exposure.” → review-change.
    • “Evaluate these real questions before the demo.” → optional RAG evaluation within write-tests, with prerequisites checked.
  • Review hypothetical behavior for missing docs, unavailable providers and a discovered product bug. Do not implement those product scenarios as part of skill creation.

Use the agent's available skill validator when present. If unavailable, validate YAML and links using existing tools and state the limitation. Do not install an unrelated toolchain merely for validation. If you add a reusable validation script, actually run it and verify its output.

Do not commit, push, deploy or install skills globally unless governing repository instructions or the user's authorization require it. Creating files is not evidence that the agent has discovered them: verify discovery if possible, otherwise explain how to invoke the files explicitly and label automatic discovery unverified.

6. Final report

Return:

  1. The created/updated file tree and actual paths.
  2. A brief explanation of each skill and one invocation example using this agent's supported syntax.
  3. The actual project-document reference mapping.
  4. Validation performed and results.
  5. Any missing documents, unresolved decisions or discovery limitations.

Keep the final report concise. Do the file work before returning it.