Skip to content

Instantly share code, notes, and snippets.

@dalethestirling
Last active February 28, 2026 13:22
Show Gist options
  • Select an option

  • Save dalethestirling/2b742108f6240d2970d7b6b44a6fdf20 to your computer and use it in GitHub Desktop.

Select an option

Save dalethestirling/2b742108f6240d2970d7b6b44a6fdf20 to your computer and use it in GitHub Desktop.
Agent skill to create consistent workspaces in Antigravity
import os
import json
import sys
import argparse
def check_requirements(manifest_path):
if not os.path.exists(manifest_path):
print(f"Error: Manifest file not found at {manifest_path}")
return False
try:
with open(manifest_path, 'r') as f:
manifest = json.load(f)
except json.JSONDecodeError as e:
print(f"Error: Failed to parse manifest JSON: {e}")
return False
requirements = manifest.get('requirements', [])
if not requirements:
print("Warning: No requirements found in manifest.")
return True
missing_items = []
workspace_root = os.getcwd()
for req in requirements:
path = req.get('path')
req_type = req.get('type', 'file')
message = req.get('message', f"Missing {req_type}: {path}")
if not path:
continue
full_path = os.path.join(workspace_root, path)
if req_type == 'file':
if not os.path.isfile(full_path):
missing_items.append(message)
elif req_type == 'directory':
if not os.path.isdir(full_path):
missing_items.append(message)
else:
print(f"Warning: Unknown requirement type '{req_type}' for path '{path}'")
if missing_items:
print("Workspace verification failed:")
for item in missing_items:
print(f" - {item}")
return False
print("Workspace verification passed.")
return True
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Verify workspace requirements.")
parser.add_argument("manifest", help="Path to the JSON manifest file.")
args = parser.parse_args()
if check_requirements(args.manifest):
sys.exit(0)
else:
sys.exit(1)
{
"requirements": [
{
"path": "README.md",
"type": "file",
"message": "Project must have a README.md to outline the project and how to run it"
},
{
"path": ".gitignore",
"type": "file",
"message": "Project must have a .gitignore file to specify which files and directories should be ignored by Git"
},
{
"path": ".git",
"type": "directory",
"message": "Project must be initialized as a Git repository to track changes and collaborate with others"
},
{
"path": "tests",
"type": "directory",
"message": "Project must have a tests directory to organize test files and ensure code quality"
}
]
}
name description
validate-workspace
Use this skill when a workspace is created or opened to ensure that specific files, directories, and configurations exist within a workspace.

Validate Workspace Skill

This skill allows the agent to verify that the workspace adheres to specific structural requirements. This is useful for maintaining consistency across projects, ensuring documentation is present, or verifying that a build environment is correctly set up.

Usage

The skill provides a script check_workspace.py that takes a JSON manifest as input. This script takes manifest.json as an argument, which defines the required files, directories, and configurations that must be present in the workspace.

manifest.json is located in this skiill's resource directory.

When feeback is recieved from the check_workspace.py script, the agent can use this information to prompt the user to add missing items or to automatically create them if possible.

Manifest Format

The manifest is a JSON object with a requirements key, which is a list of requirement objects.

{
  "requirements": [
    {
      "path": "README.md",
      "type": "file",
      "message": "Project must have a README.md"
    },
    {
      "path": "src",
      "type": "directory",
      "message": "Project must have a src directory"
    },
    {
      "path": ".env.example",
      "type": "file"
    }
  ]
}

Running the Check

The scripd does not require the creation of a manifest file within the workspace to be run and should use the manifest.json provided in the skill's resource directory. The script will check for the presence of the specified files and directories in the current workspace.

Execute the script from the root of the workspace:

python3 /Users/dalestirling/.gemini/antigravity/skills/workspace-guard/scripts/check_workspace.py /Users/dalestirling/.gemini/antigravity/skills/resources/manifest.json

The script will exit with code 0 if all requirements are met, and code 1 otherwise, listing the missing items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment