Scaffold Security
Create a security/pentest tool scaffold with a consistent Python project layout.
Input Parsing
Accept input as: TOOL_NAME [DESCRIPTION]
Examples:
$scaffold-security recon-spider$scaffold-security recon-spider "Async web crawler for subdomain content discovery"
If no tool name is provided, ask the user for one before proceeding.
Preference Policy
- Prefer
uvfor initialization and environment management. - If
uvis missing:- warn the user that
uvis preferred, - remind them to install
uv, - ask for approval before using a fallback bootstrap path.
- warn the user that
- Fallback only after explicit user approval.
Recommended install reminder:
curl -LsSf https://astral.sh/uv/install.sh | sh
Steps (Preferred: uv)
- Create the project directory in the current working directory.
- Run:
uv init --name <tool_name> --package - Ensure structure exists:
<tool_name>/ src/ <package_name>/ __init__.py main.py cli.py core.py output.py tests/ __init__.py conftest.py .gitignore README.md pyproject.toml - Ensure
pyproject.tomlincludes:- Python
>=3.11 - runtime dependencies:
typer,rich,pydantic,httpx - dev dependencies:
pytest,ruff,mypy - script entry point mapping tool name to
<package>.cli:app - Ruff config (line length 88, 4-space indent)
- Python
- Implement
cli.pywith:- Typer app
- options for target, ports, output, format, verbose, timeout
- logging setup using
rich.logging - delegation to
core.py
- Implement
core.pywith:- typed models for results
- tool logic class/functions
- async support where network I/O is expected
- Implement
output.pywith:- formatters for text/json/csv output
- helper for stdout vs file output
- Implement
main.pywith__main__entry. - Write test stubs and basic README usage.
- Run:
uv sync - Report created files and example usage.
Fallback Steps (Only If Approved)
Use only when uv is unavailable and user explicitly approves fallback.
- Create the same project structure.
- Write/adjust
pyproject.tomlwith equivalent project and tool settings. - Initialize virtual environment:
python3 -m venv .venv .venv/bin/python -m pip install --upgrade pip - Install dependencies:
.venv/bin/pip install typer rich pydantic httpx pytest ruff mypy - Report fallback usage and remind user to install
uvfor future scaffolds.
Output Requirements
- Report final directory tree.
- Report whether preferred (
uv) or fallback path was used. - Include a runnable example command for the scaffolded tool.
- If fallback was used, include the
uvinstall reminder at the end.