Implement a feature or fix with automatic validation
65%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./plugins/pragma/skills/implement/SKILL.mdImplement the requested feature/fix, then validate before completing.
Phase 0 is mandatory and must complete successfully before any other phase.
$ARGUMENTS
Before starting work, collect and read all applicable project rules.
Based on the task, identify which directories will contain files to be created or modified.
If uncertain, err on the side of including more directories rather than fewer. Extra rules being applied is safe; missing rules is not.
Collect project rules from the project's rule directory. Rule file locations vary by agent platform:
.claude/rules/*.mdAGENTS.md (auto-loaded natively)For Claude Code, use the Glob tool to discover .claude/rules/*.md files, then the Read tool to load them. OpenCode auto-loads rules from AGENTS.md at the platform level. Collect those that exist and are readable. A file is considered "found" only if it exists and can be successfully read.
Note: Path-scoped rules (those with paths: frontmatter) may be auto-loaded by the agent platform only for matching files. When collecting rules manually, read the frontmatter and apply path-scoped rules only to the target directories they match.
Check for a local supplements file (e.g., CLAUDE.local.md for Claude Code) at the project root and read it if present. This is a per-user, unversioned file for machine-specific overrides (e.g., custom validation commands).
If it exists, read it. Pay particular attention to any "Validation Commands" section, which overrides defaults.
Read each discovered rule file. Apply rules in order of precedence (most specific first):
1. Path-scoped language rules with matching paths (highest precedence)
2. Universal rulesEarlier rules override later rules where they conflict.
If two rules conflict and precedence is unclear, prefer the more specific rule and note the conflict in the final report.
This step only applies if NO project rule files were found in Step 2.
If project-specific rules were found and loaded, skip this step entirely and note in report: "Project rules: loaded (N files)"
If no project-specific rules were found, attempt to load the universal baseline from the plugin:
Resolve plugin root: The skill loader provides the base directory in the header: Base directory for this skill: <path>. Derive PLUGIN_ROOT as <base directory>/../.. (skills live at <plugin-root>/skills/<name>/, so two levels up).
Validate plugin root: Check that $PLUGIN_ROOT/.claude-plugin/plugin.json exists.
Validate baseline file: Does $PLUGIN_ROOT/claude-md/universal/base.md exist and is it readable?
Load baseline: If both checks pass, read $PLUGIN_ROOT/claude-md/universal/base.md as the baseline rules.
This fallback ensures projects without /setup-project still get essential rules (branch creation, scope verification, etc.).
Track which rule files were loaded for the final report, including:
The "Pre-Implementation Setup" section of the loaded rules contains actions to execute, not just guidance to follow. The rules file is the single source of truth; this step is the executor.
If no "Pre-Implementation Setup" section exists in any loaded rules, skip this step and note in the final report that no pre-implementation setup was defined.
How to execute:
Locate the section: Find the "Pre-Implementation Setup" section in the loaded rules.
Identify actionable items: Look for:
```bash) - these are commands to runExecute in order: For each actionable item:
Handle failures: If any command fails or a situation isn't covered by the rules, ask the user for guidance before proceeding.
Record for report: Track what was executed and outcomes (e.g., branch created, steps skipped, user decisions).
Clarify requirements if ambiguous.
Discover existing patterns before proposing solutions:
Identify files that need changes based on discovered patterns.
Plan the commit units. Split the work into logical units, where each unit is one self-contained, independently reviewable change. Order them by dependency: shared types and helpers before the code that consumes them. Record the list for Phase 2.
A task touching one concern is one unit. Do not invent units to pad the history.
Determine the commit mode. The mode governs every committing step in Phases 2 and 3, so settle it here, while the plan is fresh and before any code is written. The three modes are:
First establish whether green commits is available. It needs a working tree that carries nothing but the work in progress, because the per-unit check runs there. If Phase 0 retained unrelated uncommitted changes, green commits is unavailable until they are stashed, and the one question below is where that is resolved.
Then settle the mode. The cases are mutually exclusive, so take the one that applies:
Do not stash anything without the user's agreement. The mode and the green-commit precondition are both settled here; no later phase reopens either.
Then re-split or re-order the remaining units for the chosen mode. Under green commits, fold a unit together with whatever it needs to pass its own checks, including its tests and its call sites. Under readable commits, keep the smaller coherent units.
Record the mode and how it was determined for the Phase 4 report.
Work through the commit units from Phase 1 one at a time. Each unit is implemented before the next one starts, and committed unless the mode from Phase 1 Step 5 is no commits. Green commits checks each unit at its own checkpoint; readable and no commits leave every check to Phase 3, which validates the complete change under all three modes.
Before the first unit: resolve the deterministic check commands once, using the precedence rules in Phase 3 Step 1. Under readable commits, also record the commit HEAD points at now, because Phase 3 needs that commit as the base of its rebase. Under green commits Phase 3 commits at the tip and needs no base, and under no commits there is nothing to rebase. The commit mode was settled in Phase 1 Step 5.
Under green commits, verify the precondition Phase 1 settled. The per-unit check runs in the working tree immediately after the commit, so the tree equals the commit and the check covers the committed content. That holds only while the tree carries nothing but the work in progress. If unrelated changes are present after all, stop and report it. Do not reopen the mode question here.
For each unit, in the planned order:
git commit --amend, then run the command again. Where the command also
rewrote files the unit did not touch, keep them out of the unit commit: commit them on their own and
report it. Folding them in puts unrelated work in the unit commit, and discarding them throws away a
change the project's own command made. Scope the command to the unit's files where it
supports file arguments, and run it whole where it does not, as make lint and
pre-commit run --all-files do. A failure in a file the unit did not touch is pre-existing only where
that is established, for example because the same failure is present at the base commit; report it and
leave it alone. Otherwise treat it as caused by the unit. If a failure cannot be made to pass, stop
before the next unit, report that the commit is not green, and ask for guidance.Every commit message explains the "why", not just the "what".
Declining a new branch does not disable committing. Phase 0 asks about branches, and a user who continues on an existing feature branch can commit normally. Only an absent git repository makes committing impossible, and Phase 1 Step 5 already resolves that case to no commits.
If a commit itself fails, stop before the next unit. A valid repository still rejects a commit for reasons that have nothing to do with the mode, such as an unset identity, a failed signature, or a hook that refuses the change. Report the command's error alongside the units already committed, and ask for guidance. Do not implement further units, and do not fall back to no commits on your own.
If a unit grows beyond its plan, split it. Commit the finished part rather than letting the unit absorb unrelated work.
If the unit plan proves wrong (a unit is not independently reviewable, or the order breaks the tree), re-plan the remaining units and note the change in the Phase 4 report.
After every unit is implemented, validate the complete change. Under green commits this catches problems that only appear across units. Under readable commits and no commits it is the only deterministic gate, so the result must pass everything here before Phase 4.
Before running validators: Re-check whether any new directories were introduced during implementation. If so, repeat Phase 0 for those directories and include any newly discovered rules.
Every change this phase makes is committed under the mode from Phase 1 Step 5. That covers the fixes you
write and the edits the commands make themselves, because the configured defaults include --fix and
formatting commands that rewrite files and still exit zero. After each command, check the working tree:
git commit --amend reaches only the tip, and rebasing to reach further
back rewrites every descendant, whose checks ran against different content. A tip commit keeps the claim
that each commit passed its checks when it was made. Cleaning the history up afterwards is review work,
not validation work, and the universal rules cover it.git commit --fixup=<that commit> where the change corrects one earlier
commit of this run, and an ordinary commit otherwise. Before Phase 4, absorb the fixups with
GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash <base>, where <base> is the commit HEAD pointed
at before Phase 2 began. Record that commit at the start of Phase 2; a bare --autosquash has no target
and fails on a branch with no upstream, which is what Phase 0 just created. Where any commit to be
rewritten has already been pushed, ask the user before rewriting it, and keep an ordinary tip commit
instead if they decline.Record every commit this phase creates, and every hash a rewrite replaces, alongside the Phase 2 ledger.
Run linters first (deterministic checks):
Check rules for custom validation commands: Look for a "Validation Commands" section in loaded project rules, in precedence order:
If custom commands exist at any level, use the highest-precedence match. Otherwise, check for a Makefile with lint/test targets and use those. If no Makefile targets exist, fall back to these defaults:
golangci-lint run --fix -vuv run pre-commit run --all-filespnpm run lint or npx --no biome check .--no restricts the command to a biome already installed in the project. Where none is installed the command refuses, and the right response is to skip TypeScript linting rather than drop the flag.
Priority order: Local supplements > path-scoped language rules > universal rules > built-in defaults. Local supplements have the highest priority to allow per-machine customization without modifying version-controlled rules.
Fix any issues before proceeding, and commit the fixes under the rule above.
Run semantic validators (LLM checks):
subagent_type: "general-purpose" and a prompt instructing the subagent to invoke the validator skill via the Skill tool (e.g., skill: "security") and return the JSON result verbatim.subagent_type — most validators are skills, not agents. Always use general-purpose as the subagent type.validate intentionally — implement needs inline control for the fix-and-re-validate loop. Keep both in sync.
security (always)state-machine (always)error-handling (always)go-effective (if Go files changed)go-proverbs (if Go files changed)python-style (if Python files changed)typescript-style (if TypeScript files changed)Fix violations:
Re-validate if fixes were made.
After all validators pass, proceed to Phase 4. Do not stop here — the final output must be the Phase 4 summary, not raw validator output.
Only after validation passes:
## Implementation Complete
**Task:** [what was requested]
**Branch:** `branch-name` (created | existing | continued | skipped)
**Rules Applied:**
- python rules (scoped to backend/**)
- universal rules
- local supplements
**Changes:**
- file.go: [what changed]
- file_test.go: [what changed]
**Commit mode:** green commits | readable commits | no commits
**Mode determined by:** asked | stated in the task | defaulted | no git repository
**Commits:** [omitted under no commits]
- `abc1234` feat(scope): first logical unit
- `def5678` feat(scope): second logical unit
**Planned units:** [only under no commits, so the user can split the changeset]
- feat(scope): first logical unit
- feat(scope): second logical unit
**Validation:**
- Linting: ✓ passed
- Security: ✓ passed (no HARD, no unexplained SHOULD)
- Go Effective: ✓ passed (no HARD, 1 SHOULD justified, 1 WARN noted)
**Justified SHOULD items:**
- security:42 - Deferred input sanitization (handled by upstream middleware)
- go-effective:78 - 6-parameter function (options pattern would over-complicate here)
**Warnings:**
- [any WARN items to be aware of]
Ready for review.peteski22/agent-pragma
314583c
Also appears in
last in sync Mar 13, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.