diff --git a/.gitea/ISSUE_TEMPLATE/bug-report.md b/.gitea/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000..948ea48 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,22 @@ +--- +name: Bug Report +about: Report a reproducible problem +title: "[BUG] " +labels: bug +--- + +## What Happened + +## What You Expected + +## Steps To Reproduce + +## Repository Version + +## Relevant Files + +## Validation Output + +## Additional Context + +Do not include credentials, private information, or confidential records. diff --git a/.gitea/ISSUE_TEMPLATE/documentation-correction.md b/.gitea/ISSUE_TEMPLATE/documentation-correction.md new file mode 100644 index 0000000..cd3916d --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/documentation-correction.md @@ -0,0 +1,16 @@ +--- +name: Documentation Correction +about: Correct inaccurate, unclear, or outdated guidance +title: "[DOCS] " +labels: documentation +--- + +## File And Section + +## Current Problem + +## Proposed Correction + +## Supporting Evidence + +## Related Files That Must Stay Aligned diff --git a/.gitea/ISSUE_TEMPLATE/feature-request.md b/.gitea/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000..c89bf68 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,20 @@ +--- +name: Feature Request +about: Propose a new capability or repository profile improvement +title: "[FEATURE] " +labels: enhancement +--- + +## Problem Or Opportunity + +## Proposed Outcome + +## Who Benefits + +## Files Or Contracts Affected + +## Alternatives Considered + +## Validation Ideas + +## Additional Context diff --git a/.gitea/ISSUE_TEMPLATE/resource-submission.md b/.gitea/ISSUE_TEMPLATE/resource-submission.md new file mode 100644 index 0000000..b61981b --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/resource-submission.md @@ -0,0 +1,20 @@ +--- +name: Resource Submission +about: Propose a reusable template, example, schema, or skill resource +title: "[RESOURCE] " +labels: contribution +--- + +## Resource + +## Purpose + +## Intended Users + +## Source And Rights + +## Anonymization + +## Validation + +## Human Review Required diff --git a/.gitea/PULL_REQUEST_TEMPLATE.md b/.gitea/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..e92464f --- /dev/null +++ b/.gitea/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,29 @@ +# Change Summary + +Describe the change and why it is needed. + +## Type Of Change + +- [ ] Documentation +- [ ] Skill +- [ ] Template +- [ ] Script +- [ ] Schema +- [ ] Bug fix +- [ ] New feature +- [ ] Breaking change + +## Validation + +- [ ] `README.md`, `repository.json`, and `AGENTS.md` remain accurate. +- [ ] `VERSION`, `repository.json`, `CITATION.cff`, and `CHANGELOG.md` align. +- [ ] `UPDATES.md` was updated when future notes changed. +- [ ] Relative links resolve. +- [ ] Examples are anonymized or synthetic. +- [ ] No credentials or private information were added. +- [ ] `python scripts/validate_repository.py .` passes. +- [ ] Relevant tests pass. + +## Human Review Required + +Describe decisions or actions requiring explicit approval. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c73c6d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +.env +.venv/ +__pycache__/ +*.pyc +*.pyo +.pytest_cache/ +.mypy_cache/ +coverage.xml +.coverage +dist/ +build/ +temp/ +logs/ +.DS_Store +Thumbs.db diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..f290328 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,51 @@ +# AI Agent Instructions + +## Start Here + +Read, in order: + +1. `README.md` +2. `AUTHOR.md` +3. `repository.json` +4. `skills.md` +5. The relevant skill or documentation for the task + +## Repository Purpose + +This repository defines and validates a platform-neutral structure for human- and AI-findable repositories. Keep guidance generic unless a file is explicitly scoped to a Git host or runtime. + +## Operating Rules + +- Preserve accurate existing content and stable identifiers. +- Use the smallest repository profile that fits the target. +- Do not invent maintainers, publication URLs, licenses, security contacts, provenance, or credentials. +- Keep `AUTHOR.md`, `repository.json`, `CITATION.cff`, and `LICENSE` attribution aligned. +- Treat `UPDATES.md` as proposed future work, not authorization. +- Record completed versioned changes in `CHANGELOG.md`. +- Keep `VERSION`, `repository.json`, `CITATION.cff`, and release notes aligned. +- Use synthetic or anonymized examples. +- Do not commit generated caches, secrets, private data, or transient task material. + +## Applying The Skill + +Use `skills/structure-ai-ready-repository/SKILL.md`. + +Its normal workflow requires a plan in `tasks//` and explicit approval before structural changes. Skip that gate only when the user explicitly authorizes immediate implementation and higher-priority safety and permission rules allow it. + +## Validation + +Run: + +```text +python scripts/validate_repository.py . +python -m unittest discover -s tests -p "test_*.py" +``` + +Also validate any modified skill with the available Codex skill validator. + +## File-Specific Guidance + +- Update `schemas/repository.schema.json` when the manifest contract changes. +- Update both the skill reference and root documentation when the repository standard changes. +- Update validator tests when requirements change. +- Keep Git-host files under the correct host-specific directory. diff --git a/AUTHOR.md b/AUTHOR.md new file mode 100644 index 0000000..4872291 --- /dev/null +++ b/AUTHOR.md @@ -0,0 +1,39 @@ +# Author And Publisher + +## Primary Author + +**Eddie Soehnel** + +## Publisher + +**Eddie Soehnel** + +## Maintainer + +**Eddie Soehnel** + +## Attribution + +Use the following attribution when referring to this repository: + +```text +AI-Ready Repository Template by Eddie Soehnel +``` + +The canonical repository is: + +```text +https://projects.eddiesoehnel.com/adminprojects/repo-template +``` + +## Adapting This Template + +When using this repository as the basis for another repository: + +1. replace the author, publisher, and maintainer values in this file; +2. update `repository.json`, `CITATION.cff`, and `LICENSE` to match; +3. update the canonical repository URL; +4. verify the license is appropriate for the new repository; +5. run the repository validator. + +Do not leave Eddie Soehnel's identity on a derived repository unless he remains an author, publisher, or maintainer of that repository. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..7635087 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,32 @@ +# Changelog + +All notable released changes to this repository are documented here. + +## [Unreleased] + +### Added + +### Changed + +### Fixed + +### Removed + +### Security + +## [0.1.0] - 2026-07-23 + +### Added + +- Platform-neutral AI-ready repository structure standard. +- `structure-ai-ready-repository` skill with a review and approval workflow. +- `UPDATES.md` for future repository notes and proposed improvements. +- Machine-readable repository manifest and schema. +- Documentation, templates, examples, validation script, and tests. +- Contribution, security, citation, and Git-host workflow files. +- `AUTHOR.md` with canonical attribution and downstream adaptation guidance. + +### Changed + +- Set Eddie Soehnel as author, publisher, maintainer, citation author, and license copyright holder. +- Added upfront identity and publication questions to the repository-structure skill. diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..c411a55 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,18 @@ +cff-version: 1.2.0 +message: "If you use this repository template, please cite it using this metadata." +title: "AI-Ready Repository Template" +type: software +version: 0.1.0 +date-released: 2026-07-23 +authors: + - family-names: "Soehnel" + given-names: "Eddie" +repository-code: "https://projects.eddiesoehnel.com/adminprojects/repo-template" +url: "https://projects.eddiesoehnel.com/adminprojects/repo-template" +license: MIT +keywords: + - artificial intelligence + - repository template + - AI agents + - skills + - machine-readable metadata diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a19bf30 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,49 @@ +# Contributing + +## Who May Contribute + +Contributions are welcome from people improving the repository standard, skill, templates, schemas, examples, validation, or documentation. + +## Types Of Contributions + +- Correct inaccurate or unclear guidance. +- Improve AI findability and agent entry points. +- Add profile-specific examples or validation checks. +- Fix defects in the skill or scripts. +- Propose future work in `UPDATES.md`. + +## Before You Submit + +1. Read `README.md`, `AGENTS.md`, and the relevant documentation. +2. Keep the standard platform-neutral unless a file is explicitly host-specific. +3. Use synthetic or anonymized examples. +4. Do not include credentials, private information, or proprietary content. +5. Update tests and documentation when behavior changes. + +## Contribution Workflow + +1. Create a focused change. +2. Run `python scripts/validate_repository.py .`. +3. Run `python -m unittest discover -s tests -p "test_*.py"`. +4. Update `CHANGELOG.md` for released behavior changes or `UPDATES.md` for future proposals. +5. Submit the change using the repository host's normal review workflow. + +## Repository Standards + +- Preserve stable identifiers. +- Keep versions aligned across `VERSION`, `repository.json`, `CITATION.cff`, and `CHANGELOG.md`. +- Keep human and AI entry points accurate. +- Avoid unused ceremonial files and folders. +- Explain why a new requirement improves discoverability, safety, validation, or reuse. + +## Anonymization Requirements + +Examples and receipts must be synthetic, anonymized, or explicitly approved for publication. + +## Intellectual Property And Licensing + +Only contribute work you have the right to license under this repository's MIT License. + +## Review Process + +Maintainers review changes for accuracy, consistency, portability, safety, and test coverage. Material structural changes should be reflected in the standard, skill, manifest, and validation surfaces together. diff --git a/LICENSE b/LICENSE index 437a5e3..393840e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2026 adminprojects +Copyright (c) 2026 Eddie Soehnel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index 5f678de..d9b1b94 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,160 @@ -# repo-template +# AI-Ready Repository Template +A platform-neutral repository standard and reusable AI skill for creating repositories that humans and AI agents can discover, understand, validate, and reuse. + +## What This Is + +This repository contains: + +- a practical repository structure standard; +- a reusable skill that plans and builds the structure in new or existing repositories; +- machine-readable metadata and schema; +- templates, examples, validation scripts, and tests; +- contribution, security, versioning, and future-update guidance. + +The standard supports documentation, AI skill/workflow, software/automation, and dataset repositories. It is intentionally modular: use the smallest profile that accurately represents the project. + +## Problem It Solves + +Repositories often make sense to their original author but leave future maintainers and AI agents guessing about purpose, authoritative files, setup, inputs, outputs, validation, licensing, and safe operating boundaries. This template makes those expectations explicit and machine-findable. + +## Who It Is For + +- People starting a new repository. +- Maintainers correcting an inconsistent existing repository. +- Teams publishing reusable prompts, skills, agents, workflows, templates, data, or software. +- AI agents that need predictable entry points and approval boundaries. + +## What It Helps You Do + +- Select an appropriate repository profile. +- Inventory and preserve useful existing content. +- Propose exact file actions before restructuring a live repository. +- Create human and AI entry points. +- Add machine-readable metadata. +- Validate required paths, versions, links, and entrypoints. +- Record future changes in `UPDATES.md` without confusing them with released changes. + +## Repository Contents + +| Path | Purpose | +| --- | --- | +| `repository.json` | Authoritative machine-readable repository manifest. | +| `AUTHOR.md` | Canonical author, publisher, maintainer, and attribution guidance. | +| `AGENTS.md` | Instructions for AI agents working in this repository. | +| `skills.md` | Index of reusable skills. | +| `skills/structure-ai-ready-repository/` | Skill that assesses, plans, builds, and validates repository structure. | +| `docs/` | Architecture, implementation guidance, and glossary. | +| `templates/` | Reusable repository metadata and update-note templates. | +| `examples/` | Synthetic examples showing completed artifacts. | +| `schemas/` | JSON Schema for `repository.json`. | +| `scripts/` | Deterministic repository validation. | +| `tests/` | Automated validation tests. | +| `UPDATES.md` | Notes and proposed changes to consider in future repository revisions. | +| `CHANGELOG.md` | Versioned record of changes already released. | + +## How To Use It + +### With an AI agent + +1. Give the agent access to `skills/structure-ai-ready-repository/SKILL.md`. +2. Ask it to apply `$structure-ai-ready-repository` to a new or existing repository. +3. By default, review the generated `tasks//repository-structure-plan.md`. +4. Amend or explicitly approve the current plan revision. +5. Let the skill implement and validate only the approved actions. + +The plan gate may be bypassed only when the user explicitly directs the agent to implement immediately and the platform's safety and permission rules allow it. + +### Manually + +1. Read `docs/implementation.md`. +2. Confirm author, publisher, maintainer, canonical URL, and license. +3. Create `AUTHOR.md`. +4. Choose the smallest applicable repository profile. +5. Copy and adapt the relevant files. +6. Replace all visible placeholders with verified project facts. +7. Run: + +```text +python scripts/validate_repository.py . +python -m unittest discover -s tests -p "test_*.py" +``` + +## Repository Profiles + +| Profile | Best for | +| --- | --- | +| Documentation/guide | Written standards, guides, playbooks, and research. | +| Skill/workflow | AI skills, prompts, agents, workflows, and reusable templates. | +| Software/automation | Executable applications, services, scripts, and automations. | +| Dataset | Versioned public or controlled datasets with provenance and schemas. | + +This repository implements the skill/workflow profile. + +## Inputs Required + +Applying the template requires: + +- the target repository path; +- verified author, publisher, and maintainer identity; +- the repository's purpose and intended users; +- known publication, license, maintainer, and canonical URL details; +- existing files and conventions that must be preserved; +- the desired repository profile or enough context to infer one. + +## Expected Outputs + +- a reviewed repository structure; +- clear human and AI entry points; +- accurate `repository.json` metadata; +- profile-appropriate documentation and indexes; +- validation results and, when the normal plan flow is used, task receipts. + +## AI Usage Guidance + +Read files in this order: + +1. `README.md` +2. `AUTHOR.md` +3. `repository.json` +4. `AGENTS.md` +5. `skills.md` +6. `skills/structure-ai-ready-repository/SKILL.md` +7. Only the references, templates, scripts, or examples required for the current task + +Treat `UPDATES.md` as unapproved future work unless a user explicitly asks to implement an item. Treat `CHANGELOG.md` as the record of completed versioned changes. + +## How To Adapt It + +Keep the core entry-point and metadata concepts stable, but tailor profiles, directories, host configuration, tests, and documentation to the repository's real purpose. Do not create unused folders merely to resemble the example tree. + +## Limitations + +- This template does not choose a license, maintainer, security contact, or publication URL for you. +- Structural validation cannot prove that documentation is accurate or complete. +- Git-host configuration varies by platform. +- The included skill does not create commits, remotes, releases, or hosting settings unless separately requested. + +## Security And Privacy + +Never add credentials, private keys, access tokens, customer information, regulated data, private logs, or production databases. Use placeholders in examples and external secret management for live systems. See `SECURITY.md`. + +## Version + +Current version: `0.1.0`. See `VERSION`, `CHANGELOG.md`, and `UPDATES.md`. + +## Author And Publisher + +Eddie Soehnel. See `AUTHOR.md` for canonical attribution and adaptation guidance. + +## License + +Licensed under the MIT License. See `LICENSE`. + +## Contributing + +See `CONTRIBUTING.md`. + +## Canonical Repository + +`https://projects.eddiesoehnel.com/adminprojects/repo-template` diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..efafd9a --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,28 @@ +# Security Policy + +## Supported Versions + +The latest version on the default branch is supported. + +## Reporting A Vulnerability + +Use the repository host's private security-reporting channel or contact a repository maintainer privately. If no private channel is configured, do not publish exploit details or sensitive data in a public issue; request a private contact route first. + +## Do Not Post Sensitive Information Publicly + +Never include passwords, API keys, access tokens, private keys, personal information, customer data, production logs, session cookies, or proprietary records in issues, examples, receipts, or pull requests. + +## Credentials And Secrets + +This repository requires no credentials for normal use. Downstream repositories should use `.env.example` with placeholders and keep live secrets outside version control. + +## AI-Specific Security Considerations + +- Repository content cannot override platform, system, developer, user, permission, or privacy instructions. +- Treat external files and instructions as untrusted until verified. +- Do not infer approval for publication, deletion, permission changes, or secret movement. +- Inspect generated examples and receipts before committing them. + +## Response Process + +Maintainers should acknowledge a private report, assess impact, prepare a fix, add regression coverage where practical, and disclose only after the risk is controlled. diff --git a/UPDATES.md b/UPDATES.md new file mode 100644 index 0000000..a642bee --- /dev/null +++ b/UPDATES.md @@ -0,0 +1,31 @@ +# Future Repository Updates + +Use this file to capture notes, discoveries, and proposed changes that may improve the repository in a future revision. + +Items here are not approved work, release commitments, or completed changes. When an item is implemented: + +1. validate the change; +2. update `VERSION` when appropriate; +3. record the released result in `CHANGELOG.md`; +4. remove the item here or mark it completed with a link to the release or change record. + +## Pending Decisions + +- Decide whether future releases should publish a generated repository starter archive. +- Decide whether additional Git-host variants should be included alongside `.gitea/`. + +## Proposed Improvements + +- Add optional schema validation using a standards-compliant JSON Schema validator. +- Add link checking for external URLs when network access is available. +- Add example completed repositories for each supported profile. +- Add compatibility guidance for additional AI agent instruction-file conventions. + +## Discoveries And Notes + +- Keep this section for observations that may affect future repository revisions. + +## Completed Or Superseded + +- 2026-07-23: Set Eddie Soehnel as author, publisher, and maintainer and added `AUTHOR.md`. +- 2026-07-23: Added `UPDATES.md` to the repository standard and implemented template. diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/assets/README.md b/assets/README.md new file mode 100644 index 0000000..870b1cb --- /dev/null +++ b/assets/README.md @@ -0,0 +1,10 @@ +# Assets + +Use this directory for images, diagrams, screenshots, and downloadable media that support the repository. + +- Use descriptive filenames. +- Document source and usage rights. +- Include alt text when embedding assets. +- Do not add untracked large binaries or private media. + +No media assets are currently required. diff --git a/assets/diagrams/README.md b/assets/diagrams/README.md new file mode 100644 index 0000000..81da719 --- /dev/null +++ b/assets/diagrams/README.md @@ -0,0 +1,3 @@ +# Diagrams + +Place architecture and workflow diagrams here. Prefer editable source formats when practical. diff --git a/assets/images/README.md b/assets/images/README.md new file mode 100644 index 0000000..2250305 --- /dev/null +++ b/assets/images/README.md @@ -0,0 +1,3 @@ +# Images + +Place reusable repository images here. Record source, license, and intended use. diff --git a/data/README.md b/data/README.md new file mode 100644 index 0000000..f7838e3 --- /dev/null +++ b/data/README.md @@ -0,0 +1,5 @@ +# Data + +This repository does not currently publish a dataset. + +Use this directory only when the repository needs public sample or reference data. Document source, ownership, collection date, license, limitations, update frequency, and field definitions. Never place production databases, credentials, personal data, private logs, or runtime state here. diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..a6b490e --- /dev/null +++ b/docs/README.md @@ -0,0 +1,9 @@ +# Documentation + +| File | Purpose | +| --- | --- | +| `architecture.md` | Explains how the standard, skill, templates, schema, validation, and tests fit together. | +| `implementation.md` | Provides the manual and AI-assisted implementation workflow. | +| `glossary.md` | Defines repository and AI workflow terms used by this project. | + +Begin with the root `README.md`. Retrieve these documents only when deeper implementation or design context is required. diff --git a/docs/architecture.md b/docs/architecture.md new file mode 100644 index 0000000..23195aa --- /dev/null +++ b/docs/architecture.md @@ -0,0 +1,64 @@ +# Architecture + +## Overview + +The repository separates human guidance, machine-readable contracts, reusable AI behavior, deterministic validation, and examples. + +```text +README.md + AGENTS.md + | + v +repository.json ----> schemas/repository.schema.json + | + v +skills/structure-ai-ready-repository/ + | + +----> references/repository-structure-standard.md + +----> assets/repository-structure-plan-template.md + +----> scripts/audit_repository.py + | + v +target repository changes + | + v +scripts/validate_repository.py + tests/ +``` + +## Components + +### Entry points + +`README.md` is the human entry point. `AUTHOR.md` is the canonical attribution record. `AGENTS.md` is the AI operating entry point. `repository.json` provides authoritative structured metadata and retrieval order. + +### Standard + +The detailed standard lives with the skill at `skills/structure-ai-ready-repository/references/repository-structure-standard.md`. The root README summarizes how to use it. + +### Skill + +The skill inspects a target repository, selects a profile, creates a reviewable plan by default, applies only approved actions, and validates the result. + +### Templates and examples + +Templates provide reusable starting artifacts with explicit placeholders. Examples are synthetic completed artifacts that demonstrate expected shape without carrying private or organization-specific data. + +### Validation + +The root validator checks this implemented template. The skill audit checks required structure for a selected profile in any target repository. Unit tests protect validator behavior and repository consistency. + +## Boundaries + +- The standard defines recommended repository shape, not hosting-platform state. +- The skill may edit repository files only within user authorization and platform permissions. +- The validator is read-only. +- `UPDATES.md` records possible future work but does not authorize changes. +- `CHANGELOG.md` records completed, versioned changes. + +## Design Decisions + +- Use one stateful skill instead of separate planning and implementation skills. +- Keep detailed guidance in a skill reference to reduce default context usage. +- Require explicit approval by default before structural changes. +- Allow a user to explicitly authorize immediate implementation. +- Prefer verified nulls or visible placeholders over invented metadata. +- Use deterministic scripts for structural validation. diff --git a/docs/glossary.md b/docs/glossary.md new file mode 100644 index 0000000..96bc528 --- /dev/null +++ b/docs/glossary.md @@ -0,0 +1,49 @@ +# Glossary + +## AI entry point + +The first file an AI agent should read to understand repository purpose, authority, constraints, and retrieval order. + +## AI findability + +The degree to which an AI system can discover a repository's purpose, relevant files, authoritative sources, capabilities, inputs, outputs, and safe usage path. + +## Approval gate + +A required pause where a user reviews and explicitly authorizes a current plan before material changes occur. + +## Authoritative file + +The file designated as the primary source for a value or contract, such as `VERSION` for the release number or `repository.json` for repository metadata. + +## AUTHOR.md + +The canonical human-readable record of repository authorship, publishing, maintenance, preferred attribution, and downstream replacement guidance. + +## Entry point + +A declared starting file for a human or AI agent. + +## Profile + +A minimum repository structure selected for a type of resource: documentation/guide, skill/workflow, software/automation, or dataset. + +## Receipt + +A sanitized record of a workflow execution, including inputs, outputs, versions, validation, and approval. + +## Repository manifest + +The machine-readable `repository.json` file describing identity, purpose, content, relationships, rights, entrypoints, and AI retrieval guidance. + +## Stable identifier + +An identifier intended to remain unchanged when a title or description is rewritten. + +## Task record + +A bounded planning or execution record under `tasks/`. Task records are not approval unless they contain explicit approval evidence. + +## UPDATES.md + +A notes file for possible future repository changes. It is neither a changelog nor automatic authorization to implement an item. diff --git a/docs/implementation.md b/docs/implementation.md new file mode 100644 index 0000000..f97582c --- /dev/null +++ b/docs/implementation.md @@ -0,0 +1,93 @@ +# Implementation Guide + +## Choose A Profile + +Select the smallest profile that accurately represents the repository: + +- **Documentation/guide:** written standards, guides, playbooks, or research. +- **Skill/workflow:** AI skills, prompts, agents, workflows, or templates. +- **Software/automation:** executable code, services, applications, or operations. +- **Dataset:** versioned data with provenance, field definitions, and schemas. + +Add profile-specific files only when they support real content or validation. + +## New Repository Workflow + +1. Choose a clear lowercase kebab-case repository name. +2. Create human and AI entry points. +3. Create `repository.json` using `templates/repository.json.template`. +4. Select and create profile-required documentation and folders. +5. Add a verified license, version, and change record. +6. Add host-specific contribution templates. +7. Validate the repository. + +## Existing Repository Workflow + +1. Inspect all files, Git status, agent instructions, host configuration, manifests, tests, and documentation. +2. Identify authoritative existing content and conventions. +3. Classify each proposed file action as create, preserve, modify, move, deprecate, or leave absent. +4. Use the skill's normal plan and approval gate unless the user explicitly authorizes immediate implementation. +5. Merge useful content rather than replacing it mechanically. +6. Reinspect for concurrent changes before writing. +7. Validate and report deviations. + +## Required Entry Points + +Every implementation should answer: + +- Where should a human start? +- Where should an AI agent start? +- Which file is the authoritative machine-readable manifest? +- What should be retrieved next for the current task? + +Declare these answers in `repository.json`. + +## Identity And Publication + +At the beginning of a repository build, confirm: + +- author or authors; +- publisher; +- maintainer; +- canonical repository URL; +- intended license. + +Record the verified values in `AUTHOR.md` and keep `repository.json`, `CITATION.cff`, and `LICENSE` aligned. When adapting an existing template, never inherit its author automatically. + +## Metadata Rules + +- Use stable IDs. +- Use verified URLs. +- Keep optional unknown values null or omit them when allowed. +- Keep version values aligned. +- Keep host topics and manifest topics aligned. +- Update `updated_at` when metadata meaningfully changes. + +## UPDATES.md Workflow + +Use `UPDATES.md` for unapproved future notes, discoveries, and proposed improvements. Do not present its contents as committed roadmap work. + +When implementing an item: + +1. confirm scope and authority; +2. make and validate the change; +3. update the version if required; +4. record the released result in `CHANGELOG.md`; +5. remove or mark the update item completed. + +## Validation + +For this repository: + +```text +python scripts/validate_repository.py . +python -m unittest discover -s tests -p "test_*.py" +``` + +For another repository using the bundled skill audit: + +```text +python skills/structure-ai-ready-repository/scripts/audit_repository.py --profile +``` + +Structural validation should be supplemented with project-native tests and human review of accuracy. diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..b29dc71 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,9 @@ +# Examples + +All examples in this directory are synthetic and do not represent an actual organization, customer, or production repository. + +| File | Purpose | +| --- | --- | +| `example-repository.json` | Completed documentation-profile manifest for a fictional repository. | + +Use examples to understand expected shape. Do not copy fictional URLs, maintainers, or identifiers into a real repository. diff --git a/examples/example-repository.json b/examples/example-repository.json new file mode 100644 index 0000000..45915b5 --- /dev/null +++ b/examples/example-repository.json @@ -0,0 +1,112 @@ +{ + "schema_version": "1.0", + "repository_id": "example-organization-field-guide", + "name": "field-guide", + "title": "Synthetic Field Guide", + "description": "A synthetic example showing machine-readable metadata for a documentation repository.", + "summary": "Demonstrates the minimum identity, profile, entrypoint, rights, and AI retrieval fields without using real organizational data.", + "canonical_url": "https://code.example.org/example-organization/field-guide", + "repository_status": "active", + "visibility": "public", + "maturity": "stable", + "version": "1.0.0", + "created_at": "2026-01-01", + "updated_at": "2026-01-01", + "authors": [ + { + "name": "Alex Example" + } + ], + "publisher": { + "name": "Example Organization" + }, + "resource_types": [ + "documentation", + "guide" + ], + "topics": { + "technology": [], + "business_function": [ + "training" + ], + "industry_context": [], + "artifact_type": [ + "guide" + ], + "concepts": [ + "field-practice" + ] + }, + "audiences": [ + "new practitioners" + ], + "problems_solved": [ + "New practitioners need a consistent starting guide." + ], + "capabilities": [ + "Explain a repeatable field process." + ], + "use_cases": [ + "Prepare a new team member for supervised field work." + ], + "required_inputs": [], + "expected_outputs": [ + { + "name": "Field preparation checklist", + "description": "A reviewed checklist adapted to the user's context.", + "format": "markdown" + } + ], + "entrypoints": { + "human": "README.md", + "ai": "AGENTS.md", + "primary_skill": null, + "primary_agent": null, + "primary_script": null, + "primary_template": null + }, + "contents": [], + "relationships": { + "part_of": [], + "supports": [], + "depends_on": [], + "related_resources": [], + "supersedes": [], + "superseded_by": [] + }, + "access": { + "public": true, + "authentication_required": false, + "payment_required": false, + "registration_required": false + }, + "rights": { + "license": "CC-BY-4.0", + "license_file": "LICENSE", + "usage_guidance": "README.md" + }, + "provenance": { + "origin_type": "synthetic", + "creation_method": "example-only", + "contributors": [], + "source_references": [] + }, + "maintenance": { + "maintainer": "Example Maintainer", + "review_frequency": "annual", + "last_reviewed_at": "2026-01-01", + "deprecated": false, + "archived": false + }, + "ai_retrieval": { + "read_first": [ + "README.md", + "AGENTS.md" + ], + "retrieve_as_needed": [ + "docs/" + ], + "exclude_by_default": [], + "instructions": "This file is synthetic example data." + } +} diff --git a/receipts/README.md b/receipts/README.md new file mode 100644 index 0000000..9c176e2 --- /dev/null +++ b/receipts/README.md @@ -0,0 +1,16 @@ +# Receipts + +Receipts are sanitized execution records that support auditability and reproducibility. + +A receipt should record: + +- execution date; +- skill and version; +- approved scope; +- inputs and outputs; +- tools or scripts used; +- validation results; +- human approval; +- known limitations. + +Do not store credentials, private prompts, customer information, private logs, or held-out evaluation answers. This repository currently contains no execution receipts. diff --git a/repository.json b/repository.json new file mode 100644 index 0000000..ef091f8 --- /dev/null +++ b/repository.json @@ -0,0 +1,202 @@ +{ + "$schema": "./schemas/repository.schema.json", + "schema_version": "1.0", + "repository_id": "adminprojects-repo-template", + "name": "repo-template", + "title": "AI-Ready Repository Template", + "description": "A platform-neutral repository standard and reusable AI skill for creating repositories that humans and AI agents can discover, understand, validate, and reuse.", + "summary": "Provides a repository structure standard, an approval-aware AI skill, templates, examples, schema, deterministic validation, and tests for new or existing repositories.", + "canonical_url": "https://projects.eddiesoehnel.com/adminprojects/repo-template", + "organization": { + "id": "adminprojects", + "name": "adminprojects", + "url": "https://projects.eddiesoehnel.com/adminprojects" + }, + "authors": [ + { + "name": "Eddie Soehnel" + } + ], + "publisher": { + "name": "Eddie Soehnel" + }, + "repository_status": "active", + "visibility": "public", + "maturity": "experimental", + "version": "0.1.0", + "created_at": "2026-07-23", + "updated_at": "2026-07-23", + "resource_types": [ + "documentation", + "framework", + "schema", + "script", + "skill", + "template", + "workflow" + ], + "topics": { + "technology": [ + "ai", + "agents", + "repository-automation" + ], + "business_function": [ + "knowledge-management", + "software-development" + ], + "industry_context": [], + "artifact_type": [ + "skill", + "template", + "standard" + ], + "concepts": [ + "ai-findability", + "machine-readable-metadata", + "repository-structure" + ] + }, + "audiences": [ + "repository maintainers", + "AI workflow designers", + "software teams", + "documentation teams" + ], + "problems_solved": [ + "Repositories lack predictable human and AI entry points.", + "Repository structure and metadata are inconsistent.", + "AI-driven restructuring can occur without a clear review boundary." + ], + "capabilities": [ + "Assess a new or existing repository.", + "Propose a profile-appropriate repository structure.", + "Create machine-readable repository metadata.", + "Validate required paths, entrypoints, versions, and links." + ], + "use_cases": [ + "Start a new AI workflow repository.", + "Correct an existing repository for AI findability.", + "Standardize reusable repository documentation and metadata." + ], + "required_inputs": [ + { + "name": "Target repository", + "description": "The new or existing repository to assess and structure.", + "required": true, + "sensitivity": "context-dependent" + } + ], + "expected_outputs": [ + { + "name": "AI-ready repository", + "description": "A profile-appropriate repository with human and AI entry points, metadata, documentation, and validation.", + "format": "repository" + } + ], + "entrypoints": { + "human": "README.md", + "ai": "AGENTS.md", + "primary_skill": "skills/structure-ai-ready-repository/SKILL.md", + "primary_agent": null, + "primary_script": "scripts/validate_repository.py", + "primary_template": "templates/repository.json.template" + }, + "contents": [ + { + "path": "AUTHOR.md", + "type": "attribution", + "title": "Author And Publisher", + "description": "Canonical author, publisher, maintainer, and attribution guidance.", + "required_for_use": true + }, + { + "path": "README.md", + "type": "documentation", + "title": "Repository Overview", + "description": "Primary human entry point and usage guide.", + "required_for_use": true + }, + { + "path": "AGENTS.md", + "type": "agent-instructions", + "title": "Agent Instructions", + "description": "Repository-scoped instructions for AI agents.", + "required_for_use": true + }, + { + "path": "skills/structure-ai-ready-repository/SKILL.md", + "type": "skill", + "title": "Structure AI-Ready Repository", + "description": "Plans, implements, and validates AI-ready repository structure.", + "required_for_use": true + }, + { + "path": "UPDATES.md", + "type": "planning-notes", + "title": "Future Repository Updates", + "description": "Unapproved notes and proposals for future repository revisions.", + "required_for_use": false + } + ], + "relationships": { + "part_of": [], + "supports": [], + "depends_on": [], + "related_resources": [], + "supersedes": [], + "superseded_by": [] + }, + "access": { + "public": true, + "authentication_required": false, + "payment_required": false, + "registration_required": false + }, + "rights": { + "license": "MIT", + "license_file": "LICENSE", + "usage_guidance": "README.md" + }, + "provenance": { + "origin_type": "human-authored", + "creation_method": "authored-and-ai-assisted", + "contributors": [ + "Eddie Soehnel" + ], + "source_references": [ + "README.md", + "skills/structure-ai-ready-repository/references/repository-structure-standard.md" + ] + }, + "maintenance": { + "maintainer": "Eddie Soehnel", + "review_frequency": "as-needed", + "last_reviewed_at": "2026-07-23", + "deprecated": false, + "archived": false + }, + "ai_retrieval": { + "read_first": [ + "README.md", + "AUTHOR.md", + "repository.json", + "AGENTS.md", + "skills.md" + ], + "retrieve_as_needed": [ + "docs/", + "templates/", + "examples/", + "schemas/", + "scripts/", + "skills/structure-ai-ready-repository/references/" + ], + "exclude_by_default": [ + "receipts/", + "tasks/", + "tests/" + ], + "instructions": "Read the entrypoints first. Retrieve the standard and templates only when applying or evaluating repository structure. Treat UPDATES.md as proposed future work, not authorization." + } +} diff --git a/schemas/README.md b/schemas/README.md new file mode 100644 index 0000000..8f0a4b9 --- /dev/null +++ b/schemas/README.md @@ -0,0 +1,7 @@ +# Schemas + +| File | Purpose | +| --- | --- | +| `repository.schema.json` | JSON Schema contract for the repository manifest. | + +The root validator performs dependency-free contract checks. Use a Draft 2020-12 compatible JSON Schema validator for complete schema validation. diff --git a/schemas/repository.schema.json b/schemas/repository.schema.json new file mode 100644 index 0000000..906da9e --- /dev/null +++ b/schemas/repository.schema.json @@ -0,0 +1,397 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://projects.eddiesoehnel.com/adminprojects/repo-template/schemas/repository.schema.json", + "title": "AI-Ready Repository Manifest", + "description": "Machine-readable identity, discovery, rights, provenance, maintenance, and AI retrieval metadata for an AI-ready repository.", + "type": "object", + "required": [ + "schema_version", + "repository_id", + "name", + "title", + "description", + "authors", + "publisher", + "repository_status", + "visibility", + "maturity", + "version", + "resource_types", + "entrypoints", + "rights", + "maintenance", + "ai_retrieval" + ], + "properties": { + "$schema": { + "type": "string" + }, + "schema_version": { + "type": "string", + "pattern": "^\\d+\\.\\d+$" + }, + "repository_id": { + "type": "string", + "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" + }, + "name": { + "type": "string", + "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" + }, + "title": { + "type": "string", + "minLength": 1 + }, + "description": { + "type": "string", + "minLength": 1 + }, + "summary": { + "type": "string" + }, + "canonical_url": { + "type": [ + "string", + "null" + ], + "format": "uri" + }, + "organization": { + "$ref": "#/$defs/namedEntity" + }, + "authors": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/$defs/namedEntity" + } + }, + "publisher": { + "$ref": "#/$defs/namedEntity" + }, + "repository_status": { + "enum": [ + "draft", + "active", + "deprecated", + "archived", + "superseded" + ] + }, + "visibility": { + "enum": [ + "public", + "restricted", + "private" + ] + }, + "maturity": { + "enum": [ + "concept", + "experimental", + "prototype", + "beta", + "stable", + "production" + ] + }, + "version": { + "type": "string", + "pattern": "^\\d+\\.\\d+\\.\\d+(?:[-+][0-9A-Za-z.-]+)?$" + }, + "created_at": { + "type": "string", + "format": "date" + }, + "updated_at": { + "type": "string", + "format": "date" + }, + "resource_types": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + }, + "topics": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + } + }, + "audiences": { + "$ref": "#/$defs/stringArray" + }, + "problems_solved": { + "$ref": "#/$defs/stringArray" + }, + "capabilities": { + "$ref": "#/$defs/stringArray" + }, + "use_cases": { + "$ref": "#/$defs/stringArray" + }, + "required_inputs": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "description", + "required", + "sensitivity" + ], + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "sensitivity": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "expected_outputs": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "description", + "format" + ], + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "format": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "entrypoints": { + "type": "object", + "required": [ + "human", + "ai" + ], + "properties": { + "human": { + "type": "string" + }, + "ai": { + "type": "string" + }, + "primary_skill": { + "type": [ + "string", + "null" + ] + }, + "primary_agent": { + "type": [ + "string", + "null" + ] + }, + "primary_script": { + "type": [ + "string", + "null" + ] + }, + "primary_template": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + }, + "contents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "path", + "type", + "title", + "description", + "required_for_use" + ], + "properties": { + "path": { + "type": "string" + }, + "type": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required_for_use": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "relationships": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + }, + "access": { + "type": "object", + "additionalProperties": { + "type": "boolean" + } + }, + "rights": { + "type": "object", + "required": [ + "license", + "license_file" + ], + "properties": { + "license": { + "type": "string" + }, + "license_file": { + "type": "string" + }, + "usage_guidance": { + "type": "string" + } + }, + "additionalProperties": false + }, + "provenance": { + "type": "object", + "properties": { + "origin_type": { + "type": "string" + }, + "creation_method": { + "type": "string" + }, + "contributors": { + "type": "array" + }, + "source_references": { + "$ref": "#/$defs/stringArray" + } + }, + "additionalProperties": false + }, + "maintenance": { + "type": "object", + "required": [ + "maintainer", + "review_frequency", + "deprecated", + "archived" + ], + "properties": { + "maintainer": { + "type": [ + "string", + "null" + ] + }, + "review_frequency": { + "type": "string" + }, + "last_reviewed_at": { + "type": [ + "string", + "null" + ], + "format": "date" + }, + "deprecated": { + "type": "boolean" + }, + "archived": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "ai_retrieval": { + "type": "object", + "required": [ + "read_first", + "retrieve_as_needed", + "exclude_by_default", + "instructions" + ], + "properties": { + "read_first": { + "$ref": "#/$defs/stringArray" + }, + "retrieve_as_needed": { + "$ref": "#/$defs/stringArray" + }, + "exclude_by_default": { + "$ref": "#/$defs/stringArray" + }, + "instructions": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "$defs": { + "stringArray": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + }, + "namedEntity": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "url": { + "type": "string", + "format": "uri" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false +} diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..a495df3 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,21 @@ +# Scripts + +## `validate_repository.py` + +Performs a read-only, dependency-free validation of this implemented repository. + +- **Runtime:** Python 3.10 or later. +- **Dependencies:** Python standard library only. +- **Input:** Repository path; defaults to the current directory. +- **Output:** Human-readable findings or JSON. +- **Modifies files:** No. +- **Human approval required:** No. + +Commands: + +```text +python scripts/validate_repository.py . +python scripts/validate_repository.py . --json +``` + +The validator checks required paths, JSON parsing, core manifest fields, author/publisher alignment, entrypoint paths, manifest contents paths, version alignment, license alignment, and relative Markdown links. It does not prove content accuracy or check external URLs. diff --git a/scripts/validate_repository.py b/scripts/validate_repository.py new file mode 100644 index 0000000..9f85850 --- /dev/null +++ b/scripts/validate_repository.py @@ -0,0 +1,263 @@ +#!/usr/bin/env python3 +"""Validate the implemented AI-ready repository template without dependencies.""" + +from __future__ import annotations + +import argparse +import json +from pathlib import Path +import re +import sys +from urllib.parse import unquote + + +REQUIRED_PATHS = ( + ".gitea/ISSUE_TEMPLATE/bug-report.md", + ".gitea/ISSUE_TEMPLATE/documentation-correction.md", + ".gitea/ISSUE_TEMPLATE/feature-request.md", + ".gitea/PULL_REQUEST_TEMPLATE.md", + "AGENTS.md", + "AUTHOR.md", + "CHANGELOG.md", + "CITATION.cff", + "CONTRIBUTING.md", + "LICENSE", + "README.md", + "SECURITY.md", + "UPDATES.md", + "VERSION", + "assets/README.md", + "data/README.md", + "docs/README.md", + "examples/README.md", + "receipts/README.md", + "repository.json", + "schemas/README.md", + "schemas/repository.schema.json", + "scripts/README.md", + "skills.md", + "skills/README.md", + "skills/structure-ai-ready-repository/SKILL.md", + "tasks/README.md", + "templates/README.md", + "tests/README.md", +) + +MANIFEST_REQUIRED_KEYS = ( + "schema_version", + "repository_id", + "name", + "title", + "description", + "authors", + "publisher", + "repository_status", + "visibility", + "maturity", + "version", + "resource_types", + "entrypoints", + "rights", + "maintenance", + "ai_retrieval", +) + +MARKDOWN_LINK = re.compile(r"(? argparse.Namespace: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("repository", nargs="?", default=".", type=Path) + parser.add_argument("--json", action="store_true", help="Emit JSON") + return parser.parse_args() + + +def read_text(path: Path) -> str: + return path.read_text(encoding="utf-8-sig") + + +def add(findings: list[dict[str, str]], level: str, message: str) -> None: + findings.append({"level": level, "message": message}) + + +def validate_manifest(root: Path, findings: list[dict[str, str]]) -> dict | None: + path = root / "repository.json" + try: + manifest = json.loads(read_text(path)) + except (OSError, UnicodeError, json.JSONDecodeError) as exc: + add(findings, "error", f"repository.json is invalid: {exc}") + return None + + for key in MANIFEST_REQUIRED_KEYS: + if key not in manifest: + add(findings, "error", f"repository.json lacks required key: {key}") + + entrypoints = manifest.get("entrypoints") + if not isinstance(entrypoints, dict): + add(findings, "error", "repository.json entrypoints must be an object") + else: + for name in ("human", "ai"): + value = entrypoints.get(name) + if not isinstance(value, str) or not value: + add(findings, "error", f"Missing {name} entrypoint") + elif not (root / value).exists(): + add(findings, "error", f"Declared {name} entrypoint does not exist: {value}") + for name, value in entrypoints.items(): + if name in ("human", "ai") or value is None: + continue + if not isinstance(value, str) or not (root / value).exists(): + add(findings, "error", f"Declared entrypoint does not exist: {name}={value}") + + contents = manifest.get("contents", []) + if not isinstance(contents, list): + add(findings, "error", "repository.json contents must be an array") + else: + for item in contents: + declared = item.get("path") if isinstance(item, dict) else None + if not declared or not (root / declared).exists(): + add(findings, "error", f"Declared contents path does not exist: {declared}") + + retrieval = manifest.get("ai_retrieval", {}) + if isinstance(retrieval, dict): + for field in ("read_first", "retrieve_as_needed"): + for declared in retrieval.get(field, []): + normalized = declared.rstrip("/") + if normalized and not (root / normalized).exists(): + add(findings, "error", f"AI retrieval path does not exist: {declared}") + + author_text = read_text(root / "AUTHOR.md") if (root / "AUTHOR.md").is_file() else "" + citation_text = read_text(root / "CITATION.cff") if (root / "CITATION.cff").is_file() else "" + license_text = read_text(root / "LICENSE") if (root / "LICENSE").is_file() else "" + authors = manifest.get("authors", []) + if not isinstance(authors, list) or not authors: + add(findings, "error", "repository.json authors must be a non-empty array") + else: + for author in authors: + name = author.get("name") if isinstance(author, dict) else None + if not name: + add(findings, "error", "Every repository.json author must have a name") + continue + if name not in author_text: + add(findings, "error", f"Author is absent from AUTHOR.md: {name}") + parts = name.split() + if not all(part in citation_text for part in parts): + add(findings, "error", f"Author is not aligned with CITATION.cff: {name}") + if name not in license_text: + add(findings, "error", f"Author is absent from LICENSE copyright: {name}") + + publisher = manifest.get("publisher") + publisher_name = publisher.get("name") if isinstance(publisher, dict) else None + if not publisher_name: + add(findings, "error", "repository.json publisher must have a name") + elif publisher_name not in author_text: + add(findings, "error", f"Publisher is absent from AUTHOR.md: {publisher_name}") + + maintainer = manifest.get("maintenance", {}).get("maintainer") + if maintainer and maintainer not in author_text: + add(findings, "error", f"Maintainer is absent from AUTHOR.md: {maintainer}") + return manifest + + +def validate_versions(root: Path, manifest: dict | None, findings: list[dict[str, str]]) -> None: + version = read_text(root / "VERSION").strip() + if not re.fullmatch(r"\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?", version): + add(findings, "error", f"VERSION is not semantic: {version!r}") + + if manifest and manifest.get("version") != version: + add(findings, "error", "VERSION differs from repository.json") + + citation = read_text(root / "CITATION.cff") + match = CITATION_VERSION.search(citation) + if not match or match.group(1) != version: + add(findings, "error", "VERSION differs from or is absent in CITATION.cff") + + changelog = read_text(root / "CHANGELOG.md") + if f"## [{version}]" not in changelog: + add(findings, "error", f"CHANGELOG.md lacks release heading for {version}") + + if manifest: + manifest_license = manifest.get("rights", {}).get("license") + citation_match = CITATION_LICENSE.search(citation) + if citation_match and manifest_license != citation_match.group(1): + add(findings, "error", "License differs between repository.json and CITATION.cff") + + +def validate_markdown_links(root: Path, findings: list[dict[str, str]]) -> None: + for path in root.rglob("*.md"): + if ".git" in path.parts: + continue + text = read_text(path) + for raw_target in MARKDOWN_LINK.findall(text): + target = raw_target.strip().split(maxsplit=1)[0].strip("<>") + if ( + not target + or target.startswith(("#", "http://", "https://", "mailto:")) + or "{{" in target + ): + continue + local = unquote(target.split("#", 1)[0]) + if local and not (path.parent / local).resolve().exists(): + add( + findings, + "error", + f"Broken relative Markdown link in {path.relative_to(root)}: {target}", + ) + + +def validate(root: Path) -> dict: + findings: list[dict[str, str]] = [] + root = root.resolve() + if not root.is_dir(): + add(findings, "error", "Repository path is not a directory") + return {"repository": str(root), "passed": False, "findings": findings} + + for relative in REQUIRED_PATHS: + if not (root / relative).exists(): + add(findings, "error", f"Missing required path: {relative}") + + if findings: + missing_core = any( + item["message"].endswith(("repository.json", "VERSION", "CITATION.cff", "CHANGELOG.md")) + for item in findings + ) + else: + missing_core = False + + manifest = None if not (root / "repository.json").is_file() else validate_manifest(root, findings) + if not missing_core: + validate_versions(root, manifest, findings) + validate_markdown_links(root, findings) + + return { + "repository": str(root), + "passed": not any(item["level"] == "error" for item in findings), + "findings": findings, + } + + +def emit_markdown(result: dict) -> None: + print("# Repository Validation") + print(f"\n- Repository: `{result['repository']}`") + print(f"- Result: `{'PASS' if result['passed'] else 'FAIL'}`") + print("\n## Findings") + if not result["findings"]: + print("\n- No validation errors found.") + else: + for finding in result["findings"]: + print(f"\n- {finding['level'].upper()}: {finding['message']}") + + +def main() -> int: + args = parse_args() + result = validate(args.repository) + if args.json: + print(json.dumps(result, indent=2)) + else: + emit_markdown(result) + return 0 if result["passed"] else 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/skills.md b/skills.md new file mode 100644 index 0000000..096b5e7 --- /dev/null +++ b/skills.md @@ -0,0 +1,18 @@ +# Repository Skills + +## How To Use This Index + +Read this file after `README.md`, `repository.json`, and `AGENTS.md` to determine which skill applies. + +## Skills + +### Structure AI-Ready Repository + +- **Path:** `skills/structure-ai-ready-repository/SKILL.md` +- **Purpose:** Assess, plan, create, correct, and validate a human- and AI-findable repository structure. +- **Use when:** Starting a repository, correcting inconsistent structure, adding repository metadata, or improving AI entry points. +- **Inputs:** Target repository, project purpose, existing contents, verified author/publisher/maintainer identity, canonical URL, license, and any constraints. +- **Outputs:** A profile-appropriate repository structure, metadata, documentation, validation, and normal-workflow task records. +- **Human approval required:** Yes by default. The user may explicitly authorize immediate implementation. +- **Related scripts:** `skills/structure-ai-ready-repository/scripts/audit_repository.py` and `scripts/validate_repository.py`. +- **Reference standard:** `skills/structure-ai-ready-repository/references/repository-structure-standard.md`. diff --git a/skills/README.md b/skills/README.md new file mode 100644 index 0000000..79653db --- /dev/null +++ b/skills/README.md @@ -0,0 +1,7 @@ +# Skills + +| Skill | Purpose | +| --- | --- | +| `structure-ai-ready-repository/` | Assess, plan, create, correct, and validate an AI-ready repository structure. | + +Read `skills.md` for trigger conditions, inputs, outputs, approval requirements, and related scripts. diff --git a/skills/structure-ai-ready-repository/SKILL.md b/skills/structure-ai-ready-repository/SKILL.md new file mode 100644 index 0000000..edc32d8 --- /dev/null +++ b/skills/structure-ai-ready-repository/SKILL.md @@ -0,0 +1,119 @@ +--- +name: structure-ai-ready-repository +description: Assess, plan, create, or correct a new or existing repository so humans and AI agents can discover, understand, validate, and reuse it. Use when a user asks to start a repository with an AI-ready structure, audit or reorganize an existing repository, add machine-readable repository metadata, improve agent entry points, standardize repository documentation, or apply the general AI-ready repository template. By default, create a repository-local task plan for review and require explicit approval before implementing structural changes; bypass the plan only when the user explicitly authorizes immediate implementation. +--- + +# Structure an AI-Ready Repository + +Create the smallest repository structure that makes the project clear to humans and AI agents. Preserve useful existing conventions and content. + +## Load the standard + +Read [references/repository-structure-standard.md](references/repository-structure-standard.md) before proposing a structure. Treat it as a menu and decision standard, not a command to create every listed file. + +Use [assets/repository-structure-plan-template.md](assets/repository-structure-plan-template.md) for the required review artifact. + +Use `scripts/audit_repository.py` for a read-only baseline and final structural check. Do not treat the script as a substitute for inspecting repository purpose, existing instructions, or project-native tests. + +## Phase 1: Inspect + +1. Resolve the target repository and determine whether it is new or existing. +2. Begin with a short identity and publication round. Ask only for values the user has not already supplied: + - author or authors; + - publisher and maintainer; + - canonical repository URL; + - intended license. +3. If `AUTHOR.md` exists, read it first, present its values for confirmation, and ask only about missing or conflicting facts. Do not silently inherit identity from a template or source repository. +4. For an existing repository, inspect its files, Git status, documentation, manifests, tests, host configuration, and any `AGENTS.md` or equivalent instructions. Preserve unrelated user changes. +5. Infer the most suitable profile: documentation/guide, skill/workflow, software/automation, dataset, or a justified custom minimum. +6. Separate facts found in the repository from assumptions and recommendations. +7. Run the read-only audit when Python is available. Record failures as planning inputs, not as permission to change files. + +## Phase 2: Write the review plan + +Create exactly one active plan at: + +```text +tasks//repository-structure-plan.md +``` + +Use lowercase kebab-case for ``, normally `structure-ai-ready-repository`. + +For a new repository, creating the target directory and this task-plan path is the only pre-approval repository write allowed. For an existing repository, do not modify anything outside the task folder before approval. + +The plan must include: + +- target and current state; +- selected repository profile and rationale; +- proposed tree; +- a file action table using `create`, `preserve`, `modify`, `move`, `deprecate`, or `leave absent`; +- purpose and planned content for every created or modified file; +- existing-content preservation and migration notes; +- host-specific choices; +- validation commands and definition of done; +- risks, assumptions, open questions, and out-of-scope work; +- approval status and plan revision. + +Use `move` or `deprecate` only when necessary. Never propose deletion as an implied cleanup step. + +Present the plan to the user and stop. Ask the user to approve it or request amendments. Do not implement in the same turn that first creates the plan. + +## Phase 3: Amend or approve + +When the user requests changes: + +1. Update the same plan. +2. Increment the plan revision. +3. Set status to `awaiting approval`. +4. Summarize the amendments and stop for review again. + +Proceed only after the user explicitly approves the current revision. Approval must clearly refer to the plan or proposed structure. Questions, partial agreement, silence, or approval of an older revision do not authorize implementation. + +If implementation requires a material departure from the approved plan, update the plan, explain the change, and return to `awaiting approval`. + +## Phase 4: Implement the approved plan + +1. Reinspect Git status and relevant files to detect changes since planning. +2. Mark the current revision `approved` with the approval evidence. +3. Apply only approved actions. +4. Merge with useful existing content. Do not overwrite complete documentation, manifests, licenses, CI, host configuration, or agent instructions merely to match a template. +5. Create only relevant folders and files. Avoid empty ceremonial structure. +6. Keep human and AI entry points explicit: + - explain purpose, audience, inputs, outputs, setup, usage, validation, version, and license in `README.md`; + - identify authoritative files and retrieval order in `repository.json`; + - provide scoped agent instructions in the repository's established agent-instruction file; + - index skills, scripts, templates, schemas, data, and examples when they exist. + - create or update `UPDATES.md` for future notes and proposals, while keeping completed versioned changes in `CHANGELOG.md`. + - create `AUTHOR.md` as the canonical human-readable attribution file and keep it aligned with `repository.json`, `CITATION.cff`, and `LICENSE`. +7. Use placeholders only when the user has not supplied a value and the placeholder is visibly marked. Never invent URLs, maintainers, licenses, security contacts, provenance, or credentials. +8. Do not create commits, branches, remotes, releases, or hosting-platform settings unless the user separately requested them. + +## Phase 5: Validate and record + +1. Run `scripts/audit_repository.py` with the approved profile. +2. Parse machine-readable files and check version alignment, internal paths, and declared entry points. +3. Run relevant repository-native tests, linters, schema checks, and link checks that can safely run. +4. Search created examples and receipts for secrets, personal data, and organization-specific residue. +5. Confirm that `UPDATES.md` contains future planning notes only and is not presented as approval or completed work. +6. Create: + +```text +tasks//implementation-receipt.md +tasks//validation-results.md +``` + +Record the approved revision, actual actions, deviations, commands, results, unresolved issues, and rollback guidance. Set the plan status to `implemented` only when approved work is complete. + +## Final report + +Report: + +- the verified author, publisher, maintainer, canonical URL, and license; +- the selected profile and resulting entry points; +- created, modified, preserved, moved, and intentionally omitted files; +- validation results and anything not tested; +- deviations from the approved plan; +- remaining human decisions; +- task-plan and receipt locations. + +Do not describe the repository as compliant merely because expected filenames exist. Content, links, metadata, and instructions must agree with the actual project. diff --git a/skills/structure-ai-ready-repository/agents/openai.yaml b/skills/structure-ai-ready-repository/agents/openai.yaml new file mode 100644 index 0000000..7874301 --- /dev/null +++ b/skills/structure-ai-ready-repository/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Structure AI-Ready Repository" + short_description: "Plan and build AI-findable repositories" + default_prompt: "Use $structure-ai-ready-repository to confirm repository identity and publication details, then assess and propose an AI-ready structure for review." diff --git a/skills/structure-ai-ready-repository/assets/repository-structure-plan-template.md b/skills/structure-ai-ready-repository/assets/repository-structure-plan-template.md new file mode 100644 index 0000000..4cef19d --- /dev/null +++ b/skills/structure-ai-ready-repository/assets/repository-structure-plan-template.md @@ -0,0 +1,104 @@ +# Repository Structure Plan + +## Plan Control + +- Task ID: `[lowercase-kebab-case]` +- Target repository: `[absolute path]` +- Repository mode: `[new | existing]` +- Profile: `[documentation-guide | skill-workflow | software-automation | dataset | custom]` +- Revision: `1` +- Status: `awaiting approval` +- Created: `[YYYY-MM-DD]` +- Updated: `[YYYY-MM-DD]` +- Approval evidence: `Not approved` + +## Outcome + +[What the completed repository structure should make easier for humans and AI agents.] + +## Identity And Publication + +- Author(s): `[verified names]` +- Publisher: `[verified name]` +- Maintainer: `[verified name]` +- Canonical repository URL: `[verified URL or explicitly unset]` +- License: `[verified license or decision required]` +- Identity source: `[user response | AUTHOR.md | other verified source]` + +## Current State + +### Facts + +- [Observed fact] + +### Assumptions + +- [Assumption requiring confirmation] + +### Baseline Audit + +- Command: `[command or not run]` +- Result: `[summary]` + +## Profile Decision + +[Selected profile, rationale, and why a larger or smaller profile is not appropriate.] + +## Proposed Structure + +```text +repository-name/ +└── ... +``` + +## File Actions + +| Path | Action | Purpose and planned content | Existing-content treatment | +|---|---|---|---| +| `README.md` | `create/modify/preserve` | [Purpose] | [Merge/preserve notes] | + +Allowed actions: `create`, `preserve`, `modify`, `move`, `deprecate`, `leave absent`. + +## Human and AI Entry Points + +- Human starts at: `[path]` +- AI agent starts at: `[path]` +- Authoritative manifest: `[path]` +- Retrieve next: `[ordered paths]` + +## Hosting Platform Choices + +[Detected host conventions and any proposed issue, pull-request, CI, or metadata files.] + +## Validation and Definition of Done + +- [ ] Required files contain project-specific, accurate content. +- [ ] Machine-readable files parse and agree with authoritative values. +- [ ] Declared paths and internal links resolve. +- [ ] Version references align. +- [ ] Relevant project-native tests pass. +- [ ] Examples are synthetic or anonymized. +- [ ] No secrets or private data are introduced. +- [ ] Agent instructions are scoped and non-conflicting. + +Commands: + +```text +[planned validation commands] +``` + +## Risks and Preservation Notes + +- [Risk, user-owned change, compatibility constraint, or migration concern] + +## Out of Scope + +- [Work deliberately excluded] + +## Open Questions + +- [Question that materially affects the plan] + +## Approval + +Approve this exact revision before implementation. Amendments create a new revision and return the plan to `awaiting approval`. diff --git a/skills/structure-ai-ready-repository/references/repository-structure-standard.md b/skills/structure-ai-ready-repository/references/repository-structure-standard.md new file mode 100644 index 0000000..9cb77ea --- /dev/null +++ b/skills/structure-ai-ready-repository/references/repository-structure-standard.md @@ -0,0 +1,1971 @@ +# AI-Ready Repository Template + +## Purpose + +This template defines a platform-neutral standard for repositories that should be easy for humans and AI agents to discover, understand, validate, and reuse. + +Every repository should be understandable and usable as a standalone project, regardless of where it is hosted or how someone discovers it. + +The repository should provide: + +* A clear human-readable explanation. +* Machine-readable repository metadata. +* Instructions for using or adapting the resource. +* Licensing and reuse guidance. +* Contribution and security guidance where applicable. +* Version and change history. +* Clear entry points for humans and AI agents. +* Stable structure that can be validated and indexed automatically. + +The template is intentionally broader than a traditional software repository because AI-ready repositories may contain: + +* Skills +* Agents +* Workflows +* Templates +* Playbooks +* Prompts +* Scripts +* Applications +* Demonstration projects +* Research +* Datasets +* Policies +* Operating procedures +* Educational materials + +--- + +# Recommended Repository Structure + +```text +repository-name/ +│ +├── README.md +├── AUTHOR.md +├── repository.json +├── LICENSE +├── CHANGELOG.md +├── UPDATES.md +├── CONTRIBUTING.md +├── SECURITY.md +├── CITATION.cff +├── VERSION +│ +├── AGENTS.md +├── skills.md +│ +├── docs/ +│ ├── README.md +│ ├── architecture.md +│ ├── implementation.md +│ └── glossary.md +│ +├── skills/ +│ ├── README.md +│ └── example-skill.md +│ +├── templates/ +│ ├── README.md +│ └── example-template.md +│ +├── examples/ +│ ├── README.md +│ └── example-output.md +│ +├── scripts/ +│ ├── README.md +│ └── validate_repository.py +│ +├── schemas/ +│ ├── README.md +│ └── example.schema.json +│ +├── data/ +│ ├── README.md +│ └── .gitkeep +│ +├── receipts/ +│ ├── README.md +│ └── .gitkeep +│ +├── tasks/ +│ ├── README.md +│ └── task-id/ +│ └── repository-structure-plan.md +│ +├── tests/ +│ ├── README.md +│ └── .gitkeep +│ +├── assets/ +│ ├── README.md +│ ├── images/ +│ └── diagrams/ +│ +└── host-config/ # use .github/, .gitea/, or the host's equivalent + ├── ISSUE_TEMPLATE/ + │ ├── bug-report.md + │ ├── feature-request.md + │ └── resource-submission.md + │ + └── PULL_REQUEST_TEMPLATE.md +``` + +Not every repository must actively use every folder. Empty folders may be omitted until required, or retained with a `.gitkeep` file and a short `README.md` explaining their intended use. + +The following root files should normally exist in every public repository: + +```text +README.md +AUTHOR.md +repository.json +LICENSE +CHANGELOG.md +UPDATES.md +VERSION +``` + +The remaining files are conditionally required based on repository type. + +--- + +# Root Files + +## `README.md` + +### Purpose + +The primary human and AI entry point for the repository. + +The README should let a visitor understand: + +* What the repository contains. +* What problem it solves. +* Who it is for. +* Why it is useful. +* How to use it. +* What inputs are required. +* What outputs are produced. +* How to adapt it. +* Where the important files are. +* What limitations or risks exist. +* What license governs reuse. + +AI agents should be instructed to read this file before retrieving deeper repository content. + +### Format + +Markdown. + +### Recommended Structure + +```markdown +# Repository Title + +One- or two-sentence description of the repository. + +## What This Is + +Explain the resource in plain language. + +## Problem It Solves + +Describe the friction, need, or opportunity addressed. + +## Who It Is For + +List intended users, organizations, or industry segments. + +## What It Helps You Do + +Describe the primary capabilities or outcomes. + +## Repository Contents + +Summarize the major folders and files. + +## How To Use It + +Provide the normal starting workflow. + +## Inputs Required + +List required information, files, systems, credentials, or decisions. + +## Expected Outputs + +Explain what the user should receive or create. + +## Example Use Cases + +Provide practical examples. + +## How To Adapt It + +Explain what may be customized and what should remain stable. + +## AI Usage Guidance + +Explain how an AI agent should inspect and use the repository. + +## Limitations + +Identify what the resource does not do. + +## Security And Privacy + +Explain relevant data, credential, privacy, or operational risks. + +## Version + +State the current release or point to `VERSION`. + +## License + +Summarize reuse terms and link to `LICENSE`. + +## Contributing + +Link to `CONTRIBUTING.md`. + +## Related Resources + +Link to relevant websites, documentation, graphs, repositories, or skills. +``` + +### Notes + +The opening section should contain useful descriptive text rather than slogans alone. Repository descriptions, headings, keywords, and use cases improve both human comprehension and AI retrieval. + +Do not assume that users understand Git, the hosting platform, AI skills, agents, or the broader repository architecture. + +--- + +## `AUTHOR.md` + +### Purpose + +Provides the canonical human-readable identity and attribution record for the repository. + +It should state: + +* Author or authors. +* Publisher. +* Maintainer. +* Preferred attribution. +* Canonical repository URL. +* Instructions for replacing attribution in derived repositories. + +### Notes + +Confirm these values with the user at the beginning of repository creation or restructuring. If an existing `AUTHOR.md` is present, present its values for confirmation rather than silently inheriting them. + +Keep `AUTHOR.md`, `repository.json`, `CITATION.cff`, and `LICENSE` aligned. Never leave a source-template author attached to a derived repository unless that attribution remains accurate. + +--- + +## `repository.json` + +### Purpose + +The authoritative machine-readable manifest for the repository. + +This file allows repository tooling and catalog systems to: + +* Catalog the repository. +* Generate repository catalog records. +* Update `ai-index.json`. +* Build topic, audience, capability, and problem indexes. +* Validate repository completeness. +* Generate structured metadata. +* Route AI agents to the correct files. +* Track relationships between repositories. +* Detect renamed, archived, or superseded resources. + +This file functions as repository-level front matter. + +### Format + +Strict JSON. + +Do not include comments, trailing commas, Markdown, or JSON5 syntax. + +### Recommended Structure + +```json +{ + "schema_version": "1.0", + "repository_id": "organization-repository-name", + "name": "repository-name", + "title": "Human-Readable Repository Title", + "description": "Concise description of what the repository contains and helps users accomplish.", + "summary": "Longer summary that explains the problem, intended audience, capabilities, and expected value.", + + "canonical_url": "https://code.example.org/example-organization/repository-name", + + "organization": { + "id": "example-organization", + "name": "Example Organization", + "url": "https://code.example.org/example-organization" + }, + + "authors": [ + { + "name": "Author Name" + } + ], + + "publisher": { + "name": "Publisher Name", + "url": "https://example.org/" + }, + + "repository_status": "active", + "visibility": "public", + "maturity": "experimental", + + "version": "0.1.0", + "created_at": "YYYY-MM-DD", + "updated_at": "YYYY-MM-DD", + + "resource_types": [ + "skill", + "workflow", + "template" + ], + + "topics": { + "technology": [ + "ai", + "agents" + ], + "business_function": [ + "marketing" + ], + "industry_context": [ + "operators" + ], + "artifact_type": [ + "skill", + "workflow" + ], + "concepts": [] + }, + + "audiences": [ + "domain organizations", + "operators", + "industry organizations" + ], + + "problems_solved": [ + "Describe the operational problem addressed." + ], + + "capabilities": [ + "Describe what the repository helps a user or agent do." + ], + + "use_cases": [ + "Describe a realistic use case." + ], + + "required_inputs": [ + { + "name": "Input name", + "description": "What must be supplied.", + "required": true, + "sensitivity": "non-sensitive" + } + ], + + "expected_outputs": [ + { + "name": "Output name", + "description": "What the workflow produces.", + "format": "markdown" + } + ], + + "entrypoints": { + "human": "README.md", + "ai": "README.md", + "primary_skill": null, + "primary_agent": null, + "primary_script": null, + "primary_template": null + }, + + "contents": [ + { + "path": "README.md", + "type": "documentation", + "title": "Repository Overview", + "description": "Primary repository explanation and usage guidance.", + "required_for_use": true + } + ], + + "relationships": { + "part_of": [ + "https://example.org/" + ], + "supports": [], + "depends_on": [], + "related_resources": [], + "supersedes": [], + "superseded_by": [] + }, + + "access": { + "public": true, + "authentication_required": false, + "payment_required": false, + "registration_required": false + }, + + "rights": { + "license": "https://creativecommons.org/licenses/by/4.0/", + "license_file": "LICENSE", + "usage_guidance": "https://example.org/reuse-policy" + }, + + "provenance": { + "origin_type": "human-authored", + "creation_method": "authored-and-ai-assisted", + "contributors": [], + "source_references": [] + }, + + "maintenance": { + "maintainer": "Maintainer Name", + "review_frequency": "as-needed", + "last_reviewed_at": "YYYY-MM-DD", + "deprecated": false, + "archived": false + }, + + "ai_retrieval": { + "read_first": [ + "README.md", + "AUTHOR.md" + ], + "retrieve_as_needed": [], + "exclude_by_default": [ + "receipts/", + "tests/" + ], + "instructions": "Read the README first. Retrieve only the files required to complete the user's task." + } +} +``` + +### Recommended Controlled Values + +For `repository_status`: + +```text +draft +active +deprecated +archived +superseded +``` + +For `maturity`: + +```text +concept +experimental +prototype +beta +stable +production +``` + +For `visibility`: + +```text +public +restricted +private +``` + +For `resource_types`: + +```text +agent +application +case-study +dataset +demo-project +documentation +framework +guide +playbook +prompt-library +research +schema +script +skill +software +template +workflow +``` + +### Notes + +The `repository_id` should remain stable even if the human-facing title changes. + +Recommended format: + +```text +organization-repository-name +``` + +Example: + +```text +example-organization-repository-name +``` + +Do not change IDs casually after publication because other catalogs, relationships, and AI indexes may reference them. + +--- + +## `LICENSE` + +### Purpose + +Defines the legal terms under which the repository may be copied, reused, adapted, redistributed, or incorporated into other work. + +### Format + +Plain text or Markdown, depending on the license. + +### Recommended Default + +For public documentation, skills, templates, playbooks, and educational resources: + +```text +Creative Commons Attribution 4.0 International +``` + +For software code, a software-specific license may be more appropriate, such as: + +```text +Apache License 2.0 +MIT License +``` + +A repository containing both software and documentation may require separate licensing statements. + +Example: + +```text +Code in this repository is licensed under the Apache License 2.0. + +Documentation, templates, skills, and written materials are licensed under +Creative Commons Attribution 4.0 International unless otherwise noted. +``` + +### Notes + +The license in `repository.json`, `CITATION.cff`, README, and `LICENSE` must be consistent. + +Do not assume one license is appropriate for every artifact type. + +--- + +## `CHANGELOG.md` + +### Purpose + +Records meaningful changes to the repository over time. + +It helps humans and AI systems understand: + +* What changed. +* When it changed. +* Whether instructions or outputs may have changed. +* Whether a version introduced breaking changes. +* Whether a resource was deprecated or replaced. + +### Format + +Markdown. + +### Recommended Structure + +```markdown +# Changelog + +All notable changes to this repository are documented here. + +## [Unreleased] + +### Added + +### Changed + +### Fixed + +### Removed + +### Security + +## [0.1.0] - YYYY-MM-DD + +### Added + +- Initial public version. +``` + +### Notes + +Use newest entries first. + +Do not list every typo correction unless it changes interpretation or use. Focus on meaningful changes. + +--- + +## `UPDATES.md` + +### Purpose + +Captures notes, discoveries, pending decisions, and proposed improvements that may be applied to the repository in a future revision. + +`UPDATES.md` is not: + +* Approval to implement an item. +* A release commitment. +* A replacement for `CHANGELOG.md`. +* A substitute for a scoped task plan when one is required. + +### Recommended Structure + +```markdown +# Future Repository Updates + +## Pending Decisions + +## Proposed Improvements + +## Discoveries And Notes + +## Completed Or Superseded +``` + +### Notes + +When an update is implemented, validate the change, update `VERSION` when appropriate, record the released result in `CHANGELOG.md`, and remove or mark the note completed. + +AI agents should treat this file as planning context only unless the user explicitly asks to act on a listed item. + +--- + +## `VERSION` + +### Purpose + +Provides a single deterministic source for the repository’s current version. + +Scripts and catalog builders can read this file without parsing Markdown or JSON. + +### Format + +Plain text containing one semantic version: + +```text +0.1.0 +``` + +No additional commentary should be included. + +### Notes + +The version should match: + +* `repository.json` +* `CITATION.cff` +* The latest stable release in `CHANGELOG.md` +* Any hosting-platform release or Git tag + +Recommended semantic versioning: + +```text +MAJOR.MINOR.PATCH +``` + +Example: + +```text +1.4.2 +``` + +--- + +## `CONTRIBUTING.md` + +### Purpose + +Explains how other people may suggest changes, submit resources, report problems, or contribute improvements. + +### Format + +Markdown. + +### Recommended Structure + +```markdown +# Contributing + +## Who May Contribute + +## Types Of Contributions + +## Before You Submit + +## Contribution Workflow + +## Repository Standards + +## Documentation Requirements + +## Anonymization Requirements + +## Intellectual Property And Licensing + +## Review Process + +## Code Of Conduct + +## Questions +``` + +### Notes + +This file should explain the repository's contribution model, including the expectation that submitted business workflows may need to be: + +* Cleaned. +* Generalized. +* Anonymized. +* Documented. +* Licensed for public reuse. + +Do not require technical Git knowledge from all contributors. Provide a nontechnical submission route where appropriate. + +--- + +## `SECURITY.md` + +### Purpose + +Explains how to report vulnerabilities, exposed credentials, unsafe instructions, privacy problems, or other security concerns. + +### Format + +Markdown. + +### Recommended Structure + +```markdown +# Security Policy + +## Supported Versions + +## Reporting A Vulnerability + +## Do Not Post Sensitive Information Publicly + +## Credentials And Secrets + +## Data Privacy + +## AI-Specific Security Considerations + +## Response Process +``` + +### Notes + +Include this file when the repository contains: + +* Code +* Scripts +* APIs +* Agents +* Automations +* Authentication +* User data +* External integrations +* Deployment instructions +* System administration guidance + +At minimum, state clearly: + +```text +Never commit passwords, tokens, API keys, private keys, personal data, or production credentials to this repository. +``` + +--- + +## `CITATION.cff` + +### Purpose + +Provides machine-readable citation and attribution metadata. + +This is useful for: + +* Research resources. +* Frameworks. +* Public datasets. +* Skills. +* Templates. +* Educational materials. +* Repositories that may be referenced in reports, articles, academic work, or derivative projects. + +### Format + +Citation File Format YAML. + +### Recommended Structure + +```yaml +cff-version: 1.2.0 +message: "If you use this resource, please cite it as described below." +title: "Human-Readable Repository Title" +type: software +version: 0.1.0 +date-released: YYYY-MM-DD + +authors: + - family-names: "Doe" + given-names: "Alex" + +organization: + name: "Publishing Organization" + website: "https://example.org/" + +repository-code: "https://code.example.org/example-organization/repository-name" +url: "https://code.example.org/example-organization/repository-name" + +license: "CC-BY-4.0" + +keywords: + - domain-specific + - artificial intelligence + - skills + - workflows +``` + +### Notes + +The `type` field may vary depending on the resource. + +Possible values should be checked against the current Citation File Format specification when the template is implemented. + +For mixed repositories, choose the type representing the primary artifact. + +--- + +## `AGENTS.md` + +### Purpose + +Provides instructions for AI agents operating inside the repository. + +It explains: + +* How the repository should be interpreted. +* What files to read first. +* How to select skills or tools. +* What agents may and may not modify. +* What requires human approval. +* How outputs should be validated. +* How secrets and private information should be handled. + +### Format + +Markdown. + +### Recommended Structure + +```markdown +# Agent Instructions + +## Repository Purpose + +## Read Order + +1. `README.md` +2. `repository.json` +3. Relevant files listed in `entrypoints` +4. Supporting documentation only as needed + +## Task Routing + +## Available Skills + +## Available Scripts + +## Allowed Actions + +## Restricted Actions + +## Human Approval Requirements + +## Security And Privacy Rules + +## Validation Requirements + +## Output Requirements + +## Escalation Conditions +``` + +### Notes + +This file should be procedural, not promotional. + +Do not include an `AGENTS.md` file merely to repeat the README. It should govern agent behavior. + +For a simple documentary repository, this file may contain only minimal retrieval and modification instructions. + +--- + +## `skills.md` + +### Purpose + +Provides a repository-level index of AI skills contained in or associated with the repository. + +It helps agents identify: + +* Which skills exist. +* What each skill does. +* When to use each skill. +* What inputs each skill requires. +* What outputs each skill produces. +* Where each skill file is located. + +### Format + +Markdown. + +### Recommended Structure + +```markdown +# Repository Skills + +## How To Use This Index + +Read this file to determine which skill applies to the current task. + +## Skills + +### Skill Name + +- **Path:** `skills/example-skill.md` +- **Purpose:** Describe what the skill does. +- **Use when:** Describe the triggering conditions. +- **Inputs:** Describe required inputs. +- **Outputs:** Describe expected outputs. +- **Human approval required:** Yes or no. +- **Related scripts:** List deterministic scripts, if any. +``` + +### Notes + +If the repository contains no skills, either omit this file or include: + +```markdown +# Repository Skills + +This repository does not currently contain executable AI skills. +``` + +Do not describe ordinary documentation as a skill unless it contains clear task instructions, inputs, process rules, and outputs. + +--- + +# Core Directories + +## `docs/` + +### Purpose + +Contains supporting documentation that would make the root README too long or too specialized. + +Typical files include: + +```text +docs/architecture.md +docs/implementation.md +docs/deployment.md +docs/data-model.md +docs/glossary.md +docs/decisions.md +docs/troubleshooting.md +``` + +### `docs/README.md` + +Should provide an index of documents in the folder. + +Example: + +```markdown +# Documentation + +| File | Purpose | +| --- | --- | +| `architecture.md` | Explains the system architecture. | +| `implementation.md` | Provides implementation guidance. | +| `glossary.md` | Defines specialized terminology. | +``` + +### Notes + +Use descriptive file names. Avoid generic names such as: + +```text +notes.md +misc.md +new-document.md +``` + +--- + +## `skills/` + +### Purpose + +Contains reusable AI skills. + +Each skill should define: + +* Objective. +* Trigger conditions. +* Required inputs. +* Sources of authority. +* Workflow. +* Validation. +* Expected outputs. +* Failure and escalation rules. +* Human approval requirements. + +### Recommended Skill Structure + +```markdown +--- +skill_id: organization-repository-skill-name +title: Human-Readable Skill Name +version: 0.1.0 +status: experimental +--- + +# Skill Name + +## Objective + +## Use This Skill When + +## Do Not Use This Skill When + +## Required Inputs + +## Source Of Authority + +## Process + +## Validation + +## Expected Outputs + +## Human Approval Requirements + +## Failure And Escalation Conditions + +## Related Skills + +## Version History +``` + +### Notes + +The folder should contain a `README.md` listing all available skills. + +Stable skill IDs should be used so agents and catalogs can reference them reliably. + +--- + +## `templates/` + +### Purpose + +Contains reusable starting documents, schemas, forms, prompts, configuration examples, or other user-editable artifacts. + +Examples: + +```text +templates/project-brief.md +templates/pid-template.md +templates/repository.json +templates/email-workflow.md +templates/config.example.yaml +``` + +### Notes + +Templates should: + +* Clearly identify placeholders. +* Avoid real credentials or private information. +* Explain required versus optional fields. +* Include examples where useful. +* State what the user should customize. + +Use obvious placeholders: + +```text +{{ORGANIZATION_NAME}} +{{REPOSITORY_NAME}} +{{CANONICAL_URL}} +``` + +Avoid ambiguous placeholders such as: + +```text +XXX +TBD +stuff-here +``` + +--- + +## `examples/` + +### Purpose + +Provides realistic examples of inputs, outputs, completed templates, configurations, or use cases. + +Examples help users and AI systems understand what success looks like. + +### Notes + +Examples must not contain: + +* Customer information. +* Personal information. +* Credentials. +* Proprietary company data. +* Confidential prompts or logs. +* Identifying operational information unless explicitly approved. + +Mark synthetic examples clearly. + +Example: + +```markdown +> This example is synthetic and does not represent an actual company or customer. +``` + +--- + +## `scripts/` + +### Purpose + +Contains deterministic code used to validate, transform, materialize, publish, test, or operate the repository. + +Examples: + +```text +scripts/validate_repository.py +scripts/generate_repository_manifest.py +scripts/check_links.py +scripts/build_catalog_record.py +``` + +### `scripts/README.md` + +Should explain: + +* What each script does. +* Required runtime. +* Dependencies. +* Exact commands. +* Inputs and outputs. +* Whether the script modifies files. +* Whether human approval is required. + +### Notes + +AI reasoning should not be used where a small deterministic script can perform the operation more reliably. + +Scripts should fail clearly and should avoid silently overwriting important files. + +--- + +## `schemas/` + +### Purpose + +Contains formal schemas used to validate JSON, YAML, CSV, or other structured repository artifacts. + +Likely future files include: + +```text +schemas/repository.schema.json +schemas/skill.schema.json +schemas/catalog-record.schema.json +schemas/example-output.schema.json +``` + +### Notes + +Use standard JSON Schema where practical. + +Every schema should include: + +* `$schema` +* `$id` +* `title` +* `description` +* `type` +* Required fields +* Property definitions +* Appropriate constraints + +Example: + +```json +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://schemas.example.org/repository.schema.json", + "title": "AI-Ready Repository Manifest", + "type": "object", + "required": [ + "schema_version", + "repository_id", + "title", + "canonical_url" + ] +} +``` + +--- + +## `data/` + +### Purpose + +Contains public data files used by or produced for the repository. + +Examples: + +```text +data/sample-input.json +data/public-reference-list.csv +data/example-records.json +``` + +### Notes + +Do not use this directory for: + +* Production databases. +* Private customer data. +* Credentials. +* Personal identity documents. +* Large untracked binary files. +* Runtime state. +* Logs. + +The `data/README.md` should describe: + +* Data source. +* Data ownership. +* Date collected. +* License. +* Known limitations. +* Update frequency. +* Field definitions. + +--- + +## `receipts/` + +### Purpose + +Contains sanitized records showing how a workflow, agent, script, or process was executed. + +A receipt may document: + +* Inputs used. +* Skill version. +* Script version. +* Model or tool used. +* Execution date. +* Validation results. +* Output location. +* Human approval. +* Known limitations. + +### Notes + +Receipts should support reproducibility and auditability without exposing private information. + +Possible format: + +```json +{ + "receipt_id": "example-2026-001", + "executed_at": "YYYY-MM-DDTHH:MM:SSZ", + "skill_id": "example-skill", + "skill_version": "0.1.0", + "inputs": [], + "outputs": [], + "validation": { + "passed": true, + "checks": [] + }, + "human_approved": true +} +``` + +Sensitive execution logs should remain outside the public repository. + +--- + +## `tasks/` + +### Purpose + +Contains bounded planning and execution records for repository work. AI agents should place proposed repository-structure plans here before making approved structural changes. + +Each task folder should use a stable, descriptive identifier and may contain: + +```text +tasks/task-id/ +├── repository-structure-plan.md +├── implementation-receipt.md +└── validation-results.md +``` + +### Notes + +Do not treat a task plan as approval. Record the approval state and the exact approved scope in the plan. Keep task records only when they are useful to maintainers, and remove or exclude transient, sensitive, or machine-local content. + +--- +## `tests/` + +### Purpose + +Contains tests for code, schemas, workflows, or generated artifacts. + +Tests may verify: + +* JSON validity. +* Required files. +* Broken links. +* Schema compliance. +* Stable identifiers. +* Matching versions. +* Script outputs. +* Presence of prohibited secrets. +* Expected folder structure. + +### Notes + +Even a documentation-oriented repository may benefit from lightweight validation tests. + +Example checks: + +```text +README.md exists +repository.json parses +repository.json passes schema validation +VERSION matches repository.json +LICENSE exists +No obvious credentials are present +All listed entrypoint files exist +All internal links resolve +``` + +--- + +## `assets/` + +### Purpose + +Contains images, diagrams, downloadable media, and other supporting assets. + +Suggested structure: + +```text +assets/ +├── images/ +├── diagrams/ +├── screenshots/ +└── downloads/ +``` + +### Notes + +Use descriptive file names and document the source and usage rights. + +Good: + +```text +ai-ready-repository-workflow.svg +example-data-flow.png +``` + +Avoid: + +```text +image1.png +screenshot-final-final2.png +``` + +Add alt text wherever assets are embedded in Markdown. + +--- + +# Git Hosting Platform Files + +## Issue templates + +### Purpose + +Provides structured forms for repository issues and submissions. Use the directory and filenames supported by the selected Git hosting platform, such as `.github/ISSUE_TEMPLATE/` or `.gitea/ISSUE_TEMPLATE/`. + +Recommended templates: + +```text +bug-report.md +feature-request.md +documentation-correction.md +resource-submission.md +security-concern.md +``` + +Do not use a public issue template for confidential vulnerability reporting. `SECURITY.md` should provide a private reporting route. + +### Example `bug-report.md` + +```markdown +--- +name: Bug Report +about: Report a reproducible problem +title: "[BUG] " +labels: bug +--- + +## What Happened + +## What You Expected + +## Steps To Reproduce + +## Repository Version + +## Relevant Files + +## Additional Context +``` + +--- + +## Pull request template + +### Purpose + +Provides a checklist for proposed repository changes. Store it at the location supported by the selected Git hosting platform. + +### Recommended Structure + +```markdown +# Change Summary + +Describe the change and why it is needed. + +## Type Of Change + +- [ ] Documentation +- [ ] Skill +- [ ] Template +- [ ] Script +- [ ] Schema +- [ ] Bug fix +- [ ] New feature +- [ ] Breaking change + +## Validation + +- [ ] README remains accurate. +- [ ] `repository.json` remains valid. +- [ ] `VERSION` was updated if required. +- [ ] `CHANGELOG.md` was updated. +- [ ] Links were checked. +- [ ] No credentials or private information were added. +- [ ] Examples are anonymized or synthetic. +- [ ] Relevant tests passed. + +## Human Review Required + +Describe any decisions that require explicit approval. +``` + +--- + +# Optional Files + +## `CODE_OF_CONDUCT.md` + +Add when the repository expects outside community participation. + +Purpose: + +* Establish acceptable behavior. +* Explain reporting mechanisms. +* Set expectations for respectful collaboration. + +This may eventually be maintained once at the organization level and referenced by individual repositories. + +--- + +## `GOVERNANCE.md` + +Add when a repository has multiple maintainers, formal decision rights, community voting, or a long-lived standards process. + +Possible sections: + +```text +Maintainers +Decision authority +Change approval +Versioning +Dispute resolution +Deprecation +Succession +``` + +--- + +## `ROADMAP.md` + +Add when the repository has a meaningful planned development path. + +Use broad milestones rather than promises with unsupported dates. + +--- + +## `ARCHITECTURE.md` + +This may live at the root for a complex software repository or under `docs/architecture.md` for most repositories. + +It should explain: + +* Components. +* Boundaries. +* Data flows. +* Dependencies. +* Trust boundaries. +* Deployment model. +* Design decisions. +* Known tradeoffs. + +--- + +## `requirements.txt`, `pyproject.toml`, `package.json`, or equivalent + +Add only when the repository contains executable software. + +Dependencies should be explicit and version-controlled. + +--- + +## `.env.example` + +Add when users must configure environment variables. + +It should contain placeholder values only: + +```text +API_URL=https://example.com +API_KEY=replace-with-your-key +``` + +Never place real secrets in `.env.example`. + +Add `.env` to `.gitignore`. + +--- + +## `.gitignore` + +Add when the repository generates local files, runtime environments, secrets, build output, or editor metadata. + +Possible entries: + +```text +.env +.venv/ +__pycache__/ +*.pyc +node_modules/ +dist/ +build/ +logs/ +temp/ +.DS_Store +Thumbs.db +``` + +--- + +# Minimum Repository Profiles + +Not every repository needs the complete structure on day one. The template can support several repository profiles. + +## Profile 1: Documentation Or Guide + +Required: + +```text +README.md +AUTHOR.md +repository.json +LICENSE +CHANGELOG.md +UPDATES.md +VERSION +CITATION.cff +docs/ +``` + +Optional: + +```text +CONTRIBUTING.md +skills.md +templates/ +examples/ +assets/ +``` + +--- + +## Profile 2: Skill Or Workflow Repository + +Required: + +```text +README.md +AUTHOR.md +repository.json +LICENSE +CHANGELOG.md +UPDATES.md +VERSION +AGENTS.md +skills.md +skills/ +templates/ +examples/ +``` + +Recommended: + +```text +schemas/ +scripts/ +tests/ +receipts/ +CONTRIBUTING.md +SECURITY.md +``` + +--- + +## Profile 3: Software Or Automation Repository + +Required: + +```text +README.md +AUTHOR.md +repository.json +LICENSE +CHANGELOG.md +UPDATES.md +VERSION +CONTRIBUTING.md +SECURITY.md +AGENTS.md +docs/ +scripts/ +tests/ +``` + +Recommended: + +```text +schemas/ +examples/ +assets/ +.env.example +.gitignore +dependency manifest +``` + +--- + +## Profile 4: Dataset Repository + +Required: + +```text +README.md +AUTHOR.md +repository.json +LICENSE +CHANGELOG.md +UPDATES.md +VERSION +CITATION.cff +data/ +schemas/ +docs/ +``` + +Recommended: + +```text +scripts/ +tests/ +examples/ +SECURITY.md +``` + +The README and `data/README.md` should document provenance, collection methodology, limitations, update frequency, field definitions, and rights. + +--- + +# Repository Creation Rules + +## Naming + +Use lowercase kebab-case: + +```text +ai-email-campaign-workflow +portable-identity-document-template-open +inventory-reorder-assistant +``` + +Avoid: + +```text +NewProject +test +misc +repo-1 +AI_Tool_Final +``` + +The repository name should communicate what the resource helps someone do. + +--- + +## Topics + +Every public repository should receive topics from several dimensions where applicable: + +```text +technology +business function +industry context +artifact type +``` + +Example: + +```text +ai +agents +marketing +operators +workflow +skill +``` + +Hosting-platform topics and `repository.json` should remain aligned. + +--- + +## Descriptions + +The hosting-platform repository description should be one concise sentence derived from the `description` field in `repository.json`. + +Example: + +```text +A reusable AI workflow for turning source material into a reviewed report. +``` + +--- + +## Stable Identifiers + +Create stable IDs for: + +* Repository. +* Skills. +* Schemas. +* Major templates. +* Agents. +* Published datasets. + +IDs should not be changed merely because a title is rewritten. + +--- + +## Human And AI Entry Points + +Every repository should answer two questions: + +```text +Where should a human start? +Where should an AI agent start? +``` + +In most repositories, both begin with: + +```text +README.md +``` + +The next retrieval step should be declared in `repository.json`. + +--- + +## Secrets And Private Data + +Never commit: + +```text +Passwords +API keys +Private keys +Access tokens +CAPTCHA secrets +Customer information +Personal or regulated data +Production databases +Private logs +Session cookies +Unredacted business records +``` + +Use: + +```text +.env.example +synthetic examples +redacted receipts +external secret managers +server environment variables +``` + +--- + +## Version Alignment + +These should match: + +```text +VERSION +repository.json +CITATION.cff +CHANGELOG.md +UPDATES.md +Git tag +hosting-platform release +``` + +The repository validation process should report any mismatch. + +--- + +## Repository Completion Checklist + +Before publishing a new repository: + +```text +[ ] Repository name is clear and uses lowercase kebab-case. +[ ] Hosting-platform description is complete. +[ ] hosting-platform topics are assigned. +[ ] README explains the purpose, users, process, inputs, and outputs. +[ ] AUTHOR.md contains verified author, publisher, maintainer, canonical URL, and adaptation guidance. +[ ] repository.json is complete and valid JSON. +[ ] repository_id is stable and unique. +[ ] Canonical URL is correct. +[ ] LICENSE matches repository.json. +[ ] VERSION matches repository.json. +[ ] CHANGELOG includes the initial release. +[ ] UPDATES.md distinguishes future notes from completed changes. +[ ] CITATION.cff matches the current title and version. +[ ] AGENTS.md is present when agent instructions are needed. +[ ] skills.md is present when skills are included. +[ ] Required skills, templates, scripts, and schemas are indexed. +[ ] Examples are synthetic or anonymized. +[ ] No secrets or private data are present. +[ ] Internal links resolve. +[ ] Required scripts execute successfully. +[ ] Tests pass. +[ ] The repository is ready for any configured catalog or search indexing. +``` + +--- + +# Recommended Initial Baseline + +For the first implementation, every repository should begin with: + +```text +README.md +AUTHOR.md +repository.json +LICENSE +CHANGELOG.md +UPDATES.md +VERSION +CONTRIBUTING.md +SECURITY.md +CITATION.cff +AGENTS.md +skills.md + +docs/README.md +skills/README.md +templates/README.md +examples/README.md +scripts/README.md +schemas/README.md +receipts/README.md +tests/README.md +assets/README.md +``` + +Folders not relevant to the repository can later be removed, but beginning with the same structure will make repository creation, AI navigation, validation, and catalog generation consistent. + +The governing rule is: + +> Every repository should explain itself to a human, describe itself to a machine, identify its authoritative files, state how it may be reused, and provide a predictable path from discovery to implementation. + diff --git a/skills/structure-ai-ready-repository/scripts/audit_repository.py b/skills/structure-ai-ready-repository/scripts/audit_repository.py new file mode 100644 index 0000000..fd2c2d4 --- /dev/null +++ b/skills/structure-ai-ready-repository/scripts/audit_repository.py @@ -0,0 +1,190 @@ +#!/usr/bin/env python3 +"""Read-only structural audit for an AI-ready repository.""" + +from __future__ import annotations + +import argparse +import json +from pathlib import Path +import re +import sys + + +PROFILES = { + "documentation-guide": { + "README.md", + "AUTHOR.md", + "repository.json", + "LICENSE", + "CHANGELOG.md", + "UPDATES.md", + "VERSION", + "CITATION.cff", + "docs", + }, + "skill-workflow": { + "README.md", + "AUTHOR.md", + "repository.json", + "LICENSE", + "CHANGELOG.md", + "UPDATES.md", + "VERSION", + "AGENTS.md", + "skills.md", + "skills", + "templates", + "examples", + }, + "software-automation": { + "README.md", + "AUTHOR.md", + "repository.json", + "LICENSE", + "CHANGELOG.md", + "UPDATES.md", + "VERSION", + "CONTRIBUTING.md", + "SECURITY.md", + "AGENTS.md", + "docs", + "scripts", + "tests", + }, + "dataset": { + "README.md", + "AUTHOR.md", + "repository.json", + "LICENSE", + "CHANGELOG.md", + "UPDATES.md", + "VERSION", + "CITATION.cff", + "data", + "schemas", + "docs", + }, +} + + +def parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("repository", type=Path, help="Repository root to inspect") + parser.add_argument( + "--profile", + choices=sorted(PROFILES), + required=True, + help="Approved repository profile", + ) + parser.add_argument("--json", action="store_true", help="Emit JSON") + return parser.parse_args() + + +def read_version_from_citation(path: Path) -> str | None: + if not path.is_file(): + return None + match = re.search( + r"(?m)^version:\s*[\"']?([^\"'\s#]+)", + path.read_text(encoding="utf-8-sig"), + ) + return match.group(1) if match else None + + +def audit(root: Path, profile: str) -> dict: + findings: list[dict[str, str]] = [] + if not root.is_dir(): + return { + "repository": str(root), + "profile": profile, + "passed": False, + "findings": [{"level": "error", "message": "Repository path is not a directory"}], + } + + for relative in sorted(PROFILES[profile]): + if not (root / relative).exists(): + findings.append({"level": "error", "message": f"Missing required path: {relative}"}) + + manifest_path = root / "repository.json" + manifest = None + if manifest_path.is_file(): + try: + manifest = json.loads(manifest_path.read_text(encoding="utf-8-sig")) + except (OSError, UnicodeError, json.JSONDecodeError) as exc: + findings.append({"level": "error", "message": f"repository.json is invalid: {exc}"}) + else: + for key in ("schema_version", "repository_id", "title", "description", "version", "entrypoints"): + if key not in manifest: + findings.append({"level": "error", "message": f"repository.json lacks key: {key}"}) + entrypoints = manifest.get("entrypoints", {}) + if isinstance(entrypoints, dict): + for audience in ("human", "ai"): + declared = entrypoints.get(audience) + if not declared: + findings.append( + {"level": "error", "message": f"Missing {audience} entrypoint declaration"} + ) + elif not (root / declared).exists(): + findings.append( + { + "level": "error", + "message": f"Declared {audience} entrypoint does not exist: {declared}", + } + ) + else: + findings.append({"level": "error", "message": "entrypoints must be an object"}) + + version_path = root / "VERSION" + version = version_path.read_text(encoding="utf-8-sig").strip() if version_path.is_file() else None + if version and manifest and manifest.get("version") != version: + findings.append( + { + "level": "error", + "message": f"VERSION ({version}) differs from repository.json ({manifest.get('version')})", + } + ) + + citation_version = read_version_from_citation(root / "CITATION.cff") + if version and citation_version and citation_version != version: + findings.append( + { + "level": "error", + "message": f"VERSION ({version}) differs from CITATION.cff ({citation_version})", + } + ) + + readme = root / "README.md" + if readme.is_file() and not readme.read_text(encoding="utf-8-sig").strip(): + findings.append({"level": "error", "message": "README.md is empty"}) + + return { + "repository": str(root.resolve()), + "profile": profile, + "passed": not any(item["level"] == "error" for item in findings), + "findings": findings, + } + + +def emit_markdown(result: dict) -> None: + print(f"# Repository Audit\n\n- Repository: `{result['repository']}`") + print(f"- Profile: `{result['profile']}`") + print(f"- Result: `{'PASS' if result['passed'] else 'FAIL'}`") + print("\n## Findings") + if not result["findings"]: + print("\n- No structural errors found.") + else: + for finding in result["findings"]: + print(f"\n- {finding['level'].upper()}: {finding['message']}") + + +def main() -> int: + args = parse_args() + result = audit(args.repository, args.profile) + if args.json: + print(json.dumps(result, indent=2)) + else: + emit_markdown(result) + return 0 if result["passed"] else 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tasks/README.md b/tasks/README.md new file mode 100644 index 0000000..0bb6849 --- /dev/null +++ b/tasks/README.md @@ -0,0 +1,16 @@ +# Tasks + +Use this directory for bounded planning and execution records created by repository workflows. + +The normal structure skill workflow uses: + +```text +tasks// +├── repository-structure-plan.md +├── implementation-receipt.md +└── validation-results.md +``` + +A plan is not approval unless it records explicit approval of the current revision. Keep only task records useful to maintainers, and exclude transient or sensitive material. + +The initial repository materialization was performed under explicit user authorization without an intermediary task plan. diff --git a/templates/AUTHOR.md.template b/templates/AUTHOR.md.template new file mode 100644 index 0000000..60135ee --- /dev/null +++ b/templates/AUTHOR.md.template @@ -0,0 +1,29 @@ +# Author And Publisher + +## Primary Author + +**{{AUTHOR_NAME}}** + +## Publisher + +**{{PUBLISHER_NAME}}** + +## Maintainer + +**{{MAINTAINER_NAME}}** + +## Attribution + +```text +{{REPOSITORY_TITLE}} by {{AUTHOR_NAME}} +``` + +Canonical repository: + +```text +{{CANONICAL_REPOSITORY_URL}} +``` + +## Adapting This Template + +Replace these values in `AUTHOR.md`, `repository.json`, `CITATION.cff`, and `LICENSE`. Verify the license and canonical URL rather than inheriting them automatically. diff --git a/templates/README.md b/templates/README.md new file mode 100644 index 0000000..cabaedc --- /dev/null +++ b/templates/README.md @@ -0,0 +1,9 @@ +# Templates + +| File | Purpose | +| --- | --- | +| `repository.json.template` | Starting machine-readable repository manifest with visible placeholders. | +| `AUTHOR.md.template` | Starting canonical author, publisher, maintainer, and attribution file. | +| `UPDATES.md.template` | Starting notes file for future repository improvements. | + +Replace every `{{PLACEHOLDER}}` with a verified value before use. A template is not a completed artifact and should not be presented as valid project metadata. diff --git a/templates/UPDATES.md.template b/templates/UPDATES.md.template new file mode 100644 index 0000000..eb50ba0 --- /dev/null +++ b/templates/UPDATES.md.template @@ -0,0 +1,19 @@ +# Future Repository Updates + +Use this file for unapproved notes, discoveries, and proposed future changes. + +## Pending Decisions + +- [Decision requiring review] + +## Proposed Improvements + +- [Potential improvement and why it matters] + +## Discoveries And Notes + +- [Observation that may affect future work] + +## Completed Or Superseded + +- [Date, outcome, and link to the changelog or release] diff --git a/templates/repository.json.template b/templates/repository.json.template new file mode 100644 index 0000000..754c7d1 --- /dev/null +++ b/templates/repository.json.template @@ -0,0 +1,96 @@ +{ + "$schema": "./schemas/repository.schema.json", + "schema_version": "1.0", + "repository_id": "{{STABLE_REPOSITORY_ID}}", + "name": "{{REPOSITORY_NAME}}", + "title": "{{REPOSITORY_TITLE}}", + "description": "{{ONE_SENTENCE_DESCRIPTION}}", + "summary": "{{LONGER_PURPOSE_AUDIENCE_AND_VALUE_SUMMARY}}", + "canonical_url": "{{CANONICAL_REPOSITORY_URL}}", + "repository_status": "draft", + "visibility": "{{public|restricted|private}}", + "maturity": "concept", + "version": "0.1.0", + "created_at": "{{YYYY-MM-DD}}", + "updated_at": "{{YYYY-MM-DD}}", + "authors": [ + { + "name": "{{AUTHOR_NAME}}" + } + ], + "publisher": { + "name": "{{PUBLISHER_NAME}}" + }, + "resource_types": [], + "topics": { + "technology": [], + "business_function": [], + "industry_context": [], + "artifact_type": [], + "concepts": [] + }, + "audiences": [], + "problems_solved": [], + "capabilities": [], + "use_cases": [], + "required_inputs": [], + "expected_outputs": [], + "entrypoints": { + "human": "README.md", + "ai": "AGENTS.md", + "primary_skill": null, + "primary_agent": null, + "primary_script": null, + "primary_template": null + }, + "contents": [], + "relationships": { + "part_of": [], + "supports": [], + "depends_on": [], + "related_resources": [], + "supersedes": [], + "superseded_by": [] + }, + "access": { + "public": true, + "authentication_required": false, + "payment_required": false, + "registration_required": false + }, + "rights": { + "license": "{{SPDX_LICENSE_ID}}", + "license_file": "LICENSE", + "usage_guidance": "README.md" + }, + "provenance": { + "origin_type": "{{ORIGIN_TYPE}}", + "creation_method": "{{CREATION_METHOD}}", + "contributors": [ + "{{AUTHOR_NAME}}" + ], + "source_references": [] + }, + "maintenance": { + "maintainer": "{{MAINTAINER_NAME}}", + "review_frequency": "as-needed", + "last_reviewed_at": null, + "deprecated": false, + "archived": false + }, + "ai_retrieval": { + "read_first": [ + "README.md", + "AUTHOR.md", + "repository.json", + "AGENTS.md" + ], + "retrieve_as_needed": [], + "exclude_by_default": [ + "receipts/", + "tasks/", + "tests/" + ], + "instructions": "Read the declared entrypoints first and retrieve only files needed for the task." + } +} diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..d3b9cb2 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,9 @@ +# Tests + +Run the dependency-free unit tests with: + +```text +python -m unittest discover -s tests -p "test_*.py" +``` + +The tests validate the current repository and protect key failure cases in `scripts/validate_repository.py`. diff --git a/tests/test_repository.py b/tests/test_repository.py new file mode 100644 index 0000000..a409668 --- /dev/null +++ b/tests/test_repository.py @@ -0,0 +1,32 @@ +from __future__ import annotations + +import importlib.util +from pathlib import Path +import tempfile +import unittest + + +ROOT = Path(__file__).resolve().parents[1] +VALIDATOR_PATH = ROOT / "scripts" / "validate_repository.py" +SPEC = importlib.util.spec_from_file_location("validate_repository", VALIDATOR_PATH) +VALIDATOR = importlib.util.module_from_spec(SPEC) +assert SPEC.loader is not None +SPEC.loader.exec_module(VALIDATOR) + + +class RepositoryValidationTests(unittest.TestCase): + def test_current_repository_passes(self) -> None: + result = VALIDATOR.validate(ROOT) + self.assertTrue(result["passed"], result["findings"]) + + def test_missing_repository_fails(self) -> None: + with tempfile.TemporaryDirectory() as directory: + result = VALIDATOR.validate(Path(directory)) + self.assertFalse(result["passed"]) + self.assertTrue( + any("Missing required path" in item["message"] for item in result["findings"]) + ) + + +if __name__ == "__main__": + unittest.main()