Skip to content
Back to skills

Pytemplate

ASecurity

Create a uv-native Python project (typed package with a CLI and optional MCP server for AI agents, or a layered FastAPI service with optional database, background jobs, API-key or OIDC auth, and Dockerfile) with pytemplate-uv. Use when the user asks to create, scaffold, start, bootstrap, or generate a new Python package, CLI, library, MCP server, or FastAPI/REST API project, or to find a template pack on pytemplate-hub (through the pytemplate-find skill).

  • 28 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 4, 2026
ai-agentspythonrustbashsqlexpressfastapidockergitapidatabase

Works with

  • terminal
  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned December 4, 2026

npx -y skills add yuxuzi/pytemplate-uv --skill pytemplate --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pytemplate?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Pytemplate
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/yuxuzi-pytemplate/badge)](https://www.skillsdirectory.com/skills/yuxuzi-pytemplate)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: pytemplate
description: Create a uv-native Python project (typed package with a CLI and optional MCP server for AI agents, or a layered FastAPI service with optional database, background jobs, API-key or OIDC auth, and Dockerfile) with pytemplate-uv. Use when the user asks to create, scaffold, start, bootstrap, or generate a new Python package, CLI, library, MCP server, or FastAPI/REST API project, or to find a template pack on pytemplate-hub (through the pytemplate-find skill).
---

# Create Python projects with pytemplate-uv

pytemplate-uv renders reviewed Copier templates into projects that pass their own lint, format,
strict type-check, and test commands from the first commit. Your job is to turn the user's request
into a validated render request, get the user's confirmation, render the project, and prove that
it works. Never hand-write a scaffold that the generator can produce.

Run every command through `uvx pytemplate-uv …`, so nothing has to be installed. If the user
already has the `pytemplate` command, you can use that instead.

## 1. Check the tool

```bash
uvx pytemplate-uv --version
```

If `uvx` is missing, ask the user to install uv (https://docs.astral.sh/uv/) and stop.

## 2. Discover what is available

```bash
uvx pytemplate-uv list-profiles --json
uvx pytemplate-uv describe-profile fastapi --json
uvx pytemplate-uv list-components --json
uvx pytemplate-uv describe-component database --json
```

Use the JSON output, not guesses:
- `question_details` lists every input with its help text, default, and choices.
- `default_components` are always included; `optional_components` may be added.
- Each component lists `requires` (added automatically), `requires_any` (pick one), `conflicts`,
  its dependencies, the files it owns, and the environment `settings` it reads.
- If the user names a template pack, add `--template <dir or gh:org/repo>` (and
  `--template-ref <tag>`) to every command, and set `template`/`template_ref` in the request. If
  they also give a commit or digest, pass `--template-commit` and `--template-digest` to every
  command, including the discovery commands above. Treat a refusal as a sign the pack changed;
  never drop the pin to get past it.

Choose the profile from what the user wants to build:
- `python`: a command-line tool, or an MCP server.
- `library`: a package others import, with no command-line interface (it may add an MCP server).
- `fastapi`: an HTTP API or web service.

If the request fits none of them, look for a template pack on the hub (step 3) instead of forcing a
profile.

For `python` or `library`, add `mcp` when the user wants an MCP server or tools an AI agent can call. It adds
a stdio server on the official `mcp` SDK, a `<project_name>-mcp` command, and a `.mcp.json`.
Add `release` (`python` or `library`) when they want to publish to PyPI: it adds a trusted-publishing
workflow, and the user must register a trusted publisher on PyPI once before the first tag.

For `fastapi`, map the user's needs to components and add only what they asked for:
- persistence, SQL, PostgreSQL, migrations: `database`;
- long-running or background work: `worker`;
- service-to-service keys: `auth-api-key`; user login through an identity provider:
  `auth-oidc` (choose one; `auth` is added automatically);
- a Docker image: `container` (also available for `python`);
- a VS Code or Codespaces development environment: `devcontainer` (also available for `python`
  and `library`);
- `auth` is never selected by itself; it comes with `auth-api-key` or `auth-oidc`.

## 3. Find a template pack on pytemplate-hub

pytemplate-hub (https://yuxuzi.github.io/pytemplate-hub/) lists template packs. Look there when the
user asks for a template or pack, or when no bundled profile fits. Do not fetch the hub's index
yourself: hand off to the `pytemplate-find` skill, which searches the hub with
`uvx pytemplate-uv@latest search`, shows each candidate with its trust and check date, and waits
for the user to choose. It gives you the chosen pack's `-h owner/pack@tag`.

If the user chooses a bundled profile, or no pack fits, carry on with the profiles from step 2.
Hub packs are used only with `-h owner/pack@tag` (step 6): never copy the hub's pins by hand, and
never use `--template` for a listed pack. The fully pinned `--template ... --template-commit ...
--template-digest ...` form is for CI and offline machines.

## 4. Collect inputs

Ask only for what you cannot infer, in one short message:

- **project_name**: a lowercase slug such as `market-data-api` (letters, digits, single hyphens).
  The package name defaults to the slug with `_`. Names that are Python keywords, standard-library
  modules, or dependencies (for example `json`, `tests`, `typer`, `fastapi`) are rejected.
- **description**: one line, with no double quotes or backslashes.
- **author** and **email**: ask; never invent personal details. If the user declines, keep the
  template defaults and tell them.
- **python_version**: the minimum, 3.11–3.15 (default 3.11).
- **license**: an SPDX expression (default MIT).
- **output directory**: an existing parent directory (default: the current directory).

Never put secrets, tokens, or credentials into any input.

## 5. Write and validate a render request

Write `<project_name>.request.toml` in the output directory:

```toml
project_name = "market-data-api"
profile = "fastapi"
components = ["database", "auth-oidc"]
output_dir = "."            # relative to this file

[data]
description = "Market data ingestion service"
author = "Ada Lovelace"
email = "ada@example.com"
python_version = "3.12"
license = "MIT"
```

Then preview it; this validates everything, including the template's answer checks, and writes
nothing:

```bash
uvx pytemplate-uv plan market-data-api.request.toml --json
```

Exit code 1 means the request is invalid: read `error.message`, which says how to fix it, and
plan again. Keep the plan's `lifecycle_commands`; they are the checks for step 7. **Show the user
the request, the resolved components (including any in `added`), the new dependencies, and the
target path, then wait for explicit confirmation before creating anything.**

## 6. Create the project

```bash
uvx pytemplate-uv create-from-config market-data-api.request.toml
```

For a pack listed on the hub, create directly from the `-h owner/pack@tag` that `pytemplate-find` gave, with `-p` and `-y`:

```bash
uvx pytemplate-uv@latest create market-data-api -h owner/pack@tag -p <profile> -y --json
```

Never run an interactive `create` yourself: without a terminal it exits 1 and asks for `-y`.
If you use `create` instead of a request file, pass `-y` (and `--json` when you need to parse it).
If the target already exists, stop and ask. Use `--force` only when the user explicitly wants the
existing directory replaced. Delete the request file afterwards, or keep it if the user wants a
reproducible record.

## 7. Prove it works

Inside the new project, run:

```bash
git init
uv sync
```

Then run every command in the plan's `lifecycle_commands` (replace `{package}` with the package
name): `uv run ruff check .`, `uv run ruff format --check .`, `uv run mypy <package>`,
`uv run pytest`, and component commands such as `uv run alembic upgrade head`. Report the real
results. If something fails, show the output; do not hide or
"fix" it by weakening checks. Finish by pointing the user to the generated `README.md` and
`AGENTS.md` (`CLAUDE.md` imports it), and suggest committing the initial project (`git add -A && git commit`). To see later whether
generated files were edited, run `uvx pytemplate-uv status <project>` (read-only, accepts `--json`).

## Rules

- Never edit `.copier-answers.yml` or `.pytemplate.toml` by hand.
- Never run `--force` without explicit user approval.
- Never put credentials into `.env.example`, a request file, or any answer; generated services
  read secrets from the environment only.
- Use pip, virtualenv activation, or make only if the user asks; generated projects use `uv` and
  `uvx`.
- Report what actually happened, including failures.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.