Some checks failed
Main Confidence / confidence (push) Failing after 48s
## Summary - implement spec 243 product usage adoption telemetry end-to-end - add bounded product usage event capture, aggregation, retention pruning, and system dashboard KPIs - add unit and feature coverage for telemetry capture, authorization, retention, privacy, and dashboard window behavior ## Validation - ran focused Pest test suites for telemetry and system dashboard behavior - ran Laravel Pint formatting - verified the system dashboard telemetry widget in the integrated browser ## Notes - branch: `243-product-usage-adoption-telemetry` - target: `dev` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #281
562 lines
20 KiB
Markdown
562 lines
20 KiB
Markdown
---
|
|
name: spec-kit-next-best-prep
|
|
description: Select the next suitable TenantPilot/TenantAtlas spec candidate from roadmap/spec-candidates, run the repository's Spec Kit preparation flow, create or update spec.md/plan.md/tasks.md, run preparation analysis, fix preparation-artifact issues only, and stop before application implementation.
|
|
---
|
|
|
|
# Skill: Spec Kit Next-Best Preparation
|
|
|
|
## Purpose
|
|
|
|
Use this skill to prepare the next implementation-ready Spec Kit package for TenantPilot/TenantAtlas without implementing application code.
|
|
|
|
This skill supports preparation only:
|
|
|
|
1. Select or scope the next suitable feature from roadmap/spec-candidates.
|
|
2. Run the repository's real Spec Kit preparation workflow where available.
|
|
3. Create or update `spec.md`, `plan.md`, and `tasks.md`.
|
|
4. Run preparation `analyze` when supported.
|
|
5. Fix preparation-artifact issues only.
|
|
6. Evaluate preparation quality gates.
|
|
7. Stop before application implementation.
|
|
|
|
The intended workflow is:
|
|
|
|
```text
|
|
roadmap / spec-candidates / feature idea
|
|
→ inspect repo truth, constitution, roadmap, spec candidates, existing specs, and relevant code
|
|
→ select the next suitable candidate or scope the provided idea
|
|
→ run Spec Kit specify/plan/tasks/analyze where available
|
|
→ create or update spec.md + plan.md + tasks.md
|
|
→ fix preparation-artifact issues only
|
|
→ evaluate Candidate Selection Gate and Spec Readiness Gate
|
|
→ final preparation report
|
|
→ explicit implementation step later
|
|
```
|
|
|
|
## When to Use
|
|
|
|
Use this skill when the user asks to:
|
|
|
|
- select the next best spec candidate from `docs/product/spec-candidates.md` and roadmap sources
|
|
- turn a feature idea, roadmap item, or candidate into `spec.md`, `plan.md`, and `tasks.md`
|
|
- prepare Spec Kit artifacts in one pass
|
|
- run specify/plan/tasks/analyze without implementation
|
|
- fix preparation analysis issues in Spec Kit artifacts only
|
|
- prepare a feature package for a later implementation skill
|
|
|
|
Typical user prompts:
|
|
|
|
```text
|
|
Nimm den nächsten sinnvollen Spec Candidate aus Roadmap/spec-candidates und mach spec, plan und tasks.
|
|
```
|
|
|
|
```text
|
|
Mach daraus spec, plan und tasks in einem Rutsch, aber noch nicht implementieren.
|
|
```
|
|
|
|
```text
|
|
Wähle aus roadmap.md und spec-candidates.md die nächste sinnvollste Spec und führe specify, plan, tasks und analyze aus.
|
|
```
|
|
|
|
```text
|
|
Behebe alle analyze-Issues in den Spec-Kit-Artefakten. Keine Application-Implementierung.
|
|
```
|
|
|
|
## Hard Rules
|
|
|
|
- Work strictly repo-based.
|
|
- This is a preparation-only skill.
|
|
- Do not implement application code.
|
|
- Do not modify production code.
|
|
- Do not modify migrations, models, services, jobs, Filament resources, Livewire components, policies, commands, routes, views, tests, or runtime behavior.
|
|
- Use the repository's actual Spec Kit workflow, scripts, templates, branch naming rules, and generated paths when available.
|
|
- Do not manually invent spec numbers, branch names, or spec paths if Spec Kit provides a script or command for that.
|
|
- Do not bypass Spec Kit branch mechanics.
|
|
- Create or update only Spec Kit preparation artifacts unless repository conventions require additional documentation artifacts.
|
|
- Do not expand scope beyond the selected feature, `spec.md`, `plan.md`, and `tasks.md`.
|
|
- Do not silently add roadmap features, adjacent UX rewrites, speculative architecture, or unrelated refactors.
|
|
- Follow the repository constitution and existing Spec Kit conventions.
|
|
- Preserve TenantPilot/TenantAtlas terminology.
|
|
- Prefer small, reviewable, implementation-ready specs over broad rewrites.
|
|
- Treat repository truth as authoritative over assumptions.
|
|
- If repository truth conflicts with the user-provided draft or candidate wording, keep repository truth and document the deviation.
|
|
- Fix only confirmed preparation-artifact findings from Spec Kit preparation analysis.
|
|
- Do not leave preparation findings open silently. If they are not fixed, document exactly why.
|
|
- Do not run destructive commands.
|
|
- Do not force checkout, reset, stash, rebase, merge, or delete branches.
|
|
- Do not overwrite existing specs.
|
|
- Do not move from preparation to an implementation step inside this skill.
|
|
|
|
## Required Inputs
|
|
|
|
The user should provide at least one of:
|
|
|
|
- feature title and short goal
|
|
- full spec candidate
|
|
- roadmap item
|
|
- rough problem statement
|
|
- UX or architecture improvement idea
|
|
- instruction to choose the next best candidate from roadmap/spec-candidates
|
|
|
|
If the input is incomplete, proceed with the smallest reasonable interpretation and document assumptions.
|
|
|
|
If no suitable candidate can be selected safely, stop and report why.
|
|
|
|
## Required Repository Checks
|
|
|
|
Always check:
|
|
|
|
1. `.specify/memory/constitution.md`
|
|
2. `.specify/templates/`
|
|
3. `.specify/scripts/`
|
|
4. existing Spec Kit command usage or repository instructions, if present
|
|
5. current branch and git status
|
|
6. `specs/`
|
|
7. `docs/product/spec-candidates.md`
|
|
8. relevant roadmap documents under `docs/product/`, especially `roadmap.md` if present
|
|
9. nearby existing specs with related terminology or scope
|
|
10. application code only as needed to avoid wrong naming, wrong architecture, duplicate concepts, impossible tasks, duplicated specs, or already-completed candidates
|
|
|
|
Do not edit application code.
|
|
|
|
## Git and Branch Safety
|
|
|
|
Before running any Spec Kit command:
|
|
|
|
1. Check the current branch.
|
|
2. Check whether the working tree is clean.
|
|
3. If there are unrelated uncommitted changes, stop and report them. Do not continue.
|
|
4. If the working tree only contains user-intended planning edits for this operation, continue cautiously.
|
|
5. Let Spec Kit create or switch to the correct feature branch when that is how the repository workflow works.
|
|
6. Do not force checkout, reset, stash, rebase, merge, or delete branches.
|
|
7. Do not overwrite existing specs.
|
|
|
|
If the repo requires an explicit branch creation script for `specify`, use that script rather than manually creating the branch.
|
|
|
|
## Quality Gates
|
|
|
|
### Gate 1: Candidate Selection Gate
|
|
|
|
Required before creating a new spec from roadmap/spec-candidates.
|
|
|
|
Pass criteria:
|
|
|
|
- The selected candidate exists in roadmap/spec-candidate material or is directly provided by the user.
|
|
- The selected candidate is not already covered by an existing active or completed spec.
|
|
- The selected candidate aligns with current roadmap priorities or explicitly documented product direction.
|
|
- The candidate can be scoped as a small, reviewable, implementation-ready slice.
|
|
- Major adjacent concerns are listed as follow-up candidates instead of being hidden inside the primary scope.
|
|
|
|
Fail behavior:
|
|
|
|
- If no candidate satisfies the gate, stop and report the top candidates plus the reason none is ready.
|
|
- Do not invent a new roadmap direction to force progress.
|
|
|
|
### Gate 2: Spec Readiness Gate
|
|
|
|
Required before reporting that the package is ready for implementation.
|
|
|
|
Pass criteria:
|
|
|
|
- `spec.md`, `plan.md`, and `tasks.md` exist.
|
|
- The spec has clear problem statement, user value, functional requirements, out-of-scope boundaries, acceptance criteria, assumptions, and risks.
|
|
- The plan identifies likely affected repo surfaces and does not contradict repository architecture.
|
|
- The tasks are small, ordered, verifiable, and include test/validation tasks.
|
|
- RBAC, workspace/tenant isolation, auditability, OperationRun semantics, evidence/result-truth, and UX requirements are addressed where relevant.
|
|
- No open question blocks safe implementation.
|
|
- The scope is small enough for a bounded implementation loop in a later implementation skill.
|
|
- Required checklist artifacts exist when the constitution requires them.
|
|
|
|
Fail behavior:
|
|
|
|
- Fix preparation-artifact issues when they are safe and bounded.
|
|
- If readiness cannot be achieved without implementation or unresolved product decisions, stop and report the gap.
|
|
- Do not compensate for an unclear spec by inventing implementation scope.
|
|
|
|
## Candidate Selection Rules
|
|
|
|
When the user asks for the next best spec from roadmap/spec-candidates:
|
|
|
|
- Read `docs/product/spec-candidates.md`.
|
|
- Read relevant roadmap documents under `docs/product/`, especially `roadmap.md` if present.
|
|
- Check existing specs to avoid duplicates.
|
|
- Prefer candidates that align with current roadmap priorities, platform foundations, enterprise UX, RBAC/isolation, auditability, observability, and governance workflow maturity.
|
|
- Prefer candidates that unlock roadmap progress, reduce architectural drift, harden foundations, or remove known blockers.
|
|
- Prefer small, implementation-ready slices over broad platform rewrites.
|
|
- If multiple candidates are plausible, choose one primary candidate and document why it was selected.
|
|
- Add non-selected relevant candidates as follow-up spec candidates, not hidden scope.
|
|
- Do not invent a candidate if existing roadmap/spec-candidate material provides a suitable one.
|
|
- Do not pick a spec only because it is listed first.
|
|
- Evaluate the Candidate Selection Gate before creating the spec directory.
|
|
|
|
Evaluate candidates using these criteria:
|
|
|
|
1. **Roadmap Fit**: Does it support the current roadmap sequence or unlock the next roadmap layer?
|
|
2. **Foundation Value**: Does it strengthen reusable platform foundations such as RBAC, isolation, auditability, evidence, OperationRun observability, provider boundaries, vocabulary, baseline/control/finding semantics, or enterprise UX patterns?
|
|
3. **Dependency Unblocking**: Does it make future specs smaller, safer, or more consistent?
|
|
4. **Scope Size**: Can it be implemented as a narrow, testable slice?
|
|
5. **Repo Readiness**: Does the repo already have enough structure to implement the next slice safely?
|
|
6. **Risk Reduction**: Does it reduce current architectural or product risk?
|
|
7. **User/Product Value**: Does it produce visible operator value or make the platform more sellable without heavy scope?
|
|
|
|
## Required Selection Output Before Spec Kit Execution
|
|
|
|
Before running the Spec Kit flow, identify:
|
|
|
|
- selected candidate title
|
|
- source location in roadmap/spec-candidates
|
|
- why it was selected
|
|
- why close alternatives were deferred
|
|
- roadmap relationship
|
|
- smallest viable implementation slice
|
|
- proposed concise feature description to feed into `specify`
|
|
|
|
The feature description must be product- and behavior-oriented. It should not be a low-level implementation plan.
|
|
|
|
## Spec Kit Preparation Flow
|
|
|
|
### Step 1: Determine the repository's Spec Kit command pattern
|
|
|
|
Inspect repository instructions and scripts to identify how this repo expects Spec Kit to be run.
|
|
|
|
Common locations to inspect:
|
|
|
|
```text
|
|
.specify/scripts/
|
|
.specify/templates/
|
|
.specify/memory/constitution.md
|
|
.github/prompts/
|
|
.github/skills/
|
|
README.md
|
|
specs/
|
|
```
|
|
|
|
Use the repo-specific mechanism if present.
|
|
|
|
### Step 2: Run `specify`
|
|
|
|
Run the repository's `specify` flow using the selected candidate and the smallest viable slice.
|
|
|
|
The `specify` input should include:
|
|
|
|
- selected candidate title
|
|
- problem statement
|
|
- operator/user value
|
|
- roadmap relationship
|
|
- out-of-scope boundaries
|
|
- key acceptance criteria
|
|
- important enterprise constraints
|
|
|
|
Let Spec Kit create the correct branch and spec location if that is the repo's configured behavior.
|
|
|
|
### Step 3: Run `plan`
|
|
|
|
Run the repository's `plan` flow for the generated spec.
|
|
|
|
The `plan` input should keep the scope tight and should require repo-based alignment with:
|
|
|
|
- constitution
|
|
- existing architecture
|
|
- workspace/tenant isolation
|
|
- RBAC
|
|
- OperationRun/observability where relevant
|
|
- evidence/snapshot/truth semantics where relevant
|
|
- Filament/Livewire conventions where relevant
|
|
- test strategy
|
|
|
|
### Step 4: Run `tasks`
|
|
|
|
Run the repository's `tasks` flow for the generated plan.
|
|
|
|
The generated tasks must be:
|
|
|
|
- ordered
|
|
- small
|
|
- testable
|
|
- grouped by phase
|
|
- limited to the selected scope
|
|
- suitable for later implementation or manual analysis before implementation
|
|
|
|
### Step 5: Run preparation `analyze`
|
|
|
|
Run the repository's `analyze` flow against the generated Spec Kit artifacts when the repository supports it.
|
|
|
|
Analyze must check:
|
|
|
|
- consistency between `spec.md`, `plan.md`, and `tasks.md`
|
|
- constitution alignment
|
|
- roadmap alignment
|
|
- whether the selected candidate was narrowed safely
|
|
- whether tasks are complete enough for implementation
|
|
- whether tasks accidentally require scope not described in the spec
|
|
- whether plan details conflict with repository architecture or terminology
|
|
- whether implementation risks are documented instead of silently ignored
|
|
|
|
Do not use analyze as a trigger to implement application code.
|
|
|
|
### Step 6: Fix preparation-artifact issues only
|
|
|
|
If preparation analyze finds issues, fix only Spec Kit preparation artifacts such as:
|
|
|
|
- `spec.md`
|
|
- `plan.md`
|
|
- `tasks.md`
|
|
- `checklists/requirements.md` or other generated Spec Kit metadata files, if the repository uses them
|
|
|
|
Allowed fixes include:
|
|
|
|
- clarify requirements
|
|
- tighten scope
|
|
- move out-of-scope work into follow-up candidates
|
|
- correct terminology
|
|
- add missing tasks
|
|
- remove tasks not backed by the spec
|
|
- align plan language with repository architecture
|
|
- add missing acceptance criteria or validation tasks
|
|
- add missing checklist artifacts required by the constitution
|
|
|
|
Forbidden fixes include:
|
|
|
|
- modifying application code
|
|
- creating migrations
|
|
- editing models, services, jobs, policies, Filament resources, Livewire components, tests, commands, routes, or views
|
|
- running implementation or test-fix loops
|
|
- changing runtime behavior
|
|
|
|
### Step 7: Evaluate the Spec Readiness Gate
|
|
|
|
After preparation analyze has passed or preparation-artifact issues have been fixed, evaluate the Spec Readiness Gate.
|
|
|
|
Stop after this gate and do not implement.
|
|
|
|
## Spec Directory Rules
|
|
|
|
When creating a new spec directory, use the repository's Spec Kit-generated directory or path.
|
|
|
|
If the repository does not provide a command for spec setup, use the next valid spec number and a kebab-case slug:
|
|
|
|
```text
|
|
specs/<number>-<slug>/
|
|
```
|
|
|
|
The exact number must be derived from the current repository state and existing numbering conventions.
|
|
|
|
Create or update preparation artifacts inside the selected spec directory:
|
|
|
|
```text
|
|
specs/<number>-<slug>/spec.md
|
|
specs/<number>-<slug>/plan.md
|
|
specs/<number>-<slug>/tasks.md
|
|
```
|
|
|
|
If the repository templates require additional preparation files, create them only when this is consistent with existing Spec Kit conventions.
|
|
|
|
## `spec.md` Requirements
|
|
|
|
The spec must be product- and behavior-oriented. It should avoid premature implementation detail unless needed for correctness.
|
|
|
|
Include:
|
|
|
|
- Feature title
|
|
- Problem statement
|
|
- Business/product value
|
|
- Primary users/operators
|
|
- User stories
|
|
- Functional requirements
|
|
- Non-functional requirements
|
|
- UX requirements
|
|
- RBAC/security requirements
|
|
- Auditability/observability requirements
|
|
- Data/truth-source requirements where relevant
|
|
- Out of scope
|
|
- Acceptance criteria
|
|
- Success criteria
|
|
- Risks
|
|
- Assumptions
|
|
- Open questions
|
|
|
|
TenantPilot/TenantAtlas specs should preserve enterprise SaaS principles:
|
|
|
|
- workspace/tenant isolation
|
|
- capability-first RBAC
|
|
- auditability
|
|
- operation/result truth separation
|
|
- source-of-truth clarity
|
|
- calm enterprise operator UX
|
|
- progressive disclosure where useful
|
|
- no false positive calmness
|
|
|
|
## `plan.md` Requirements
|
|
|
|
The plan must be repo-aware and implementation-oriented, but it must not make code changes by itself.
|
|
|
|
Include:
|
|
|
|
- Technical approach
|
|
- Existing repository surfaces likely affected
|
|
- Domain/model implications
|
|
- UI/Filament implications
|
|
- Livewire implications where relevant
|
|
- OperationRun/monitoring implications where relevant
|
|
- RBAC/policy implications
|
|
- Audit/logging/evidence implications where relevant
|
|
- Data/migration implications where relevant
|
|
- Test strategy
|
|
- Rollout considerations
|
|
- Risk controls
|
|
- Implementation phases
|
|
|
|
The plan should clearly distinguish where relevant:
|
|
|
|
- execution truth
|
|
- artifact truth
|
|
- backup/snapshot truth
|
|
- recovery/evidence truth
|
|
- operator next action
|
|
|
|
## `tasks.md` Requirements
|
|
|
|
Tasks must be ordered, small, and verifiable.
|
|
|
|
Include:
|
|
|
|
- checkbox tasks
|
|
- phase grouping
|
|
- tests before or alongside implementation tasks where practical
|
|
- final validation tasks
|
|
- documentation/update tasks if needed
|
|
- explicit non-goals where useful
|
|
|
|
Avoid vague tasks such as:
|
|
|
|
```text
|
|
Clean up code
|
|
Refactor UI
|
|
Improve performance
|
|
Make it enterprise-ready
|
|
```
|
|
|
|
Prefer concrete tasks such as:
|
|
|
|
```text
|
|
- [ ] Add a feature test covering workspace isolation for <specific behavior>.
|
|
- [ ] Update <specific Filament page/resource> to display <specific state>.
|
|
- [ ] Add policy coverage for <specific capability>.
|
|
```
|
|
|
|
If exact file names are not known yet, phrase tasks as repo-verification tasks first rather than inventing file paths.
|
|
|
|
## Preparation Scope Control
|
|
|
|
If the requested feature implies multiple independent concerns, create one primary spec for the smallest valuable slice and add a `Follow-up spec candidates` section.
|
|
|
|
Examples of follow-up candidates:
|
|
|
|
- assigned findings
|
|
- pending approvals
|
|
- personal work queue
|
|
- notification delivery settings
|
|
- evidence pack export hardening
|
|
- operation monitoring refinements
|
|
- autonomous governance decision surfaces
|
|
|
|
Do not force all follow-up candidates into the primary spec.
|
|
|
|
## Failure Handling
|
|
|
|
If a Spec Kit command or preparation analyze phase fails:
|
|
|
|
1. Stop at the relevant gate.
|
|
2. Report the failing command or phase.
|
|
3. Summarize the error.
|
|
4. Do not attempt implementation as a workaround.
|
|
5. Suggest the smallest safe next action.
|
|
|
|
If the branch or working tree state is unsafe:
|
|
|
|
1. Stop before running Spec Kit commands.
|
|
2. Report the current branch and relevant uncommitted files.
|
|
3. Ask the user to commit, stash, or move to a clean worktree.
|
|
|
|
## Final Response Requirements
|
|
|
|
Respond with:
|
|
|
|
1. Selected candidate and why it was chosen
|
|
2. Why close alternatives were deferred
|
|
3. Current branch after Spec Kit execution, if changed
|
|
4. Generated spec path
|
|
5. Files created or updated by Spec Kit
|
|
6. Preparation analyze result summary
|
|
7. Preparation-artifact fixes applied after analyze
|
|
8. Assumptions made
|
|
9. Open questions, if any
|
|
10. Candidate Selection Gate result
|
|
11. Spec Readiness Gate result
|
|
12. Recommended next implementation prompt
|
|
13. Explicit statement that no application implementation was performed
|
|
|
|
Keep the final response concise, but include enough detail for the user to continue immediately.
|
|
|
|
## Manual Review and Next-Step Prompts
|
|
|
|
Provide a ready-to-copy manual artifact review prompt like this, adapted to the generated spec branch/path:
|
|
|
|
```markdown
|
|
Du bist ein Senior Staff Software Architect und Enterprise SaaS Reviewer.
|
|
|
|
Analysiere die neu erstellte Spec `<spec-branch-or-spec-path>` streng repo-basiert.
|
|
|
|
Ziel:
|
|
Prüfe, ob `spec.md`, `plan.md` und `tasks.md` vollständig, konsistent, implementierbar und constitution-konform sind.
|
|
|
|
Wichtig:
|
|
- Keine Implementierung.
|
|
- Keine Codeänderungen.
|
|
- Keine Scope-Erweiterung.
|
|
- Prüfe nur gegen Repo-Wahrheit.
|
|
- Benenne konkrete Konflikte mit Dateien, Patterns, Datenflüssen oder bestehenden Specs.
|
|
- Schlage nur minimale Korrekturen an `spec.md`, `plan.md` und `tasks.md` vor.
|
|
- Wenn alles passt, gib eine klare Implementierungsfreigabe.
|
|
```
|
|
|
|
Also provide a ready-to-copy implementation prompt for the separate implementation skill after analyze has passed or preparation-artifact issues have been fixed:
|
|
|
|
```markdown
|
|
/spec-kit-implementation-loop
|
|
|
|
Implementiere die vorbereitete Spec `<spec-branch-or-spec-path>` streng anhand von `tasks.md`.
|
|
|
|
Danach Tests ausführen, Browser Smoke Test falls UI/user-facing betroffen ist, Post-Implementation Analyse durchführen und alle bestätigten In-Scope Findings unabhängig von Severity beheben, wenn safe und bounded.
|
|
|
|
Wiederhole test + browser smoke + analysis + fix bis keine In-Scope Findings mehr offen sind oder eine Stop Condition greift.
|
|
```
|
|
|
|
## Example Invocation
|
|
|
|
User:
|
|
|
|
```text
|
|
Nutze den Skill spec-kit-next-best-prep.
|
|
Wähle aus roadmap.md und spec-candidates.md die nächste sinnvollste Spec.
|
|
Führe danach GitHub Spec Kit specify, plan, tasks und analyze in einem Rutsch aus.
|
|
Behebe alle analyze-Issues in den Spec-Kit-Artefakten.
|
|
Keine Application-Implementierung.
|
|
```
|
|
|
|
Expected behavior:
|
|
|
|
1. Inspect constitution, Spec Kit scripts/templates, specs, roadmap, and spec candidates.
|
|
2. Check branch and working tree safety.
|
|
3. Compare candidate suitability.
|
|
4. Select the next best candidate.
|
|
5. Evaluate the Candidate Selection Gate.
|
|
6. Run the repository's real Spec Kit `specify` flow, letting it handle branch/spec setup.
|
|
7. Run the repository's real Spec Kit `plan` flow.
|
|
8. Run the repository's real Spec Kit `tasks` flow.
|
|
9. Run the repository's real Spec Kit preparation `analyze` flow.
|
|
10. Fix analyze issues only in Spec Kit preparation artifacts.
|
|
11. Evaluate the Spec Readiness Gate.
|
|
12. Stop before application implementation.
|
|
13. Return selection rationale, branch/path summary, artifact summary, analyze summary, fixes applied, gates, and next implementation prompt.
|
|
``` |