🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

pi-agent-codebase-workflows

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pi-agent-codebase-workflows - npm Package Compare versions

Comparing version
0.2.0
to
0.3.0
+24
prompts/safe-start-01-intent.md
---
description: "Safe-start pass 1: capture greenfield project intent and guidance level"
argument-hint: "[project idea / constraints]"
---
Use `/skill:safe-start` Pass 1 — Intent Capture.
Project idea or constraints: $ARGUMENTS
Determine guidance level: Freshman, Standard, or Expert. If unclear, ask once; default to Standard when user wants to proceed.
Produce or update `docs/agent/PROJECT_INTENT.md` when creating files. If not editing yet, produce the same sections in chat.
Required output:
- Product goal
- Target users
- Primary user journeys
- Must-have features
- Non-goals
- Runtime/platform/deployment target
- Constraints and preferences
- Guidance level
- Assumptions
- Open questions
- Approval gate: confirm whether to proceed to data-flow design
---
description: "Safe-start pass 2: data-first input/transformation/output design"
argument-hint: "[focus or project notes]"
---
Use `/skill:safe-start` Pass 2 — Data Flow Design.
Focus or notes: $ARGUMENTS
Read `docs/agent/PROJECT_INTENT.md` if present. Do not choose modules before data shape is clear.
Produce/update:
- `docs/agent/DATA_FLOW.md`
- `docs/agent/DATA_MODEL.md`
- `docs/agent/INVARIANTS.md`
Required output:
- External inputs
- User inputs
- Files/events/API payloads
- Core entities/value objects
- Identifiers and relationships
- Lifecycle/state transitions
- Validation and normalization
- Transformation pipeline: input -> validation -> normalization -> domain operation -> output
- Outputs: UI states, API responses, reports, side effects
- Error states
- Invariants and forbidden states
- Persistence/serialization draft if needed
- Open questions and risks
- Approval gate: confirm whether to proceed to architecture decisions
---
description: "Safe-start pass 3: architecture decisions derived from data flow"
argument-hint: "[stack preference / constraints]"
---
Use `/skill:safe-start` Pass 3 — Architecture Decisions.
Stack preference or constraints: $ARGUMENTS
Read first when present:
- `docs/agent/PROJECT_INTENT.md`
- `docs/agent/DATA_FLOW.md`
- `docs/agent/DATA_MODEL.md`
- `docs/agent/INVARIANTS.md`
Derive module boundaries from data flow and side-effect boundaries. Choose framework/libraries after boundaries are clear.
Produce/update:
- `docs/agent/ARCHITECTURE.md`
- `docs/agent/DEPENDENCY_RULES.md`
- `docs/agent/RISK_REGISTER.md`
- `docs/agent/adr/0001-initial-architecture.md`
Required output:
- Architecture overview
- Module boundaries and ownership
- Dependency direction
- Side-effect boundaries
- Stack/framework/library decisions and alternatives considered
- Configuration/secrets approach
- Error handling strategy
- Security/privacy basics
- Key risks and mitigations
- ADR: context, decision, alternatives, consequences
- Approval gate: confirm whether to proceed to contract docs or scaffold plan
---
description: "Safe-start pass 4: create project contract docs for humans and future agents"
argument-hint: "[docs focus]"
---
Use `/skill:safe-start` Pass 4 — Project Contract Docs.
Docs focus: $ARGUMENTS
Read first when present:
- `docs/agent/PROJECT_INTENT.md`
- `docs/agent/DATA_FLOW.md`
- `docs/agent/DATA_MODEL.md`
- `docs/agent/INVARIANTS.md`
- `docs/agent/ARCHITECTURE.md`
- `docs/agent/DEPENDENCY_RULES.md`
- `docs/agent/RISK_REGISTER.md`
Create compact operational docs. Freshman mode may include short teaching notes and command explanations. Expert mode should be terse and contract-oriented.
Produce/update:
- `README.md`
- `AGENTS.md`
- `docs/agent/CHANGE_GUIDE.md`
- `docs/agent/TESTING_STRATEGY.md`
- optional `docs/agent/CONTRACTS.md`, `docs/agent/SECURITY.md`, `docs/agent/DEPLOYMENT.md`
Required output:
- Project overview
- Architecture rules
- Data model rules
- Invariants not to violate
- How to add/modify features
- How to validate changes
- Documentation update rules
- Forbidden shortcuts
- Approval gate: confirm whether to proceed to scaffold planning
---
description: "Safe-start pass 5: plan minimal scaffold and tooling before code"
argument-hint: "[framework/tooling preference]"
---
Use `/skill:safe-start` Pass 5 — Scaffold Plan.
Framework/tooling preference: $ARGUMENTS
Read prior design docs under `docs/agent/` if present. Do not scaffold before the plan is explicit unless user already approved implementation.
Produce a minimal scaffold plan with:
- File tree to create
- Package/build config choices
- Format/lint/typecheck choices where suitable
- Test runner and initial tests
- App entrypoint and health/hello path
- Config/env example if needed
- Exact commands to create/install/run
- Files that will be generated or edited
- Validation commands expected after scaffold
- Risks/assumptions
Avoid:
- speculative abstractions
- unused frameworks
- broad feature implementation
- auth/payment/admin systems unless the initial project goal requires them
Approval gate: ask whether to write files and run scaffold commands unless user explicitly requested implementation now.
---
description: "Safe-start pass 6: establish green validation baseline for new project"
argument-hint: "[validation focus]"
---
Use `/skill:safe-start` Pass 6 — Validation Baseline.
Validation focus: $ARGUMENTS
Run the most relevant checks for the scaffolded project. Prefer project-local commands and wrappers.
Validate when applicable:
- install/bootstrap works
- format/lint command works
- typecheck/build works
- tests run
- app starts
- one smoke test proves runtime path
Produce/update `docs/agent/VALIDATION_BASELINE.md` with:
- Commands run
- Results
- Known warnings
- Blockers and exact errors if any
- Next best check when a command cannot run
- Baseline status: green / partial / blocked
Do not proceed to feature depth until baseline is green or blockers are explicitly accepted by user.
---
description: "Safe-start pass 7: implement first thin vertical slice"
argument-hint: "[slice goal]"
---
Use `/skill:safe-start` Pass 7 — Thin Vertical Slice.
Slice goal: $ARGUMENTS
Read first when present:
- `docs/agent/PROJECT_INTENT.md`
- `docs/agent/DATA_FLOW.md`
- `docs/agent/DATA_MODEL.md`
- `docs/agent/INVARIANTS.md`
- `docs/agent/ARCHITECTURE.md`
- `docs/agent/DEPENDENCY_RULES.md`
- `docs/agent/VALIDATION_BASELINE.md`
Implement one small end-to-end feature only. Include:
- Input adapter: UI/API/CLI/event/file as relevant
- Validation/schema if relevant
- Domain/core operation
- Output adapter/rendering/API response
- Persistence adapter or explicit in-memory/mock choice if persistence is deferred
- Tests around core invariant and runtime path
- Docs update only if durable semantics change
Before editing, state slice boundary, touched files, invariants at risk, and validation plan. Stop for approval unless user explicitly requested implementation now.
After editing, run focused validation and update validation/risk docs if needed.
---
description: "Safe-start pass 8: hand off new project to safe-change workflow"
argument-hint: "[handoff focus]"
---
Use `/skill:safe-start` Pass 8 — Handoff to Safe Change.
Handoff focus: $ARGUMENTS
Verify project is ready for documented-codebase work.
Check:
- Root `AGENTS.md` exists and is operational
- `docs/agent/` artifacts cover architecture, data model, invariants, dependency rules, tests, risks, and change guide
- Validation baseline commands are known and recently run
- First vertical slice is implemented or explicitly deferred
- Next work items are small enough for `safe-change`
Produce/update:
- `docs/agent/CHANGE_GUIDE.md`
- `docs/agent/RISK_REGISTER.md`
- optional `docs/agent/BACKLOG.md`
Final output:
- Handoff status: ready / partial / blocked
- Validation summary
- Remaining risks
- Next recommended work items
- Explicit instruction: future feature/bug/refactor work should use `/skill:safe-change`
---
description: "Safe-start all-in-one greenfield workflow for small/simple projects"
argument-hint: "[project idea / constraints]"
---
Use `/skill:safe-start` all-in-one mode.
Project idea or constraints: $ARGUMENTS
Only use all-in-one mode if the project appears small/simple enough. Otherwise recommend starting with `/safe-start-01-intent`.
Workflow:
1. Determine guidance level: Freshman, Standard, or Expert. Default Standard if unclear.
2. Capture intent and assumptions.
3. Produce data-first design: inputs -> transformations -> outputs, data model, invariants.
4. Propose architecture decisions derived from data flow.
5. Propose contract docs and scaffold plan.
6. Stop for approval before writing files unless user explicitly requested implementation now.
7. If approved/requested, scaffold minimal baseline, run validation, implement one thin vertical slice, and hand off to `safe-change`.
Required final output:
- Files created/changed
- Validation run and result
- Handoff status: ready / partial / blocked
- Next safe-change-sized work items
---
name: safe-start
description: Safe greenfield project creation workflow. Use when starting a new project from scratch, bootstrapping a repo, choosing initial architecture, scaffolding baseline tooling, creating project-agent docs, and implementing the first thin vertical slice. Adapts guidance for freshman, standard, and expert developers.
---
# Safe Start
Goal: create new projects safely by defining data-first project truth before code, scaffolding the smallest validated baseline, then handing future work to `safe-change`.
## Core Principles
- Create durable project truth before feature depth.
- Design data flow first: input data -> transformations -> output data.
- Derive module boundaries from data and side-effect boundaries, not from early framework guesses.
- Keep architecture simple enough for current needs; record intentional extension points only.
- Build validation harness before real features.
- Implement one thin vertical slice before expanding scope.
- After baseline and first slice are validated, future changes should use `safe-change`.
## Guidance Levels
At start, determine guidance level from user preference or ask once:
```text
Preferred guidance level?
1. Freshman: explain decisions and commands.
2. Standard: concise but guided.
3. Expert: compact, assumption-driven.
```
Default: `Standard`.
Same safety gates apply at every level. Only communication and artifact density change:
- Freshman: more explanation, glossary, command notes, simpler questions, explicit file tree, starter tests, minimal jargon.
- Standard: concise decisions, enough rationale to maintain project safely.
- Expert: terse assumptions, ADRs, contracts, risk gates, extension points, fewer explanations.
## Target Artifacts
Create/update these before or during scaffold as appropriate:
```text
README.md
AGENTS.md
.env.example # when env/config exists
docs/agent/
PROJECT_INTENT.md
DATA_FLOW.md
DATA_MODEL.md
INVARIANTS.md
ARCHITECTURE.md
DEPENDENCY_RULES.md
RISK_REGISTER.md
TESTING_STRATEGY.md
CHANGE_GUIDE.md
VALIDATION_BASELINE.md
adr/
0001-initial-architecture.md
```
Optional when useful:
```text
docs/agent/BACKLOG.md
docs/agent/CONTRACTS.md
docs/agent/DEPLOYMENT.md
docs/agent/SECURITY.md
```
Rules:
- Project operating instructions stay at root `AGENTS.md`.
- Do not create `docs/AGENTS.md` or `docs/agent/AGENTS.md`.
- Keep docs compact and operational.
- Docs should describe durable semantics, not tutorial prose, except in Freshman mode where short teaching notes are allowed.
## Execution Modes
Default: numbered-pass mode.
Use one pass at a time for uncertain, high-risk, large, commercial, regulated, or multi-service projects:
```text
/safe-start-all
/safe-start-01-intent
/safe-start-02-data-flow
/safe-start-03-architecture
/safe-start-04-contract-docs
/safe-start-05-scaffold-plan
/safe-start-06-validation
/safe-start-07-vertical-slice
/safe-start-08-handoff
```
Optional all-in-one mode may be used when user explicitly asks and project is small/simple enough:
```text
/skill:safe-start all
```
In all-in-one mode:
1. Capture intent and guidance level.
2. Produce data-first design and scaffold plan.
3. Stop for approval before writing files unless user explicitly requested implementation.
4. Scaffold, validate, implement first vertical slice if approved/requested.
5. Report validation and handoff status.
## Approval Gates
Stop for approval after these outputs unless user explicitly requested implementation now:
1. Intent summary and assumptions.
2. Data-flow design and core data model.
3. Architecture/scaffold plan and validation commands.
4. First vertical-slice plan.
Never perform destructive actions, remote deployments, credential setup, paid service provisioning, production database changes, or publishing without explicit permission.
## Pass 1 — Intent Capture
Prompt template: `/safe-start-01-intent`.
Task: define project purpose, constraints, guidance level, scope, and non-goals.
Output/update:
- `docs/agent/PROJECT_INTENT.md`
- initial `README.md` summary if creating files now
Required sections:
- Product goal
- Target users
- Primary user journeys
- Must-have features
- Non-goals
- Runtime/platform/deployment target
- Constraints and preferences
- Guidance level
- Assumptions
- Open questions
## Pass 2 — Data Flow Design
Prompt template: `/safe-start-02-data-flow`.
Read first: `docs/agent/PROJECT_INTENT.md` if present.
Task: design data-first system shape.
Output/update:
- `docs/agent/DATA_FLOW.md`
- `docs/agent/DATA_MODEL.md`
- `docs/agent/INVARIANTS.md`
Required sections:
- External inputs
- User inputs
- Files/events/API payloads
- Core entities/value objects
- Identifiers and relationships
- Lifecycle/state transitions
- Validation and normalization
- Transformation pipeline
- Outputs: UI states, API responses, reports, side effects
- Error states
- Invariants and forbidden states
- Persistence/serialization draft if needed
## Pass 3 — Architecture Decisions
Prompt template: `/safe-start-03-architecture`.
Read first: project intent, data flow, data model, invariants.
Task: choose initial architecture after data shape is known.
Output/update:
- `docs/agent/ARCHITECTURE.md`
- `docs/agent/DEPENDENCY_RULES.md`
- `docs/agent/RISK_REGISTER.md`
- `docs/agent/adr/0001-initial-architecture.md`
Required sections:
- Architecture overview
- Module boundaries derived from data flow
- Dependency direction
- Side-effect boundaries
- Stack/framework/library decisions
- Configuration/secrets approach
- Error handling strategy
- Security/privacy basics
- Key risks and mitigations
- ADR with context, decision, alternatives, consequences
## Pass 4 — Project Contract Docs
Prompt template: `/safe-start-04-contract-docs`.
Read first: intent, data flow/model, architecture, dependency rules.
Task: create operational docs for future agents and developers.
Output/update:
- `README.md`
- `AGENTS.md`
- `docs/agent/CHANGE_GUIDE.md`
- `docs/agent/TESTING_STRATEGY.md`
- optional `docs/agent/CONTRACTS.md`, `SECURITY.md`, `DEPLOYMENT.md`
Required content:
- How to understand project quickly
- Architecture rules
- Data model rules
- Invariants not to violate
- How to add/modify features
- How to validate changes
- Documentation update rules
- Freshman-friendly command explanations when guidance level is Freshman
## Pass 5 — Scaffold Plan
Prompt template: `/safe-start-05-scaffold-plan`.
Read first: all prior design docs.
Task: propose minimal file tree and tooling before writing project code.
Output:
- concise scaffold plan
- package/build/test/lint/typecheck choices
- exact commands to create/install/run
- generated files list
- risks/assumptions
Scaffold should include only:
- package/build config
- formatter/linter/typecheck where suitable
- test runner
- app entrypoint
- minimal runtime health/hello path
- config/env example if needed
- CI only if requested or clearly expected
Avoid:
- speculative abstractions
- unused frameworks
- premature auth/payment/admin systems
- mock complexity beyond first slice needs
## Pass 6 — Validation Baseline
Prompt template: `/safe-start-06-validation`.
Task: make baseline checks green before real feature depth.
Output/update:
- `docs/agent/VALIDATION_BASELINE.md`
Required validations when applicable:
- install/bootstrap works
- format/lint command works
- typecheck/build works
- tests run
- app starts
- one smoke test proves runtime path
If any validation cannot run, record exact blocker and next best check.
## Pass 7 — Thin Vertical Slice
Prompt template: `/safe-start-07-vertical-slice`.
Read first: prior docs and validation baseline.
Task: implement one small end-to-end feature crossing real boundaries.
Slice should include:
- input adapter: UI/API/CLI/event/file as relevant
- validation/schema if relevant
- domain/core operation
- output adapter/rendering/API response
- persistence adapter or explicit in-memory/mock choice if persistence is deferred
- tests around core invariant and runtime path
- docs update only if durable semantics change
Stop at one slice. Do not build broad feature set.
## Pass 8 — Handoff to Safe Change
Prompt template: `/safe-start-08-handoff`.
Task: verify project is ready for normal documented-codebase workflow.
Output/update:
- `docs/agent/CHANGE_GUIDE.md`
- `docs/agent/RISK_REGISTER.md`
- optional `docs/agent/BACKLOG.md`
Checklist:
- root `AGENTS.md` exists and is operational
- docs/agent artifacts cover architecture, data, invariants, dependency rules, tests, risks
- validation baseline commands are known and recently run
- first slice is implemented or explicitly deferred
- next work items are small enough for `safe-change`
Final note should say whether future work should use `safe-change`, and which docs to read first.
+57
-1
# Tutorial
This package provides pi skills and prompt templates for reconstructing codebase knowledge, making safe changes, and reviewing architecture drift.
This package provides pi skills and prompt templates for starting new projects safely, reconstructing codebase knowledge, making safe changes, and reviewing architecture drift.

@@ -21,2 +21,58 @@ ## Install

## Start a new project safely
For small/simple greenfield projects, run all safe-start passes:
```text
/safe-start-all build a small habit tracker web app
```
For larger, higher-risk, or learning-oriented projects, run numbered passes so each decision is reviewable:
```text
/safe-start-01-intent
/safe-start-02-data-flow
/safe-start-03-architecture
/safe-start-04-contract-docs
/safe-start-05-scaffold-plan
/safe-start-06-validation
/safe-start-07-vertical-slice
/safe-start-08-handoff
```
Safe-start is data-first:
```text
input data -> validation/normalization -> domain transformation -> output data/side effects
```
Module boundaries are derived after data flow is understood.
At the start, choose guidance level:
```text
Freshman - more explanations, command notes, simple questions
Standard - concise but guided
Expert - compact, assumption-driven, contract/ADR oriented
```
Safe-start creates project operating docs such as:
```text
README.md
AGENTS.md
docs/agent/PROJECT_INTENT.md
docs/agent/DATA_FLOW.md
docs/agent/DATA_MODEL.md
docs/agent/INVARIANTS.md
docs/agent/ARCHITECTURE.md
docs/agent/DEPENDENCY_RULES.md
docs/agent/RISK_REGISTER.md
docs/agent/TESTING_STRATEGY.md
docs/agent/CHANGE_GUIDE.md
docs/agent/VALIDATION_BASELINE.md
```
After `/safe-start-08-handoff`, use `/skill:safe-change` or safe-change prompts for normal feature, bug, and refactor work.
## Reconstruct a small repo

@@ -23,0 +79,0 @@

+4
-2
{
"name": "pi-agent-codebase-workflows",
"version": "0.2.0",
"description": "Pi skills and prompt templates for codebase reconstruction, architecture-aware review, and safe changes.",
"version": "0.3.0",
"description": "Pi skills and prompt templates for safe greenfield starts, codebase reconstruction, architecture-aware review, and safe changes.",
"license": "MIT",

@@ -13,2 +13,4 @@ "author": "PriNova",

"codebase-recon",
"safe-start",
"greenfield",
"code-review",

@@ -15,0 +17,0 @@ "architecture",

# pi-agent-codebase-workflows
Pi package with skills and prompt templates for documented-codebase workflows.
Pi package with skills and prompt templates for safe greenfield starts, documented-codebase changes, reconstruction, and reviews.

@@ -9,2 +9,3 @@ Credits: built for [pi](https://github.com/earendil-works/pi-mono), created by Mario Zechner ([GitHub: @badlogic](https://github.com/badlogic), [X: @badlogicgames](https://x.com/badlogicgames)) and the Earendil Works team ([@earendil-works](https://github.com/earendil-works)).

- `safe-start` — create new projects safely with data-first design, project-agent docs, minimal scaffold, validation baseline, and first thin vertical slice.
- `codebase-recon` — reconstruct durable project understanding into `docs/agent/*.md` plus project-root `AGENTS.md`.

@@ -35,2 +36,14 @@ - `arch-code-review` — review current diffs against documented architecture, invariants, data model, dependency rules, risks, and tests.

Safe-start workflow:
- `/safe-start-all`
- `/safe-start-01-intent`
- `/safe-start-02-data-flow`
- `/safe-start-03-architecture`
- `/safe-start-04-contract-docs`
- `/safe-start-05-scaffold-plan`
- `/safe-start-06-validation`
- `/safe-start-07-vertical-slice`
- `/safe-start-08-handoff`
Safe-change workflow:

@@ -125,2 +138,3 @@

skills/
safe-start/SKILL.md
codebase-recon/SKILL.md

@@ -127,0 +141,0 @@ arch-code-review/SKILL.md