基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/hpsgd/turtlestack --skill write-feature-spec命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Review staged or recent changes — native Claude Code review for mechanics, layered with team conventions and the team verdict contract
Perform a security-focused audit of code changes or a specific area of the codebase.
Propose a change to a marketplace repo based on learned patterns — new rules, updated skills, evolved regex patterns. Infers which upstream marketplace the learning belongs to, confirms with the user, then creates a branch, applies changes, shows diff for review, and raises a PR on approval. Use when patterns have enough evidence to share upstream.
| name | write-feature-spec |
| description | Write a Behat feature specification in Gherkin with step definitions. |
| argument-hint | [feature or behaviour to specify] |
| user-invocable | true |
| allowed-tools | Read, Write, Edit, Bash, Glob, Grep |
| paths | ["**/*.php","**/*.feature"] |
Write a Behat feature spec for $ARGUMENTS.
Before writing any Gherkin:
Read existing features — match conventions:
find . -name "*.feature" -not -path "*/vendor/*" | head -20
find . -path "*/features/bootstrap/*" -name "*.php" | head -20
Check existing step definitions — reuse where possible:
grep -rn "@Given\|@When\|@Then" --include="*.php" features/ | head -30
Identify the domain language — what terms do product/business use? Use those, not technical terms
Confirm Behat is set up — composer.json should have behat/behat in require-dev, and behat.yml (or behat.yml.dist) should configure the suite path
Every feature file follows this structure:
# features/<feature-name>.feature
Feature: <Feature name in business language>
As a <role>
I want <capability>
So that <business value>
Background:
Given <common precondition shared by all scenarios>
Scenario: <Happy path — most common success case>
Given <specific precondition in business language>
When <user action in business language>
Then <expected outcome in business language>
Scenario: <Edge case — boundary or unusual input>
Given <precondition>
When <action with edge-case input>
Then <expected outcome>
Scenario: <Error case — invalid input or failed precondition>
Given <precondition>
When <action that should fail>
Then a <SpecificError> is reported with <relevant context>
Scenario Outline: <Parameterised scenarios>
Given a crawl with <pages> pages
When the operator completes the crawl
Then <events> events are emitted
Examples:
| pages | events |
| 1 | 2 |
| 3 | 4 |
| 10 | 11 |
Feature rules:
HttpRequest, Repository, getId(). Use crawl, operator, pageAnd for additional conditions)Background: for preconditions shared by every scenario in the fileScenario Outline: only when the variation is genuinely tabularStep definitions go in features/bootstrap/ (typical) as final class implementing Context:
<?php
declare(strict_types=1);
namespace App\Tests\Behat;
use App\Application\Crawl\CompleteCrawl;
use App\Domain\Crawl\CrawlAggregate;
use App\Domain\Crawl\CrawlId;
use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
use Symfony\Component\Messenger\MessageBusInterface;
final class CrawlContext implements Context
{
private ?CrawlId $crawlId = null;
/** @var list<object> */
private array $dispatchedMessages = [];
public function __construct(
private readonly MessageBusInterface ,
InMemoryMessageRepository ,
) {}
{
->crawlId = ::();
}
{
::(->crawlId, );
->commandBus->( (->crawlId));
}
{
= ->messageRepository->(->crawlId);
= ( fn ( ): => ( ())->(), );
::(, );
}
}
Step definition rules:
FeatureContextbehat.yml service config — never service locationvoid and assert directly with PHPUnit\Framework\Assertbehat.yml (or behat.yml.dist):
default:
suites:
default:
paths:
- "%paths.base%/features"
contexts:
- App\Tests\Behat\CrawlContext:
commandBus: '@command.bus'
messageRepository: '@App\Infrastructure\EventStore\InMemoryMessageRepository'
extensions:
FriendsOfBehat\SymfonyExtension:
kernel:
class: App\Tests\Behat\TestKernel
For non-Symfony projects, configure via the Behat container directly or use FriendsOfBehat\ServiceContainerExtension.
Run the scenario before implementing the behaviour. It must fail because the behaviour does not exist yet. This is the spec contract — if it passes on first run, either the behaviour is already implemented (verify it matches) or the step definitions are not asserting anything.
vendor/bin/behat features/<name>.feature
Expected output: scenarios fail with concrete errors pointing at missing classes, methods, or assertions.
Deliver:
features/<name>.featurefeatures/bootstrap/ (or configured location)behat.yml updates if a new context was wiredHttpRequest, Repository, Doctrine — these belong in step defs, not GherkinFeatureContext with 50 steps. Split by bounded context/php-developer:write-aggregate — once a scenario fails on missing aggregate behaviour, this skill writes the event-sourced aggregate/php-developer:write-handler — once a scenario fails on missing handler, this skill writes the command/query handler